0 is kept saturated. Define θ¯ = min λ, min{ye | e ∈ L− } as the upper bound on θ coming from [1] and [2], which is trivial to compute in O(m) time. The bound from [3] is trickier since |P| is “large”, and so needs to rely on O y . The next two lemmas show that in [3] it suffices to consider only paths P with l(P ) = 0. Lemma 16. Suppose that we update y to y via θ where θ = min{gap(P )/(1 − l(P )) | l(P ) ≤ 0} < min{ye | e ∈ L− },
(11)
i.e., that θ is determined by [3] and not by [1]. Further suppose that Pˆ , Q ∈ P(λ ) with xQ > 0. Then (12) l(Pˆ ) + l(Q) = l(Pˆ ×e Q) + l(Q×e Pˆ ). Lemma 17. If (11) is true, then this minimum is attained at some P with l(P ) = 0. Thus [3] becomes θ ≤ gap(P ) for P such that l(P ) = 0, proving that θ is an integer, and so y and λ areintegral. To compute θ, we take advantage of knowing that it is an ¯ − θ¯ . If there are no violating paths, then we can just set integer. First call O y + θl|λ ¯ Otherwise, the new value of θ is the largest θˆ ∈ (0, θ) ¯ such that O y + θl|λ ˆ − θˆ θ = θ. returns no violating path. This can be determined via binary search with O(log rmax ) ˆ costs O(m) for each θ, ˆ the whole process of calls to the oracle. Since computing y + θl determining the step length takes O(log rmax (m + PO)) time. Lemma 18. These primal and dual updates preserve (OPT(λ) i–iii). 5.2 WAF Algorithm Running Time It is easy to construct examples where x is not augmented during an iteration (but y and λ are changed). Suppose that an iteration changes y, λ to y , λ , but does not change x. Let R be defined w.r.t. y and R w.r.t. y , and let T and H denote elements whose heads and tails are reachable via PAS’s in P(λ) using x and R, and T and H denote the same in P(λ ) using x and R . Lemma 19. If a non-terminal iteration changes y, λ to y , λ but does not change x, then (13) T ⊆ T and H ⊆ H . Lemma 20. Suppose that a non-terminal iteration changes y to y but does not change x. Then at least one inclusion in (13) is proper.
108
M. Martens and S.T. McCormick
Theorem 21. The WAF algorithm runs in O min{rmax , m2 U } · (log rmax (m + PO) + mU (m3 nU + mPO)) time, and the final x and y are integral optimal solutions. Notice that Theorem 21 also gives a constructive proof of Theorem 1. The running time bound of Theorem 21 is only pseudopolynomial, as it depends on rmax and U . One can adapt a construction of Zadeh [12] to demonstrate that the dependence on rmax cannot be removed. Zadeh constructed a family of instances of min-cost flow parametrized by k such that instance k has O(k) nodes, O(k 2 ) arcs, and SSP takes O(2k ) iterations. So far we have dealt with the objective to maximize the total weight of a flow, regardless of its actual flow value. However, it is easy to adapt our algorithm to the case where we want a flow that routes the maximum number of units possible and whose weight is maximum among those flows. We call such a flow a maximum abstract flow at maximum weight (MAFMW).
6 A Polynomial Capacity-Scaling WAF Algorithm The seminal paper by Edmonds and Karp [2] pointed out that scaling is a useful technique for turning algorithms that augment a feasible solution into algorithms that can find an optimal solution in weakly polynomial time. For example, [11] uses scaling to show that augmentation in strongly polynomial time and optimization in strongly polynomial time are equivalent for 0–1 optimization problems. When the number of positive paths is strongly polynomial, our I MPROVE routine is strongly polynomial, but our problem is not 0–1, so we cannot use the results in [11]. In theory we could choose to scale either the rewards rP or the capacities ue . It is not clear how to scale the rP so that (1) is preserved. Hence we scale the capacities. Recall that U is the largest capacity of any element, and set b = log2 U (one less than the number of bits needed to represent the largest capacity). For 0 ≤ k ≤ b + 1, define uke = ue /2k , the k-th scale of u. Thus ub+1 = 0, ub is a 0–1 vector, and u0 = u. Since the ub instance has U = 1, Theorem 21 shows that the algorithm computes x and y optimal for ub in O(min{rmax , m2 } · (log rmax (m + PO) + m4 n + m2 PO)) time. Clearly 2x and y are optimal for capacities 2ub . Note that 2ub is “close” to ub−1 in the sense that ub−1 − 2ube is 0 or 1 for all e ∈ E. Define the set of elements whose e − 2uke = 1}, and capacities need to be incremented at scale k as I(k) = {e | uk−1 e E χ(e) ∈ IR as the characteristic vector of e. We would like to replace u := 2ub by u + χ(e) for each e ∈ I(b) and then modify the optimal x, y for u to a new optimal x , y for u + χ(e). The next section develops a subroutine R E O PT(e; r, u) which does this. Thus if we call R E O PT for each e ∈ I(b) in turn, we will get x and y optimal for ub−1 , and we can continue like this until we get x and y optimal for u0 = u. 6.1 Solving the Incremental Capacity Subproblem The input to R E O PT is an instance with rewards r and capacities u, x and y optimal for r and u, and some e ∈ E. The goal is to modify x and y so they are optimal for r and u + χ(e). Notice that if ye = 0, then x = x and y = y are again optimal for u + χ(e),
A Polynomial Algorithm for Weighted Abstract Flow
0 h ∞
2 d 9
3
0
e 3
g ∞
λ = 8: xabcd = 2, RAMC = {b}, yb = 1 λ = 7: xaecd = 3, RAMC = {b, e}, yb = 4, ye = 3
c 5
λ = 4: xaf d = 4, RAMC = {d}, yd = 2
0 f ∞
7 3
0
4
109
λ = 2: xag = 2, RAMC = {a}, ya = 2 λ = 0: done
b 2 8
4
2
2 a 11
Fig. 3. An example of the WAF Algorithm in action. Reward values are in circles next to paths, so that, e.g., raecd = 7. For each element e, the value of ue is to the right of e, and the optimal value of ye is in a box above and to the left of e. The dashed path aeh does not belong to P(0) since gap(aeh) = 2 > 0. If we call I MPROVE on P(0) it returns L = ({a}, ∅).
and so the algorithm first deletes all such elements from I(b). In theory we can use ye as a guide: as the dual variable corresponding to the x(e) ≤ ue constraint, it should tell us how the optimal objective value changes when we replace u by u + χ(e). In practice, degeneracy often implies that the change in optimal objective value is different from ye . R E O PT changes the given dual optimal y into an alternate dual optimal solution as necessary to be able to change x while maintaining complementary slackness. We now change flows on two generalized PAS’s (gPAS’s). Let us first consider a simple case. Suppose that there is a PAS C tail to tail(e) in P(λ) w.r.t. x and y, i.e., that I MPROVE returns RAMC L with e ∈ T . Notice that it is easy to reverse everything in I MPROVE such that it searches for PAS’s from head(f )/tail(f ) to t, instead of from s; call this R EV I MPROVE; such a “reversed” PAS is one type of gPAS. Further suppose that R EV I MPROVE finds a PAS C head from head(e) to t. Then we could glue together C tail , e, and C head into an AS such that we could call AUGMENT using u + χ(e) and it would change x into x such that x (e) = x(e) + 1. Then it is easy to see that x and y are jointly optimal w.r.t. u + χ(e). However, it often happens that L blocks any PAS from s from reaching tail(e). For the example in Figure 3, L prevents a PAS from s to the tail of every element other than a. In this example, suppose we are interested in u + χ(d). Then the correct flow change is to push one unit of flow through the gPAS C tail that uses (a, t)ag backwards, then uses (a, d)af d forwards to tail(d), together with the trivial reverse PAS from head(d) to t; this is a “cycle” from t to t containing d. Note that in general, gPAS’s to the tail of our key element such as C tail that “start from t” follow the rules for a PAS from s. To find such gPAS’s we adapt I MPROVE to
110
M. Martens and S.T. McCormick
a Phase II version with this trick: set t ∈ L+ in the initialization, which is equivalent to adding new path st to P; we call ordinary I MPROVE without this initialization Phase I I MPROVE. In Phase II I MPROVE we also skip the check for an AS (because putting t ∈ L+ otherwise creates spurious AS’s). Lemma 22. If ye > 0, then either Phase I or Phase II I MPROVE finds a gPAS to tail(e). Often neither R EV I MPROVE nor Phase II R EV I MPROVE (which artificially puts s into L+ ) can find a gPAS from head(e) to t. Let lt denote l with the extra lst = +1 component. By (OPT RAMF i) lt (P ) ≥ 1 for all P ∈ P(0), implying that l(P ) ≥ 0 (since all P contain s). In such cases we treat l as a direction vector, and consider the move y = y + αl for some step length α ≥ 0. Two factors determine α: (a) To keep y ≥ 0 we must have that α ≤ min{yf | f ∈ L− }; since f ∈ L− implies that yf > 0, this min
0 (P ) is positive. (b) To keep feasible we must have that α ≤ min −gap | P s.t. l(P ) < l(P ) 0 ; since l(P ) ≥ 0 for P ∈ P(0), all P with l(P ) < 0 have gap0 (P ) > 0, and so this min is also positive. A lemma similar to Lemma 17 shows that when (b) determines α, it does so at some P with l(P ) = −1, and so α is a positive integer. A binary search similar to the computation of θ can be used to compute α in O(log rmax (m + PO)) time. Changing to y causes all P with l(P ) > 0 to leave P(0), but this is okay since l(P ) > 0 means that xP = 0. If α is determined by (a), changing to y would mean that ye = 0 for some e’s. If any such e’s are in I(b), we just remove them from I(b). If α is determined by (b), changing to y causes some new P ’s to enter P(0). Lemma 23. When we set y = y +αl as above, y is an alternate optimal dual solution. Using arguments similar to Lemma 20 we can prove that after O(m) such dual changes, either ye becomes zero (in which case no primal change is necessary), or a gPAS from head(e) appears. Then we AUGMENT along the two gPAS’s to produce a new optimal x. 6.2 The Capacity-Scaling Algorithm With R E O PT in place, it is now easy to write the overall capacity-scaling algorithm and derive its running time. Theorem 24. The capacity-scaling algorithm solves WAF in O log rmax (m3 +m2 PO) + m6 n + m4 PO time. This is a (weakly) polynomial algorithm for WAF, as compared to the original WAF algorithm, which is only pseudopolynomial.
References 1. Applegate, D.L., Cook, W.J., McCormick, S.T.: Integral Infeasibility and Testing Total Dual Integrality. OR Letters 10, 37–41 (1991) 2. Edmonds, J., Karp, R.M.: Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems. J. ACM 19, 248–264 (1972)
A Polynomial Algorithm for Weighted Abstract Flow
111
3. Ford Jr., L.R., Fulkerson, D.R.: Maximal Flow through a Network. Canadian J. of Mathematics 8, 399–404 (1956) ´ An Application of Simultaneous Diophantine Approximation in Com4. Frank, A., Tardos, E.: binatorial Optimization. Combinatorica 7, 49–65 (1987) 5. Gr¨otschel, M., Lov´asz, L., Schrijver, A.: Geometric Algorithms and Combinatorial Optimization. Springer, Heidelberg (1988) 6. Hoffman, A.J.: A Generalization of Max Flow-Min Cut. Math. Prog. 6, 352–359 (1974) 7. McCormick, S.T.: A Polynomial Algorithm for Abstract Maximum Flow. UBC Faculty of Commerce Working Paper 95-MSC-001. In: An extended abstract appeared in Proceedings of the Seventh Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 490–497 (1995) 8. McCormick, S.T.: Submodular Function Minimization. In: Aardal, K., Nemhauser, G., Weismantel, R. (eds.) Handbook on Discrete Optimization Ch. 7, pp. 321–391. Elsevier, Amsterdam (2006) 9. McCormick, S.T., Fujishige, S.: Strongly Polynomial and Fully Combinatorial Algorithms for Bisubmodular Function Minimization. In: Mathematical Programming; an extended abstract appeared in Proceedings of Nineteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 44–53 (submitted, 2008) 10. Schrijver, A.: Theory of Linear and Integer Programming. John Wiley & Sons, New York (1986) 11. Schulz, A.S., Weismantel, R., Ziegler, G.M.: 0/1-Integer Programming: Optimization and Augmentation are Equivalent. Technical Report No.441/1995, Fachbereich Mathematik, Technische Universit¨at Berlin (1995) 12. Zadeh, N.: A bad network problem for the simplex method and other minimum cost flow algorithms. Mathematical Programming 5, 255–266 (1973)