570 likes | 757 Views
On Efficient Spatial Matching Raymond Chi-Wing Wong (the Chinese University of Hong Kong) Yufei Tao (the Chinese University of Hong Kong) Ada Wai-Chee Fu (the Chinese University of Hong Kong) Xiaokui Xiao (the Chinese University of Hong Kong). Presented by: Chan Kit Yan, Anissa
E N D
On Efficient Spatial MatchingRaymond Chi-Wing Wong (the Chinese University of Hong Kong)Yufei Tao (the Chinese University of Hong Kong)AdaWai-Chee Fu (the Chinese University of Hong Kong)Xiaokui Xiao (the Chinese University of Hong Kong) Presented by: Chan Kit Yan, Anissa Chau Chun Wai, Vincent Chau Ming Lung, Aaron TseWai Lam, Forest
Outline • Introduction • Bichromatic Reverse Nearest Neighbor (BRNN) • Problem • Spatial Matching Problem (SPM) • Unweighted SPM • Weighted SPM • Related Work • Closest Pair • Stable Marriage • Algorithm • Chain for Unweighted SPM • Chain for Wighted SPM • Empirical Study • Conclusion
Introduction Bichromatic Reverse Nearest Neighbor (BRNN) • Given • P and O are two sets of objects in the same data space. • Problem • Given an object p P, a BRNN query finds all the object o O whose nearest neighbors (NN) in P are p.(There does not exist any object p’ P such that |o, p’| < |o, p|)
Introduction p3, RNN = { } o1, NN in P = { p1 } o2, NN in P = { p1 } p2, RNN = { } p1, RNN = { o1 , o2 , o3 } o3, , NN in P= { p1 }
Introduction The method fails! p3, RNN = { } o1, NN in P = { p1 } o2, NN in P = { p1 } p2, RNN = { } p1, RNN = { o1 , o2 , o3 } o3, , NN in P= { p1 } The total population from o1, o2 and o3 is equal to 14k, which is greater than the capacity of p1.
Introduction • Our Goal • Allocate each estate o O to the polling-place p P that • (i) is as near to o as possible, and • (ii) its servicing capacity has not been exhausted in serving other closer estates.
Problem • Spatial Matching Problem (SPM) • Unweighted SPM • Capacity of pi P = 1 • Population of oj O = 1 • Weighted SPM • Capacity of pi P 1 • Population of oj O 1
Problem • The problem of computing the BRNN set of each object p P is an instance of weighted SPM, where • p.w = |O| for every p P and • o.w=1 for every o O. • SPM can be regarded as a generic version of BRNN search that incorporates serving capacities.
Related Work • Related Work • Closest Pair • Running time = O(|P| x |O|2) • Stable Marriage • A classical problem in Computer Science • Running time = O(|P| x |O|)
Closest Pair • Given • Two sets P and O of objects. • Problem • A closest pair query finds the pair of objects (p, o) whose distance is the smallest among object-pairs in the Cartesian product P x O. • Running Time • O(|P| x |O|) for each query • O(|P| x |O|2) for |O| times
Stable Marriage • Given • Two sets O (for woman) and P (for man) • For each woman o O, • there is a preference list which sorts the men in descending order of how much o loves them. • For each man p P, • there is a preference list which sorts the women in descending order of how much p loves them. • Running Time • O(|P| x |O|)
Algorithm • Algorithm • Chain for Unweighted/Weighted SPM - Fairness Result - High Efficiency
p3 o1 o2 p2 o3 p1 Chain For Unweighted/Weighted SPM • Fairness - No Dangling Pair • Definition of Dangling Pair: • 1. |p, o| < the distance between o and some of its partners in A • 2. |p, o| < the distance between p and some of its partners in A
p3 o1 o2 p2 o3 p1 Chain For Unweighted/Weighted SPM Fair • Fairness - No Dangling Pair • Definition of Dangling Pair: • 1. |p, o| < the distance between o and some of its partners in A • 2. |p, o| < the distance between p and some of its partners in A
p3 o1 o2 p2 o3 p1 Chain For Unweighted/Weighted SPM Not Fair • Fairness - No Dangling Pair • Definition of Dangling Pair: • 1. |p, o| < the distance between o and some of its partners in A • 2. |p, o| < the distance between p and some of its partners in A
Chain For Unweighted/Weighted SPM • Algorithm Chain use two techniques - Bichromatic mutual NN Search { Let A’be a fair assignment for the SPM with P’ and O’. } - Then, A’U {(p, o)} is a fair assignment for the SPM with P and O. • Definition of Bichromatic mutual NN: For an object p P and an object o O • 1. p is NN of o in P • 2. o is NN of p in O NN = Nearest Neighbor
Chain For Unweighted/Weighted SPM • Algorithm Chain use two techniques - Bichromatic mutual NN Search { Let A’be a fair assignment for the SPM with P’ and O’. } - Then, A’U {(p, o)} is a fair assignment for the SPM with P and O. • Prove of A’U {(p, o)} is a fair assignment : Prove by Contradiction, assume it is a unfair assignment: • 1. The dangling pointer must include p or o (not both) • 2. |p’,o| < |p , o|, contradicting p & o are mutual NNs. • 3. |p,o’| < |p , o|, contradicting p & o are mutual NNs.
Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove them. 4) Back to step 2….. • Example: Potter Hermione Ronald
Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove them. 4) Back to step 2….. • Example: Potter Hermione Ronald
Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove them. 4) Back to step 2….. • Example: Potter Hermione Ronald
Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove them. 4) Back to step 2….. • Example: Potter Hermione Ronald
Assignment = null Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove until one of the weight = 0. 4) Back to Step 2….. • Example: boys2 girls1 boys1 10 10 5
Assignment = null Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove until one of the weight = 0. 4) Back to Step 2….. • Example: boys2 girls1 boys1 10 10 5
Assignment = { (boys1, girls1, 5) } Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove until one of the weight = 0. 4) Back to Step 2….. • Example: boys2 girls1 5 10
Assignment = { (boys1, girls1, 5) (boys2, girls1, 5)} Chain For Unweighted/Weighted SPM • Algorithm for Unweighted Chain: 1) Randomly pick a point, put it into a list. 2) Find NN, and then put it into the list. 3) If the first mutual NN is found, remove until one of the weight = 0. 4) Back to Step 2….. • Example: boys2 5
Cost of CHAIN for un-weighted SPM • Theorem 1: Chain performs at most 3|O| NN queries, and exactly 2 |O| object deletions. Proof : At most 3|O| NN queries • For each couple (p,o) A, at least 2 queries • Each couple (p,o) found by Chain must appear at the end of the chain. • Assume that P appears as the last object of the chain O appears as the second last object of the chain
Cost of CHAIN for un-weighted SPM For each couple (p,o) A, Case A: 2 NN queries ( no previous object, i.e. p’) 1 query from p 1 query from o Case B: 3 NN queries 1 query from p 1 query from o 1 query from p’ where p’ is the previous object before o along the chain
Cost of CHAIN for un-weighted SPM P1 find O2 1 queryO2 find P2 1 queryP2 find O2 1 query Couple (P2, O2) is assigned Case B P1 find O4 1 queryO4 find P4 1 queryP4 find O4 1 query Couple (P4, O4) is assigned Case B Case A O1 find P1 1 queryP1 find O1 1 query Couple (P1, O1) is assigned
Cost of CHAIN for un-weighted SPM Since |P| > |O|, |O| couple in assignment Thus, At most 3|O| NN queries Proof:exactly 2 |O| object deletions When find a couple, delete 1 object from P delete 1 object from O Since |O| couple in assignment Thus, exactly 2 |O| object deletions
Cost of CHAIN for weighted SPM • Theorem 3: Weighted Chain performs at most 3(|P| + |O|) NN queries, and at most |P| + |O| object deletions. Proof: At most 3(|P| + |O|) NN queries - 3 NN queries for each extended couple (p,o,w) - Remove only one object from its origin dataset total No. of couples (p,o,w) <= |P| + |O| Thus, at most 3(|P| + |O|) NN queries Proof: At most |P| + |O| deletions - Remove only one object from its origin dataset Thus, total deletions <= |P| + |O|
Running time of Chain (|N|) = complexity of NN query (|N|) = object deletion For Un-weighted SPM Running time of Chain = O(|O|. ((|P|)+(|P|))) If randomized technique (one of NN queries) used, (|P|) = log2 (|P|) (|P|) = log(|P|) Thus, in this case, time complexity of Chain = O(|O|. logO(1)|P|)
Running time of Chain For Weighted SPM Running time of Chain = O(|O|+|P|. ((|P|)+(|P|)+ (|O|)+(|O|))) If randomized technique (one of NN queries) used, (|P|) = log2 (|P|) (|P|) = log(|P|) Thus, in this case, time complexity of Chain = O((|O|+|P|). (logO(1)|P| + logO(1)|O|))