Linear Programming Computational Geometry, WS 2007/08 Lecture 7, Part II Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät für Angewandte Wissenschaften Albert-Ludwigs-Universität Freiburg
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann2 Overview Problem formulation and example. Incremental, deterministic algorithm. Randomized algorithm. Unbounded linear programs. Linear programming in higher dimensions. Half-plane intersection.
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann3 Side-Track: Half-Plane Intersection Problem Given a set of n half-planes H = {h 1, h 2, …, h n }, compute their intersection. A half-plane h i is a convex set, and hence the intersection of any number of half-planes is In the worst case, how many sides can bound the intersection of n half-planes? [Open discussion] How fast can we compute the intersection of the half-spaces?
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann4 Recall: Problem Description Maximize c 1 x 1 + c 2 x c d x d Subject to the conditions: a 1,1 x a 1,d x d b 1 a 2,1 x a 2,d x d b 2 ::: a n,1 x a n,d x d b n Linear program of dimension d: c = (c 1,c 2,...,c d ) h i = {(x 1,...,x d ) ; a i,1 x a i,d x d b i } l i = hyperplane that bounds h i ( straight lines, if d=2 ) H = {h 1,..., h n }
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann5 Recall: Geometric Interpretation Each constraint h i represents a half-space in R d The intersection of these half-spaces forms the feasible region The feasible region is a convex polyhedron in R d A convex polyhedron is not necessarily bounded Feasible region
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann6 Recall: Geometric Interpretation Given c = (c 1, c 2, …, c d ) We want to find the optimal vertex v opt of the feasible region, such that c is the outer normal at v opt, if one exists. Without loss of generality, we assume that the vector c is pointing straight down, and the problem is just finding the lowest point of the feasible region. Feasible region c v opt
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann7 Recall: Degenerate Case Degenerate case: An LP may have an infinite number of solution. Feasible region f(x,x) = opt c
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann8 Recall: Infeasible c The feasible region can be empty; in this case there is no solution to the LP, and the program is said to be infeasible.
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann9 Recall: Unbounded The feasible region may be unbounded in the direction of c. Our task is then to determine if the given set H = {h 1, h 2, …, h n } is unbounded in the direction of the optimization function c. c Feasible region
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann10 Recall: Randomized Algorithm 2D-LP Input:A 2-dimensional Linear Program (H, c) Output:Either (i) one optimal vertex, or, (ii) , or (iii) a ray along which (H, c) is unbounded If Unbounded_LP(H, c) does not report 2 half-planes Then Return the ray along which (H, c) is unbounded Else h 1 := h; h 2 := h’; v 2 := l 1 l 2 ; h 3, …, h n := the remaining half-planes in H Compute the random permutation of h 3, …, h n For i := 3 to n Do If v i-1 h i Then v i := v i-1 ElseS i-1 := H i-1 * I i v i := 1_Dim_LP(S i-1, c) If v i does not exist Then Return Loop End If Return v n
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann11 Unbounded Linear Programs Begin by finding l i* from the given set H The ray l i* makes the smallest angle i, amongst the half-planes in H, between its outward normal i and c. The ray l i* = h i*, where h i* is the most restrictive half- plane among all the half- planes with the same smallest angle i. h i* hjhj hkhk c
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann12 Unbounded Linear Programs i min, an index with i min = min j, 1 j n i := The smaller angle that i makes with c i : The outward normal of h i hihi ii ii c
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann13 Finding the Test Plane l i* H min = {h j H | j = min } H par = {h j H | j = - min } h i* hjhj hkhk c ii ii -j-j
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann14 Lemma Consider the set of half-planes H = {h 1, h 2, …, h n } Assuming that (H min H par ) is not empty. l i* c i* i* Case 1 If l i* h j is unbounded in the direction c, for h j H \ (H min H par ), then (H, c) is unbounded along a ray contained in l i*.
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann15 Lemma (continued) l i* c i* i* Case 2 If l i* h j* is bounded in the direction c, for h j* H \ (H min H par ), then the LP ({h i*, h j* }, c) is bounded. h j* j*
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann16 Algorithm: Unbounded_LP Input:A 2-dimensional Linear Program (H, c) Output:Either (i) a pair of half-planes bounding the LP, or, (ii) , or (iii) a ray along which (H, c) is unbounded For Each half-plane h i H, compute i Let h min be the half-plane with min ; where min = Min( j ), for 1 j n Set H min := {h j H | j = min }; Set H par := {h j H | j = - min } If H min H par is empty Then Return Let h i* H min be the half-plane whose line l i* bounds H min H par Let Ĥ = H \ {H min H par } If a half-plane h j* H, such that l i* h j* is bounded in c ThenReturn {h i*, h j* } ElseReturn unbounded along ray l i* ( Ĥ) End If
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann17 The Half-Plane Intersection Problem Given a set of n half-planes H = {h 1, h 2, …, h n }, compute their intersection. The Divide-and-Conquer Approach If n = 1 Then Split the n half-planes of H into H 1 and H 2 of sizes Recursively compute the intersection of H 1 and H 2, and let K 1 and K 2 be the results. (Non-trivial) Intersect polygons K 1 and K 2 into a single convex polygon K, and
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann18 Intersecting Two Convex Polygons Given two convex polygons K 1 and K 2, compute K = K 1 K 2. What information do we already know and can use? Computing the intersection of line-segments. Run time: One edge in K 1 can intersect at most edges in K 2. Two convex polygons cannot intersect in more than pairs. Based on the above… The total runtime to compute K = K 1 K 2 : This can be too slow if we put it into the main Divide-and-Conquer algorithm; which will give Can we go faster?
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann19 Intersecting Two Convex Polygons Theorem: The intersection of two convex polygons K 1 and K 2 containing a total of n points can be computed in O(n) time. Approach: Plane-sweep (from left to right) What can we derive from this? The vertical sweep-line intersects a convex polygon in at most Thus, the sweep-line Status-Structure: Event Q: K1K1 K2K2 Sweep direction
Computational Geometry, WS 2007/08 Prof. Dr. Thomas Ottmann20 The Half-Plane Intersection Problem Theorem: The intersection of a set H of n half-planes in 2D can be computed in O(n log n) time. From the Divide-and-Conquer algorithm: T(n) =