kinetic algorithms: approximation and trade-offs pankaj k. agarwal duke university

44
Kinetic Algorithms: Approximation and Trade- offs Pankaj K. Agarwal Duke University

Upload: ophelia-boyd

Post on 12-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kinetic Algorithms:

Approximation and Trade-offs

Pankaj K. AgarwalDuke University

Page 2: 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

Page 3: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Modeling Motion

p(t) = (x(t),y(t)): Position of p at time tx(t), y(t): polynomialsDegree 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 linearTrajectory of points can changeTrajectory can be piecewise linear

Page 4: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Early WorkOff-line setting: Entire motion known in advanceBound 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: (n2)

Page 5: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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 (n2)

# changes in the smallest disk containing points• Smallest disk is defined by 2 or 3 points lying on its

boundary

Page 6: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kinetic Data Structures[Basch, Guibas, Hershberger 1999]

Event based frameworkStore 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)

external event

internal event

A B C D

DB

D

A B DC

A

B DCAB DC

A

A

B DC AB DCD

A

B CB DC A

A

Page 7: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kinetic Data Structure (KDS)

Maintain a set of certficatesCertificates provide a proof of the correctness of

the structureDetermine 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

Proof of Correctnes

s

Certificate Failure

Proof Update

Structure Update

first event in global queue

Page 8: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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]

IssuesToo many events for many KDSComputing event times is expensiveQuerying moving objects

• No need to maintain the structure at all times

Page 9: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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

Page 10: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

I. Efficiency vs Approximation

Page 11: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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 (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-) diam(S(t))

Q: coreset of S

Page 12: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Extent of FunctionsF={f1, …, fn}: d-variate functions

• UF: Upper envelope of F UF(x) = maxi fi(x)

• LF: Lower envelope of F LF(x) = mini fi(x)

Extent: EF(x) = UF(x) - LF(x) -kernel: G is -kernel of F if (1-) EF(x) ≤ EG(x)

Page 13: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Coresets for Moving Points

S: Set of n moving points in R2 (u,S(t)): Directional width of S(t) in direction u A subset Q is -kernel of S if For u in S1, t in R

(1-)(u,S(t)) ≤(u,Q(t))

fi(u,t): ‹pi(t), u›, F={f1…fn}

Claim: (u,S(t)) = EF(t) -kernel of F -kernel of S

Page 14: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kernels of Moving Points

Theorem [A., Har-Peled, Varadarajan]

F={f1, …, fn}: d-variate polynomials of fixed degree;

> 0 parameter

An -kernel of F of size 1/O(1) can be computed in time O(n+ 1/O(1)).

Corollary: S: n points moving with fixed velocity in 2D, > 0 parameter.

An -kernel of S of size O(1/3/2) can be computed in time O(n+ 1/3).

Page 15: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Maintaining a Bounding Box

Maintain an -approximation of the bounding box of SCompute an -kernel Q of S Smallest Bounding box defined by:

left-,right, top, and bottom-most pointsUse KDS to maintain these 4 points of QEvents: When one of them changes

Same approach works for maintaining

width, diameter, … approximately

Page 16: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Bounding Box: Quality of Kernels10,000 moving pointsTrajectories linear of quadraticError < 0.02 for kernel of size 32

Linear Motion Quadratic Motion

Page 17: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Bounding Box: # Events

Exact Algorithm Approximation Algorithm

Page 18: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kinetic Convex Hull with Coresets

Quality of Approximation

Quality over 200 Random Directions

Quality of WidthQuality of Diameter

Convex hull of 10,000 moving points

Page 19: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kinetic Event Distribution

Original Set Coreset

* Input: 10,000 linearly moving points

Page 20: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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?

Kinetic Triangulations

[A., Guibas, Gao, Koltun, Sharir 2006]Maintain a subgraph of Delaunay triangulation that • contains (n) Delauanay edges •contains all wide Delaunay edges • performs ≈ n2 edge flips

Is there a good definition of almost Delaunay triangulation?

Page 21: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Efficiency vs Accuracy

Robust KDS

Page 22: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Event Scheduling in KDS

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!

Proof of Correctness

Certificate Failure

Proof Update

Structure Update

first event in global queue

Page 23: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Out-of-Order Event Processing

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

)(tA

)(tB

)(tC

In-order: ABCACBCABCBAOut-of-order: ABCBACBCA

Not scheduled because its computed event time is before current time

scheduled processed

t

Page 24: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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]

Robust KDS 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

Page 25: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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

)(tf )(tf

kII ,,1 iI

iI

1I 2I3I

Page 26: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Computing Event Times

1I 2I3I

+_ + _ +_ + _

currt

last1last

)sign( currt If Certificate conforms to schedule a future event at ;

Otherwise schedule a past event at .

last 1last

Page 27: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Computing Event Times

: failing certificate; : polynomial associated withc c c

A past event…

A future event…

currtlast 1lastcurrtlast 1last

Page 28: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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)

Page 29: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Nice Properties

The KDS does not fall into an infinite loop

List is correct except within -neighborhood of actual event times

t

Page 30: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Nice Properties

Events may be delayed by at most time long

Even when list is incorrect, it is still close to true sorted list geometrically

)( nO

maxcurrcurr )(ˆ)( Vntxtx ii ix : i-th pt in maintained list

ix̂ : i-th pt in sorted list

maxV : maximum velocity over time interval currcurr , tt

currt

Page 31: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Experimental Results: Kinetic Sorting

Input

Page 32: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Experimental Results

Input

Page 33: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Experimental Results

Input

Page 34: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Other Robust KDS

[Abam, A., de Berg, Yu, 2006]

Kinetic tournamentConvex 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

Page 35: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Soft KDS

[Czumaj, Sohler 2005]

Approximate KDSRepair the structure only when necessaryUse the ideas from property testing to ensure

KDS is almost correct with high probabilityCompetitive analysis to measure the performance

of KDS

Page 36: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

III. Querying Moving Objects

Page 37: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kinetic Range Searching

S: Set of points, each moving with fixed velocity in R2

Preprocess S into a data structure: (Q1) Given rectangle R at time t, 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]

Page 38: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

KDS ApproachKientic range trees [A., Arge, Erickson 2003]

• O(n log n) space, O(log n + k) query (Q1)• Use KDS approach to update range tree (n2) events; O(log2 n) (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)(n2) events; O(log2 n) (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?

Page 39: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Kinetic Range SearchingPartition tree based approach [A., Arge, Erickson]O(n) space, O(n1/2 + k) query timeO(log2 n) insertion/deletion of a point

Answering (Q1) query

A similar approach works for (Q2) queries

Page 40: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Time-Responsive Indexing

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, ((tq)/n)1/2 + logO(1) n + k query time

(tq): # events between current time and tq

t

x4l

3l

2l

1l

)()( nOtq

)()( 2ntq

kn polylog

kn 2/1

(near future)(distant future)

Page 41: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

: 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

],[}{ 21 xxtq

],[ 21 xx qt ],[)( 21 xxtS q )(tS

Example: 1D Time-Responsive Indexing

nlogni 2

x

tqt

2x

1x

Page 42: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Window Structure

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)

n~ kni polylog2 2/

in 2/~i2

i2 2/2i

cutting tree

partition tree

)/2( ni

x

t

-cutting

iqt 2)(

)(nO)( nO

Page 43: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

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.

Page 44: Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University

Example: Kinetic Sorting

)(tA

)(tB

)(tC

CBAList: ABCBACBCA

scheduled processed

currtcurrt currt

currt

Scheduled as a past event because current configuration is inconsistent with )()(sign currcurr tCtB