Sublinear Geometric Algorithms Sublinear Geometric Algorithms B. Chazelle, D. Liu, A. Magen B. Chazelle, D. Liu, A. Magen Princeton University / University of Princeton University / University of Toronto Toronto STOC 2003 STOC 2003 CS 468 Geometric Algorithms Seminar Winter 2005/2006
Overview Overview What is this paper about? What is this paper about? Sublinear geometric algorithms, for Sublinear geometric algorithms, for convex polygons (2D) and convex polyhedra (3D): convex polygons (2D) and convex polyhedra (3D): • Intersection • Intersection • Ray shooting • Ray shooting • Volume approximation • Volume approximation • Shortest path approximation • Shortest path approximation CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 2
Sublinear Algorithms Sublinear Algorithms What means sublinear? What means sublinear? • Not reading the complete input • Not reading the complete input • Hence: No preprocessing • Hence: No preprocessing • Assuming “standard” input formats • Assuming “standard” input formats • Randomized Las-Vegas algorithms • Randomized Las-Vegas algorithms • No wrong answers, but run time may vary • No wrong answers, but run time may vary • Expected runtimes are sublinear • Expected runtimes are sublinear CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 3
Overview Overview Overview: Overview: • Basic technique • Basic technique • Sublinear search algorithm • Sublinear search algorithm • Optimality • Optimality • Polygons / polyhedra intersection • Polygons / polyhedra intersection • Ray shooting & applications • Ray shooting & applications • Volume approximation • Volume approximation • Shortest path approximation • Shortest path approximation CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 4
Overview Overview Overview: Overview: • Basic technique • Basic technique • Sublinear search algorithm • Sublinear search algorithm each each • Optimality • Optimality new new • Polygons / polyhedra intersection • Polygons / polyhedra intersection technique technique builds builds • Ray shooting & applications • Ray shooting & applications upon upon previous previous • Volume approximation • Volume approximation techniques techniques • Shortest path approximation • Shortest path approximation CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 5
6 Basic Technique Basic Technique
Search Problem Search Problem Successor Search: Successor Search: • Given a sorted doubly-linked list of numbers • Given a sorted doubly-linked list of numbers • And a search value k • And a search value k • Find first element greater than k • Find first element greater than k • List stored in continuous memory block • List stored in continuous memory block (allowing sampling of list elements) (allowing sampling of list elements) CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 7
Data Structure Data Structure Looks like this: Looks like this: 1 3 7 8 9 Memory Layout: Memory Layout: 9 3 1 8 7 CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 8
The Search Algorithm The Search Algorithm Search Algorithm: Search Algorithm: • Pick √ n random list elements • Pick √ n random list elements • Determine closest predecessor and successor • Determine closest predecessor and successor of k (within the random sample) of k (within the random sample) • Perform plain, linear search towards k • Perform plain, linear search towards k (starting from these two elements) (starting from these two elements) CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 9
The Search Algorithm (2) The Search Algorithm (2) Looks like this: Looks like this: succ( k ) - list - - random sample - - linear search - CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 10
Analysis Analysis The Algorithm: The Algorithm: • Takes expected O( √ n ) time. • Takes expected O( √ n ) time. • This is optimal . • This is optimal . CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 11
Why? Why? Runtime: Runtime: Sampling: Good case: Bad case: CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 12
Runtime Runtime Runtime Analysis Runtime Analysis Runtime depends on “empty” block around succ ( k ) Runtime depends on “empty” block around succ ( k ) factor c away Probability of no hit within Factor c √ n of target Probability of no hit within Factor c √ n of target is O(exp(- c )) is O(exp(- c )) Hence: Expected distance O( √ n ) after √ n trials. Hence: Expected distance O( √ n ) after √ n trials. CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 13
Optimality Optimality Why can’t we do O(any better)? Why can’t we do O(any better)? The proof employs Yao’s minimax principle: The proof employs Yao’s minimax principle: The expected running time of an optimal deterministic algorithm The expected running time of an optimal deterministic algorithm for any chosen input distribution for any chosen input distribution is a lower bound is a lower bound on the expected running time of the optimal Las Vegas on the expected running time of the optimal Las Vegas randomized algorithm. randomized algorithm. CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 14
Constructing the Bound Constructing the Bound A Lower Bound for an Opt. Determ. Algorithm A Lower Bound for an Opt. Determ. Algorithm Choose the following scenario: Choose the following scenario: • Input: Random permutation • Input: Random permutation • Search for last element • Search for last element What can the algorithm do? What can the algorithm do? • Op. “ A ”: Visit neighbor of known node • Op. “ A ”: Visit neighbor of known node • Op. “ B ”: Go to unknown node in memory • Op. “ B ”: Go to unknown node in memory CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 15
Constructing the Bound (2) Constructing the Bound (2) Random input: Random input: • Consider the question: How likely is it, to • Consider the question: How likely is it, to discover one of the last √ n elements? discover one of the last √ n elements? • With every newly visited node, the chance of • With every newly visited node, the chance of discovery increases discovery increases • After a A-Op’s and b B-Op’s: • After a A-Op’s and b B-Op’s: b ( ) ⎛ ⎞ + + n a b ⎜ ⎟ Pr " saw not last n elem. " ≥ 1 − ⎜ ⎟ n ⎝ ⎠ CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 16
Constructing the Bound (3) Constructing the Bound (3) Looks like this: target: Looks like this: last √ n A B A B B A A A B A unknown new random choice b b ( ) ⎛ ⎞ n a b n + a + b ⎜ ⎟ ≥ 1 − Pr " saw not last n elem. " ⎜ ⎟ n ⎝ ⎠ no-go Pr(“no discovery”) CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 17
Constructing the Bound (3) Constructing the Bound (3) Number of B-Ops: Number of B-Ops: • Expected value of A and B -op’s until visiting • Expected value of A and B -op’s until visiting one of the last √ n is O( √ n ). one of the last √ n is O( √ n ). • If last √ n elements have not been visited • If last √ n elements have not been visited ⇒ √ n more A -Ops necessary ⇒ √ n more A -Ops necessary CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 18
What’s next? What’s next? Now: Construct sublinear geometric algorithms Now: Construct sublinear geometric algorithms • Similar basic idea • Similar basic idea • All with O( √ n ) time complexity • All with O( √ n ) time complexity • Some problems are “more general” than • Some problems are “more general” than successor-searching successor-searching Thus: run-time also optimal Thus: run-time also optimal CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 19
20 I ntersection I ntersection Polygon Polygon
Problem Statement Problem Statement Polygon Intersection: Polygon Intersection: • Given two polygons A , B • Given two polygons A , B A • Encoded as densely stored • Encoded as densely stored linked lists of vertices linked lists of vertices (same as before) (same as before) B • Do they intersect? • Do they intersect? • If so, report one intersection point. • If so, report one intersection point. CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 21
I dea of the Algorithm I dea of the Algorithm Idea: Employ the same sampling approach Idea: Employ the same sampling approach simplified by two input polygons random subsampling CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 22
I dea of the Algorithm I dea of the Algorithm Two step Approach: Two step Approach: (II) test potentially overlapping (I) test for simplified remaining region polys intersection CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 23
First Step First Step A B First Step: First Step: • Random subsampling • Random subsampling • Choose O( √ n ) sample points • Choose O( √ n ) sample points • Compute intersection in linear time • Compute intersection in linear time CS 468 – Geometric Algorithms Seminar – Winter 2005/2006 24
Recommend
More recommend