CMPS 3130/6130 Computational Geometry Spring 2015 Linear Programming and Halfplane Intersection Carola Wenk 1 CMPS 3130/6130 Computational Geometry
Word Problem A company produces tables and chairs. The profit for a chair is $2, and for a table $4. Machine group A needs 4 hours to produce a chair, and 6 hours to produce a table. Machine group B needs 2 hours to produce a chair, and 6 hours to produce a table. Per day there are at most 120 working hours for group A and at most 72 hours for group B . How can the company maximize profit? Variables: Constraints: c A = # chairs produced on machine group A 4 c A +6 t A ≤ 120 c B = # chairs produced on machine group B 2 c B +6 t B ≤ 72 t A = # tables produced on machine group A t B = # tables produced on machine group B Objective function (profit): Maximize 2( c A + c B )+4( t A + t B ) 2 CMPS 3130/6130 Computational Geometry
Linear Programming Variables: x 1 ,…, x d Objective function: Maximize f c ( x ) = c 1 x 1 +…+ c d x d Constraints: h 1 : a 11 x 1 +…+ a 1 d x d ≤ b 1 Linear program in h 2 : a 21 x 1 +…+ a 2 d x d ≤ b 2 d variables with . . . n constraints h n : a n1 x 1 +…+ a n d x d ≤ b n • Each constraint h i is a half-space in R d � • ⋂ � � is the feasible region of the ��� linear program • Maximizing f c ( x ) corresponds to finding a point x that is extreme in direction c . 3 CMPS 3130/6130 Computational Geometry
Sub-Problem: Halfspace Intersection (in R 2 : Halfplane Intersection) Given: A set H = { h 1 , h 2 , …, h n } of halfplanes h i : a i x + b i y ≤ c i with constants a i , b i , c i ; for i =1,…, n . � , i.e., the feasible region of all points ( x , y ) R 2 � � Find: ⋂ ��� satisfying all n constraints at the same time. This is a convex polygonal region bounded by at most n edges. intersection intersection intersection intersection degenerated to bounded unbounded empty a point 4 CMPS 3130/6130 Computational Geometry
D&C Halfplane Intersection Algorithm Intersect_Halfplanes( H ): Input: A set H of n halfplanes in R 2 Output: The convex polygonal region C= ⋂ � �∈� if | H| =1 then C = h , where H= { h } else split H into two sets H 1 and H 2 of size n /2 each C 1 = Intersect_Halfplanes( H 1 ) C 2 = Intersect_Halfplanes( H 2 ) C = Intersect_Convex_Regions( C 1 , C 2 ) return C • Use a plane-sweep to develop an O( n )-time algorithm for Intersect_Convex_Regions T( n ) O( n log n ) • T( n ) = 2T( n /2)+ n
Incremental Linear Programming • 2D linear program (LP) • Assume the LP is bounded (otherwise add constraints) • Assume there is one unique solution (if any); take the lexicographically smallest solution • Incremental approach: Add one halfplane after the other. � � � � � , … , � � � � � � � ∩ ⋯ ∩ � � � � � � � ⋂ � �∈� Let v i = unique optimal vertex for feasible region C i , for � � 2 . Then � � ⊇ � � ⊇ … ⊇ � � � � , and hence if � � � ∅ for some � then � � � ∅ for all � � � .
Incremental Linear Programming Lemma: Let 2 ≤ i ≤ n . (i) If � ��� ∈ � � then � � � � ��� (ii) If � ��� ∉ � � then � � � ∅ or � � ∈ � � � the line bounding � � Handling case (ii) involves solving a 1-dimensional LP on � � : • The feasible region is just an interval, that can be computed in linear time [rightmost left-bounded halfplane, leftmost right-bounded halfplane] • We can compute a new � � , or decide that the LP is infeasible, in O( i ) time
2D_Bounded_LP Algorithm 2D_Bounded_LP( H , c ): Input: A two-dimensional LP ( H , c ) Output: Report if ( H , c ) is infeasible. Otherwise report the lexicographically smallest point that maximizes f c . Let � � , … , � � be the halfplanes of H Let � � be the corner of � � , which exists because LP is bounded for i=3 to n do if � ��� ∈ � � then � � � � ��� else // Case (ii) � � � point on � � that maximizes f c subject to constraints in � ��� if such a point does not exist then Report that the LP is infeasible break; return � � � � ��� � � • Runtime: ∑ ���� ��� Storage: ����
Randomized Incremental LP Depending on the insertion order of the halfplanes the runtime varies between O( n ) and O( n 2 ). Randomize the input order of the halfplanes. Theorem: 2D_Randomized_Bounded_LP runs in O( n ) expected time and O( n ) deterministic space. Proof: Define a random variable � � � �1, � ��� ∉ � � 0, ���� The total time spent to resolve case (ii), over all � � , … , � � is � � � � � � ���
Randomized Incremental LP We now need to bound the expected value � � E( ∑ � � � � � � ∑ � � ��� � � ��� ��� and we know that ��� � � � � � � � ��� ��� ∉ � � � . Apply backwards analysis to bound ��� � � : – Fix � � � � � , … , � � which determines � � . – Analyze what happened in last step when � � was added. – P(had to compute new optimal vertex when adding � � ) = P(optimal vertex changes when we remove a halfplane from � � ) � � � 2 lines defining v i � ��� � � � � � � Total expected runtime is ∑ � � � � ���� ���
Recommend
More recommend