Presentation is loading. Please wait.

Presentation is loading. Please wait.

Department of Computer Science, The University of Hong Kong Continuous Monitoring Application for a Car Parking System (Part2) Presenter: Leong Hou, U.

Similar presentations


Presentation on theme: "Department of Computer Science, The University of Hong Kong Continuous Monitoring Application for a Car Parking System (Part2) Presenter: Leong Hou, U."— Presentation transcript:

1 Department of Computer Science, The University of Hong Kong Continuous Monitoring Application for a Car Parking System (Part2) Presenter: Leong Hou, U (Kamiru) Supervisor: Nikos Mamoulis

2 Summary of my last talk Given out the other types of query which are not appropriate to our proposed problem Given out the definition of ECP Given out a hybrid method to solve ECP efficiently

3 Outline Problem Definition Solutions of static case Man and Woman Optimal Stable Matching == ECP? Data model Update modules Experiments Conclusion

4 Problem Definition kICP Given two set of points A and B, the k inclusive closest pairs kICP(A,B) are defined as The set S in {A×B}, such that |S|=k and for all (a, b) in S, (a 0, b 0 ) in {A×B}−S, dist(a, b) ≤ dist(a 0, b 0 ). kECP Given two set of points A and B, the k exclusive closest pairs kECP(A,B) are defined as: kECP(A,B) = {(a, b)} for k = 1, and kECP(A,B) = {(a, b)} U [(k−1)ECP(A−{a},B−{b}) otherwise, where {(a, b)}=1ICP(A,B). dist(a i, b j ) is an Euclidean distance, dist(a i, b j )==dist(b j, a i ) dist(a i, b j ) != dist(a k, b m ), which i!=k or j!=m Ignore the tie case a1a1 a2a2 a3a3 b1b1 b2b2

5 Solution Straightforward Solution: For the datasets (A, B) Run 1ICP(A,B) = {(a,b)} A=A-{a}, B=B-{b} Repeat this process until A or B is empty Easy to implement, but it is too slow Some advance technologies can be used: Stable Marriage Algorithm Conceptual Partitioning Monitoring (CPM) [Mouratidis05] Plane Scan

6 Stable Marriage Definition Definition of Stable Marriage Given a set of n men and n women, marry them off in pairs after each man has ranked the women in order of preference from 1 to n {w 1,..., w n } each woman has done likewise, {m 1,..., m n }. If the resulting set of marriages contains no pairs of the form {m i, w j }, {m k, w l } such that m i prefers w l to w j and w l prefers m i to m k The marriage is said to be stable Example: The stable marriage pairs are {m 2, w 1 }, {m 1, w 2 } menpreference m1m1 w 2, w 3, w 1 m2m2 w 1, w 2, w 3 womenpreference w1w1 m 1, m 2 w2w2 w3w3 m 2, m 1

7 Stable Marriage Algorithm Gale-Shapley algorithm [Gale69] Initialize all m IN M and w IN W to free while for all free man m who still has a woman w to propose to w = m's highest ranked such woman if w is free engage (m, w) else // some pair (m', w) already exists if w prefers m to m‘ (m, w) become married m' becomes free else (m', w) remain married menpreference m1m1 w 2, w 3, w 1 m2m2 w 1, w 2, w 3 womenpreference w1w1 m 1, m 2 w2w2 w3w3 m 2, m 1 womensuggested man w1w1 w2w2 w3w3 mensuggested woman w2w2 w1w1 m1m1 m1m1 m1m1 m2m2 Stable marriage problem is asymmetric m2m2

8 Man/Woman Optimal Stable Matching This stable matching has the remarkable property that every man/woman achieves in it the best partner that he/she can possibly have in any stable matching. The results of Gale-Shapley Algorithm are the Man/Woman Optimal Stable Matching (M/W OSM)

9 Optimal Stable Marriage Problem == ECP? For the traditional M/W OSM, the answer is If we add a weight to the preference list, such that weight(m, w)==weight(w, m) weight(m i, w j ) != weight(m k, w m ), where i!=k or j!=m then the Symmetric Weighted M/W OSM can be proved that it is the same as our ECP. NO

