Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dept. of Computer Science Assignment Problems in Spatial Databases Kamiru Leong Hou, U Supervisor: Nikos Mamoulis Probation Talk:

Similar presentations


Presentation on theme: "Dept. of Computer Science Assignment Problems in Spatial Databases Kamiru Leong Hou, U Supervisor: Nikos Mamoulis Probation Talk:"— Presentation transcript:

1 Dept. of Computer Science Assignment Problems in Spatial Databases Kamiru Leong Hou, U Supervisor: Nikos Mamoulis Probation Talk:

2 Dept. of Computer Science Outlines  Spatial Assignment Problems  Applications  Continuous Exclusive Closest Pair Monitoring  Problem Definition  Examples of the solutions  Experiments  Capacity Constrained Assignment Problem  Problem Definition  Solutions  Discussion

3 Dept. of Computer Science Spatial Assignment Problems  Given two sets of objects, find the k 1 to k 2 assignments between these two sets with 1.minimizing the cost from one set of objects, which is named as stable assignment 2.minimizing the total cost, which is named as optimal assignment  Both cost might be measured by the distance in spatial applications

4 Dept. of Computer Science Spatial Assignment Problems Stable Assignment Spatial Assignment Problems Optimal Assignment Set A Set B

5 Dept. of Computer Science Stable Assignment  It is a variant of stable marriage problem  `stable matching’ means  a matching in which no element of the first matched set prefers an element of the second matched set that also prefers the first set element. a b cd {b,c} is a stable matching since both b and c cannot find an element o i of the other matched set which dist(o i,b/c)<dist(b,c) and dist(o i,b/c)<dist(o i,o i.assigned-object) a b cd

6 Dept. of Computer Science Stable Marriage Problem  Stable Marriage Problem can be solved by [Gale62][Gusfield89] menpreference m1m1 w 2, w 3, w 1 m2m2 w 1, w 2, w 3 womenpreference w1w1 m 1, m 2 w2w2 m 2, m 1 w3w3 womensuggested man w1w1 w2w2 w3w3 mensuggested woman w2w2 w1w1 m1m1 m2m2 m1m1 m2m2 In general, stable marriage problem is asymmetric The results can be symmetric if the preference lists are symmetric

7 Dept. of Computer Science Optimal Assignment  It consists of finding a maximum (minimum) weight matching in a weighted bipartite graph. a b cd The pairs {a,c} and {b,d} are the best assignment with the minimum total distance a b c d 5 12 2 5

8 Dept. of Computer Science slot aslot b Application 1  Given a set of cars and a set of parking slots, which of the followings is the best way to assign the slots to the cars? 1.Stable Assignment 2.Optimal Assignment please go to slot a please go to slot b

9 Dept. of Computer Science slot aslot b Application 1  Given a set of cars and a set of parking slots, which of the followings is the best way to assign the slots to the cars? 1.Stable Assignment 2.Optimal Assignment please go to slot b please go to slot a Can I park in? Sorry, no! ##@#$%$

10 Dept. of Computer Science Application 2  Given a set of wireless routers and a set of clients, which of the followings is the best way to let the routers serve the clients? 1.Stable Assignment 2.Optimal Assignment each router can serve at most 2 clients No signal

11 Dept. of Computer Science  Given a set of wireless routers and a set of clients, which of the followings is the best way to let the routers serve the clients? 1.Stable Assignment 2.Optimal Assignment Application 2 each router can serve at most 2 clients

12 Dept. of Computer Science Conclusion  Both problems in spatial database have received little attention in the past  Although both can be solved by some existing algorithms, they are not optimized by the spatial features

13 Dept. of Computer Science Continuous Exclusive Closest Pair Monitoring

14 Dept. of Computer Science Exclusive Closest Pair  For the datasets (A, B)  Run CP(A,B) = {(a,b)}  A=A-{a}, B=B-{b}  Repeat this process until A or B is empty  ECP can be solved by stable marriage algorithm  Too many computations

15 Dept. of Computer Science Memory Based Solution  CPM (conceptual partitioning monitoring) is the state of the art technique for NN searching  which can be used by incremental solution of ECP U3U3 U2U2 U1U1 L3L3 L2L2 L1L1 L0L0 U0U0 q D0D0 R0R0 R1R1 R2R2 R3R3 D1D1 D2D2 D3D3 o1o1 o2o2 o3o3 First NN has been found, stop? No, since dist(q, o 1 )>mindist(q, next cell) Continue to search~~

16 Dept. of Computer Science Solution 1  Drawback  Each a i should use a priority queue to store the searching order  If |a| is very large, then there are too many priority queue a1a1 b1b1 a2a2 (a 1,b 1 ) must be our result Remove a 1 and b 1 Enlarge the searching distance, until find all assignments b2b2

17 Dept. of Computer Science Solution 2  Drawback  There might have a lot of false alarms too many candidates are found, but too less results can be confirmed a1a1 a2a2 b1b1 b2b2 (a 1,b 1 ) and (a 2,b 2 ) are the candidates of the ECP (a 1,b 1 ) is the result, since b 1 also sees a 1 as its NN (a 2,b 2 ) is not sure, since b 2 sees a 1 as its NN

18 Dept. of Computer Science Discussion  The drawback of solution 1  too many priority queue if there are too many objects in A  The drawback of solution 2  less results are found in late iterations  Hybrid Solution  Run solution 2 first, then run solution 1 The number of A should be reduced by solution 2 The solution 2 does not need to run into the late iterations

19 Dept. of Computer Science Experiments Grid size: 128x128 Strip size: 16 Grid size: 128x128 Strip size: 16

20 Dept. of Computer Science Update module  We focus on the car-parking slot assignment  Run Hybrid solution in the initial state  Monitor the results by the update module  Observation slot a Timestamp 1 please go to slot a Timestamp 2 The distance between the assignment is shorter by time to time slot b please go to slot b ##@#$%$ The assignment should be changed if and only if the car can find a better slot

21 Dept. of Computer Science Update module  Find a better assignment for the assigned cars  If there is any, then change the original assigned slot as empty and set the new slot as assigned  Run Hybrid solution to all unassigned cars (which are asking for park) and all empty slots

22 Dept. of Computer Science Update module s3s3 s1s1 c2c2 c1c1 c 1 cannot change the assignment to s 3 c 2 can change the assignment to s 3, let s 2 as empty slot s2s2 Repeat to run until no more empty slot Optimization 2 Optimization 1 swsw cwcw Assume that (s w,c w ) is the worst assignment in last iteration Terminate the search, since dist(s f,next cell)>worst dist s f does not need to scan c 1, since dist(s f, cell c1 )>dist(s 1,c 1 ) sfsf s1s1 c1c1 sfsf s2s2 c2c2

23 Dept. of Computer Science Experiments |C|: 40k (number of unassigned cars) |S_f|: 20k (number of empty slots) |C|: 40k (number of unassigned cars) |S_f|: 20k (number of empty slots)

24 Dept. of Computer Science Capacity Constrained Assignment Problem

25 Dept. of Computer Science Capacity Constrained Assignment  Given a set of queries, a set of objects and a parameter k  Find the assignments between queries and objects with minimum cost (distance), such that  Each query can assign to at most k objects  Each object can assign to at most 1 query

26 Dept. of Computer Science Related works  It is one variant of the optimal assignment  Some existing algorithms  Hungarian Algorithm  Cost Scaling Algorithm  Successive Shortest Path Algorithm (SSPA)

27 Dept. of Computer Science 0, 1/2 -4, 1 0, 1 d ij, x ij /c ij Flow Network 0, 1/2 4, 1/1 8, 0/1 0, 1/1 0, 0/2 6, 0/15, 0/1 0, 0/1 ij Flow Network d ij, r ij 8, 1 0, 1 0, 2 6, 15, 1 0, 1 ij Residual Network 0, 1 d ji =-d ij r ij =c ij -x ij r ji =x ij arc ij exists if r ij >0 d ji =-d ij r ij =c ij -x ij r ji =x ij arc ij exists if r ij >0 d ij, x ij /c ij ED 0, 2/2 4, 1/1 8, 0/1 0, 1/1 0, 0/2 6, 1/1 5, 0/1 0, 1/1 ij Flow Network -4, 1 0, 2 d ij, r ij ED 8, 1 0, 1 0, 2 -6, 15, 1 0, 1 ij Residual Network Minimum Cost Maximum Flow 1 to 2 assignment

28 Dept. of Computer Science Optimal Assignment a b c d e Queries Objects d(i,j), r ij ij 6, 1 4, 1 8, 1 3, 1 7, 1 5, 1 ED 0, 2 0, 1 Each query can assign to at most 2 objects Add one exceed node and one deficit node Exceed node have arcs to all queries with cost=0 and capacity k=2 All objects have arcs to deficit node with cost=0 and capacity 1 The number of flows from exceed node to deficit node is min{k|Q|,|O|}

29 Dept. of Computer Science SSPA a b c d e 6, 1 4, 1 8, 1 3, 1 7, 1 5, 1 ED 0, 2 0, 1 (1) Find the shortest path from exceed node to deficit node (2) Send a flow from exceed node to deficit node, and update the graph a b c d e 6, 1 4, 1 8, 1 -3, 1 7, 1 5, 1 ED 0, 2 0, 1 (3) Repeat (1), until no more augmenting path can be found The number of augmenting paths is min{k|Q|, |O|} a b c d e 6, 1 4, 1 8, 1 -3, 1 7, 1 5, 1 ED 0, 2 0, 1

30 Dept. of Computer Science How to find shortest path?  Dijkstra algorithm is an efficient algorithm to find the shortest path  but it does not allow negative value on the arc  since the negative value may affect the correctness of the Dijkstra algorithm b a c d 10 -3 -4 5 1.S={(a,0)}, a is labeled 2.S={(d,5),(b,10)}, d is labeled 3.S={(e,8),(b,10)}, e is labeled (PROBLEM) e 3

31 Dept. of Computer Science How to find shortest path?  Use reduced cost (d’ ij ) to solve this problem  For every path, the reduced cost can be defined as follows:  d’ ij =d ij -p(i)+p(j)  p(i)=p(i)-mindist(i)+mindist(D) For all node i which are labeled by the Dijkstra algorithm p is the potential value of node i  At the beginning, all p(i)=0 2 6 3 4 a b E c d D 0 00 0 0 4 1 2 a b E c d D 20 20 0 1 0 0 a b E c d D 31 50 a, b, and c are labeled by Dijkstra p(a)=p(a)-0+2=2 p(b)=p(b)-0+2=2 p(c)=p(c)-2+2=0 p(a)=p(a)-2+3=3 p(b)=p(b)-0+3=5 p(c)=p(c)-2+3=1 p(d)=p(d)-3+3=0

32 Dept. of Computer Science SSPA d ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 q1q1 20193035364556 q2q2 1311930151729 q3q3 3022237423549 q1q1 q2q2 q3q3 o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 (1) Labeled objects = {q 1,q 2,q 3,o 4 } p(q 1 )=p(q 1 )-mindist(q 1 )+mindist(D)=0-0+7=7 p(q 2 )=p(q 2 )-mindist(q 2 )+mindist(D)=0-0+7=7 p(q 3 )=p(q 3 )-mindist(q 3 )+mindist(D)=0-0+7=7 p(o 4 )=p(o 4 )-mindist(o 4 )+mindist(D)=0-7+7=0 0 0 0 0 0 0 00 0 07 7 7 (2) Labeled objects = {q 1,q 2,q 3,o 3 } p(q 1 )=p(q 1 )-mindist(q 1 )+mindist(D)=7-0+2=9 p(q 2 )=p(q 2 )-mindist(q 2 )+mindist(D)=7-0+2=9 p(q 3 )=p(q 3 )-mindist(q 3 )+mindist(D)=7-0+2=9 p(o 3 )=p(o 3 )-mindist(o 3 )+mindist(D)=0-2+2=0 02 0 9 9 9 (3) Labeled objects = {q 1,q 2,q 3,o 2 } … 0 2 4 11 Each query can assign to at most 2 objects

33 Dept. of Computer Science 12 01 0 SSPA d ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 q1q1 20193035364556 q2q2 1311930151729 q3q3 3022237423549 q1q1 q2q2 q3q3 o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 (4) Discovered objects = {q 1,q 2,q 3,o 1,o 2 } p(q 1 )=p(q 1 )-mindist(q 1 )+mindist(D)=11-0+9=20 p(o 1 )=p(o 1 )-mindist(o 1 )+mindist(D)=0-9+9=0 p(q 2 )=p(q 2 )-mindist(q 2 )+mindist(D)=11-8+9=12 p(o 2 )=p(o 2 )-mindist(o 2 )+mindist(D)=0-8+9=1 p(q 3 )=p(q 3 )-mindist(q 3 )+mindist(D)=11-0+9=20 0 0 0 00 0 11 20 Each query can assign to at most 2 objects 8

34 Dept. of Computer Science SSPA-Range  It is unnecessary to calculate all distances before we run the SSPA  Assume that we run a range search with a threshold ε  Run the Range-Search(ε) for all queries  Run SSPA Find the shortest path Fill the flow only when it can be guaranteed as a shortest path, otherwise, break  ε = ε+k

35 Dept. of Computer Science SSPA-Range q1q1 q2q2 q3q3 o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 0 0 0 0 0 0 00 0 07 7 7 02 0 9 9 9 0 2 4 11 Each query can assign to at most 2 objects ε=10 ε=15 d’ ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 p q1q1 -------7 q2q2 --2----7 q3q3 ---0---7 p0000000 d ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 q1q1 ------- q2q2 --9---- q3q3 ---7--- 0 29 9 9 111315 246 202 4 4 11 E->q 3 ->o 4 ->D must be the shortest path dist(E->q 3 ->o 4 ->D)=7  ε (1) Labeled objects = {q 1,q 2,q 3,o 4 } … E->q 2 ->o 3 ->D must be the shortest path dist(E->q 2 ->o 3 ->D)=2  ε-7 (the highest p) (2) Labeled objects = {q 1,q 2,q 3,o 3 } … E->q 2 ->o 2 ->D must be the shortest path dist(E->q 2 ->o 2 ->D)=2  ε-9 (the highest p) (3) Labeled objects = {q 1,q 2,q 3,o 2 } …

36 Dept. of Computer Science SSPA-Range d ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 q1q1 2019----- q2q2 13119-1517- q3q3 ---7--- ε=20 E->q 1 ->o 1 ->D must be the shortest path dist(E->q 1 ->o 1 ->D)=9  ε-11 (the highest p) (4) Labeled objects = {q 1,q 2,q 3,o 1,o 2 } … d ’ ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 p q1q1 98-----11 q2q2 202-46- q3q3 ---4--- p0000000 dir  d ’ ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 p q1q1 00-----20 q2q2 103-35-12 q3q3 ---13---20 p0100000 dir 

37 Dept. of Computer Science SSPA-Range  Repeat the above steps, until find all assignments  It saves I/O accesses (only 30 objects are discovered by range- search) in this example, and it can save more if there are more objects and queries d ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 q1q1 20193035--- q2q2 1311930151729 q3q3 3022237-35- ε=35

38 Dept. of Computer Science 11 0 79 02 SSPA-INN q1q1 q2q2 q3q3 o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 0 0 0 0 0 00 0 07 7 02 9 9 0 4 11 Each query can assign to at most 2 objects E->q 3 ->o 4 ->D must be the shortest path dist(E->q 3 ->o 4 ->D)=7  possible mindist = 7 (1) Labeled objects = {q 1,q 2,q 3,o 4 } … First, run NN search for all queries E->q 2 ->o 3 ->D must be the shortest path dist(E->q 2 ->o 3 ->D)=2  possible mindist = 2 (2) Labeled objects = {q 1,q 2,q 3,o 3 } … Find next NN for query q 3 Find next NN for query q 2 E->q 2 ->o 2 ->D must be the shortest path dist(E->q 2 ->o 2 ->D)=2  possible mindist = 2 (3) Labeled objects = {q 1,q 2,q 3,o 2 } … d’ ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 p q1q1 -19-----0 q2q2 --9----0 q3q3 ---7---0 p0000000 127 7 7 2 0 15 0 213 109 9 9 2 2 411 8 0

39 Dept. of Computer Science 11 SSPA-INN 11 0 q1q1 q2q2 q3q3 o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 0 0 0 00 0 Each query can assign to at most 2 objects E->q 1 ->o 2 ->q 2 ->o 1 ->D is not the shortest path dist(E->…->D)= 10 > mindist = 8 Find next NN for query q 2 E->q 1 ->o 1 ->D must be the shortest path dist(E->q 1 ->o 1 ->D)=9  mindist = 9 (4) Labeled objects = {q 1,q 2,q 3,o 1,o 2 } … Find next NN for query q 1 d’ ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 p q1q1 -8-----11 q2q2 -02---- q3q3 - -4--- p0000000 2 9 3 133 020 12 20 0 0 1 1

40 Dept. of Computer Science Discussion  It saves 8/35 I/O accesses in the above example, which is more than SSPA-RANGE  SSPA-INN should be better than SSPA-RANGE, since it accesses the index tree only when it is necessary d ij o1o1 o2o2 o3o3 o4o4 o5o5 o6o6 o7o7 q1q1 201930---- q2q2 13119-1517- q3q3 3022237-35- The objects have been searched before terminated the SSPA-INN

41 Dept. of Computer Science SSPA-INN-PRUNING  Observation Assigned in previous iteration Running NN search Does not need to search in blue area Since dist(q b,o a )+dist(q a,o i )  dist(q a,o a )+dist(q b,o i ) which o i is the objects in blue area Does not need to search in blue area Since dist(q b,o a )+dist(q a,o i )  dist(q a,o a )+dist(q b,o i ) which o i is the objects in blue area qaqa qbqb oaoa oioi ococ

42 Dept. of Computer Science SSPA-INN-PRUNING qaqa qbqb oaoa obob ococ Find next NN in blue area Find next NN in red area M1M1 M2M2 M3M3 m1m1 m2m2 m3m3 m4m4 m5m5 m6m6 m7m7 m8m8 m9m9 …

43 Dept. of Computer Science Conclusion  Three algorithms have been introduced to solve the capacity constrained assignment problem  SSPA-RANGE  SSPA-INN  SSPA-INN-PRUNING  All these algorithms aim to reduce the number of I/O accesses and optimize with spatial features  The experiments have not finished yet

44 Dept. of Computer Science Kamiru

45 Dept. of Computer Science Kamiru


Download ppt "Dept. of Computer Science Assignment Problems in Spatial Databases Kamiru Leong Hou, U Supervisor: Nikos Mamoulis Probation Talk:"

Similar presentations


Ads by Google