Today Profit maximization. To pea or not to pea. 4$ for peas. 2$ bushel of carrots. x 1 - to pea! x 2 to carrot ? Money 4 x 1 + 2 x 2 maximize max4 x 1 + 2 x 2 . Carrots take 2 unit of water/bushel. Plant Carrots or Peas? Peas take 3 units of water/bushel. 100 units of water. 2$ bushel of carrots. 4$ for peas. 3 x 1 + 2 x 2 ≤ 100 Carrots take 3 unit of water/bushel. Continue Review: linear programming. Peas 2 yards/bushel of sunny land. Have 40 sq yards. Peas take 2 units of water/bushel. 2 x 1 ≤ 40 Simplex and Matching. Carrots get 3 yards/bushel of shady land. Have 75 sq. yards. 100 units of water. Taking Duals. 3 x 2 ≤ 75 Peas require 2 yards/bushel of sunny land. Can’t make negative! x 1 , x 2 ≥ 0. Carrots require 1 yard/bushel of shadyland. A linear program. Garden has 60 yards of sunny land and 75 yards of shady land. max4 x 1 + 2 x 2 To pea or not to pea, that is the question! 2 x 1 ≤ 40 3 x 2 ≤ 75 3 x 1 + 2 x 2 ≤ 100 x 1 , x 2 ≥ 0 Feasible Region. A linear program. 30 max4 x 1 + 2 x 2 40 2 x 1 ≤ 40 40 20 3 x 2 ≤ 75 30 max4 x 1 + 2 x 2 3 x 1 + 2 x 2 ≤ 100 30 10 20 2 x 1 ≤ 40 x 1 , x 2 ≥ 0 10 3 x 2 ≤ 75 20 Optimal point? 10 20 30 3 x 1 + 2 x 2 ≤ 100 10 20 30 40 10 Try every point if we only had time! x 1 , x 2 ≥ 0 Convex. How many points? Any two points in region connected by a line in region. Algebraically: Real numbers? 10 20 30 40 If x and x ′ satisfy onstraint, Infinite. Uncountably infinite! → x ′′ = α x +( 1 − α ) x Optimal point?
30 30 Duality. max x 1 + 8 x 2 max4 x 1 + 2 x 2 20 20 3 x 1 ≤ 60 x 1 ≤ 4 10 10 3 x 2 ≤ 75 x 2 ≤ 3 3 x 1 + 2 x 2 ≤ 100 x 1 + 2 x 2 ≤ 7 x 1 , x 2 ≥ 0 x 1 , x 2 ≥ 0 10 20 30 10 20 30 Simplex: Start at vertex. Move to better neighboring vertex. One Solution: x 1 = 1 , x 2 = 3 . Value is 25. Optimal at pointy part of feasible region! Until no better neighbor. This example. Vertex of region. (0,0) objective 0. → ( 0 , 25 ) objective 50. Best possible? Intersection of two of the constraints (lines in two dimensions)! → ( 16 2 3 , 25 ) objective 115 2 3 For any solution. Try every vertex! Choose best. → ( 20 , 20 ) objective 120. x 1 ≤ 4 and x 2 ≤ 3 .. O ( m 2 ) if m constraints and 2 variables. Duality: ....so x 1 + 8 x 2 ≤ 4 + 8 ( 3 ) = 28 . Add blue equations to get objective function? For n variables, m constraints, how many? 1 / 3 times first plus second. Added equation 1 and 8 times equation 2 � m � nm ? ? n + m ? n Get 4 x 1 + 2 x 2 ≤ 120. Every solution must satisfy this inequality! yields bound on objective.. � m � n Objective value: 120. Better solution? Finite!!!!!! Can we do better? No! Better upper bound? Exponential in the number of variables. Dual problem: add equations to get best upper bound. Duality. Duality:example Duality: computing upper bound. Best Upper Bound. max x 1 + 8 x 2 x 1 ≤ 4 Multiplier Inequality x 2 ≤ 3 x 1 + 2 x 2 ≤ 7 y 1 x 1 ≤ 4 Idea: Add up positive linear combination of inequalities to “get” x 1 , x 2 ≥ 0 y 2 x 2 ≤ 3 upper bound on optimization function. x 1 + 2 x 2 ≤ 7 y 3 Solution value: 25. Will this always work? Add equation 1 and 8 times equation 2 gives.. Adding equations thusly... How to find best upper bound? x 1 + 8 x 2 ≤ 4 + 24 = 28. ( y 1 + y 3 ) x 1 +( y 2 + 2 y 3 ) x 2 ≤ 4 y 1 + 3 y 2 + 7 y 3 . The left hand side should “dominate” optimization function: Better way to add equations to get bound on function? Sure: 6 times equation 2 and 1 times equation 3. If y 1 , y 2 , y 3 ≥ 0 x 1 + 8 x 2 ≤ 6 ( 3 )+ 7 = 25 . and y 1 + y 3 ≥ 1 and y 2 + 2 y 3 ≥ 8 then.. x 1 + 8 x 2 ≤ 4 y 1 + 3 y 2 + 7 y 3 Thus, the value is at most 25. Find best y i ’s to minimize upper bound? The upper bound is same as solution! Proof of optimality!
The dual, the dual, the dual. The dual. Complementary Slackness Find best y i ’s to minimize upper bound? In general. Again: If you find y 1 , y 2 , y 3 ≥ 0 Primal LP Dual LP and y 1 + y 3 ≥ 1 and y 2 + 2 y 3 ≥ 8 then.. min y T b max c · x x 1 + 8 x 2 ≤ 4 y 1 + 3 y 2 + 7 y 3 y T A ≥ c Primal LP Dual LP Ax ≤ b min 4 y 1 + 3 y 2 + 7 y 3 min y T b max c · x x ≥ 0 y ≥ 0 y 1 + y 3 ≥ 1 y T A ≥ c Ax ≤ b Given A , b , c , and feasible solutions x and y . y 2 + 2 y 3 ≥ 8 x ≥ 0 y ≥ 0 y 1 , y 2 , y 3 ≥ 0 Solutions x and y are both optimal if and only if x i ( c i − ( y T A ) i ) = 0, and y j ( b j − ( Ax ) j ) . Theorem: If a linear program has a bounded value, then its dual is x i ( c i − ( y T A ) i ) = 0 → bounded and has the same value. ∑ i ( c i − ( y T A ) i ) x i = cx − y T Ax → cx = y T Ax . Weak Duality: primal ( P ) ≤ dual ( D ) A linear program. y j ( b j − ( Ax ) j ) = 0 → Feasible ( x , y ) The Dual linear program. ∑ i y j ( b j − ( Ax ) j ) = yb − y T Ax → by = y T Ax . P ( x ) = c · x ≤ y T Ax ≤ y T b · x = D ( y ) . Primal: ( x 1 , x 2 ) = ( 1 , 3 ) ; Dual: ( y 1 , y 2 , y 3 ) = ( 0 , 6 , 1 ) . cx = by . Strong Duality: next lecture. Value of both is 25! If both are feasible, cx ≤ by , so must be optimal. Primal is optimal ... and dual is optimal! In words: nonzero dual variables only for tight constraints! Again: simplex Example: review. Matrix equations. 30 max x 1 + 8 x 2 min 4 y 1 + 3 y 2 + 7 y 3 max [ 1 , 8 ] · [ x 1 , x 2 ] min [ 4 , 3 , 7 ] · [ y 1 , y 2 , y 3 ] max4 x 1 + 2 x 2 x 1 ≤ 4 y 1 + y 3 ≥ 1 20 1 0 4 1 0 � x 1 � � 1 � 3 x 1 ≤ 60 x 2 ≤ 3 y 2 + 2 y 3 ≥ 8 ≥ 0 1 3 0 1 ≤ [ y 1 , y 2 , y 3 ] 10 x 2 8 3 x 2 ≤ 75 x 1 + 2 x 2 ≤ 7 x 1 , x 2 ≥ 0 1 2 7 1 2 3 x 1 + 2 x 2 ≤ 100 y 1 , y 2 , y 3 ≥ 0 [ x 1 , x 2 ] ≥ 0 [ y 1 , y 2 , y 3 ] ≥ 0 10 20 30 x 1 , x 2 ≥ 0 Simplex: Start at vertex. Move to better neighboring vertex. “Matrix form” Until no better neighbor. Duality: We can rewrite the above in matrix form. max [ 1 , 8 ] · [ x 1 , x 2 ] min [ 4 , 3 , 7 ] · [ y 1 , y 2 , y 3 ] Add blue equations to get objective function? 1 / 3 times first plus second. 1 0 4 1 0 � x 1 � � 1 � Get 4 x 1 + 2 x 2 ≤ 120. Every solution must satisfy this inequality! 1 0 ≥ 0 1 3 [ y 1 , y 2 , y 3 ] 0 1 ≤ x 2 8 Geometrically and Complementary slackness: A = 0 1 c = [ 1 , 8 ] b = [ 4 , 3 , 7 ] 1 2 7 1 2 Add tight constraints to “dominate objective function.” 1 2 [ x 1 , x 2 ] ≥ 0 [ y 1 , y 2 , y 3 ] ≥ 0 Don’t add this equation! Shifts. The primal is Ax ≤ b , max c · x , x ≥ 0. The dual is y T A ≥ c , min b · y , y ≥ 0.
Rules for School... Maximum Weight Matching. Complementary Slackness. Bipartite Graph G = ( V , E ) , w : E → Z . Find maximum weight perfect matching. Solution: x e indicates whether edge e is in matching. or...”Rules for taking duals” max ∑ w e x e max ∑ w e x e Standard: e e ∀ v : ∑ x e = 1 p v Ax ≤ b , max cx , x ≥ 0 ↔ y T A ≥ c , min by , y ≥ 0. ∀ v : ∑ x e = 1 p v e =( u , v ) e =( u , v ) min ↔ max x e ≥ 0 x e ≥ 0 ≥↔≤ Dual. Variable for each constraint. p v unrestricted. “inequalities” ↔ “nonnegative variables” Constraint for each variable. Edge e , p u + p v ≥ w e Dual: “nonnegative variables” ↔ “inequalities” Objective function from right hand side. min ∑ v p v min ∑ v p v ∀ e = ( u , v ) : p u + p v ≥ w e One more useful trick: Equality constraints. min ∑ v p v ∀ e = ( u , v ) : p u + p v ≥ w e Complementary slackness: “equalities” ↔ “unrestricted variables.” Only match on tight edges. Weak duality? Price function upper bounds matching. Nonzero p u on matched u . ∑ e ∈ M w e x e ≤ ∑ e =( u , v ) ∈ M p u + p v ≤ ∑ v p u . Strong Duality? Same value solutions. Hungarian algorithm !!! Multicommodity Flow. Take the dual. Given G = ( V , E ) , and capacity function c : E → Z , and pairs min µ ( s 1 , t 1 ) ,..., ( s k , t k ) with demands d 1 ,..., d k . ∀ e : ∑ f p ≤ µ c e Route D i flow for each s i , t i pair, so every edge has ≤ µ c ( e ) flow with p ∋ e minimum µ . ∀ i : ∑ f p = D i variables: f p flow on path p . p ∈ P i P i -set of paths with endpoints s i , t i . f p ≥ 0 Modify to make it ≥ , which “go with min. And only constants on right hand side. min µ ∀ e : ∑ f p ≤ µ c e p ∋ e min µ ∀ i : ∑ f p = D i ∀ e : µ c e − ∑ f p ≥ 0 p ∈ P i p ∋ e f p ≥ 0 ∀ i : ∑ f p = D i p ∈ P i f p ≥ 0
Recommend
More recommend