OR 215 Network Flows Spring 1999 M. Hartmann THE SIMPLEX ALGORITHM FOR GENERALIZED NETWORK FLOWS Generalized Networks Generalized Min-Cost Flow Problem Sending Flows in Paths and Cycles Augmented Trees (and Forests) Calculating Simplex Multipliers Pivoting in Generalized Networks Data Structures GENERALIZED NETWORKS ij i j ij > 0 is called the flow multiplier; for each unit of flow leaving i along arc (i,j), ij units of flow arrive at node j. EXAMPLE 1. Financial networks. node i : Bank i (in the US) node j : Bank j (in Great Britain) ij = conversion factor from dollars to pounds EXAMPLE 2. Energy networks. node i : a power plant node j : the end of a high power transmission line ij = .90 to reflect a 10% loss in energy shipped along the line. EXAMPLE 3. Communication networks. node i : a communication node (sender) node j: a communication node (receiver) ij < 1 reflects that communication may be lost in transmission. THE GENERALIZED MIN-COST FLOW PROBLEM uij = capacity of arc (i,j). cij = unit cost of shipping flow from node i to node j on (i,j). xij = amount shipped on arc (i,j) (decision variables) b(i) = supply/demand at node i (> 0 for a supply node) ij = the multiplier of arc (i,j) minimize cijxij subject to j xij - k kixki 0 xij uij = b(i) for all i N for all (i,j) A An arc (i,j) is a gainy arc if ij > 1. An arc (i,j) is a lossy arc if ij < 1. An arc (i,j) is a gainfree arc if ij = 1. Note: The constraint matrices of generalized network flow problems have at most two non-zero elements per column. GENERALIZED ASSIGMENT PROBLEM EXAMPLE 4. Job shop scheduling. node Ji: job i node Mj: machine j pij is the processing time of job i on machine j p11 J1 M1 xij = assigned p12 to machine j p13 J2 1 if job i is Tj = processing time alloted for machine j M2 minimize J3 subject to cx j xij = 1 for all i i pijxij Tj for all j J 4 M3 x 0, integer 1 2 2 1 1 2 3 4 3 (1,2) (1,3) (2,3) (3,4) (4,1) 1 1 1 0 0 -2 2 -1 0 1 0 0 3 0 -2 -1 1 0 4 0 0 0 -3 1 node-arc incidence matrix Assumption: The rank of the node-arc incidence matrix is n. (The generalized network is connected and is not equivalent to an ordinary min cost network flow problem.) PATHS AND CYCLES Sending Flow along Paths: Suppose that P is a path from node i to node j. If we send one unit of flow from i and flow is conserved at all non-terminal nodes of P, how much flow arrives at j? Example 1: A directed path. 2 1/4 1 2 3 3 4 The multiplier of a directed path P is (P) = (i,j)P ij. Example 2: A directed cycle. 1 2 2 3 1 1/3 4 3 The multiplier of a directed cycle C is (C) = (i,j)C ij. The multiplier of a directed cycle C is (C) = (i,j)C ij. A cycle is a gainy cycle if (C) > 1. A cycle is a lossy cycle if (C) < 1. A cycle is a gainfree cycle if (C) = 1. A gainy cycle is also called a flow generating cycle. A lossy cycle is also called a flow absorbing cycle. 1 1/2 2 3 1 3 4 3 For a non-directed cycle, the multiplier of the cycle is the product of the multipliers of the forward arcs divided by the product of the multipliers of the reverse arcs. Theorem. Let G = (N,A) be a generalized network, and let C be a gainy or lossy directed circuit of G. Then there is a unique way of sending flow in C so as to create one unit of supply at node i of C. AUGMENTED TREES An augmented tree is a tree T plus an arc (v,w). Suppose that the cycle C in an augmented tree is gainy or lossy. Then T+(v,w) is a basis. (Note: the number of nodes in an augmented tree equals the number of arcs.) Proof: It suffices to show that the following procedure uniquely determines the flow (WLOG node v is the root): Step 1. Calculate the unique solution x such that xvw = 0 and the flows in T satisfy demands b(i) for i v. Step 2. Send flow from v to v around C (or its reversal) so as to satisfy the suppy/demand constraint at v. 1 1 1 2 3 1/2 3 2 4 5 Corollary. A 2-tree is dependent (a tree plus 2 arcs) BASES FOR GENERALIZED NETWORKS An augmented forest is a subgraph of n arcs such that each component is an augmented tree. Theorem. A basis an augmented forest with the additional property that no circuit of the augmented forest is gainfree. Proof: We leave as an exercise that there is some augmented tree in G with a gainy or lossy cycle. Thus some basis has n arcs, and thus all bases have n arcs. Suppose that H is a basis. If there is some component H' with more nodes than arcs, then H' is dependent. Thus each component has the same number of arcs as nodes, and thus each component has a unique cycle. If some such cycle was gainfree, the arcs on the cycle would be dependent, contrary to assumption. 1 2 1 7 2 4 6 CALCULATING SIMPLEX MULTIPLIERS minimize cijxij subject to j xij - k kixki 0 xij uij = b(i) for all i N for all (i,j) A i is the dual variable for the supply constraint at node i. c ij cijiijj. Rule: Calculate simplex multipliers so that c ij = 0 for all arcs (i,j) in the augmented forest solution. Let j be the cost of getting rid of one unit of supply from node j in the augmented forest. Claim: i = cij ijj for each arc (i,j) in the augmented forest, and thus is the vector of simplex multipliers. CALCULATING THE SIMPLEX MULTIPLIERS OF AN AUGMENTED TREE T+(v,w) Assume without loss of generality that node v is the root. Step 1. Calculate the simplex multiplier for node v. (It is the cost of getting rid of one unit of supply from node v.) Step 2. Calculate the simplex multiplier for every other node of the tree T in the order of the thread of T. root 1 $10,1 1 2 $5, 2 3 $6, 3 $8, 3 $10, 2 4 5 Arc labels are costs cij and multipliers ij. PIVOTING Case 1. The entering arc spans two components. 1 2 3 8 4 6 5 7 1. Send units of flow along the entering arc. 2. Compute the flows in all other arcs as a function of . 3. Determine the leaving arc. 4. Determine the new component(s) of the basis, and recompute the data structures, including the new prices and flows. Case 2. The entering arc is within one component. 1 2 3 7 4 5 6 A bicycle is a 2-tree with no nodes of degree 1. In a non-degenerate pivot, we either send flow on each arc of a gainfree cycle, or we send flow on each arc of a 2-tree. 1 2 3 4 5 6 7 8 DATA STRUCTURES Pred, Depth and Thread will suffice. Other data structures have proved to be slightly faster, but not by much. Time to perform the pivot with entering arc (i,j): 0[ (# of arcs scanned in pricing out) + (# of of arcs in the components of the augmented forest containing i and j) ] Remark: Strong feasibility extends to generalized networks when each multiplier is positive (i.e., if a column of the constraint matrix has 2 non-zero elements, then one is positive and one is negative.) Remark: Computation times are 2 to 4 times greater for the simplex algorithm in generalized networks than in pure networks.