MEIO/UPC-UB : NETWORK FLOWS Network Flows UPCOPENCOURSEWARE number 34414 Topic 1: Introduction 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: – Minimum shortest path problems. – Maximum flow problems. – Minimum cost flow problems. • Network flow problems (NF) as a class of linear programming problems (LP): – – – – – – Standard form of the minimum flow cost problem. Nodes-arcs incidence matrix. Formulation of the minimum shortest path problem. Formulation of the maximum flow problem. Formulation of the transportation and assignment problem. Transformation to the standard form. • Applications. F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-2 introduction MEIO/UPC-UB : NETWORK FLOWS Introduction • To Identify the shortest path between a source node (“s”) and the sink node (“t”). 20 2 4 10 30 s 15 1 35 t 40 20 25 3 • Applications: 6 35 5 – Minimum cost flow problem. – Minimum time flow problem. – Equipment replacement problems. F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-3 introduction MEIO/UPC-UB : NETWORK FLOWS Shortest Path Problems • To seek how to send the maximum possible amount of flow from a source node (“s”) to sink node (“t”) in a capacitated network. 3 3 2 6 2 2 5 s 4 5 6 t 1 6 4 4 2 4 2 3 2 5 4 5 • Applications: determining the maximum steady –state flow of: – – – – Petroleum products in a pipeline network. Cars in a road network. Messages in a telecommunication network. Electricity in an electrical network. F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-4 introduction MEIO/UPC-UB : NETWORK FLOWS Maximum Flow Problems • We wish to determie a least shipment cost of a single commodity through a network in order to satisfy comsuption at demand nodes with the production of the supply nodes. 10 2 -15 2 4 3 5 5 1 4 10 3 • Applications: 5 6 3 0 1 5 0 2 4 7 10 6 6 -10 – Logistics(warehouses to retailers). – Automobile routing in an urban traffic network. – Routing of calls through a telephone system. F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-5 introduction MEIO/UPC-UB : NETWORK FLOWS Minimum Flow Cost Problems • Let G=(N,A) be the directed graph defined by the set N of n nodes (|N| = n) and the set A of m directed arcs (|A| = m) . 10 2 2 3 5 5 4 1 b4 = -15 4 1 5 6 3 (7,4) c74 = 2 7 4 b7 = +10 6 3 0 5 6 -10 n=7 ; m=11 ; N={1,2,3,4,5,6,7} ; A={ (1,2), (1,3), (2,3),...} • Demand/supply vector: bj , j=1,2,...,n: b=[5,10,0,-15,0,5,10]’ • Cost vector: cij , (i,j)∈A : c=[5,3,4,...]’ • Flow: xij , (i,j)∈A : amout of commodity to be sent between node i and node j through arc (i,j). F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-6 introduction MEIO/UPC-UB : NETWORK FLOWS Standard form of the minimum cost flow problem (MCNFP) (I) • Mathematic formulation: min s.a. : z= ∑c x (i,j)∈ A ∑ xij − { j:( i , j )∈A} ij ij (1.1a) ∑ x ji = bi ∀i ∈ N (1.1b) { j:( j ,i )∈A} xij ≥ 0 ∀(i, j ) ∈ A Balance equations (1.1c) n – We assume the network is balanced: ∑b = 0 i =1 • Matrix notation: i c′x (1.2a) min s.a. : T x = b (1.2b) x ≥ 0 (1.2c) F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-7 introduction MEIO/UPC-UB : NETWORK FLOWS Standard form of the minimum cost cost flow flow problem problem(II) (II) • The associated node-arc • Consider the incidence matrix T is: following network: 4 (35,50) 3 i (25,20) (cij ,uij) (1, 2 ) (1,3) ( 2, 4 ) ( 3, 2 ) ( 4,3) ( 4,5) ( 5,3) ( 5, 4 ) 1 1 1 0 0 0 0 0 0 2 − 1 0 1 − 1 0 0 0 0 T= 3 0 −1 0 1 − 1 0 − 1 0 4 0 0 −1 0 1 1 0 − 1 5 0 0 0 0 0 − 1 1 1 • Properties: 5 j – – – – 2m non-zero elements among nm. Only 2 elements ≠0 per column. Every non-zero elements is +1 or -1. Rank(T)= n-1. F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-8 introduction 1 (15,40) (45,60) 2 45,10) MEIO/UPC-UB : NETWORK FLOWS Node-arc incidence matrix 20 2 4 10 cij i j 30 +1 15 1 35 -1 40 6 20 25 3 35 5 • b1= +1 ; b6= -1 ; bj= 0 ∀j ≠1,6 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-9 introduction MEIO/UPC-UB : NETWORK FLOWS Shortest path problem formulated as a MCNFP 2 (0,3) 4 i s 1 (cij ,uij) j t 6 3 (0,5) 5 (-1,+∞) • Artificial arc xts with cts=-1 and uts= +∞. • cij=0 ∀(i,j)≠(t,s) F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-10 introduction MEIO/UPC-UB : NETWORK FLOWS Maximum flow problem formulated as a MCNFP 1 5 2 6 3 4 7 • Properties: – N = N1∪ N2: N1: production nodes; N2: demand nodes. – ∀(i,j)∈A : i ∈ N1 ; j ∈ N2 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-11 introduction MEIO/UPC-UB : NETWORK FLOWS Transportation problem formulated as a MCNFP +1 1 4 +1 -1 -1 2 5 +1 -1 3 6 • Properties: – N = N1∪ N2 ; |N1 |= |N2| – A⊆ N1× N2. – bj=+1 ∀j ∈N1 ; bj=-1 ∀j ∈N2 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-12 introduction MEIO/UPC-UB : NETWORK FLOWS Assigment problem formulation • Undirected arcs: xij j i xji – Contribution to the objective function: cij xij +cij xji – cij ≥ 0 ⇒ at the optimal solution xij > 0 or xji > 0 – Transformation: each directed arc {i,j} is replaced by two directed arcs (i,j) and (j,i) with cost cij : xij j i xji F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-13 introduction MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form (I) • Arcs with non-zero lower bounds: – xij ≥ lij – xij is replaced by x’ij+lij in the problem’s formulation: Bounds: xij ≥ lij Balance ⇒ x’ij+lij ≥ lij ; x’ij ≥ 0 equations: bi → bi - lij Objective ; bj → bj + lij function: cij xij → cij (x’ij + lij ) = cij x’ij + cij lij cte. F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-14 introduction MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form (II) • Arcs with negative costs: – Let be xij with cij<0. – Let uij a trivial upper bound of the arc (i,j). – xij is replaced by x’ij = uij – xij. 0 ≤ x’ij ≤ uij cst >0 function: z = ...+ cij xij +...→ z’= ...+ cijuij – cij x’ij +... Objective Balance bi equations: xij i cij ,uij bj j bi - uij x’ bj + uij ij i j -cij ,uij F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-15 introduction MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form (III) • Arcs with capacity: – Let 0 ≤ xij ≤ uij. – Network transformation: bi i xij cij ,uij The bj j bi xik i c ,∞ ik - uij k xjk 0 ,∞ bj + uij j network is equivalent to the original: xij ≡ xik ; xik + xjk = uij ⇒ xik = xij ≤ uij The objective function id not modified: cik ≡ cij F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-16 introduction MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form (IV) • Unbalanced network: – Excess of production n ( ∑b j =1 j – Excess of demand n >0 ): ( ∑b j =1 +10 1 3 -8 j <0 ): +10 1 3 -12 +4 -3 5 5 +8 2 4 -7 +8 2 4 -10 A dummy demand node n+1 is A dummy supply node n+1 is added linking all production nodes added, linking all demand nodes through uncapacitated - null through uncapacitated – null cost arcs. cost arcs. F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-17 introduction MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form (V) • Example 1: bj bi (cij ,uij ,lij ) j i -15 20 1 -10 (-2,10,0) 4 (2, ∞,0) 2 (-1,20,0) (10, ∞,5) (Solution) 3 5 10 0 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-18 introduction MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form (VI) • Solve the applications examples from book chapter 1.3 of AMO (1 week): – Problem description. – Network formulation and objective function associated to the problem. – Problem classification. • Problems assigment: F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-19 introduction MEIO/UPC-UB : NETWORK FLOWS Applications 1. Negative cost elimination b bi (cij ,uij ,lij ) j j i -15-10-20= -45 20 4 z=z’+20+20=z’+40 (10, ∞,5) 3 10+20 = +30 5 0 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-20 introduction 1 -10+10 = 0 (2,10,0) (2, ∞,0) 2 (1,20,0) MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form Example (1/4) 2. Lower bounds elimination ≠0 b bi (cij ,uij ,lij ) j j i 0 -45+5 = -40 (2,10,0) 1 z=z’+40+25+50=z’+115 (10, ∞,0) 3 30-5 = -25 5 0+5 = 5 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-21 introduction 20-5 = 15 4 (2, ∞,0) 2 (1,20,0) MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form Example (2/4) 3. Capacity elimination bj bi (cij ,uij ,lij ) j i -40+20+10 = 30 (2, ∞,0) 0 (0, ∞,0) 7 2 4 z=z’+115 -10 6 1 -20 (10, ∞,0) 3 5 -25 5 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-22 introduction 15 (2, ∞,0) MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form Example (3/4) 4. Unbalance network bj bi (cij ,uij ,lij ) j i z=z’+115 30 (2, ∞,0) 0 (0, ∞,0) 7 2 4 -10 6 1 -20 (10, ∞,0) 3 5 5 -25 F.-Javier Heredia http://gnom.upc.edu/heredia Introduction-23 introduction -25 15 7 (2, ∞,0) MEIO/UPC-UB : NETWORK FLOWS Transformation to the standard form Example (4/4)