10 Symmetric Weighted OSM == ECP? Assume that we have two sets M and W, which |M|is n 1 and |W| is n 2, n = min(n 1, n 2 ), and get the results of MOSM by the Gale algorithm, such that {(m 1, w 1 ), (m 2, w 2 ), …, (m n, w n )} and dist(m i, w i )<dist(m i+1, w i+1 ) Want to proof: Symmetric Weighed OSM == ECP? 1.Since ECP gives only an unique result, but OSM may have two results (MOSM and WOSM) MOSM == WOSM? 2.From assumption, we know that dist(m i, w i ) < dist(m i+1, w i+1 ), dist(m i, w j ) > dist(m i, w i )? dist(m j, w i ) > dist(m i, w i )? where j>i

11 (1) MOSM == WOSM? m1m1 w1w1 m2m2 w2w2 m3m3 w3w3 mnmn WnWn............ dist(m 1, w 1 ) is the smallest distance in all the results The ordered results of MOSM The assignment of red line should not be the result, since dist(m 1, w 1 ) < dist(m 1, w j ) and dist(w 1, m 1 ) < dist(w 1, m i ) The assignment of yellow line should not be the result, since dist(m 1, w 1 ) is the smallest distance

12 (1) MOSM == WOSM? m1m1 w1w1 m2m2 w2w2 m3m3 w3w3 mnmn WnWn............ dist(m 2, w 2 ) is the second one, and we have m 1 prefer w 1 to w i (m 1 =>w 1 >w i ), and w 1 =>m 1 >m i, where i>1, from first result (m 1, w 1 ). The ordered results of MOSM We know that m 1 and w 1 do not affect our rest results, since m 1 =>w 1 >w j and w 1 =>m 1 >m i. We do not need to consider them in our rest process. The assignment of blue line should not be the result, since m 1 =>w 1 >w j and w 1 =>m 1 >m i So the assignment of red line should not be the result, since the same reason as previous slide. Recursive to do the same processes, we know that, MOSM == WOSM using our contraint

13 (2) Symmetric Weighed OSMP == ECP? WTP: We can not find any object (m j or w j ), such dist(m i, w j ) < dist(m i, w i ) and dist(m j, w i ) < dist(m i, w i ) where i<j In contradiction with the statement, we assume that can find dist(m i, w j ) < dist(m i, w i ) or dist(m j, w i ) < dist(m i, w i ), where i<j dist(m 1, w j ) > dist(m 1, w 1 ) dist(m j, w 1 ) > dist(m 1, w 1 ) Not true

14 Data Model We have n cars and m parking slots in our system Each car can be moving, parking, assigned, or parked Each parking slot can be used, assigned, or free At the beginning, each car is either in moving, or parked status The parking slot which is used by the car is set to used Otherwise, it is set to free The status of assigned means that car/parking slot is already assigned to the parking slot/car If the car is assigned to the parking slot, the distance between the assignment is shorter by time to time

15 Data Model In the first timestamp, we handle the cars which are in parking status and the parking slots which are in free status Running hybrid method to find all-ECP We set the ‘assigned’ status to all-ECP results In the further timestamp, Check whether the assigned car arrive its assigned parking slot, if ‘yes’, update its status to parked If the parked car is time to check out, update the car to moving and parking slot to free Run update module for Parking and Assigned cars Free and Assigned parking slots The request in earlier timestamp has higher priority in our system

16 Update Module 1.Re-run ECP calculation only on the parking cars and free parking slots It is reasonable in real world, since we can mark all assigned parking slots to reserved status But it is not reasonable in scientific effort 2.Re-run ECP calculation for The cars which are in parking and assigned status The parking slots which are in free and assigned status Monitoring region is an efficient way to handle the continuous monitoring Since the problem of Chain Effect, the monitoring region is hard to handle this problem It is unreasonable in real world I’m slot1 timestamp 1timestamp 2 orz

17 Properties of Monitoring Region Monitoring region properties Each query has a monitoring region, it updates the results only when the objects move in/out the region If the query moves, the system needs to re-compute that query Chain Effect When a new object comes, it may affect the whole previous results That is the reason why this problem is difficult in update new object b2b2 b1b1 b3b3 a1a1 a2a2 a3a3 b4b4

