A POLYNOMIAL-TIME PARAMETRIC SIMPLEX ALGORITHM FOR THE MINIMUM COST NETWORK FLOW PROBLEM James B. Orlin Sloan W.P, No. 1484-83 -(a·RISlfU-XXIL71 -- _- ______ September 1983 A Polynomial-Time Parametric Simplex Algorithm for the Minimum Cost Network Flow Problem by James B. Orlin Sloan School of Management MIT Abstract In this paper we consider the minimum cost network flow problem: min(cx : Ax = b, x matrix. 0), where A is an m x n vertex-edge incidence We show how to solve this problem as a parametric linear program with 0(m b*) pivots, where binary representation of b. b* is the number of l's in the The parametric formulation is non-linear and is based on Edmonds-Karp scaling technique. sai·igrs31--l a ____ In this paper we consider the minimum cost network flow problem (1). where Minimize cx Subject to Ax = b x 0, A (1) matrix in which there is at most one m x n is a full row'rank 1 and at most one -1 in each column and the remaining entries are all 0. Moreover, is an integral m-vector, and b c is a real n-vector. Zadeh (1978) showed that the simplex procedure as applied to (1) may take an exponentially large number of pivots. Edmonds and Karp (1972) developed a scaling procedure in conjunction with the out-of-kilter method that solves the minimum-cost network flow problem in a polynomial number The purpose of this note is to provide a parametric simplex of steps. procedure that solves the minimum-cost network flow problem in polynomial time. Recently, Ikura and Nemhauser (1983) have independently developed a similar parametric procedure for the transshipment problem. Strongly Feasible Bases Preliminaries: 2. As before, we assime that A is the full row rank constraint matrix of We assume without loss of the minimum cost network flow problem (1). generality that no two columns of matrix where (2.1) A the directed graph V = {0, ..., m If a column of component (2.2) 0 are the same. G = (V, E) , and the edge set A We associate with has a 1 E is constructed as follows. in component i and a , then we associate an edge (i, j) of If a column of a A A has a 1 -1 in E. [resp, -1] in component i and in the remaining components then we associate an edge (i, 0) [resp., (0, i)] of E. III 2. As is well known, each basis is a tree. downward edge of A induces a subgraph G, we say that the edge T of T GB of G e are two vertices of PT(i, i') e = (i, j) of is an upward edge of and that T e be the simple path in whose terminal vertex is i'. T e whose initial edge is and T T. e' T Suppose that i are two edges of PT(e, e') is a to j. whose initial vertex is Similarly that 0. if (i, j) is on the unique simple path from Otherwise, we say that let of We assume henceforth that the tree is rooted at vertex For each tree i' B and We T. i and is the simple path in and whose terminal edge is e'. We define PT(i, e) and PT(e, i) analogously. e We say that e' on PT(O, e' in T e if is a descendent of e. We say that (and that e' is the son of e) if e also say that of is an ancestor of e'). spanning tree e' For each vertex v V e e'). We is the father is the second to last edge and for each edge ei of the basic T, we associate the colors red, green and yellow as follows. (3.1) If x.i > 0, then we color edge (3.2) If xi = 0 ei is colored "red". If xi = 0 (3.3) PT(, E and if ei and if ei ei "green". is an upward edge of T is a downward edge of then T then ei is colored "yellow". (3.4) For each vertex red edge then (3.5) v v For each vertex yellow edges then We say that a red edge red and j is green. V, if PT(O, v) has at least one is colored "red". v solely of green and V, PT(O, v) v is colored "green". e = (i, j) in Thus the ancestors of T is maximum in e in T T if i is are green. As per Cunningham (1976), we say that a basic feasible flow is strongly 3. feasible if no edge of the corresponding tree is red. (Orlin (1983) showed that a basic feasible flow is strongly feasible if and only if it is lexico-positive.) In general, the dual simplex pivot rule that we adopt will pivot out For each red (and hence upward) edge red edges. the vertices of vertex 0. Let e = (i, j), let that are in the same connected component of V be the fundamental cutset of F(T, e) Te T - e induced by T be as e and defined as follows. F(T, e) = {e' = (i', j') G - T i' Te and j' We illustrate these terms in Figure 1 and in Tables 1 and 2. the only maximal red edge is by e is e = (4, 2). In Figure 1, The fundamental cutset induced 6)} F(T, e) = {(1, Tree Edge Edge T - T } Reduced Cost Flow Color (0, 1) Yes 3 green (0, 2) Yes 0 yellow (1, 6) No 5 0 (2, 1) No 2 0 (2, 3) Yes 4 green (4, 2) Yes 0 red (4, 5) Yes 2 green (4, 6) Yes 6 green (5, 3) No Table 1. 1 2 3 4 5 6 _ 0 The data for the edges of the graph of Figure 1. Vertex Table 2. 6 Supply/Demand Color -3 4 -4 8 -2 -6 green green green red red red The data for the vertices of the graph in Figure 1. slll 11 0 3 0 /0 Figure 1. A basic feasible solution that is not strongly feasible. Edge (4,2) is red. The edge numbers refer to the edge flows. 4. 3. Dual Pivoting to Reach Strong Feasibility In Section 4 we will develop a parametric procedure in which the parameter decreases whenever strong feasibility is obtained. Our parametric algorithm relies on the efficient procedure developed below for moving from feasibility to strong feasibility using dual pivots. The dual simplex pivoting procedure is well-known; see for example Dantzig (1963). Here we describe it using the terminology developed in the previous section. Moreover, we specialize it for our purposes. Dual Simplex Pivoting (4.0). Start with an optimal basic solution x = (xi) feasible. (4.1). Let ck denote the reduced cost of variable Select a maximum red edge edge e that is not strongly e in the basis tree exists, then quit because T T. xk. If no such is strongly feasible. Otherwise, continue. (4.2). Select an edge If e' in F(T, e) whose reduced cost is minimum. F(T, e) = 0, then quit as there is no strongly feasible basis. Otherwise, let the new basic tree consist of T + e' - e. Return to (4.1). REMARK. A special case of the dual simplex pivot rule (4) is the rule of pivoting out the lexicographically most infeasible edge. See Orlin (1983) for more details. We illustrate the dual simplex pivot rule in Figure 2. pivoted out corresponds to edge (2, 3), the only red edge. pivoted in corresponds to the edge (1, 6). --1IIIII DDil - - -·^ The variable The spanning tree obtained subsequent to the pivot is given in Figure 2. I'0-- The variable .I_._..... 3 0 2 Figure 2. A strongly feasible spanning tree solution obtained from Figure 1 by a dual pivot. 5. We say that of T j and if PT(i, j) PT(i, j) has no yellow edges. induce a partial order e and e' is a red-green chain in ST as follows. are red and if T We write that if edges T. We illustrate these concepts in Figures 3 and 4. Suppose that problem (1) but that B B PT(e, e') T. e e' in is a red-green chain in is not strongly feasible. Let T be the be the partial order on the red ST edges induced by the red-green chains. S is an ancestor is an optimal basis for the network flow corresponding spanning tree, and let elements in i The red-green chains in ST THEOREM 1. if Let t be the number of minimal Then the number of dual pivots using procedure (4) to create a strongly feasible basis (or prove that none exist) is at least t and at most PROOF. tm. Let dual pivots, where T, T TO , ... , Tr be the sequence of trees obtained by is the tree corresponding to the original basis. In addition, we define the following notation. vk = set of green vertices in Tk. Ek = set of maximum red edges in Tk. Sk = partial order on the red edges induced by k t = number of minimal red edges in k s = dilworth number of Tk k S k Sk, i.e., the minimum number of k red-green chains to cover the red edges of pk(i, j) = PTk(i, ) = the path on Tk from i T to j. To complete the proof, we will prove the following relations, all of which are valid for integers L I j, k [O..r-l]. +l,...,k. Here the notation [j..k] refers to the set of 0 0 0 2 Q Figure 3. 010 0 A tree with its corresponding feasible flow. I 1 Figure 4. I-i-----L- The partial order induced by the red-green chains of the tree of Figure 3. Elements (2,0) and (3,1) are maximum. Elements (2,0), (7,5) and (8,6) are minimal. _ iBrl 8. sl_ __ 6. l Vk+ 1 vk (5) Vk + l =V If !Ekl < sk tk. tk 1 k then IEk+ I < IE kI (6) k (7) (8) tk + l < t (9) We will prove the relations (5) - (9) below. First we will investigate the consequences of these relations. tO The fact that the number of pivots is at least since follows from (9) tr = O. IEki < tO From (7), (8) and (9) we see that Thus the number of consecutive iterations for which for t0 - 1 by (6) (If Vk + l $ Vk for which at most Vk 0 then is at most Ekl > 1 .). k Vk+ [..r]. = Vk is at most Since the number of iterations by (5), the total number of iterations is m t °m = tm. To prove (5) - (9) we consider tree is the edge that is pivoted in at the Suppose that edge e = (i5, i4) Tk. Suppose that k-th pivot, and thus e' = (i2, i3) e' is the edge pivoted out of tree Tk+l - Tk. T . Now let us consider Figure 5, which represents the circuit created upon adding edge (i2, i3 ) to Tk. In Figure 5, i0 "edges" in Figure 5 represent paths in is the source vertex T . 0, and the Since we will often refer to the paths in Figure 5 we will sometimes drop the superscript k. We do not assume that the vertices in Figure 5 are distinct. example, i = i4 then If, for is the trivial path consisting of a P(il, i4) single vertex. The colors of the edges in Tk + l (10.1) Edge is yellow in e' = (i2, i3) (10.2) If edge e e b P(i5, i3 ) may be summarized as follows. and is colored the same in Tk e T k+1 T - e, then and in Tk+ l 7. (10.3) If edge e P(i5, i3 ) e orientations in Tk then and e Tk+l. has different (Switching orientation changes red edges to yellow and changes yellow edges to red.) We are now ready to prove (5). Tk . in i5 i pk(o, v). Then k+1. T Otherwise k+1 Since * Let * P that k+(0, v) V k + l = Vk . e e e E k is green in and v is green * Ek+l c Ek i2 * pk(O, e ), and i2 is red in Tk. We will now prove that k+1 - Ek + l , this will complete the proof of (6). be a maximum red edge in is maximum, k We first claim that yk+l _-V k , contrary to assumption. i3 k c E. Since pk(O, v) = v Thus (5) is true. . Suppose now that E Thus Suppose that vertex e P . k+1 Tk In fact P * Let P * k+l =P (O, e ). n P(i5, i3) = 0. Thus k T. is a maximal red edge in We have thus shown and thus (6) is true. Relation (7) is immediate since the set of maximum red edges forms an Sk . (An anti-chain is a set of unrelated elements in anti-chain in To see that relation (8) is valid, we first note that Sk . since the minimal red edges are an anti-chain in ei let Ri denote the maximal red-green chain of We claim that each red edge sk < tk show that minimal in Pk(e', e) k P . e' of Tk is in some chain and complete the proof. Then e' Tk ei ei tk For each red edge containing ei. Ri, and this will Suppose that for some red edge sk Sk). e' k in Sk. is not Then c Ri, and thus (8) is true. We now consider relation (9). edges of Tk. Mk Let denote the set of minimal red Our proof first takes into consideration the set Mk n Mk+l We state the result as Lemma 1. LEMMA 1. Then __s_l e* E Mk _r Suppose that if and only if * T e e* T u Tk+ T1 and that M+l. ______ * e P(i4 , i3 ). III 8. PROOF. Suppose that e is a maximum red edge in Mk E Tk, and e* since Tk+l is yellow. P(i5 , i3 ) contradicts that Mk e and that = e* P e* ~ P(i0 , i4 ). kl T (10) P(e*, e') e'. e* Mk+l be a red-green (i2 , i3) i P Then P does not contain k T. * it follows that P = P(e*, e') e'. e* I P(i3, i5 ). and E 1Mk+l This Suppose further that is a red-green chain in Since Thus no edge of . (i5 , i4) M. E terminates at the red edge a path in P Since We suppose that Therefore, the chain and by Suppose now that e* Let terminating at the red edge (i2 , i3) any edge of P(i4 , i3). P(i0 , i4 ). and we will derive a contradiction. chain in e* P* (i4 , i5 ) * e that is maximum, we know that is in (i5, i3 ) Thus contradicts that Tk k+l E and thus P* is also , completing the proof of the Lemma. O To complete the proof of (9) we will define a into (but not necessarily onto) at most one element of Mk Mk . 1:1 M k+ l mapping of However, we will show that there is that is not in the range of the mapping, and this will complete the proof. Let f M k+l + k Mk be defined as follows. let f(e*) = e . For e* E P(i 3 , i5 ) n Mk+l P(i3, i5 ) then let For * e E By Lemma 1, we are left with edges on the path let that is closest to f(e*) e . If P(i3, be the unique yellow edge Pk+l (e*, i5) we e' i5 ). in has no yellow edges, f(e*) = (i5 , i4 ). We first note that f(e*) is red in Tk by relation (10). note that the mapping is 1:1. such that In such a case, one can show that f(e*) = f(et). Pk+l(e', e*) Mk+l k k+ l Mk n Mk+, Otherwise there are two edges is a red-green chain and thus at most one of We also e P and e' (e*, e') or e*, e' is in i5 i2 Figure 5. The circuit created by adding edge (i2 , i 3 ) to Tk. ir_*___DII__·___1_111______ - 9. in Tk chain in of Pk+l(e We claim that P(i5 , i3 ). be on the path (Otherwise, P(e, e * than is that Pk+l(e*, i') edge e e".) Tk+ l e" e But then is a P f(e*) k+l e" since (i', P must e") is We now claim e". e than is e', This completes the proof of the Pk(i, i such that Mk - f(Mk+l). P(i5, i3 ) attention to the path Let i 'tk+l tk - 1", we show that By Lemma 1, we may restrict e' i* e* r Mk n P(i*, i4 ), then We claim first that if P(i3, i5) be the vertex on is a red-green chain and such that 3) To see this, we let e . and P(i5 , i3 ), is closer to f(e*). e" tk+lt < there is at most one edge in to We note that Otherwise, there is a yellow To complete the proof of the relation i5. T terminating at the red edge is a red-green chain. on the path. k(i ) u k(e', Moreover, Tk. is yellow in e Since contradicting our definition of to = P is a red-green chain terminating is yellow in e" since i5) a red-green chain in relation e") be the last vertex i' This now contradicts our definition of red-green chain. closer to Thus is a red-green e", and this will complete the contradiction. at the red edge is Let e". P(i5 , i3 ). u Pk+l(i', ') i , P* = Pk(e', e") and that terminating at the red edge that is also on the path P e" e' = f(e*) Suppose that Tk. is a minimal red edge f(e*) We now prove via a contradiction that be the yellow edge in Pk(e*, i3 ) e* k* 3 Pk(i , i ) n Mk. Suppose that feasible. Let t f(Mk+l). e' E This completes the O proof of Theorem 1. THEOREM 2. E that is closest A symmetric argument to the one given above shows that Finally, there is at most one edge in is closest B is a feasible basis that is not strongly be the number of minimal red edges in the partial order induced by the tree corresponding to basis B. Then the number of pivots e). 10. required to reach strong feasibility is at least t. Moreover, if the directed graph is complete and if we are permitted to pivot in any edge, then the minimum number of pivots to reach strong feasibility is exactly PROOF. An examination of the proof in Theorem 1 "t k+ that t. t-k 1", will show that the proof does not rely on the fact that the edge pivoted out is a maximum red edge. Thus the number of dual pivots required to reach strong feasibility is at least exactly t t. To prove that there is a sequence of pivots to reach strong feasibility, we prove the equivalent result that there is a single pivot that reduces the number of minimal red edges from Let t to P(e*, e') minimal red edge of P(e*, e'). edge t - 1. be a red-green chain from a maximum red edge e'. Let i and j T' has at most (i, j) and pivot out t - 1 minimal red edges. If we consider Figure 5 once again, we note first that and that i3 = j. Thus P(i4, i3 ) any minimal red edge in T' minimal red edge in Since minimal red edges in 4. T. T' is a red-green chain in does not lie on e' is at most to a be the initial and terminal vertices We claim that if we pivot in edge e*, then the resulting tree e* P(i3 , i5 ) i4 = i1 = i2 = i T. Moreover, and thus is a T - T', it follows that the number of 0 t - 1, completing the proof. The Parametric Network Flow Algorithm Consider the parametric linear program Minimize Subject to Lg(E) cx Lg(G) Ax = b + g(G) x > O. We will soon specify a vector-valued function Lg(e) very efficiently. Our choice of g g for which we can solve is based on ideas from Edmonds-Karp scaling technique and on the following Lemma concerning network flows. _ III 11. LEMMA 2. Suppose that min(cx : Ax = b, x > 0). flow problem (1) is a strongly feasible basis for the network B b' < b, If Then the following are true. n is integral and Z (bi - b) < , then B b is also feasible for the network flow problem min(cx : Ax = b', x 2>0). (2) b' If b and if is feasible for the network flow B min(cx : Ax = b', x > 0), then problem be the spanning tree corresponding to the T Let By hypothesis, upward edge of has no red edges and thus the flow in any T b, the flow in any upward edge of To obtain the basic flow of Z(bi - b E T B and is at least one. from the basic feasible flow of b' units of flow along the path b i - bi : i By the unimodularity of is strictly positive. T the integrality of one sends for Statement (2) is proved as part of Theorem 1 of Orlin (1983). We next consider (1). B. 0) b* < b. b' PROOF. basis is also feasible min(cx : Ax = b*, x for the network flow problem all B PT( 0 , i). b, Since 1, the resulting flow is non-negative and hence [l..m]) feasible. Let a bi Let us now rewrite i + 1)1 : 1 t = max(rlog(Ibi < m). as t-l b i = bti2t - bki2k , Z for iE [l ..m] i. We now define (11) k=O where bki 0 or 1 for all is For each triple i E [l..m] , g = (gi) as follows. of integers with i, j, E [0..t-l] , let j E [O..m-l] , and Z bki2k if j [i..mJ k=O gi(Im + j) -1 Z k= 0 (12) bki k 2k if j [O..i-J. 12. The Parametric Network Flow Algorithm (13.0) Obtain an optimal strongly feasible basis = tm. for for L g('). solution. for L (e) (We will discuss this step in more detail below). Determine the minimum integral value (13.1) B If O' O' such that B 0, then quit with the optimum basic feasible < Otherwise, continue. Perform dual pivots using procedure (4) until either (13.2) strongly feasible basis some is obtained or B partition Lg(e) (a) a (b) F(T, e) = 0 In case (a), return to step (13.1). T. is feasible In case for (b), into two network flow problems as described by Cunningham (1976). Suppose that the parametric algorithm (13) is used to solve THEOREM 3. Lg() most with mb*, where (11) of e* We will henceforth abbreviate B (14) and (15) B Lg(e) is optimal and strongly feasible for and that such that is the total number of ones in the binary representation b* b. PROOF. the basis Then the total number of pivots is at defined as in (12). g ' L(O'). L(o). L(O*) is the minimal integral value of is feasible for ' < as Suppose that for the integer chosen in (13.1) We claim that . The number of dual pivots to create a strongly feasible basis for L(1') is at most m(e* - '). Relation (14) is a consequence of (1) of Lemma 2 and our construction of g. (In order to apply Lemma 2 it will be necessary to divide the right hand side coefficients b - g(e) a suitable choice of 2k k.) We now consider (15). · by the least common divisor, which is Let T be the optimal spanning tree for 1_··rC_l____l___l_____l____lslll___ for III 13. P (e*). in (13), V: {i ISI PT( 0, path S Let i) gi(') < gi(O*)}. e'. for i E S, it follows that no edge of any of these paths is Moreover, since we are sending flow along each for L(O*).) most ISI. at most Thus the set L(O'). {PT( 0 , i) : i E S} red-green chains that covers all of the red-edges of ISI with respect to g e* - yellow with respect to the flow for is a set of By our construction of L(e'). (No other edge is red since Thus the number of minimal red edges in T is strongly feasible T T for L(O*) is at By Theorem 1, the number of pivots to reach strong feasibility is m(O* - mSI '). Initialization of the Algorithm In step (13.0), we assume that we start with a strongly feasible basis for the network flow problem Mimimize cx Subject to -Ax = 2tb ' x where or b' = 0 i -1 We rewrite this problem as P (tm). (16) 0 according as b 1 is non-positive or positive. Then (16) is a shortest path and may be solved via a number of different procedures. If the optimum basis for the shortest path problem is not strongly feasible, then we may obtain a strongly feasible optimum basis with at most m2 (In fact, the simplex algorithm additional pivots, as proved in Theorem 1. with Dantzig's pivot rule solves the shortest path problem in a number of pivots that is bounded by a polynomial in On the Binary Representation of IVI, as proved by Orlin (1983)). b The algorithm given above also works if the function g(e) monotonically decreasing rather than increasing. (It does rely on monotonic). -b ti In this case we could write 2t + Z(bki2k : k e [0..t-l]). ki bi is g being as In this case, the binary representation 14. of bi is the ordinary one if b i > 0. The previous representation was the ordinary representation of negative integers If g bi. is monotonically decreasing, the algorithm works essentially the same way as before except that the roles of yellow edges and red edges are reversed. A Speed-up Technique In (13) we defined the function g in a specific way. However, the computational bound would be valid if we chose any parametrization such that g(O) differs from bit of accuracy. g( + 1) in at most one component and only in the last It may be worthwhile in practice to consider a heuristic procedure that determines which component should vary at the value . In this way one may be able to decrease the number of pivots. We also note that the pivoting technique consists of dual pivots. Unfortunately performing dual pivots requires O( Ef) steps per iteration as opposed to the faster methods for performing primal pivots. Some Concluding Remarks Although the above procedure was developed primarily for theoretical reasons, we hope that the algorithm will prove to be efficient in practice. As of this time, we have insufficient computational experience with the algorithm to assess its efficacy. The above parametric network simplex algorithm runs in polynomial time, i.e., time that is polynomially bounded in the size of the data. It is an interesting open question as to whether the number of pivots is bounded by a polynomial in IV!. It appears that the "equivalence" arguments of Lemma 3 of this author (1983) are not strong enough to prove such a bound for the parametric algorithm. 1_1 _ REFERENCES Cunningham, W. (1976). 11, 105-116. A network simplex method. Dantzig (1963). Linear Programming and Extensions. Press. Princeton, N.J. Mathematical Programming Princeton University Edmonds, J. and R. Karp (1972). Theoretical improvements in algorithmic efficiency for network flow problems. Journal of the ACM 19, 248-264. Ikura, Y. and G. Nemhauser (1983). Unpublished manuscript. Orlin, J. (1983). On the simplex algorithm for networks and generalized networks. Working Paper. Sloan School of Management, MIT. Zadeh, N. (1973). A bad network flow problem for the simplex method and other minimum cost flow algorithms. Mathematical Programming 5, 255-266. -- -. I -- --- - .....'--- - - -... ----- - .I-I.........--- I.---I. --... , ".·