CS/ECE/ISyE 524 Introduction to Optimization Spring 2017–18 7. Dual flows and algorithms ❼ Duality review ❼ Minimum-cost flow dual ❼ Specialized flow duals ❼ Max-flow problems ❼ LP solvers ❼ Wrap-up Laurent Lessard (www.laurentlessard.com)
Duality review Every LP has a dual, which is also an LP. ❼ Every primal constraint corresponds to a dual variable ❼ Every primal variable corresponds to a dual constraint Minimization Maximization Nonnegative variable ≥ Inequality constraint ≤ Nonpositive variable ≤ Inequality constraint ≥ Free variable Equality constraint = Inequality constraint ≥ Nonnegative variable ≥ Inequality constraint ≤ Nonpositive variable ≤ Equality constraint = Free Variable 7-2
Duality review c T x b T λ max min (maximization) (minimization) x λ Ax ≤ b s.t. s.t. λ ≥ 0 (constraint ≤ ) (variable ≥ ) A T λ ≥ c x ≥ 0 (variable ≥ ) (constraint ≥ ) LP with every possible variable and constraint: c T x + d T y + f T z p T λ + q T η + r T µ max min x , y , z λ,η,µ s.t. Ax + By + Cz ≤ p λ ≥ 0 Dx + Ey + Fz ≥ q η ≤ 0 Gx + Hy + Jz = r µ free A T λ + D T η + G T µ ≥ c x ≥ 0 B T λ + E T η + H T µ ≤ d y ≤ 0 C T λ + F T η + J T µ = f z free 7-3
Minimum-cost flow problems 1 6 3 5 8 2 4 7 ❼ Decision variables : x ij is the flow on edge ( i , j ) ∈ E . ❼ Capacity constraints : p ij ≤ x ij ≤ q ij ∀ ( i , j ) ∈ E . ❼ Conservation : � j ∈N x kj − � i ∈N x ik = b k ∀ k ∈ N . ❼ Total cost : � ( i , j ) ∈E c ij x ij . Either b i > 0 (source), b i < 0 (sink), or b i = 0 (relay). Also, assume � i ∈N b i = 0 (model is balanced). 7-4
Minimum-cost flow problems 1 6 3 5 8 2 4 7 The entire model (compact form): c T x minimize x ∈ R |E| subject to: Ax = b p ≤ x ≤ q Note: from now on, we will assume p = 0. 7-5
Dual of minimum-cost flow problems c T x b T µ + q T η min max (minimization) (maximization) x µ,η s.t. Ax = b s.t. µ free (constraint =) (variable free) x ≤ q η ≤ 0 (constraint ≤ ) (variable ≤ ) A T µ + η ≤ c x ≥ 0 (variable ≥ ) (constraint ≤ ) ❼ balance constraints (at nodes) ❼ dual variables (at nodes) ❼ capacity constraints (on edges) ❼ dual variables (each edge) ❼ flow variables (on edges) ❼ dual constraints (each edge) Next : what does the dual mean for: transportation? planning? max-flow? 7-6
Transportation c T x b T µ + q T η min max (minimization) (maximization) x µ,η s.t. Ax = b s.t. µ free (constraint =) (variable free) x ≤ q η ≤ 0 (constraint ≤ ) (variable ≤ ) A T µ + η ≤ c x ≥ 0 (variable ≥ ) (constraint ≤ ) ❼ dual variables (at nodes) ❼ balance constraints (at nodes) ❼ capacity constraints (on edges) ❼ dual variables (each edge) ❼ flow variables (on edges) ❼ dual constraints (each edge) Transportation/transshipment/assignment problems: no capacity constraints on edges 7-7
Transportation (primal) c T x b T µ min max (minimization) (maximization) x µ s.t. Ax = b s.t. µ free (constraint =) (variable free) A T µ ≤ c x ≥ 0 (variable ≥ ) (constraint ≤ ) min c 12 x 12 + c 13 x 13 + c 14 x 14 + c 23 x 23 + c 34 x 34 b 2 x x 12 , c 12 x 24 , c 24 2 s.t. x 12 + x 13 + x 14 = b 1 x 14 , c 14 − x 12 + x 24 = b 2 1 4 b 1 b 4 − x 13 + x 34 = b 3 3 − x 14 − x 24 − x 34 = b 4 x 13 , c 13 x 34 , c 34 b 3 x ij ≥ 0 ∀ i , j ❼ x ij are flow amounts along edges. ❼ Node constraints: flow is conserved and supply/demand is met. ❼ Edges have transportation cost. Pick x ij to minimize total cost. 7-8
Transportation (dual) c T x b T µ min max (minimization) (maximization) x µ s.t. Ax = b s.t. µ free (constraint =) (variable free) A T µ ≤ c x ≥ 0 (variable ≥ ) (constraint ≤ ) µ 2 , b 2 max b 1 µ 1 + b 2 µ 2 + b 3 µ 3 + b 4 µ 4 µ c 12 c 24 2 s.t. µ 1 − µ 2 ≤ c 12 µ 1 − µ 3 ≤ c 13 c 14 1 4 µ 1 , b 1 µ 4 , b 4 µ 1 − µ 4 ≤ c 14 3 µ 2 − µ 4 ≤ c 24 c 13 c 34 µ 3 − µ 4 ≤ c 34 µ 3 , b 3 A shipping company wants to get in on this business. ❼ will buy commodity from sources (to alleviate supply) ❼ will sell commodity to destinations (to satisfy demand) ❼ at node i , the buy/sell price will be π i = − µ i . 7-9
Transportation (dual) c T x − b T π min max (minimization) (maximization) x π s.t. Ax = b s.t. π free (constraint =) (variable free) − A T π ≤ c x ≥ 0 (variable ≥ ) (constraint ≤ ) π 2 , b 2 max − ( b 1 π 1 + b 2 π 2 + b 3 π 3 + b 4 π 4 ) π c 12 c 24 2 π 2 − π 1 ≤ c 12 s.t. π 3 − π 1 ≤ c 13 c 14 1 4 π 1 , b 1 π 4 , b 4 π 4 − π 1 ≤ c 14 3 π 4 − π 2 ≤ c 24 c 13 c 34 π 4 − π 3 ≤ c 34 π 3 , b 3 ❼ π i is buy/sell price of commodity at node i (shift-invariant!). ❼ Edge constraints: ensures the prices are competitive. e.g. if we had π 2 − π 1 > c 12 , it would be cheaper to transport it ourselves! ❼ Pick prices π i to maximize total profit. 7-10
Transportation summary Primal problem: ❼ Pick how much commodity flows along each edge of the network to minimize the total transportation cost while satisfying supply/demand constraints. ❼ If each supply/demand b i is integral, flows will be integral. Dual problem: ❼ Pick the buy/sell price for the commodity at each node of the network to maximize the total profit while ensuring that the prices are competitive. ❼ If each edge cost c ij is integral, prices will be integral. 7-11
Longest path Recall the house-building example, a longest-path problem. ❼ Add source and sink nodes l,3 o,3 m,1 n,2 t,3 s,2 7-12
Longest path Recall the house-building example, a longest-path problem. 3 ❼ Add source and sink nodes l 3 2 ❼ Move times out of nodes and 1 onto preceding edges o m n ❼ Solve longest-path problem 3 2 3 t 2 s 0 7-13
Longest path (primal) Recall the house-building example, a longest-path problem. 3 c T x maximize l x subject to: Ax = b 3 2 1 x ≥ 0 o m n 1 3 2 3 0 t . unit flow: b = . . 2 s 0 0 − 1 7-14
Longest path (dual) Recall the house-building example, a longest-path problem. 3 b T µ minimize l µ A T µ ≥ c 3 2 subject to: 1 ❼ using same trick as before, o m n 3 define: t i = − µ i 2 3 t 2 s 0 7-15
Longest path (dual) Recall the house-building example, a longest-path problem. 3 l minimize t end − t start t 3 2 t l − t start ≥ 3 subject to: 1 o m n t o − t l ≥ 3 3 t m − t l ≥ 1 2 3 t . . . 2 s Precisely the alternative problem for- 0 mulation we deduced in class! 7-16
Longest path (dual) Recall the house-building example, a longest-path problem. Key players: 3 ❼ Primal variables: x ij ∈ { 0 , 1 } l ❼ Dual constraints: t j − t i ≥ c ij 3 2 1 o m n Complementary slackness: 3 2 ❼ if x ij = 1 then t j − t i = c ij 3 t (longest path corresponds to 2 s tight time constraints) ❼ if t j − t i > c ij then x ij = 0 0 (this path has slack) 7-17
Max-flow We are given a directed graph and edge capacities. Find the maximum flow that we can push from source to sink. ❼ Edges have max capacities s 2 , 0 ❼ Edges have zero cost except 3 , 0 a feedback edge, with cost − 1. 3 , 0 ❼ Finding max flow is equivalent to 4 , 0 ∞ , − 1 b finding the minimum cost flow. 2 , 0 c 1 , 0 t (edge capacity) (cost) 7-18
Max-flow (primal) ❼ Primal problem : s 2 , 0 max x ts 3 , 0 x ij a x sa 3 , 0 1 1 0 0 0 0 − 1 0 x sb 4 , 0 ∞ , − 1 b − 1 0 1 1 0 0 0 x ab 0 s.t. 0 − 1 − 1 0 1 0 0 = 0 x ac 0 0 0 − 1 0 1 0 x bt 0 2 , 0 c 0 0 0 0 − 1 − 1 1 0 x ct x ts 1 , 0 0 2 x sa t 0 x sb 3 0 3 x ab ≤ ≤ 0 x ac 4 (edge capacity) 0 2 x bt (cost) 0 x ct 1 7-19
Max-flow (dual) ❼ Dual problem : s 2 , 0 min 2 λ sa + 3 λ sb + 3 λ ab + 4 λ ac + 2 λ bt + λ ct λ ij ,µ i 3 , 0 a 1 − 1 0 0 0 λ sa 0 1 0 − 1 0 0 0 µ s λ sb 3 , 0 1 − 1 0 0 0 µ a λ ab 0 4 , 0 b s.t. 0 1 0 − 1 0 µ b + λ ac ≥ 0 0 − 1 0 0 1 µ c λ bt 0 0 0 0 1 − 1 µ t λ ct 0 2 , 0 c − 1 0 0 0 1 0 1 λ ij ≥ 0 , µ i free 1 , 0 t ◮ µ i are shift-invariant. Therefore (edge capacity) we may assume µ s = 0. (cost) ◮ We want each λ ij small; no slack! 7-20
Recommend
More recommend