18 Pruning based Solution For each iteration, the pairs are set to result if each object in the pair considers the other as its nearest neighbor a1a1 a2a2 a3a3 a4a4 b3b3 b1b1 b2b2 b4b4 iteration=0 iteration=1 b5b5 new object Time StampInterationResult Pairs 10 (a 2,b 1 ) (a 4,b 3 ) 11(a 1,b 2 ) 12(a 3,b 4 )

19 Update Module 3.Only process the car in parking status, and process the car in assigned status which has a better choice in the new time stamp After the system assigned a parking slot to driver, it does not make sense to change it to some further slot The assignment only change when the assigned car has a closer free parking slot It should be reasonable in both real world and scientific effort

20 Update Module P F is a set of all free parking slots For all p j in P F Set {d i, p j } as result, if dist(d i, p i ) > dist(d i, p j ), where {d i, p i } in Result timestamp-1 P i may equal to NULL if d i is not in any result pair in last iteration, and dist(d i, NULL)=MAX Push p i into P F, if p i is not NULL The cost is too high

21 Update Module CPM based searching strategy is used to reduce the cost of scanning

22 Update Module Level 0 Level 1 else If else Level 0 Level 1 Level 2

23 Experiments ParameterValues Number of strip (Plane Scan)16 Number of grid cell (CPM)128x128 Number of grid cell (Hybrid-CPM)32x32 Cardinality ratio, |A|/|B|1:1

24 Experiments KB

25 Experiments This experiment use update module 3 Data Set SizeUpdate RateTimes Elapsed 200K (1:1)0.011.25 200K (1:1)0.052.58 200K (1:1)0.13.58 200K (1:1) Rerun (Update Module2) 4.3

26 Conclusion We propose a hybrid solution to handle the ECP problem efficiently, and it overcomes other methods as shown in the experiments. Moreover, the incremental update has not finished. The performance is possible to be increased by more optimizations. We can extend this work to handle kECP Road Network Car-parking lot assignment Factor based assignment

27 Reference [Zhang04] J. Zhang, N. Mamoulis, D. Papadias, and Y. Tao. All-nearestneighbors queries in spatial databases. In SSDBM, pages 297–306, 2004. [Corral00] A. Corral, Y. Manolopoulos, Y. Theodoridis, and M. Vassilakopoulos. Closest pair queries in spatial databases. In SIGMOD Conference, pages 189–200, 2000. [Hjaltason98] G. R. Hjaltason and H. Samet. Incremental distance join algorithms for spatial databases. In SIGMOD Conference, pages 237–248, 1998. [Stanoi01] I. Stanoi, M. Riedewald, D. Agrawal, and A. E. Abbadi. Discovery of influence sets in frequently updated databases. In VLDB, pages 99–108, 2001. [Nering92] E. D. Nering and A. W. Tucker. Linear Programs & Related Problems: A Volume in the Computer Science and Scientific Computing Series. Academic Press, Inc., 1992. [Gale62] D. Gale and L. S. Shapley. College admissions and the stability of marriage. Amer. Math., 69:9–14, 1962. [Gusfield89] D. Gusfield and R.W. Irving. The Stable Marriage Problem, Structure and Algorithms. MIT Press, 1989. [Mouratidis05] K. Mouratidis, D. Papadias, and M. Hadjieleftheriou. Conceptual partitioning: An efficient method for continuous nearest neighbor monitoring. In SIGMOD Conference, pages 634–645, 2005. [Gale69] Gale, D. and Shapley, L. S. "College Admissions and the Stability of Marriage." Amer. Math. Monthly 69, 9-14, 1962.

28 Department of Computer Science, The University of Hong Kong The END (Thank you for your attendance)^2

29 Problem Properties Chain Effect When a new object comes, it will affect the whole previous results That is the reason why this problem is difficult in update Tie Breaking It happens rarely in real world if the distance is calculated by floating point new object b2b2 b1b1 b3b3 a1a1 a2a2 a3a3 b4b4 a1a1 a2a2 a3a3 b1b1 b2b2


Download ppt "Department of Computer Science, The University of Hong Kong Continuous Monitoring Application for a Car Parking System (Part2) Presenter: Leong Hou, U."

Similar presentations


Ads by Google