kinetic data structures. goal maintain a configuration of moving objects each object has a posted...

36
Kinetic data structures

Upload: darren-bryan

Post on 05-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Kinetic data structures

Page 2: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Goal

• Maintain a configuration of moving objects

• Each object has a posted flight plan (this is essentially a well behaved function of time)

Page 3: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Example 1

Maintain the closest pair among points moving in the plane

Page 4: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Example 2

Maintain the convex hull of points moving in the plane

Page 5: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Elements of a KDS

• An event queue (A heap of discrete times)

• The event queue will contains all times where the combinatorial structure of the configuration may change

• Like a “sweep” of the time dimension

Page 6: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Example 3

Maintain the topmost among points moving along the y-axis

Page 7: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Look at the ty-plane

t

y

Page 8: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

We are interested in the upper envelope

t

y

Page 9: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Solution

• Calculate this upper envelope !

• Sharir, Hart, Agarwal and others:– The complexity of the envelope is

close to linear if any pair of function intersect at most s times

– Can compute it in O(n log(n)) time

Page 10: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Problem

• If we would like to change a trajectory then we need to recompute te envelope

• That takes O(nlog(n)) time• We want to be able to change a

trajectory faster

Page 11: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Another solution

• Maintain the points sorted• For every pair of points put in the

event queue the time when they switch order

Page 12: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Example 3

Page 13: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Problem

• We process Ω(n2) events

• But the configuration changes only linear (or close to linear) number of times…

Page 14: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

So what do we want from a KDS to be good

• You maintain a set of certificates that as long as they are valid the configuration does not change.

• Want: The number of times a certificate fails (internal events) to be small relative to the number of times the configuration changes (external events)

Efficient

Page 15: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

So what do we want from a KDS to be good (Cont)

• Process a certificate failure fast

responsive

• Small space

compact

• Object participates in a small # of cetificates (can change trajectories easily)

local

Page 16: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Dynamic KDS

• Want also to be able to insert and delete objects efficiently

Page 17: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

So what would be a good solution for this problem ?

Maintain the topmost among points moving along the y-axis

Page 18: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

A tournament tree

abcd

ab cd

Page 19: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

A tournament tree

abcd

ab cd

d c

d

Page 20: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

A tournament tree

abcd

ab cd

d c

d

For each internal node maintain in an event queue the next time where the children flip order

Page 21: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

abcd

ab cd

d c

d

Processing of an event: Replace the winner and replace O(log(n)) events in the event queue

t

y

Takes O(log2(n)) time responsive

Linear space compact

Each point participates in O(log n) events local

Page 22: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

abcd

r

ab cd

d c

d

What is the total # of events ?

t

y

Events at r correpond to changes at the upper envelope, lets say there are O(n)

Events at 1 correponds to change at the upper envelope of {b d} O(n/2) …

In total we get O(nlog(n)) events efficient

Page 23: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

abcd

r

ab cd

d c

d

Handeling insertions/deletions ?

t

y

Use some kind of a balanced binary search tree

Each node charges its events to the upper envelope of its subtree

Without rotations we get O(nlog(n)) events

Page 24: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

abcd

r

ab cd

d c

d

Handeling insertions/deletions

t

y

Because of rotations each point participates in more than O(log n) envelopes

Use a BB[alpha] tree think of each pair of nodes participating in a rotation as new nodes, then the total size of envelopes corresponding to new nodes is O(nlog(n))

Page 25: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

abcd

r

ab cd

d c

d

t

y

We’ll focus now a bit more at the case where the points move with constant velocity

Can redefine the problem so we do not insist on maintaining the upper envelope explicitly at all times

Page 26: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

A collection of items, each with an associated key.

key (i) = ai x + bi ai,, bi reals, x a real-valued parameterai = slope, bi = constant

Operations:

make an empty heap.

insert item i with key ai x + bi into the heap: insert(i,ai,bi)

find an item i of minimum key for x = x0: find-max( x0)

delete item i : delete(i)

Parametic Heap

Page 27: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

A parametric heap such that successive x-values of find maxs are non-decreasing.

(Think of x as time.)

xc = largest x in a find max so far (current time)

Additional operation:

increase the key of an item i, replacing it by a key that is no larger for all x xc : increase-key(i,a,b)

Kinetic Heap

Page 28: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Equivalent problems:

maintain the upper envelope of a collection of lines in 2D

projective duality

maintain the convex hull of a set of points in 2Dunder insertion and deletion

What is known about parametric and kinetic heaps?

Page 29: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Overmars and Van Leeuwen (1981)

O( log n) time per query

O(log2n) time per update, worst-case

Chazelle (1985), Hershberger and Suri (1992)

(deletions only)

O( log n) time per query, worst-case

O(n log n) for n deletions

Results I

Page 30: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Results II

Chan (1999)

Dynamic hulls and envelopes

O( log n) time per query

O(log1+n) time per update, amortized

Brodal and Jacob (2000), Kaplan, Tarjan, Tsioutsiouliklis (2000)

O( log n) time per query

O( log n log log log n) time per insert,

O( log n log log n) timer per delete, amortized

Page 31: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Results III

Basch, Guibas, and Hershberger (1997)

“Kinetic” data structure paradigm

Page 32: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Users

One server, many possible items to send (say, all the same length)

One broadcast channel.

Users submit requests for items.

Goal: Satisfy users as well as possible, making decisions on-line. (say, minimize sum of waiting times)

Server:many

data items Broadcastchannel

(single-item)

Broadcast Scheduling

Page 33: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Greedy = Longest Wait first (LWF):Send item with largest sum of waiting times.

R x W: send item with largest (# requests x longest waiting time)

Scheduling policies

(vs. number of requests or longest single waiting time)

Page 34: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Questions (for an algorithm guy or gal)

LWF does well compared to what?

Try a competitive analysis

Can we improve the cost of LWF?

What data structure?

Open question 1

Will talk about this

Page 35: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

Need a max-heap (replace find min by find max, decrease key by increase key, etc) Can implement LWF or R x W or any similar policy:

Broadcast decision is find max plus delete

Request is insert (if first) or increase key (if not)

Only find max need be real-time, other ops can proceed concurrently with broadcasting

Slopes are integers that count requests

Broadcast scheduling via kinetic heap

Page 36: Kinetic data structures. Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function

LWF:

Suppose a request for item i arrives at time ts

If i is inactive then insert(i, t-ts)

If i is active with key at+b then increase-key(i, (a+1)t+(b-ts))

To broadcast an item at time ts we perform delete-max(ts)

and broadcast the item returned.

Broadcast scheduling via kinetic heap (Cont.)