A Network Simplex Algorithm with O(n) Consecutive Degenerate Pivots
Ravindra K. Ahuja Department of Industrial and Systems Engineering University of Florida Gainesville, FL 32611, USA
[email protected] James B. Orlin Sloan School of Management Massachusetts Institute of Technology Cambridge, MA 02139, USA
[email protected] Prabha Sharma Department of Mathematics Indian Institute of Technology Kanpur 208016, INDIA
[email protected] P. T. Sokkalingam HCL-CISCO ODC Centre Nelson Mannicken Road Chennai 600 029, INDIA
[email protected]
(Revised February 3, 2001)
A Network Simplex Algorithm with O(n) Consecutive Degenerate Pivots
Ravindra K. Ahuja1, James B. Orlin2, Prabha Sharma3, and P. T. Sokkalingam4
ABSTRACT In this paper, we suggest a new pivot rule for the primal simplex algorithm for the minimum cost flow problem, known as the network simplex algorithm. Due to degeneracy, cycling may occur in the network simplex algorithm. By maintaining strongly feasible bases due to Cunningham [1976, 1979], cycling can be prevented but without restrictions on the entering variable, the algorithm can still perform an exponentially long sequence of non-degenerate pivots; this phenomenon is known as stalling. Researchers have suggested several pivot rules with the following bounds on the number of consecutive degenerate pivots: m, n2, k(k+1)/2, where n is the number of nodes in the network, m is the number of arcs in the network, and k is the number of degenerate arcs in the basis. (Observe that k ≤ n.) In this paper, we describe an anti-stalling pivot rule that ensures that the network simplex algorithm performs at most k consecutive degenerate pivots. This rule uses a negative cost augmenting cycle to identify a sequence of entering variables.
1
Department of Industrial and Systems Engineering, University of Florida, Gainesville, FL 32611, USA. Sloan School of Management, MIT, Cambridge, MA 02139, USA. 3 Department of Mathematics, Indian Institute of Technology, Kanpur 208016, INDIA. 4 P. T. Sokkalingam, HCL-CISCO ODC Centre, Nelson Mannicken Road, Chennai 600 029, INDIA. 2
1
1. Introduction The primal simplex algorithm for the minimum cost flow problem, known as the network simplex algorithm, is known to exhibit cycling (that is, an indefinitely repeating sequence of degenerate pivots). Cunningham [1976, 1979] showed that by using specific types of basis, known as the strongly feasible basis, cycling can be avoided. This technique (described in Section 2) starts with a strongly feasible basis, allows any nonbasic arc to enter the basis, but requires that if several arcs qualify as leaving arcs then an arc satisfying a particular property be chosen as the leaving arc. Cunningham [1979], however, showed through a counter-example that the network simplex maintaining strongly feasible basis can still perform an exponentially long sequence of degenerate pivots, a phenomenon known as stalling. Several anti-stalling pivot rules have been proposed by researchers. Cunningham [1979] and Roohey-Laleh [1981] proposed several anti-stalling pivot rules with bounds of O(m) and O(n2) on the number of consecutive degenerate pivots, where n is the number of nodes and m is the number of arcs in the network. Goldfarb, Hao and Kai [1990] also several proposed anti-stalling pivot rules, one of which performs at most k(k+1)/2 consecutive degenerate pivots, where k is the number of degenerate arcs in the basis. (Observe that k ≤ n.) In this paper, we describe an anti-stalling pivot rule that ensures that the network simplex algorithm performs at most k degenerate pivots. This rule maintains strongly feasible basis and uses a negative cost augmenting cycle to identify a sequence of entering variables which prevent stalling. We may point out that the results in this paper do not lead to a polynomial time network simplex algorithm for the minimum cost flow problem. Currently, the only known polynomial time network simplex algorithm is due to Orlin [1997]. 2. Network Simplex Algorithm for the Minimum Cost Flow Problem In this section, we first present some basic definitions and notation. We then give the linear programming formulation of the minimum cost flow problem and describe the network simplex algorithm. Let G = (N, A) be a directed network (or graph) defined by a set N of n nodes and a set A of m directed arcs. Each arc (i, j) ∈ A has an associated cost cij denoting the cost per unit flow on that arc, and a capacity uij denoting the maximum amount of flow that can be sent on the arc. Each node i ∈ N has an associated number b(i) representing its supply/demand. A path in G = (N, A) is a sequence of nodes and arcs i1, (i1, i2), i2, (i2, i3), i3, … , (ir-1, ir), ir satisfying the property that either (ik, ik+1) ∈ A or (ik+1, ik) ∈ A for each k, 1 ≤ k ≤ r-1, and all nodes visited are distinct. For simplicity, we refer to a path by the sequence of nodes i1, i2, i3, … , ir it visits; we may alternatively refer to it by the arcs contained in the path. A directed path is a sequence of nodes i1, i2, i3, … , ir such that (ik, ik+1) ∈ A for each k, 1 ≤ k ≤ r-1. A directed cycle is a directed path i1, i2, i3, … , ir together with the arc (ir, i1), and a cycle is a path together with the arc (ir, i1) or (i1, ir). We call a network to be connected if the network contains at least one path between any two nodes. A tree is a connected graph that contains no cycle. A subgraph B is a spanning tree of G if B is a tree of G containing all of its nodes. In a spanning tree B, there is a unique path between any pair of nodes. In the minimum cost flow problem, we wish to determine a least cost shipment of a commodity through a network that satisfies the demands at certain nodes from the available supplies at other nodes. 2
The decision variables in the minimum cost flow problem is the flow xij on each arc (i, j) ∈ A. This problem can be formulated as the following optimization problem:
∑ (i, j)∈A cijxij
Minimize
(1a)
subject to
∑
{ j:( i , j) ∈A}
x ij −
∑ x ji = b(i),
{ j:( j,i ) ∈A}
lij ≤ xij ≤ uij,
for all i ∈ N,
(1b)
for all (i, j) ∈ A.
(1c) where Σ i=1b(i) = 0. n
A basic solution of the minimum cost flow problem is denoted by a basis structure (B, L, U). The set B denotes the basis. The sets L and U denote, respectively, the sets of nonbasic arcs at their lower and upper bounds. A basis structure (B, L, U) is called feasible if by setting xij = 0 for each arc (i, j) ∈ L and xij = uij for each arc (i, j) ∈ U, the problem (1) has a feasible flow x satisfying (1b) and (1c). It is well known that the basis B is a spanning tree. We assume that the basis is hanging from a specific node called the root node r (we can select the root node arbitrarily). The basis can be stored using predecessor (or, parent) indices. The tree arcs are either upward pointing (towards the root) or downward pointing (away from the root). If an arc (i, j) is a downward pointing arc, then node i is the predecessor of node j. We denote by pred(i) the predecessor (or, parent) index of each node i ∈ N\{r}; In the basis, there is a unique path connecting any two nodes; we refer to this path as a basis path. For each node i ∈ N\{r}, let P[i] denote the arcs in the basis path in B from node i to the root node. For nodes i ∈ N and j ∈ N, let P[i, j] denote arcs in the basis path in B from node i to node j. Observe that P[i, j] = P[j, i], and P[i, j] = P[i]∪P[j]\P[i]∩P[j]. We say that an arc (i, j) ∈ A is a free arc if 0 < xij < uij, otherwise it is a restricted arc. Observe that all nonbasic arcs are restricted arcs, whereas basic arcs can be either free or restricted. The set of free basic arcs define a set of subtrees; we refer to each such subtree a free component. One can determine all free components of B in O(n) time using a graph search algorithm. Associated with nodes of G is a vector π of node potentials. Let cπ denote the reduced costs
defined as cijπ = cij - π(i) + π(j) for each arc (i, j) ∈ A. For the network simplex algorithm, the node
potentials are chosen so that cijπ = 0 for each arc (i, j) ∈ B. This vector of node potentials is commonly called the simplex multipliers. A feasible basis structure is an optimal basis structure of the minimum cost flow problem if it is possible to obtain a set of node potentials π so that the reduced costs satisfy the following optimality conditions: cijπ = 0 for each arc (i, j) ∈ B,
(2a)
cijπ ≥ 0 for each arc (i, j) ∈ L,
(2b)
cijπ ≤ 0 for each arc (i, j) ∈ U.
(2c)
3
Given a basic feasible flow, and a vector π of node potentials, a nonbasic arc (i, j) not satisfying (2b) or (2c), whichever is applicable, violates its optimality condition. We refer to an arc violating its optimality condition as an eligible arc. The following algorithm specifies the steps of the network simplex algorithm. algorithm network simplex; begin determine an initial basis structure (B, L, U); let x be the flow and π be the node potentials associated with this basis structure; while there are eligible arcs do begin select an eligible arc (k, l); add arc (k, l) to the basis and determine the leaving arc (p, q); update the basis structure and the solutions x and π; end; end; At each iteration, the network simplex algorithm selects an eligible arc (k, l) to enter the basis. Adding arc (k, l) to the basis forms a unique cycle W, which we call the pivot cycle. If (k, l) ∈ L, then we define the orientation of W along arc (k, l); otherwise, we define it opposite to the orientation of the arc (k, l). We send maximum possible flow δ in the pivot cycle along the orientation of W without violating any of the lower and upper bound constraints of arcs in the pivot cycle. At this point, some arcs in the pivot cycle block further increase in the flow; we call such arcs as blocking arcs. The algorithm drops one such blocking arc (p, q) and obtains a new basis structure. This completes one pivot operation. This pivot operation is degenerate if δ = 0, and non-degenerate if δ > 0. The algorithm performs pivot operations until there are no eligible arcs. Our network simplex algorithm maintains a strongly feasible basis at every iteration. We say that a basis structure (B, L, U) is strongly feasible if we can send a positive amount of flow from any node i in the basis tree B to the root node r along the basis path from i to r without violating any of the flow bounds of arcs. The following property immediately follows from this definition: Property 1. In a strongly feasible basis each basic arc (i, j) with xij = 0 must be an upward pointing arc, and each basic arc with xij = uij must be a downward pointing arc. The network simplex maintaining strongly feasible basis must select the leaving arc appropriately so that the next basis is also strongly feasible. Let W(k, l) be the pivot cycle formed by adding an arc (k, l) ∈ L to the basis tree. (If the entering arc is (u, v) ∈ U, then we define k = v and l = u.) We define the apex w of this cycle as the first common ancestor of nodes k and l. The pivot cycle consists of the arc (k, l), the basis path from node l to node w, and the basis path from node w to node k. After sending flow in this cycle, the algorithm identifies blocking arcs. If the blocking arc is unique, then it is selected as the leaving arc. If there are more than one blocking arcs, then the algorithm selects the leaving arc as per the following rule: Leaving Arc Rule: Select the blocking arc farthest from the entering arc when arcs are traversed along the orientation of the cycle. This pivot rule implies that if arc (k, l) is pivoted in and the pivot is degenerate, then arc pivoted out is the restricted arc on the path from node k to node r that is nearest to node k. 4
It can be shown (Cunningham [1976]) that the above rule guarantees that the next basis is strongly feasible. 3. Augmenting and Valid Cycles Let C be a cycle in G. Let C denote the set of forward arcs and C denote the set of backward arcs in C. A cycle C is an augmenting cycle in G with respect to a flow x if xij < uij for each arc (i, j) ∈ C , and xij < uij for each arc (i, j) ∈ C. We define the cost of an augmenting cycle C, c(C), as the change it will cause to the total flow cost if unit flow is augmented along the cycle, that is, c(C) = π π ∑ (i, j)∈C cij − ∑ (i, j)∈C cij. We let cπ(C) = ∑ (i, j)∈C cij − ∑ (i, j)∈C cij . It is well known that for any set of
node potentials π, cπ(C) = c(C). We call an augmenting cycle C a negative cost augmenting cycle if cπ(C) = c(C) < 0. We can identify a negative cycle in G by using variants of shortest path algorithms (that can handle negative arc costs). The paper by Cherkassky and Goldberg [1999] describes several negative cycle detection algorithms. We say that nodes i and j are in the same free component if P[i, j] comprises of free arcs. We say that a negative cost augmenting cycle C is a valid cycle if it satisfies the following property: If C visits two nodes i and j of the same free component, then P[i, j] ⊆ W. We illustrate this property in Figure 1. Figure 1(a) shows a valid cycle 1-4-3-5-10-8-11-9-1, and Figure 1(b) shows a cycle 1-4-5-8-7-1 that is not a valid cycle (because the cycle has two nodes 4 and 5 in the same free component, but the basis path P[4, 5] is not contained in the cycle). Lemma 1. If G has a negative cost augmenting cycle, then G has a valid negative cost cycle. Proof. Suppose that C is a negative cost augmenting cycle. For convenience, suppose that the nodes are renumbered so that the cycle C is 1-2-3- … k-1. Suppose that we label free components in B and let free(j) denote the label of node j. Then two nodes i and j are in the same free component if and only if free(i) = free(j). Observe that C is a valid cycle if and only if the following property holds: all nodes with the same free label are consecutive nodes in C. (For example, if nodes in C have free labels as 1, 1, 2, 2, 3, 4, 5, 5, then C is a valid cycle; and if nodes in C have free labels 1, 1, 2, 3, 4, 2, 5, 5, then C is not a valid cycle.) Suppose that C is not a valid cycle. In this case, there exist two nodes i and j such that i+2 ≤ j, free(i) = free(j), and all nodes i, i+1, i+2, … , j do not have the same free label. For a given node i, if several nodes j satisfy this property, then let node j be the first node with this property. Let Q[i, j] denote the path in C from node i to node j (see, for example, Figure 2). If Q[i, j] has a nonpositive reduced cost, then we replace C by C∪Q[i, j]\P[i, j]; this change keeps the cost of cycle C negative and makes it closer to satisfying the valid cycle property. If Q[i, j] has a negative reduced cost, then the cycle i-i+1- ...-j-P[j, i] is a valid cycle. We repeat this process until we get a valid cycle ♦ Using simple data structures, the proof of Lemma 1 can be used to establish an O(n) time algorithm for converting a negative cost augmenting cycle into a valid cycle. Lemma 2. Suppose that the entering arc (k, l) is in some valid cycle C, and that the pivot is degenerate. If the leaving arc is chosen to maintain strong feasibility, then the leaving arc is not an arc of C. Moreover, C remains valid after the pivot.
5
Proof. Without loss of generality, let us assume that (k, l) is a nonbasic arc at its lower bound. Let (p, q) be the leaving arc. Since the pivot is degenerate, by the leaving arc rule, (p, q) is the first restricted arc on the path from node k to the root node p. Without loss of generality, let us assume that (p, q) is also at its lower bound, and hence q = pred(p). Suppose that (p, q) ∈ C. We will show that this assumption results in a contradiction. There are two cases to consider: Case 1: p = k. We illustrate an example of this case in Figure 3(a). Since (p, q) is a degenerate arc, and the basis B is strongly feasible, (p, q) must be an upward pointing arc. In this case, (p, q) and (k, l) are two arcs of C that are directed out from the same node. This will imply that C is not an augmenting cycle, contradicting our assumption that C is a valid cycle. Case 2: p ≠ k. We illustrate an example of this case in Figure 3(b). As in Case 1, arc (p, q) must be an upward pointing arc. It follows from the leaving arc rule that the basis path P[p, k] comprises of free arcs. Since (p, q) ∈ C, and C is a valid cycle, it follows that P[p, k] ⊆ C. Hence, {(p, q)}∪P[p, k]∪{(k, l)} ⊆ C. But this would imply that C is not an augmenting cycle, again contradicting our assumption. The above discussion shows that the leaving arc (p, q) is not an arc in C. Also notice that a degenerate pivot does not change arc flows. Since arc flows do not change, free components do not change too, and a cycle that is valid prior to a degenerate pivot stays valid subsequently. ♦ 4. The Anti-Stalling Pivot Rule We will now present our pivot rule. Our rule uses a valid cycle to identify entering arcs and uses Property 2 to identify leaving arcs. Anti-Stalling Pivot Rule: if there is an eligible arc (k, l) such that nodes k and l are in the same free component, then pivot in the arc (k, l); else begin find a valid negative cycle C in G with respect to the flow x; while C is valid select an eligible arc (k, l) in W and pivot it in; end; Theorem 1. The network simplex algorithm using the anti-stalling pivot rule performs at most k consecutive degenerate pivots where k denotes the number of degenerate arcs in the basis. Proof. Suppose that x is the current flow. If there is no negative cost cycle with respect to x, then x is optimal flow. This can be determined by solving a single shortest path problem (see, for example, Ahuja, Magnanti and Orlin [1993]). Otherwise, there exist a negative cost cycle, and by Lemma 1, there exists is a valid cycle C. Since C has a negative cost, its reduced cost is negative, and there is an eligible arc (k, l). By Lemma 2, if we pivot in the arc (k, l), then either the pivot is nondegenerate, or else we pivot out a degenerate arc in the basis, and C continues to remain a valid cycle. Since each degenerate pivot pivots in an arc in C, we can have at most |C| such pivots before a nondegenerate pivot occurs (since C is a cycle and every arc in it cannot be pivoted in). In addition, each degenerate pivot pivots in a degenerate arc in 6
B which are bounded by k. Hence there will be at most min{|C|, k} degenerate pivots before a nondegenerate pivot occurs. This completes the proof of the lemma. ♦ We illustrate our pivot rule using a numerical example. Figure 4(a) shows a basis and the valid cycle W = 5-10-8-11-9-7-3-5. The cycle contains three basic arcs and three nonbasic arcs. Suppose that π c5,10 < 0 and we select arc (5, 10) as the entering arc. This pivot is a degenerate pivot and from Property π < 2, the pivot the leaving arc is (3, 2). Figure 4(b) shows the basis after this pivot. Now suppose that c11,9
0, and we select arc (11, 9) as the entering arc. This pivot is also a degenerate pivot and from Property 2, arc (8, 7) is the leaving arc, giving the basis shown in Figure 4(c). Now arc (7, 3) is the only nonbasic arc in the cycle W and we pivot it in. Observe that this pivot will be a non-degenerate pivot and positive amount of flow can be augmented along the pivot cycle 7-3-5-10-8-11-9-7. Acknowledgements: The research of the first author was supported by the NSF grants DMI-9900087 and DMI0085682. The second author was supported by the NSF grants DMI-9810359 and DMI-9820998. References Ahuja, R.K., T.L. Magnanti and J.B. Orlin. 1993. Network Flows: Theory, Algorithms, and Applications. Prentice Hall, Englewood Cliffs. Cunningham, W.H. 1976. A network simplex method. Mathematical Programming 11, 105-116. Cunningham, W.H. 1979. Theoretical properties of the network simplex method. Mathematics of Operations Research 4, 196-208. Cherkassky, B.V., and A. V. Goldberg. 1999. Negative-cycle detection algorithms. Mathematical Programming 85, 277-311. Goldfarb D., J. Hao, and S. Kai. 1990. Anti-stalling pivot rules for the network simplex algorithm. Networks 20, 79-91. Orlin, J. B. 1985. On the simplex algorithm for networks and generalized networks. Mathematical Programming Study 24, 166-178. Orlin, J. B. 1997. A polynomial time primal network simplex algorithm for minimum cost flows. Mathematical Programming 78, 109-129. Rooley-Laleh, E. 1981. Improvements to the Theoretical Efficiency of the Simplex Method. Ph. D. Thesis, University of Carleton, Ottawa, Canada.
7
4
1
1
2
2
3
7
5
8
9
6
10
11
4
3
7
5
8
9
6
10
11
(a)
Figure 1. Ilustrating valid cycles. (a) The cycle 1-4-3-5-10-8-11-9-1 is a valid cycle. (b) The cycle 1-4-5-8-7-1 is not a valid cycle.
(b)
2 P[6, 10] 3
7
5
8
6
10 Q[6, 10]
Figure 2. Proving Lemma 2.
1 1 2 (p, q) 3
2
6
4
7
C
3
7
5
8
(p, q) 5
(k, l)
9 6
(k, l)
C (b)
(a)
Figure 3. Proving Lemma 2.
10
4
1
1
2
2
3
7
5
8
9
6
10
11
4
3
7
5
8
9
6
10
11
(a)
(b) 1
2
4
3
7
5
8
9
6
10
11
(c)
Figure 4. Applying the pivot rule to a numerical example. (a) This figure shows a valid cycle 5-10-8-11-9-7-3-5. (b) The basis when arc (5, 10) enters and arc (3, 2) leaves. (c) The basis when arc (11, 9) enters and arc (8, 7) leaves.