440 likes | 518 Views
Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University. Motivation. Applications Location based services Animation Physical simulation Mobile and wireless networks Need algorithms and data structures for processing, analyzing, querying moving objects
E N D
Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University
Motivation Applications • Location based services • Animation • Physical simulation • Mobile and wireless networks Need algorithms and data structures for processing, analyzing, querying moving objects Dynamic data structures not suitable for handling moving objects
Modeling Motion p(t) = (x(t),y(t)): Position of p at time t • x(t), y(t): polynomials • Degree of motion: max degree of x(), y() • Linear motion: Degree = 1 • p(t) = a t + b, a, b in R2 • Mostly assume motion to be linear • Trajectory of points can change • Trajectory can be piecewise linear
Early Work • Off-line setting: Entire motion known in advance • Bound the # combinatorial/topological changes in geometric attributes under algebraic motion [Atallah 1985] • Convex hull, closest pair, Voronoi diagram • # combinatorial changes in • Convex hull: ≈n2 • closest pair: Q(n2)
Early Work: Open Problems • # edge-flips in Delaunay triangulation of a point set, each point moving with fixed velocity • Upper Bound O(n3) • Lower Bound W(n2) • # changes in the smallest disk containing points • Smallest disk is defined by 2 or 3 points lying on its boundary
Kinetic Data Structures external event internal event [Basch, Guibas, Hershberger 1999] • Event based framework • Store some auxiliary information to expedite the simulation • A<B, C<D, B<D hold: no computation necessary (certificates) • A=B, C=D, or B=D: update structure (events)
Kinetic Data Structure (KDS) first event in global queue Proof of Correctness Certificate Failure Proof Update Structure Update • Maintain a set of certficates • Certificates provide a proof of the correctness of the structure • Determine when a certificate fails: event • Event times are roots of certain polynomials • Update the structure at an event and compute new certficates • Store events in a global priority queue
Kinetic Data Structures (KDS) Performance of KDS measured as • # events (efficiency) • # certificates (compactness) • Time spent at each event (locality) Efficient KDS developed for many problems [A. et al. 2001][Guibas 2004] Issues • Too many events for many KDS • Computing event times is expensive • Querying moving objects • No need to maintain the structure at all times
Trade Offs in KDS • Efficiency vs Approximation • Efficiency vs Accuracy • Querying Moving Objects • Range searching, nearest-neighbor searching on moving points • No need to maintain the structure at all times
KDS using Coresets S: Set of n moving points in R2 Maintain the diameter (width, smallest enclosing box) of S • [A., Guibas, Hershberger, Veach] • Diametral pair can change Q(n2) times • KDS with ~ n2 events • Can we maintain the approximate diameter of S more efficiently? • Is there a small subset Q of S s.t. for all t diam(Q(t)) ≥ (1-e) diam(S(t)) • Q: coreset of S
Extent of Functions • F={f1, …, fn}:d-variate functions • UF: Upper envelope of F UF(x) = maxifi(x) • LF: Lower envelope of F LF(x) = minifi(x) e-kernel:G is e-kernel of F if (1-e) EF(x) ≤ EG(x) Extent:EF(x) = UF(x) - LF(x)
Coresets for Moving Points S: Set of n moving points in R2 w(u,S(t)):Directional width of S(t) in direction u A subset Q is e-kernel of S if For u in S1, t in R (1-e)w(u,S(t)) ≤w(u,Q(t)) fi(u,t): ‹pi(t), u›, F={f1…fn} Claim:w(u,S(t)) = EF(t) e-kernel of F e-kernel of S
Kernels of Moving Points Theorem [A., Har-Peled, Varadarajan] F={f1, …, fn}:d-variatepolynomials of fixed degree; e > 0parameter An e-kernel of F of size 1/eO(1) can be computed in time O(n+ 1/eO(1)). Corollary:S: n points moving with fixed velocity in 2D, e > 0parameter. An e-kernel of S of size O(1/e3/2) can be computed in time O(n+ 1/e3).
Maintaining a Bounding Box Maintain an e-approximation of the bounding box of S • Compute an e-kernel Q of S • Smallest Bounding box defined by: left-,right, top, and bottom-most points • Use KDS to maintain these 4 points of Q • Events: When one of them changes Same approach works for maintaining width, diameter, … approximately
Bounding Box: Quality of Kernels • 10,000 moving points • Trajectories linear of quadratic • Error < 0.02 for kernel of size 32 Linear Motion Quadratic Motion
Bounding Box: # Events Exact Algorithm Approximation Algorithm
Kinetic Convex Hull with Coresets Quality over 200 Random Directions Quality of Width Quality of Diameter Convex hull of 10,000 moving points Quality of Approximation
Kinetic Event Distribution Coreset Original Set * Input: 10,000 linearly moving points
Kinetic Triangulations • Delaunay triangulation in R2 • O(n3) edge flips • An arbitrary triangulation in R2 • ≈n2 edge flips [A., Wang, Yu 2004] Can we maintain an almost Delaunay triangulation with ≈n2 edge flips? • [A., Guibas, Gao, Koltun, Sharir 2006] • Maintain a subgraph of Delaunay triangulation that • contains W(n) Delauanay edges • contains all wide Delaunay edges • performs ≈n2 edge flips Is there a good definition of almost Delaunay triangulation?
Efficiency vs Accuracy Robust KDS
Event Scheduling in KDS first event in global queue Proof of Correctness Certificate Failure Proof Update Structure Update • The kinetic data structure framework • Events: Computing roots of a polynomial • KDS assumes events are processed in correct order * Need exact root comparison; EXPENSIVE! * Need degeneracy handling (simultaneous events); PAINFUL!
Out-of-Order Event Processing Not scheduled because its computed event time is before current time • What if using floating point arithmetic to compute and compare event times inexactly? * Pros: cheaper arithmetic operations * Cons: events may now be processed in the wrong order processed scheduled In-order: Out-of-order: t
Out-of-Order Event Processing • Issues in out-of-order event processing * Does the KDS fall into an infinite loop? * Can an event be delayed for too long? * Can error in the maintained structure be too large? [Abam, A., de Berg, Yu, 2006] • RobustKDS to address these issues • KDS is correct at all times except near the event times • No event is delayed too long • Bonus: Degeneracies are handled automatically
Model of Robust KDS • Root computation procedure CROP * : input polynomial; : error bound in CROP * CROP( ) does the following (1) find set of disjoint, open event intervals s.t. each and they cover all roots (2) find parity of the number of roots lying in each (3) return intervals with odd number of roots
Computing Event Times _ _ + + _ _ + + If Certificate conforms to schedule a future event at ; Otherwise schedule a past event at .
Computing Event Times : failing certificate; : polynomial associated with A past event… A future event…
Robust Kinetic Sorting I may encounter a past event… The new EventTime(.) * Almost the same as traditional kinetic sorting algorithm… (but not always, e.g., robust kinetic convex hull)
Nice Properties • The KDS does not fall into an infinite loop • List is correct except within -neighborhood of actual event times
Nice Properties : i-th pt in maintained list : i-th pt in sorted list :maximum velocity over time interval • Events may be delayed by at most time long • Even when list is incorrect, it is still close to true sorted list geometrically
Experimental Results Input
Experimental Results Input
Other Robust KDS [Abam, A., de Berg, Yu, 2006] • Kinetic tournament • Convex hull, kd-tree, range-tree, … • Is there a robust KDS for Delaunay triangulation? • Find a sequence of edge-flips to convert a self-intersecting triangulation to Delaunay triangulation
Soft KDS [Czumaj, Sohler 2005] • Approximate KDS • Repair the structure only when necessary • Use the ideas from property testing to ensure KDS is almost correct with high probability • Competitive analysis to measure the performance of KDS
Kinetic Range Searching S: Set of points, each moving with fixed velocity in R2 Preprocess S into a data structure: • (Q1) Given rectangleRat timet, report all points S(t)∩R • (Q2) Given R and time interval[a,b], report all points of that pass thru R during the time interval [a,b]
KDS Approach • Kientic range trees [A., Arge, Erickson 2003] • O(n log n) space, O(log n + k) query (Q1) • Use KDS approach to update range tree • Q(n2) events; O(log2n) (amortized) time at each event • Queries have to arrive in chronological order • Kinetic kd-trees [A. Gao, Guibas 2003] • O(n) space, O(n1/2 + k) query (Q1) • Q(n2) events; O(log2n) (amortized) time at each event • Queries have to arrive in chronological order • What if queries do not arrive in chronological order? Why spend time processing events?
Kinetic Range Searching Partition tree based approach [A., Arge, Erickson] • O(n) space, O(n1/2 + k) query time • O(log2n) insertion/deletion of a point Answering (Q1) query A similar approach works for (Q2) queries
Time-Responsive Indexing (near future) (distant future) • Time-responsiveness * Near future queries need to be answered more quickly * Optimize structure for near future * Approximate distant future • Results [A., Arge, Erickson, Yu, 2004] * Orthogonal range queries in R1 , R2 ~n space, (f(tq)/n)1/2 + logO(1)n + kquery time f(tq): # events between current time and tq
Example: 1D Time-Responsive Indexing • : set of linearly moving points in R1 * Given interval and time , report • In tx-plane, reduces to stabbing query * Report all lines intersecting a vertical segment • Overall structure * Divide tx-plane into slabs * i-th slab contains events (vertices) * A window structure for each slab to answer stabbing query
Window Structure cutting tree partition tree • Hierarchical triangulation of the i-th slab * triangles * Each triangle intersects at most lines • Partition tree for each triangle * Size: , query time: • Overall * Space: , query: (note that ) * Update every other events ( amortized per event) -cutting
References [Abam, Agarwal, de Berg, Yu, 2006] Out-of-order event processing in kinetic data structures. ESA’06. [Abam, de Berg, 2005] Kinetic sorting and kinetic convex hulls. SoCG’05. [Agarwal, Arge, Erickson, 2003] Indexing moving points. J. Comput. Syst. Sci., 66(1). [Agarwal, Arge, Erickson, Yu, 2004] Efficient tradeoff schemes in data structures for querying moving objects. ESA’04. [Agarwal, Arge, Vahrenhold, 2001] Time responsive external data structures for moving points. WADS’01. [Agarwal, Gao, Guibas, Koltun, Sharir, 2006] Stable Delaunay triabgulation, manuscript. [Agarwal, Har-Peled, Varadarajan, 2004] Approximating extent measures of points. J. ACM, 51(4). [Agarwal, Wang, Yu] Kinetic triangulation, SOCG’04. [Czumaz, Sohler, 2005] Soft kinetic data structures, SODA. [Guibas 2004] Kinetic data structures, Handbook of DCG, 2nd edition, [Yu, Agarwal, Poreddy, Varadarajan, 2004] Practical methods for shape fitting and kinetic data structures using coresets. SoCG’04.
Example: Kinetic Sorting Scheduled as a past event because current configuration is inconsistent with processed scheduled List: