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

Slides:



Advertisements
Similar presentations
Computational Geometry
Advertisements

COL 106 Shweta Agrawal and Amit Kumar
Tight Bounds for Dynamic Convex Hull Queries (Again) Erik DemaineMihai Pătraşcu.
Binary Search Trees. A binary search tree is a binary tree that keeps the following property: Every element is larger than all elements in its left sub-tree.
Priority Queues And the amazing binary heap Chapter 20 in DS&PS Chapter 6 in DS&AA.
Kinetic Algorithms Data Structure for Mobile Data.
9/5/06CS 6463: AT Computational Geometry1 CS 6463: AT Computational Geometry Fall 2006 Plane Sweep Algorithms and Segment Intersection Carola Wenk.
Robert Pless, CS 546: Computational Geometry Lecture #3 Last Time: Convex Hulls Today: Plane Sweep Algorithms, Segment Intersection, + (Element Uniqueness,
Binary Heaps CSE 373 Data Structures Lecture 11. 2/5/03Binary Heaps - Lecture 112 Readings Reading ›Sections
Chapter 6: Priority Queues Priority Queues Binary Heaps Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
Rank-Pairing Heaps Bernhard Haeupler, Siddhartha Sen, and Robert Tarjan, ESA
Convex Hull Algorithms for Dynamic Data Kanat Tangwongsan Joint work with Guy Blelloch and Umut Acar (TTI-C)
Kinetic Data Structures and their Application in Collision Detection Sean Curtis COMP 768 Oct. 16, 2007.
Tirgul 6 B-Trees – Another kind of balanced trees Problem set 1 - some solutions.
Tirgul 7 Heaps & Priority Queues Reminder Examples Hash Tables Reminder Examples.
The Complexity of Algorithms and the Lower Bounds of Problems
5.9 Heaps of optimal complexity
Heaps and heapsort COMP171 Fall 2005 Part 2. Sorting III / Slide 2 Heap: array implementation Is it a good idea to store arbitrary.
Fractional Cascading and Its Applications G. S. Lueker. A data structure for orthogonal range queries. In Proc. 19 th annu. IEEE Sympos. Found. Comput.
Priority Queues, Heaps & Leftist Trees
Heapsort Based off slides by: David Matuszek
CHAPTER 71 TREE. Binary Tree A binary tree T is a finite set of one or more nodes such that: (a) T is empty or (b) There is a specially designated node.
Compiled by: Dr. Mohammad Alhawarat BST, Priority Queue, Heaps - Heapsort CHAPTER 07.
Kinetic Algorithms: Approximation and Trade-offs Pankaj K. Agarwal Duke University.
Jessie Zhao Course page: 1.
The Binary Heap. Binary Heap Looks similar to a binary search tree BUT all the values stored in the subtree rooted at a node are greater than or equal.
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Computer Algorithms Submitted by: Rishi Jethwa Suvarna Angal.
Computer Sciences Department1. Sorting algorithm 3 Chapter 6 3Computer Sciences Department Sorting algorithm 1  insertion sort Sorting algorithm 2.
Chapter 21 Priority Queue: Binary Heap Saurav Karmakar.
1 Trees 4: AVL Trees Section 4.4. Motivation When building a binary search tree, what type of trees would we like? Example: 3, 5, 8, 20, 18, 13, 22 2.
Trees  Linear access time of linked lists is prohibitive Does there exist any simple data structure for which the running time of most operations (search,
Data Structure & Algorithm II.  In a multiuser computer system, multiple users submit jobs to run on a single processor.  We assume that the time required.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 9.
1 Heaps (Priority Queues) You are given a set of items A[1..N] We want to find only the smallest or largest (highest priority) item quickly. Examples:
HEAPS • Heaps • Properties of Heaps • HeapSort
Chapter 2: Basic Data Structures. Spring 2003CS 3152 Basic Data Structures Stacks Queues Vectors, Linked Lists Trees (Including Balanced Trees) Priority.
Foundations of Data Structures Practical Session #8 Heaps.
Four different data structures, each one best in a different setting. Simple Heap Balanced Heap Fibonacci Heap Incremental Heap Our results.
Priority Queues Two kinds of priority queues: Min priority queue. Max priority queue. Nov 4,
CS 361 – Chapter 5 Priority Queue ADT Heap data structure –Properties –Internal representation –Insertion –Deletion.
S. Raskhodnikova and A. Smith. Based on slides by C. Leiserson and E. Demaine. 1 Adam Smith L ECTURES Priority Queues and Binary Heaps Algorithms.
1 Fat heaps (K & Tarjan 96). 2 Goal Want to achieve the performance of Fibonnaci heaps but on the worst case. Why ? Theoretical curiosity and some applications.
FALL 2005CENG 213 Data Structures1 Priority Queues (Heaps) Reference: Chapter 7.
AVL Trees and Heaps. AVL Trees So far balancing the tree was done globally Basically every node was involved in the balance operation Tree balancing can.
Lecture 9COMPSCI.220.FS.T Lower Bound for Sorting Complexity Each algorithm that sorts by comparing only pairs of elements must use at least 
Lecture 10COMPSCI.220.FS.T Binary Search Tree BST converts a static binary search into a dynamic binary search allowing to efficiently insert and.
HeapSort 25 March HeapSort Heaps or priority queues provide a means of sorting: 1.Construct a heap, 2.Add each item to it (maintaining the heap.
MotivationKinetic Data StructuresExampleKDS Properties Networks play a central role in numerous applications, and the design of good networks is therefore.
Priority Queues, Heaps, and Heapsort CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Kinetic Heaps K, Tarjan, and Tsioutsiouliklis. Broadcast Scheduling Parametric and Kinetic Heaps Broadcast Scheduling Using a Kinetic Heap The Computational.
Heaps © 2010 Goodrich, Tamassia. Heaps2 Priority Queue ADT  A priority queue (PQ) stores a collection of entries  Typically, an entry is a.
Priority Queues, Heaps, and Heapsort CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1 Last modified: 2/22/2016.
Priority Queues, Heaps, and Heapsort CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Priority Queues An abstract data type (ADT) Similar to a queue
COSC160: Data Structures Binary Trees
Balancing Binary Search Trees
Heaps © 2010 Goodrich, Tamassia Heaps Heaps
Segment tree and Interval Tree
Selection in heaps and row-sorted matrices
Sorting We have actually seen already two efficient ways to sort:
Priority Queues.
Ch 6: Heapsort Ming-Te Chi
Priority Queues.
Priority Queues An abstract data type (ADT) Similar to a queue
Kinetic Collision Detection for Convex Fat Objects
June 12, 2003 (joint work with Umut Acar, and Guy Blelloch)
Binomial heaps, Fibonacci heaps, and applications
Priority Queues CSE 373 Data Structures.
Sorting We have actually seen already two efficient ways to sort:
Presentation transcript:

Kinetic data structures

Goal Maintain a configuration of moving objects Each object has a posted flight plan (this is essentially a well behaved function of time)

Example 1 Maintain the closest pair among points moving in the plane

Example 2 Maintain the convex hull of points moving in the plane

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

Example 3 Maintain the topmost among points moving along the y-axis

Look at the ty-plane t y

We are interested in the upper envelope t y

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

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

Another solution Maintain the points sorted For every pair of points put in the event queue the time when they switch order

Example 3

Problem We process Ω(n 2 ) events But the configuration changes only linear (or close to linear) number of times…

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

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

Dynamic KDS Want also to be able to insert and delete objects efficiently

So what would be a good solution for this problem ? Maintain the topmost among points moving along the y-axis

A tournament tree a b c d a b c d

a b c d a b c d d c d

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

a b c d a b c d d c d Processing of an event: Replace the winner and replace O(log(n)) events in the event queue t y Takes O(log 2 (n)) time  responsive Linear space  compact Each point participates in O(log n) events  local

a b c d   r a b c d 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

a b c d   r a b c d 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

a b c d   r a b c d 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))

a b c d   r a b c d 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

A collection of items, each with an associated key. key (i) = a i x + b i a i,, b i reals, x a real-valued parameter a i = slope, b i = constant Operations: make an empty heap. insert item i with key a i x + b i into the heap: insert(i,a i,b i ) find an item i of minimum key for x = x 0 : find-max( x 0 ) delete item i : delete(i) Parametic Heap

A parametric heap such that successive x-values of find maxs are non-decreasing. (Think of x as time.) x c = 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  x c : increase-key(i,a,b) Kinetic Heap

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 2D under insertion and deletion What is known about parametric and kinetic heaps?

Overmars and Van Leeuwen (1981) O( log n) time per query O(log 2 n) 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

Results II Chan (1999) Dynamic hulls and envelopes O( log n) time per query O(log 1+  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

Results III Basch, Guibas, and Hershberger (1997) “Kinetic” data structure paradigm

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 Broadcast channel (single-item) Broadcast Scheduling

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)  

34 Results of Mike Franklin and others: LWF schedules well “in practice” (in simulations) but too expensive (linear-time) This claim used to justify approximations to R x W, still linear-time but with a smaller (parameterized) constant.

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

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

LWF: Suppose a request for item i arrives at time t s If i is inactive then insert(i, t-t s ) If i is active with key at+b then increase-key(i, (a+1)t+(b-t s )) To broadcast an item at time t s we perform delete-max(t s ) and broadcast the item returned. Broadcast scheduling via kinetic heap (Cont.)