MEIO/UPC-UB : NETWORK FLOWS Network Flows UPCOPENCOURSEWARE number 34414 Topic 7: Convex Costs 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. • • • • • Introduction Applications Transformations to a MCNFP Pseudopolynomial Time Algorithms Polynomial-Time Algorithm • Source material: – R.K. Ahuja, Th.L. Magnanti, J. Orlin “Network Flows”, chap. 15. – R.K. Ahuja “Advanced Network Optimization” http://www.ise.ufl.edu/ANO/ F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 2 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS 7.- Convex Cost Flows • Convex cost flow problems are minimum cost flow problems where the cost of flow is nonlinear. Minimize ∑ (i, j)∈A Cij (x ij ) subject to ∑ {j:(i,j)∈A} xij − = ∑ x ji b(i) for each node i ∈ N {j:(j,i)∈A} 0 ≤ x ij ≤ u ij and int eger for each arc (i, j) ∈ N • Here we assume that the total cost is separable. • The cost of flow Cij(xij) is a convex function of xij instead of a linear function cijxij. F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 3 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Introduction to Convex Cost Flows • Some sample cost functions: 1000 40 800 30 600 20 Cij(xij ) 400 10 Cij(xij ) 200 0 0 -10 0 2 4 6 x ij 8 10 0 2 6 4 8 10 x ij (a) (b) F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 4 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Introduction to Convex Cost Flows • • • • Urban Traffic Flows. Area transfer in Communication Networks. Matrix Balancing. Stick Percolation Problem. F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 5 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Applications • We will assume that the cost of flow on any arc is a piecewise linear convex function: 150 100 Cij(xij ) 50 0 0 1 2 3 4 5 x ij F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 6 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Piecewise Linear Assumption • We will assume that each arc has p linear segments associated with it. For example, if p = 5, then the cost function would look like: cij5 cij4 cij3 cij2 c1ij dij0 d1ij dij2 dij3 dij4 F.-Javier Heredia http://gnom.upc.edu/heredia dij5 CCF- 7 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Nature of the Cost Function • The convex cost flow problem can be transformed to a minimum cost flow problem by increasing the number of variables: xij = x + x + x + x + x 1 ij 2 ij 3 ij 4 ij xij3 x x c c1ij dij0 d1ij xij5 cij5 xij4 cij4 cij3 2 ij 2 ij 1 ij 5 ij dij2 dij3 dij4 F.-Javier Heredia http://gnom.upc.edu/heredia dij5 CCF- 8 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Transformation to Min Cost Flows • We replace each arc with p linear segments by p arcs with linear costs. Costs i Cij(xij) Capacities j c1ij d1ij − dij0 cij2 i cij3 c 4 ij cij5 dij2 − d1ij j i dij3 − dij2 dij4 − dij3 j dij5 − dij4 F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 9 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Transformation to Min Cost Flows (contd.) • We call a flow in the transformed network to be a contiguous flow if a segment with greater cost is used only if segments of lower costs are saturated. xij1 Flows xij2 i Cij(xij) j i xij3 j xij4 xij5 • There is a one-to-one correspondence between flows in the original network and contiguous flows in the transformed network. F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 10 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Transformation to Min Cost Flows (contd.) • A feasible flow in the transformed network may or may not be contiguous. • The optimal solution in the transformed network is always a contiguous flow. • We can solve the convex cost flow problem by solving a minimum cost flow problem. F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 11 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Transformation to Min Cost Flows (contd.) • We can transform a convex cost flow problem into a minimum cost flow problem and then solve it using any minimum cost flow algorithm. – The cycle canceling algorithm – The successive shortest path algorithm • However, the resulting minimum cost flow problem may have too many arcs which might slow down the algorithm. • We will show that if we define the residual network appropriately, then the network size will not increase at all (that is, extra arcs can be handled implicitly). F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 12 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Pseudopolynomial-Time algorithms 150 i (xij , u ij ) j 100 (3, 5) i Cij(xij ) j 50 (a) 0 0 1 2 3 4 5 x ij i x ij j i 1 1 1 j 1 1 i rij j i 1 0 1 0 1 (b) (c) F.-Javier Heredia http://gnom.upc.edu/heredia j CCF- 13 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Constructing the Residual Network • We need to maintain only two arcs for any arc (i, j): one from node i to node j and another from node j to node i. • For the exemple: – Cost of the arc (i, j): Cij(xij + 1) - Cij(xij) – Cost of the arc (j, i): Cij(xij - 1) - Cij(xij) 150 100 Cij(xij ) 50 Cij(xij + 1) - Cij(xij) Cij(xij - 1) - Cij(xij) 0 0 1 2 3 xij= 4 5 x ij F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 14 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Constructing the Residual Network (contd.) • What will be the costs and residual capacity of arcs in the residual networks if xij = 5, 6, 10. 25 20 3 15 Cij(xij ) slopes 10 2 5 1 0 0 1 2 3 4 5 6 7 8 9 10 11 12 x ij F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 15 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Constructing the Residual Network (contd.) • The capacity scaling algorithm approximates the convex cost function with greater refinements (in terms of a parameter ∆). • This algorithm is a modification of the capacity scaling algorithm for the minimum cost flow problem and has the same running time. F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 16 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Polynomial Time Capacity Scaling Algorithm MEIO/UPC-UB : NETWORK FLOWS The Original Cost Function Consider, for instance, Cij(xij)=xij4, linearized with step length 2000 1500 1000 Cij(xij ) 0 0 1 2 3 4 5 6 7 8 9 10 11 12 x ij F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 17 Convex Cost Flows 500 2000 1500 1000 Cij(xij ) 500 ∆=8 0 8 0 x ij (a) F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 18 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS The Approximate Cost Function (∆ = 8) 2000 1500 1000 ∆=4 Cij(xij ) 500 0 0 4 8 12 x ij (b) F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 19 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS The Approximate Cost Function (∆ = 4) 2000 1500 ∆=2 1000 Cij(xij ) 500 0 0 2 4 6 8 10 12 x ij (c) F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 20 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS The Approximate Cost Function (∆ = 2) 2000 1500 ∆=1 1000 Cij(xij ) 500 0 0 1 2 3 4 5 6 7 8 9 10 11 12 x ij (d) F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 21 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS The Approximate Cost Function (∆ = 1) • For any arc (i, j) ∈ A with xij + ∆ ≤ uij, the ∆-residual network contains the arc (i,j) with residual capacity ∆ and cost equal to (Cij(xij + ∆) - Cij(xij))/∆ • For any arc (i, j) ∈ A with xij ≥ ∆, the ∆-residual network contains the arc (j,i) with residual capacity ∆ and cost equal to (Cij(xij - ∆) - Cij(xij))/∆ F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 22 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS The ∆-Residual Network algorithm capacity scaling; begin x : = 0, π : = 0; ∆ : = 2 log U; while ∆ ≥ 1 begin {∆-scaling phase} preprocessing; S(∆) : = {i ∈ N : e(i) ≥ ∆}; T(∆) : = {i ∈ N : e(i) ≤ -∆}; while S(∆) ≠ Φ and T(∆) ≠ Φ do begin select a node k ∈ S(∆) and a node l ∈ T(∆); determine shortest path distances d(.) from node k to all other nodes in the ∆residual network G(x, ∆) with respect to the reduced costs; let P denote a shortest path from node k to node l in G(x, ∆); update π : = π - d; augment ∆ units of flow along the path P; update x, S(∆), T(∆) and G(x, ∆); end; ∆ : = ∆/2; end; end; CCF- 23 F.-Javier Heredia http://gnom.upc.edu/heredia Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS The Capacity Scaling Algorithm B 20000 Arc costs with scale factor 2 ∆ 15000 Arc costs with scale factor ∆ 10000 D A 5000 C E 0 2 4 x ij -2 ∆ 6 8 x ij - ∆ x ij 10 x ij + ∆ F.-Javier Heredia http://gnom.upc.edu/heredia 12 x ij+2 ∆ CCF- 24 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Going from One Scaling Phase to Another • As we go from 2∆-scaling phase to ∆-scaling phase, the costs of the arc (i, j) and (j, i) change and so their reduced costs. • There are four possibilities to consider after the reduced costs are changed: (1) cijπ ≥ 0 and c πji ≥ 0 Nothing needs to be done. (2) cijπ ≥ 0 and c πji < 0 Decrease xij by ∆ units (3) cijπ < 0 and c πji ≥ 0 Increase xij by ∆ units. (4) cijπ < 0 and c πji < 0 This case cannot occur. It can be show that the actions in (2) and (3) conserve the RCOC. F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 25 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Preprocessing Theorem: In a scaling phase, the algorithm performs at most m augmentations. Overall, the algorithm performs O(m log U) augmentations, and its running time equals solving O(m log U) shortest path problems. F.-Javier Heredia http://gnom.upc.edu/heredia CCF- 26 Convex Cost Flows MEIO/UPC-UB : NETWORK FLOWS Running Time Analysis