Computational Geometry Linear programming Exercise session #8: Incremental construction & • Problem : maximize c T x s.t. Ax ≤ b Arrangements � c = ( c 1 ,…, c d ) T • Linear Programming � x = ( x 1 ,…, x d ) T � Incremental algorithm � Objective function: f ( x ) = c T x � A n x d – coefficient matrix with entries a ij � Randomized algorithm � constraint equations: Ax ≤ b • Smallest enclosing disc problem � Half-space defined by i th constraint h i : A i x ≤ b i • Arrangements & Duality � Feasible region – convex region defined by constraints. � The minimum area triangle problem • Linear programming in low dimensions is efficiently solved with geometric methods. • Homework 5 handed 1 2 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Incremental algorithm Bounded solutions • Four cases for linear program solution: • Feasible region of solution can be computed in O ( n log n ) time with half-plane intersection � Infeasible. algorithm. � Unbounded solution. � Bounded solution, not unique. • Observation : no need to have all region to find � Bounded unique solution. optimal solution. • To ensure incremental approach works, we • Can we break the Ω ( n log n ) bound? need a unique solution at each step: • Idea : solve the problem incrementally, � Add artificial constraints that bound solution. computing the solution to the first i constraints � Choose lexicographically smallest solution when in the i th step. not unique. 3 4 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Incremental solution properties Reduction to one-dimension • Let C i be the feasible region at the i th step, then • When v i -1 ∉ h i , find optimal solution on l i . C 0 ⊇ C 1 ⊇ … ⊇ C n • Search according to x -coordinate of p ∈ l i (y-coord if l i • Observation : solution is monotonically non- is vertical): increasing. • Let v i be the solution at the i th step, then: � Take max when l i ∩ h i is bounded to left, otherwise min. � If v i -1 ∈ h i , then v i = v i -1 . l i ∩ h i bounded to right � If v i -1 ∉ h i , then either C i = ∅ or v i ∈ l i where l i is the line bounding h i . h x ≤ σ ( h , l i ) • Proof : l i � first case, by inclusion of feasibility regions. � Second case, by contradiction: solution increases along σ ( h , l i ) segment [ v i v i -1 ]. Intersection point of [ v i -1 v i ] with h i contradicts the optimality of v i . 5 6 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 1
Algorithm complexity Randomized algorithm • Each iteration takes: • Create a random permutation of the half-planes and insert them in that order. � O (1) time when v i -1 ∈ h i . � O ( i ) time when v i -1 ∉ h i . • X i - random variable which is 1 if v i -1 ∉ h i and 0 • Worst case: O ( n 2 ) time, linear space. otherwise. n ∑ ( ) • Total time is: O i X h n h 1 i = 1 ⎡ ⎤ h 5 i n n ∑ ∑ = h 2 • Expected total time: ( ) ( ) [ ] E ⎢ O i X ⎥ O i E X h 4 … i i ⎣ ⎦ h 3 = 1 = 1 i i • Backwards analysis - remove h i and see when v i changes: only when h i is one of the half-planes c defining v i � E [ X i ] ≤ 2/ i � total expected cost O ( n ). 7 8 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Smallest enclosing disc Incremental construction • Problem : Compute smallest radius disc that • Notation: contains all n input point. � P i = { p 1 , p 2 ,…, p i } • Motivation : placement of a robotic arm base to � D i – the smallest enclosing circle of P i . pick up and drop boxes – minimize maximum • Lemma : For 2 < i < n , we have: distance between base and floor locations. � If p i ∈ D i -1 then D i = D i -1 . • Naïve solution: Try all triplets of points: O ( n 4 ). � If p i ∉ D i -1 then p i lies on the boundary of D i . • Efficient deterministic solution: using the • Proof: part of a stronger lemma to be proven furthest point Voronoi diagram: O ( n log n ). later. • Randomized incremental construction: based on properties similar to Linear Programming. 9 10 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Randomized algorithm I Randomized algorithm II Algorithm MiniDisc ( P ) Algorithm MiniDisc1Point ( P , q ) Input : A set P and point q such that there exists an Input : A set P of n points in the plane enclosing disc for P with q on its boundary Output : The smallest enclosing disc of P Output : Smallest enclosing disc of P with q on boundary 1. Compute random permutation { p 1 ,…, p n } of P 1. Compute random permutation { p 1 ,…, p n } of P 2. Let D 2 be the smallest enclosing disc for { p 1 , p 2 } 2. Let D 1 be the smallest disc with q and p 1 on 3. For i = 3 to n boundary a. If p i ∈ D i -1 then D i = D i -1 3. For j = 2 to n b. Else D i = MiniDisc1Point ({ p 1 ,…, p i -1 }, p i ) a. If p i ∈ D j -1 then D j = D j -1 4. Return D n b. Else D j = MiniDisc2Points ({ p 1 ,…, p j -1 }, p j , q ) 4. Return D n 11 12 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 2
Randomized algorithm III Proof of correctness Algorithm MiniDisc2Points ( P , q 1 ,q 2 ) • Lemma : Let P be a set of points in the plane, Input : A set P and points q 1 ,q 2 such that there exists an let R be a possibly empty set of points disjoint enclosing disc for P with q 1 and q 2 on its boundary from P , and let p ∈ P . Then the following holds: Output : Smallest enclosing disc of P with q 1 ,q 2 on � If there is a disc that encloses P and has all the boundary points of R on its boundary, then the smallest such 1. Let D 0 be the smallest disc with q 1 and q 2 on disc is unique, denoted by md ( P , R ). boundary � If p ∈ md ( P \{ p }, R ) then md ( P , R ) = md ( P \{ p }, R ) 2. For k = 2 to n � If p ∉ md ( P \{ p }, R ) then md ( P , R ) = md ( P \{ p }, R ∪ P ) a. If p k ∈ D k -1 then D k = D k -1 b. Else D k = Disc ( q 1 , q 2 , q k ) 3. Return D n 13 14 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Proof of lemma (cases i, ii) Proof of lemma (case iii) D 0 D 1 D 1 D 0 z z p x 0 x 0 x 1 x 1 x ( λ ) D ( λ ) 15 16 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Complexity analysis Randomized Incremental Summary • Theorem : the smallest enclosing disc of n points can • Very simple algorithms – easy to implement be computed in O ( n ) expected time and using worst and executing fast. case linear space. • Method applicable in many situations – when • Proof : solution doesn’t change most of the times if � MiniDisc2Points runs in O ( i ) time (always). the order is random. � MiniDisc1Point runs in O ( i ) without counting the calls to • Extension to higher dimensions possible: MiniDisc2Points . � Probability of calling – backward analysis: disc changes � Make recursive calls to problem solver in one when p i is one of the points on boundary – two possibilities ‘dimension’ lower. ( q doesn’t count), so probability is 2/ i . � increased constant in O ( n ) bound. � Same argument for MiniDisc � overall expected time O ( n ). 17 18 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 3
Arrangements and duality Minimum area triangle • Arrangements – one of the fundamental • Problem : given a set S of n points in the plane, geometric structures with strong connection to: find the triangle whose vertices are from S , and whose area is minimal. � Convex hulls � Voronoi Diagrams • Naïve solution : try all triplets of points: O ( n 3 ). � Combinatorial properties of geometric structures. • Best know solution is by using duality and • Duality transform sheds new light on many arrangements! problems, providing efficient solutions. • Numerous applications in many fields � Example: assembly sequence planning. 19 20 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Duality transform Minimum area triangle - fixed pair Smallest vertical distance • Duality transform : point p = ( a , b ) transforms to line y corresponds to smallest = ax – b and vice versa. orthogonal distance! • Preserves point-line incidence. • Preserves point-line above/below relation. • Preserves point-line vertical distance. y = cx - d y = ax - b ac-d-b ac-b-d ( a , b ) ( c , d ) 21 22 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Fixed pair in dual plane Search in dual space • For each cell, find smallest vertical distance of all vertices (linear time in size of cell), keep minimum for each vertex. • Vertex + line with minimal vertical distance correspond to three points making up smallest area triangle. • Traversal of arrangement takes O ( n 2 ) time, which is the algorithm complexity. 23 24 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 Yaron Ostrovsky-Berman, Computational Geometry, Spring 2005 4
Recommend
More recommend