MEIO/UPC-UB : NETWORK FLOWS Network Flows UPCOPENCOURSEWARE number 34414 Topic 9: Multicommodity Flows F.-Javier Heredia This work is licensed under the Creative Commons AttributionNonCommercial-NoDerivs 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. • Definitions. • Applications. • Properties and optimality conditions. • Lagrangian relaxation. • Column generation. • Source material: – R.K. Ahuja, Th.L. Magnanti, J. Orlin “Network Flows”, chap. 17. – J. Orlin “Network Optimization” http://ocw.mit.edu/courses/sloanschool-of-management/15-082j-network-optimization-fall-2010/ F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 2 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS 9.- Multicommodity flows K origin-destination pairs of nodes (s1, t1), (s2, t2), …, (sK, tK) Network G = (N, A) dk = amount of flow that must be sent from sk to t k . uij = capacity on (i , j ) shared by all commodities. cijk = cost of sending 1 unit of commodity k in (i , j ). xijk = flow of commodity k in (i , j ) F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 3 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS On the Multicommodity Flow Problem O-D version 5 units good 1 1 $5 5 units good 1 4 $1 $1 $1 2 5 u25 = 5 $1 $1 2 units good 2 3 $6 6 2 units good 2 Quick exercise: determine the optimal multicommodity flow. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 4 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A Linear Multicommodity Flow Problem 5 units good 1 1 $5 5 units good 1 4 $1 $1 $1 2 $1 $1 2 units good 2 3 1 1 1 x= x = x = 3 12 25 54 5 u25 = 5 $6 2 2 2 x= x = x = 2 32 25 56 6 1 x14 =2 2 units good 2 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 5 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A Linear Multicommodity Flow Problem Min ∑ k k c ∑ ij x ij ( i , j )∈A k d k if i = sk k k x x − =− ∑j ij ∑j ji d k if i ∈ tk 0 otherwise k x ∑ ij ≤ uij for all (i , j ) ∈ A k x ijk ≥ 0 Supply/ demand constraints Bundle constraints ∀(i , j ) ∈ A, k ∈ K F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 6 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS The Multicommodity Flow LP • The constraint matrix has the following structure: Bundle Constraints Commodity 1 Commodity 2 Commodity K • If we can handle the bundle constraints so that they can be ignored, then the multicommodity flow problem decomposes into K independent subproblems. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 7 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Structure of the Constraint Matrix • Homogeneous goods: Each unit flow of commodity k on (i,j) uses up one unit of capacity on (i,j). • No congestion: Cost is linear in the flow on (i,j) until capacity is totally used up. • Fractional flows: Flows are permitted to be fractional. – In general, multicommodity flow problems have fractional flows, even if all data is integral. – The integer multicommodity flow problem is difficult to solve to optimality. • OD pairs: Usually a commodity has a single origin and single destination. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 8 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Assumptions (for now) Type of Network Nodes Arcs Flow Communic. Networks O-D pairs for messages Transmission lines Message Routing Computer Networks Storage dev. or Computers Transmission Lines Data, Messages Railway Networks Yard and Junction pts. Tracks Trains Distribution Networks Plants, Warehouses,... Highways Railway Tracks etc. Trucks, Trains, etc F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 9 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Application areas 1 unit of flow must be sent from si to ti for i = 1, 2, 3. uij = 1 for all arcs cij = 0 except as listed. s1 t3 $2 $2 1 t1 s3 2 3 s2 t2 $2 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 10 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A fractional multicommodity flow 1 unit of flow must be sent from si to ti for i = 1, 2, 3. uij = 1 for all arcs cij = 0 except as listed. s1 t3 ½ $2 $2 1 t1 2 s2 s3 3 $2 t2 Optimal solution: send ½ unit of flow in each of these 15 arcs. Total cost = $3. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 11 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A fractional multicommodity flow 1 unit of flow must be sent from si to ti for i = 1, 2, 3. uij = 1 for all arcs cij = 0 except as listed. $2 ½ s1 t3 ½ $2 ½ 1 t1 s3 ½ 2 ½ 3 ½ s2 ½ $2 t2 Optimal solution: send ½ unit of flow in each of these 15 arcs. Total cost = $3. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 12 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A fractional multicommodity flow Price directed decomposition. Focus on prices or tolls on the arcs. Then solve the problem while ignoring the capacities on arcs. Resource directive decomposition. Allocate flow capacity among commodities and solve Simplex based approaches Try to speed up the simplex method by exploiting the structure of the MCF problem. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 13 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Decomposition based approaches Minimize subject to ∑ ck x k ∑ x ijk ≤ uij (17.1a) 1≤ k ≤ K 1≤ k ≤ K Nx k = b k 0≤ x ≤u k ij k ij for all (i , j ) ∈ A (17.1b) for k = 1, 2, ..., k (17.1c) for all (i , j ) ∈ A for k = 1, 2, ..., k (17.1d) • The complementary slackness conditions of problem (17.1) can be re-expressed in a set of optimal conditions that avoid the use of the node potentials πk(j) (partial dualization). F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 14 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A formulation without OD pairs Theorem: The multicommodity flow x = (xk) is an optimal multicommodity flow for (17.1) if there exists non-negative prices w = (wij) on the arcs so that the following is true i) ii) k w ij ( ∑ k xijk − u= 0 , (i,j) ∈ A ≡ w > 0 ⇒ = x ) ( ∑ k ij uij ) ij ij The flow xk is optimal for the k-th commodity if ck is replaced by cw,k, where ,k cijw= cijk + w ij Recall: xk is optimal for the k-th commodity if there is no negative cost cycle in the kth residual network. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 15 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Optimality Conditions: Partial Dualization 5 units good 1 1 $5 5 units good 1 4 $1 $1 $1 2 $1 $1 2 units good 2 Set w2,5 = $2 3 1 1 1 x= x = x = 3 12 25 54 5 u25 = 5 $6 2 2 2 x= x = x = 2 32 25 56 6 1 x14 =2 2 units good 2 Create the residual networks F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 16 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A Linear Multicommodity Flow Problem $5 1 4 -$5 $1 -$1 -$1 $1 $3 2 $-3 5 $1 $1 3 Set w2,5 = $2 $6 6 There is no negative cost cycle. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 17 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS The residual network for commodity 1 $5 1 4 $1 $1 $3 2 3 Set w2,5 = $2 $-3 -$1 $1 5 $1 -$1 $6 6 There is no negative cost cycle. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 18 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS The residual network for commodity 2 One can also define node potentials π so that the reduced cost cijπ ,k = cijk + w ij − π ik + π kj ≥ 0 for all (i , j ) ∈ A and k = 1, ... , K This combines optimality conditions for min cost flows with the partial dualization optimality conditions for multicommodity flows. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 19 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Optimality Conditions: full dualization Min ∑ k k c ∑ ij x ij ( i , j )∈A k d k if i = sk k k d k if i ∈ t k ∑j x ij − ∑j x ji =− 0 otherwise s.t.: k x ∑ ij ≤ uij for all (i , j ) ∈ A k x ijk ≥ 0 Supply/ demand constraints Bundle constraints ∀(i , j ) ∈ A, k ∈ K F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 20 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Lagrangian relaxation for multicommodity flows Min ∑ k k c ∑ ij x ij + ( i , j )∈A k ∑ ( i , j )∈A w ij (∑ x ijk − uij ) k d k if i = sk k k d k if i ∈ t k ∑j x ij − ∑j x ji =− 0 otherwise s.t.: k x ∑ ij ≤ uij for all (i , j ) ∈ A k x ijk ≥ 0 Supply/ demand constraints Bundle constraints ∀(i , j ) ∈ A, k ∈ K Penalize the bundle constraints. Relax the bundle constraints. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 21 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Lagrangian relaxation for multicommodity flows Formulate the Lagrangian dual function L(w) (Lagrangian subproblem) and solve the Lagrangian dual k k k cij x ij + ∑ w ij (∑ x ij − uij ) ∑ ∑ ( i , |j )∈ wA ≥ 0 }k ( i , j )(D) ∈A kmax { L(w) with: L(w) = Min x ∑ k k ( c + w ) x ∑ ij ij ij − ( i , j )∈A k ∑ ( i , j )∈A w ij uij d k if i = sk Supply/ k k x − x d k if i ∈ t k demand ∑j ij ∑j ji =− 0 otherwise constraints s.t.: x ijk ≥ 0 ∀(i , j ) ∈ A, k ∈ K Remark: observe the relation between the optimality conditions of the Lagrangian dual (D) and the partial dualization optimality conditions. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 22 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Lagrangian relaxation for multicommodity flows 5 units good 1 1 $5 5 units good 1 4 $1 $1 $1 2 3 units good 2 u25 = 5 $1 u32 = 2 $6 3 e.g., set w0 = 0. 5 $1 6 3 units good 2 Choose an initial value w0 of the “tolls” w, and find the optimal solution for L(w). F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 23 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Subgradient Optimization for solving the Lagrangian Multiplier Problem 5 units good 1 1 $5 5 units good 1 4 $1 $1 $1 2 5 u25 = 5 3 units good 2 $1 u = 2 32 $6 3 $1 6 next: determine the flows, and then determine w1 from w0 3 units good 2 The flow on (2,5) = 8 > u25 = 5. The flow on (3,2) = 3 > u32 = 2. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 24 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Subgradient Optimization for solving the Lagrangian Multiplier Problem r + = max (0, r ) y ij = ∑ x ijk = flow in arc (i,j) k w q +1 ij = [w + θ q ( y ij − uij )] q ij + 1 0 w 25 = [w 25 + θ 0 (8 − 5)]+ = 3θ 0 (y-u)+ is called the search direction. θq is called the step size. 1 0 w 32 = [w 32 + θ 0 (3 − 2)]+ = θ 0 1 1 = w 3 = and w 1 So, if we choose θ0 = 1, then 25 32 Then solve L(w1). F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 25 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Choosing a search direction 5 units good 1 1 $5 5 units good 1 4 $1 $1 If θ1 = 1, then w2 = 0. $4 2 5 $1 $2 3 units good 2 3 $6 6 3 units good 2 2 1 w 25 = [w 25 + θ 1(0 − 5)]+ = [3 − 5θ 1 ]+ 2 1 w 32 = [w 32 + θ 1(0 − 2)]+ = [1 − 2θ 1 ]+ F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 26 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Solving L(w1) • The search direction is a good search direction. • But the step size must be chosen carefully. • Too large a step size and the solution will oscillate and not converge • Too small a step size and the solution will not converge to the optimum. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 27 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Comments on the step size The step size θq should be chosen so that lim θ q = 0 q →∞ ∞ and ∑θ q =1 q = ∞ (1) e.g., take θq = 1/q. Theorem. If the search direction is chosen as on the previous slides (subgradient search), and if (θq) satisfies (1), then the wq converges to the optimum for the Lagrangian dual problem (D). F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 28 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS On choosing the step size 5 units good 1 1 $5 5 units good 1 4 $1 $1 $1 2 u25 = 5 $1 u32 = 2 $6 3 3 units good 2 q lim w 32 =1 q →∞ 1 1 1 x= x = x = 3 12 25 54 1 x14 =2 5 2 2 2 x= x = x = 2 32 25 56 $1 6 2 x36 =1 3 units good 2 q lim w 25 =2 q →∞ F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 29 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS The optimal multipliers and flows. 5 units good 1 1 $5 5 units good 1 4 $1 $1 1 x14 =5 $3.001 2 5 $1 $2.001 3 units good 2 2 x36 =3 3 $6 6 3 units good 2 Conclusion: Near Optimal Multipliers do not always lead to near optimal (or even feasible) flows. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 30 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Suppose that w32 = 1.001 and w25 = 2.001 • The formulation of the multicommodity flow problem we gave earlier is known as the node-arc formulation. • We will now give another formulation known as the arcpath formulation. This formulation uses the fact that any arc flow can be decomposed into flow along paths and cycles (Flow decomposition theorem, Th. 3.5 A-M-O). F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 31 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Column Generation: Arc-Path Formulation • Flow Decomposition Theorem. Any non-negative feasible flow x can be decomposed into the following: i. the sum of flows in paths directed from supply nodes to demand nodes, plus ii. the sum of flows around directed cycles. • It will always have at most n + m paths and cycles. Remark: The decomposition usually is not unique. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 32 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Flow Decomposition Theorem begin Initialize while y ≠ ∅ do begin Select(s, y) Search(s, y) if a cycle C is found then do begin let ∆ = Capacity(C, y) Add Flow(∆, C) to cycle flows Subtract Flow(∆, C) from y. end if a path P is found then do begin let ∆ = Capacity(P, y) Add Flow(∆, P) to path flows Subtract Flow(∆, P) from y. end end F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 33 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Flow decomposition algorithm 4 2 0 2 7 3 1 2 A supply node 3 0 0 4 8 4 9 3 5 0 4 6 -2 5 The flow x A demand node A balanced node F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 34 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS The initial flow 4 Carry a Selectout a supply depth node first search until a cycle C or a path P is found 2 7 2 3 1 2 3 0 4 8 4 9 3 5 0 4 6 -2 5 Determine the capacity The capacity is 2. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 35 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Find a Path or Cycle 24 Add the cycle flow to the decomposition 2 57 2 3 1 02 update the current flow 3 0 4 86 4 79 3 5 0 4 6 -2 5 path flows cycle flows 2 units around 1-2-4-5-3-1 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 36 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Update the decomposition 2 Start at a supply node and find the next cycle or path 2 5 2 4 3 1 3 0 cycle flows 6 4 5 0 7 3 4 6 -2 5 path flows 2 units around 1-2-4-5-3-1 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 37 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Find the next path or cycle 2 update the 2 current flow and decomposition 5 2 2 4 30 1 3 0 3 6 3 4 5 0 7 4 4 6 -2 5 path flows cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 38 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS update the decomposition and current flow start with a supply node and find the next flow or cycle. 2 2 2 2 4 1 3 4 3 0 The capacity of 4-5-3-4 is 3 5 0 4 3 4 6 -2 5 path flows cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 39 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Find the next flow or cycle 2 update the 2 current flow and decomposition 2 2 4 1 3 0 1 4 3 0 3 5 0 4 1 4 6 -2 5 cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 3 units around 4-5-3-4 path flows F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 40 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Update start with a supply node and find the next flow or cycle. 2 2 2 2 1 4 1 The capacity of 1-2-4-6 is 2 3 0 1 4 3 4 5 0 6 -2 5 cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 3 units around 4-5-3-4 path flows F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 41 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Find the next flow or cycle update the current flow and decomposition 2 0 2 0 2 2 0 4 1 1 3 0 4 5 0 1 4 3 1 6 -2 0 5 cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 3 units around 4-5-3-4 path flows 2 units in 1-2-4-6 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 42 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Update start with any node incident to an arc with flow and find 0 the next flow or cycle. 0 2 4 1 1 3 0 4 5 0 1 4 1 6 -2 0 5 cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 3 units around 4-5-3-4 path flows 2 units in 1-2-4-6 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 43 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Find the next path or cycle 0 0 2 4 1 1 0 3 0 4 5 0 1 4 0 1 0 6 -2 0 5 4 cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 3 units around 4-5-3-4 1 units around 3-4-6-5-3 path flows 2 units in 1-2-4-6 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 44 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Update 0 0 2 4 1 6 -2 0 4 0 3 0 cycle flows 2 units around 1-2-4-5-3-1 3 units around 2-4-5-3-2 3 units around 4-5-3-4 1 units around 3-4-6-5-3 4 units around 5-6-5 5 0 40 path flows 2 units in 1-2-4-6 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 45 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS The Final Decomposition • O-D multicommodity flow problems: Let sk be the unique source of commodity k and tk be the unique sink of commodity k. • Additional assumption: for every commodity, the cost of every cycle W in the underlying network is nonnegative ⇒ for some optimal solution, the flow on every cycle is zero ⇒ any optimal solution can be represented as the sum of flows on directed paths This is the case if cijk ≥ 0 ∀ i,j,k. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 46 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Column Generation: Arc-Path Formulation 5 units good 1 P1 = set of paths from node 1 to node 4. 1 5 units good 1 4 $1 $1 $1 2 5 u25 = 5 $1 3 units good 2 $5 3 P1 = {1-4, 1-2-5-4} u32 = 2 $6 $1 6 P2 = set of paths from node 3 to node 6. 3 units good 2 P2 = {3-6, 3-2-5-6} F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 47 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A Linear Multicommodity Flow Problem c(1-4) c(1-2-5-4) c(3-6) c(3-2-5-6) f(P) = flow in path P c(P) = cost of path P = = = = 5 3 6 3 Minimize 5 f(1-4) + 3 f(1-2-5-4) + 6 f(3-6) + 3 f(3-2-5-6) subject to f(1-4) + f(1-2-5-4) = 5 f(3-6) + f(3-2-5-6) = 3 f(1-2-5-4) + f(3-2-5-6) ≤ u25 = 5 f(3-2-5-6) ≤ u32 = 2 f(P) ≥ 0 for all paths P F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 48 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS A path based formulation 5 units good 1 1 $5 $1 $1 f(1-4) = 2 f(3-6) = 1 $1 f(1-2-5-4) = 3 2 $1 3 f(3-2-5-6) = 2 5 u25 = 5 3 units good 2 5 units good 1 4 u32 = 2 $6 $1 6 3 units good 2 The path based LP can be solved using the simplex method. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 49 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Optimal solution for the path based version Let Pk = set of directed paths from sk to tk Let ck(P) = cost of path P ∈ Pk. Let f(P) = flow on path P. 1 if (i,j) ∈ P Let δ ij ( P ) = 0 otherwise Master Problem Minimize ∑∑ ck ( P ) f ( P ) k P∈P k ∑∑δ k P∈P k ∑ ij ( P ) f ( P ) ≤ uij f (P) = d k P∈P k f (P) ≥ 0 for P ∈ for all ( i , j ) ∈ A for k = 1 to K K k =1 Pk F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 50 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS General formulation for the path based version Minimize ∑∑ ck ( P ) f ( P ) k P∈P k ∑∑δ k P∈P k ∑ ij ( P ) f ( P ) ≤ uij for all ( i , j ) ∈ A for k = 1 to K f (P) = d k P∈P k f (P) ≥ 0 for P ∈ K Pk k =1 • Contraints: (m+K << m+nK node-arc formulation) Bundle constraints: one for each capacitated arc (m). Supply/demand constraints: one for commodity (K). • Variables: one for each path from origin to destination for each commodity : exponential!! F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 51 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Remarks on the path based version Let Sk = subset of Pk = directed paths from sk to tk Let ck(P) = cost of path P ∈ Sk. Let f(P) = flow on path P. 1 if (i,j) ∈ P Let δ ij ( P ) = 0 otherwise Restricted Master Problem Minimize ∑∑ ck ( P ) f ( P ) k P∈S k ∑∑δ k P∈S k ∑ ij ( P ) f ( P ) ≤ uij f (P) = d k for all ( i , j ) ∈ A for k = 1 to K P∈S k f (P) ≥ 0 for P ∈ K Sk k =1 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 52 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Column Generation Approach: generate paths as needed 1. Initialize Sk for each k. 2. Apply LP to solve the restricted master problem for paths in S = ∪k Sk obtaining solution f(P). 3. Check to see if f(P) is optimal for the master problem. If not, find new paths to add to S and return to step 2. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 53 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Solving the Master Problem Restricted Master Problem Minimize ∑∑ ck ( P ) f ( P ) k P∈S k ∑∑δ k P∈S k ∑ ij ( P ) f ( P ) ≤ uij for all ( i , j ) ∈ A f (P) = d k P∈S k f (P) ≥ 0 for P ∈ K Sk k =1 Let w = (wij) be a set of non-negative tolls on the arcs. c = c + wij w ,k ij k ij c w ,k ( P ) = ∑ ( i , j )∈P cijw ,k F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 54 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Towards Optimality conditions for the master and restricted master 5 units good 1 1 $5 $1 Suppose w32 = 1 c w ,2 32 = 1+1 3 units good 2 5 units good 1 4 $1 Suppose w25 = 2.5 $1 2 w25 = 2.5 $1 w32 = 1 $6 3 5 $1 6 w ,2 c25 =+ 1 2.5 = 3.5 3 units good 2 c w ,2 (3 − 2 − 5 − 6) = 2 + 3.5 + 1 = 6.5 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 55 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Illustration of definitions A flow f is optimal for the restricted master if it is feasible, and if there is a non-negative vector w of tolls on arc so that the following is true: 1. w ij > 0 ⇒ ∑∑δ k 2. P ∈S k ij (P )f (P ) = uij for all (i,j) ∈ A f (P ') > 0 for P' ∈ Sk ⇒ c w ,k (P ') = min (c w ,k (P ) : P ∈ S k ) The tolls w are produced by the LP solution to the restricted master (shadow prices of the bundle constraints). Optimality for the master problem is the same except that Sk is replaced by Pk. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 56 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Optimality conditions for the restricted master f(P’) > 0 P’ sk tk P Suppose that the optimality conditions are not satisfied, and that c(P’) > c(P). The residual network G(xk) has Rev(P’). Rev(P’) + P is a circulation with negative cost -c(P’) +c(P) < 0. Thus G(xk) has a negative cost cycle. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 57 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS On the optimality conditions Let f be optimal for the restricted master 1. w ij > 0 ⇒ ∑∑δ k 2. P ∈S k ij (P )f (P ) = uij for all (i,j) ∈ A f (P ') > 0 for P' ∈ Sk ⇒ c w ,k (P ') = min (c w ,k (P ) : P ∈ S k ) How can be checked if f is optimal for the master problem: 1. Let Pk be the shortest path from sk to tk using cw,k . 2. If Pk ∈ Sk for each k, then f is optimal for the master problem because condition 1 and condition 2 are both satisfied when we replace Sk by Pk for each k. 3. Otherwise, add Pk to Sk for each k, and solve the new restricted master problem. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 58 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Adding paths or proving optimality • We used partial dualization. That is, we had optimality conditions that used w, but not σk the dual variables of the supply/demand constraints of commodity k. • In usual column generation, one would use LP path flow complementarity slackness optimality conditions, which are more detailed, but follow the same general approach (See A-M-H, section 17.5). (a) w ij ∑ ∑ δ ij (P )f (P ) − uij = 0 ∀(i , j ) ∈ A 1≤ k ≤K P∈Pk ∀k 1,2,, K , ∀P ∈ Pk (b) c σ ,w (P ) ≥ 0= (c) c σ ,w (P )f (P )= 0 ∀k= 1,2,, K , ∀P ∈ Pk P) with c σ ,w (= ∑ (c ( i , j )∈P k ij ) + w ij − σ k the reduced cost of variable f (P ) and σ k the dual variable of comm. k , which can also be interpreted as the shortest path distance from sk to t k w.r.t. the modified costs cijk + w ij F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 59 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS More on optimality conditions c(1-4) c(1-2-5-4) c(3-6) c(3-2-5-6) f(P) = flow in path P c(P) = cost of path P = = = = 5 3 6 3 Minimize 5 f(1-4) + 3 f(1-2-5-4) + 6 f(3-6) + 3 f(3-2-5-6) subject to f(1-4) + f(1-2-5-4) = 5 f(3-6) + f(3-2-5-6) = 3 f(1-2-5-4) + f(3-2-5-6) ≤ u25 = 5 f(P) ≥ 0 for all paths P F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 60 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Restricted Master Problem 1 5 units good 1 1 $5 $1 $1 f(3-6) = 3 $1 f(1-4) = 5 2 5 u25 = 5 $1 3 units good 2 5 units good 1 4 3 u32 = 2 $6 w25 = 0; w32 = 0 $1 6 3 units good 2 The unique shortest path for commodity 1 is 1-2-5-4. The unique shortest path for commodity 2 is 3-2-5-6. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 61 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Optimal solution for restricted master 1 Suppose we add path 3-2-5-6 to the restricted master f(P) = flow in path P c(1-4) c(1-2-5-4) c(3-6) c(3-2-5-6) = = = = 5 3 6 3 c(P) = cost of path P Minimize 5 f(1-4) + 3 f(1-2-5-4) + 6 f(3-6) + 3 f(3-2-5-6) subject to f(1-4) + f(1-2-5-4) = 5 f(3-6) + f(3-2-5-6) = 3 f(1-2-5-4) + f(3-2-5-6) ≤ u25 = 5 f(3-2-5-6) ≤ u32 = 2 f(P) ≥ 0 for all paths P F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 62 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Restricted Master Problem 2 5 units good 1 1 $5 $1 $1 $1 f(1-4) = 5 2 $1 3 u32 = 2 $6 f(3-6) = 1 f(3-2-5-6) = 2 5 u25 = 5 3 units good 2 5 units good 1 4 $1 6 w25 = 0; w32 = 3 3 units good 2 The unique shortest path for commodity 1 is 1-2-5-4. ? The shortest paths for commodity 2 are 3-2-5-6 and 3-6 F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 63 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Optimal solution for restricted master 2 We next add path 1-2-5-4 to the restricted master f(P) = flow in path P c(1-4) c(1-2-5-4) c(3-6) c(3-2-5-6) = = = = 5 3 6 3 c(P) = cost of path P Minimize 5 f(1-4) + 3 f(1-2-5-4) + 6 f(3-6) + 3 f(3-2-5-6) subject to f(1-4) + f(1-2-5-4) = 5 f(3-6) + f(3-2-5-6) = 3 f(1-2-5-4) + f(3-2-5-6) ≤ u25 = 5 f(3-2-5-6) ≤ u32 = 2 f(P) ≥ 0 for all paths P F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 64 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Restricted Master Problem 3 5 units good 1 1 $5 $1 $1 $1 f(1-4) = 2 2 f(1-2-5-4) = 3 3 u32 = 2 $6 f(3-6) = 1 f(3-2-5-6) = 2 5 u25 = 5 $1 3 units good 2 5 units good 1 4 $1 6 w25 = 2; w32 = 1 3 units good 2 The solution is optimal for the entire problem. F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 65 Multicommodity Flows MEIO/UPC-UB : NETWORK FLOWS Optimal solution for the path based version Restricted Master Problem (RMP) > Trillions (?) of Variables Constraints Variables that were never considered F.-Javier Heredia http://gnom.upc.edu/heredia J. Orlin http://jorlin.scripts.mit.edu/ MCNFP- 66 Multicommodity Flows Initial variables Added variables MEIO/UPC-UB : NETWORK FLOWS Column Generation