Advanced Algorithms 2.5

Advanced Algorithms 2.5 - one maximum ow problem or by...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: one maximum ow problem or by modifying the instance so that a circulation can easily be found. The cycle canceling algorithm can be used to prove Theorem 1. The proof is by induction. Assume that the initial circulation is chosen to be integral. Now, if at iteration k the circulation is integral, then the residual capacities as well as are also integral. Therefore, the circulation remains integral throughout the algorithm. For the maximum ow problem as discussed in Section 3.1, any negative cost directed cycle must consist of a directed path from s to t along with the arc t; s since the only negative cost arc is t; s. Therefore, in this special case, Klein's algorithm reduces to the well-known Ford-Fulkerson's augmenting path algorithm 8 . Ford-Fulkerson's augmenting path algorithm: 1. Start with the zero ow: f = 0. 2. While Gf contains a directed path P from s to t do push = v;w2, uf v; w along P . min In the next Theorem, we show that the cycle canceling algorithm is correct if the costs and capacities are integral. Theorem 4 If c : E ! Z and u : E ! Z then Klein's algorithm terminates after OmCU iterations where m = jE j, C is an upper bound on the absolute value of any cost and U is an upper bound on the absolute value of any capacity. Moreover, the resulting circulation is optimal. Proof: Since the costs are integral, any cycle of negative cost has a cost of at most -1. Moreover, if v; w 2 Gf then uf v; w 1 which implies that 1. Therefore, at each iteration, the cost of the current circulation decreases by at least 1 unit. On the other hand, since jcv; wj C and jf v; wj U , the absolute value of the cost of the optimal circulation is at most mCU . Therefore, the algorithm terminates after OmCU iterations. At that point, the residual graph does not contain any negative cycle and, hence, by Theorem 3, the circulation is optimal. The bound given in Theorem 4 is however not polynomial. In fact, if the negative cycles or the directed paths in Ford and Fulkerson's algorithm are not appropriately chosen, the worst-case running time of the algorithm is exponential. In Figure 6, we have an instance of the maximum ow problem in which if we augment alternatively along the paths s , 1 , 2 , t and s , 2 , 1 , t, the number of iterations will be 2C since at each iteration we push only one additional unit of ow from s to t. If C = 2n, this gives an exponential bound. Even more surprisingly, the cycle canceling algorithm and the augmenting path algorithm without any speci cation of which negative directed cycle or which directed st-path to select are not correct if the capacities are irrational. In 9 , it is shown that Flow-11 1 c s c 2 1 c t c Figure 5: Numbers on the arcs represent the capacities. The reverse arcs have zero capacities. the augmenting path algorithm can converge to a suboptimal ow if the capacities are irrational and the directed paths are selected in an unfortunate way. To obtain a polynomial running time, we therefore need to specify which negative directed cycle to cancel. If the negative cycle resulting in the maximum cost improvement is selected, the number of iterations becomes polynomial. Unfortunately, nding this cycle is NP-hard. For the maximum ow problem, however, this selection rule reduces to nding the st-path with maximum residual capacity. Such a path can be found in polynomial time for example, by adapting Dijkstra's algorithm. The resulting algorithm, due to Edmonds and Karp 7 , requires Om log U iterations. The time per iteration is Om amortized. Hence we can implement the algorithm with a total running time of Om2 log U Tarjan 20 . For a long time the question of nding a strongly polynomial algorithm and even its existence for the minimum cost circulation problem was kept open. In 1985, Eva Tardos 19 devised the rst such algorithm. In 1987, Goldberg and Tarjan 14 produced an improved version that we will now present. 7 The Goldberg-Tarjan Algorithm De ne the mean cost of a cycle , to be P c, = v;w2, cv; w j,j j,j where j,j represents the number of arcs in ,. The minimum mean cost cycle of a graph can be found in strongly polynomial time, namely in Onm time, by adapting the Bellman-Ford algorithm for the all pairs shortest path problem. Let c, f = min cycles , in Ef j,j denote the minimum mean cost of all cycles in Gf . Goldberg-Tarjan algorithm 14 : Flow-12 The Goldberg-Tarjan algorithm is a cycle canceling algorithm since Gf has a negative directed cycle i f 0. For the maximum ow problem, this algorithm reduces to the Edmonds-Karp shortest augmenting path algorithm 7 in which the st-path with the fewest number of arcs is selected. The Edmonds-Karp shortest augmenting path algorithm requires Om time per augmentation and the number of augmentations is Onm. This results in a running time of Onm2. 1. Let f = 0. 2. While f 0 do push = v;w2, uf v; w along a minimum mean cost cycle , of Gf . min 8 Analysis of the Goldberg-Tarjan Algorithm Before analyzing the Goldberg-Tarjan cycle canceling algorithm, we need some de nitions. De nition 1 A circulation f is -optimal if there exists p such that cpv; w , for all v; w 2 Ef . For = 0, this de nition reduces to the condition 3 of Theorem 3, and, therefore, a 0-optimal circulation is a minimum cost circulation. De nition 2 f = minimum such that f is -optimal. We now show that approximate optimality is su cient when the costs are integral. 1 Theorem 5 If f is a circulation with f n then f is optimal. 1 1 Proof: f n implies that, for some potentials p, cpv; w , n 1for all v; w 2 Ef . Therefore, any cycle , of Gf has reduced cost greater than ,j,j n ,1. Since the costs are integral and the cost of any cycle is equal to its reduced cost, we obtain that any directed cycle of Gf has nonnegative cost. Theorem 3 implies that f is optimal. The following Theorem shows that the minimum mean cost f of all cycles in Gf represents how close the circulation f is from optimality. Theorem 6 For any circulation f , f = , f . Proof: f , f . By de nition, there exists p such that cpv; w , f for all v; w 2 Ef . This implies that cp, , f j,j for any directed cycle , of Gf . But, for any directed cycle ,, c, = cp,. Therefore, dividing by j,j, we obtain that the mean cost of any directed cycle of Gf is at least , f . Hence, f , f . Flow-13 ,f f . To show that ,f f , we want to construct a function p such that cpv; w f for all v; w 2 Ef . Let cv; w = cv; w + ,f for all ~ v; w 2 Ef . Notice that Gf has no negative cost cycle with respect to c:; : ~ since the mean cost of any directed cycle of Gf is increased by ,f . Next, add a new node s to Gf and also arcs from s to v for all v 2 V . Let cs; v ~ be any value, say 0. Let pv be the cost with respect to c:; : of the shortest ~ path from s to v in this augmented graph. Hence, for all v; w 2 Ef , we have pw pv + cv; w = pv + cv; w , f implying that cpv; w f . ~ We are now ready to analyze the algorithm. First, we show that, using f as a measure of near-optimality, the algorithm produces circulations which are closer and closer to optimal. Theorem 7 Let f be a circulation and let f 0 be the circulation obtained by canceling the minimum mean cost cycle , in Ef . Then f f 0 . Proof: By de nition, there exists p such that 2 cpv; w , f for all v; w 2 Ef . Moreover, for all v; w 2 ,, we have cpv; w = , f since, otherwise, its mean cost would not be , f . We claim that, for the same p, 2 holds for all v; w 2 Ef . Indeed, if v; w 2 Ef Ef , 2 certainly holds. If v; w 2 Ef nEf then w; v certainly belongs to ,. Hence, cpv; w = ,cpw; v = f 0 and 2 is also satis ed. Next, we show that f decreases after a certain number of iterations. Theorem 8 Let f be any circulation and let f 0 be the circulation obtained by performing m iterations of the Golberg-Tarjan algorithm. Then 1 f 0 1 , n f : Proof: Let p be such that cpv; w , f for all v; w 2 Ef . Let ,i be the cycle canceled at the ith iteration. Let k be the smallest integer such that there exists v; w 2 ,k+1 with cpv; w 0. We know that canceling a cycle removes at least one arc with negative reduced cost from the residual graph and creates only arcs with positive reduced cost. Therefore k m. Let f 0 be the ow obtained after k iterations. By Theorem 6, , f 0 is equal to the mean cost of ,k+1 which is: P v;w2,k+1 cp v; w ,l l, 1 f l 1 = ,1 , 1 f ,1 , n f ; l where l = j,k+1 j. Therefore, by Theorem 7, after m iterations, f decreases by a 1 factor of 1 , n . 0 0 0 Flow-14 Theorem 9 Let C = v;w2E jcv; wj: Then the Goldberg-Tarjan algorithm nds a max minimum cost circulation after canceling nm lognC cycles log = loge . The initial circulation f = 0 is certainly C -optimal since, for p = 0, we have cpv; w ,C . Therefore, by Theorem 8, the circulation obtained after nm log nC iterations is ,optimal where: 1 n lognC C 1 1,n C e, lognC C = nC = n ; 1 where we have used the fact that 1, n n e,1 for all n 0. The resulting circulation is therefore optimal by Theorem 5. The overall running time of the Goldberg-Tarjan algorithm is therefore On2 m2 lognC since the minimum mean cost cycle can be obtained in Onm time. Proof: 9 A Faster Cycle-Canceling Algorithm We can improve upon the algorithm presented in the previous sections by using a more exible selection of cycles for canceling and explicitly maintaining potentials to help identify cycles for canceling. The idea is to use the potentials we get from the minimum mean cost cycle to compute the edge costs cpv; w and then push ow along all cycles with only negative cost edges. The algorithm Cancel and Tighten is described below. 1. Cancel: As long as there exists a cycle , in Gf with cpv; w 0; 8v; w 2 , push as much ow as possible along ,. 2. Tighten: Compute a minimum mean cost cycle in Gf and update p. We now show that the Cancel step results in canceling at most m cycles each iteration and the ow it gives is 1 , 1=n f optimal. Cancel and Tighten: Theorem 10 Let f be a circulation and let f 0 be the circulation obtained by performing the Cancel step. Then we cancel at most m cycles to get f 0 and f 0 1 , 1 f : n Proof: Let p be such that cpv; w , f for all v; w 2 Ef . Let , be any cycle in f 0 and let l be the length of ,. We know that canceling a cycle removes at least one arc with negative reduced cost from the residual graph and creates only arcs with positive reduced cost. Therefore we can cancel at most m cycles. Now Gf 0 Flow-15 has no negative cycles therefore every cycle in Gf contains an edge v; w such that cpv; w 0. Hence the mean cost of , is at least: P v;w2, cp v; w ,l l, 1 f l 1 = ,1 , 1 f ,1 , n f ; l 0 The above result implies that the Cancel and Tighten procedure nds a minimum cost circulation in at most n lognC iterations by an analysis which is a replication of Theorem 9. It also takes us On time to nd a cycle on the admissible graph. This implies that each Cancel step takes Onm steps due to the fact that we cancel at most m cycles and thus a running time of Onm for one iteration of the Cancel and Tighten Algorithm. Therefore the overall running time of Cancel and Tighten is On2m lognC i.e. an amortized time of On per cycle canceled. We can further improve this by using dynamic trees 14 to get an amortized time of Olog n per cycle canceled and this results in an Onm log n lognC algorithm. 10 Alternative Analysis: A Strongly Polynomial Bound In this section, we give another analysis of the algorithm. This analysis has the advantage of showing that the number of iterations is strongly polynomial, i.e. that it is polynomial in n and m and does not depend on C . The rst strongly polynomial algorithm for the minimum cost circulation problem is due to Tardos 19 . De nition 3 An arc v; w 2 E is , xed if f v; w is the same for all ,optimal circulations. There exists a simple criterion for deciding whether an arc is , xed. Theorem 11 Let Proof: 0. Let f be a circulation and p be node potentials such that f is -optimal with respect to p. If jcpv; wj 2n then v; wis , xed. The proof is by contradiction. Let f 0 be an -optimal circulation for which f 0v; w 6= f v; w. Assume that jcpv; wj 2n . Without loss of generality, we can assume by antisymmetry that cpv; w ,2n . Hence v; w 2 Ef , i.e. = f v; w = uv; w. This implies that f 0v; w f v; w. Let E = fx; y 2 E : f 0x; y f x; yg. Claim 12 There exists a cycle , in V; E that contains v; w. Flow-16 Proof: Since v; w 2 E , it is su cient to prove the existence of a directed path from w to v in V; E . Let S V be the nodes reachable from w in V; E . Assume v 2 S . By ow conservation, we have = X XX f x; y , f 0x; y = f x; y , f 0x; y = 0: x2S;y= S 2 x2S y2V However, f v; w , f 0v; w 0, i.e. f w; v , f 0w; v 0, and by assumption w 2 S and v 2 S . Therefore, there must exists x 2 S and y 2 S such that f x; y , f 0x; y = = 0, implying that x; y 2 E . This contradicts the fact that y 2 S . = By de nition of E , we have that E Ef . Hence, the mean cost of , is at least f 0 = , f 0 = , . On the other hand, the mean cost of , is l = j,j: 0 1 X c, = cp, = 1 @c v; w + cpx; yA l l l p 0 a contradiction. tions. 1 ,2n + l , 1 1 ,l = , ; l l x;y2,nfv;wg Theorem 13 The Goldberg-Tarjan algorithm terminates after Om2n log n iteraProof: If an arc becomes xed during the execution of the algorithm, then it will remain xed since f does not increase. We claim that, as long as the algorithm has not terminated, one additional arc becomes xed after Omn log n iterations. Let f be the current circulation and let , be the rst cycle canceled. After mn log2n iterations, we obtain a circulation f 0 with 1 n log2n f 0 1 , n f e, log2n f = 2f n by Theorem 10. Let p0 be potentials for which f 0 satis es the f 0-optimality constraints. By de nition of ,, , , f = cpj,j : 0 Hence, cp , ,2n f 0: j,j Therefore, there exists v; w 2 , such that jcp v; wj ,2n f 0: By the previous Theorem, v; w is f 0, xed. Moreover, v; w is not f , xed since canceling , increased the ow on v; w. This proves that, after mn log2n iterations, one additional arc becomes xed and therefore the algorithm terminates in m2n log2n iterations. 0 0 Flow-17 Using the Omn algorithm for the minimum mean cost cycle problem, we obtain a Om3n2 log n algorithm for the minimum cost circulation problem. Using the Cancel and Tighten improvement we obtain a running time of Om2n2 log n. And if we implement Cancel and Tighten with the dynamic trees data structure we get a running time of Om2nlog2n. The best known strongly polynomial algorithm for the minimum cost circulation problem is due to Orlin 18 and runs in Om log nm + n log n = Om2 log n + mn log2 n time. References 1 R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Some recent advances in network ows. SIAM Review, 33:175 219, 1991. 2 R. K. Ahuja, T. L. Magnanti, and J. B. Orlin. Network ows: Theory, algorithms, and applications. Prentice Hall, 1993. 3 R. K. Ahuja, K. Mehlhorn, J. B. Orlin, and R. E. Tarjan. Faster algorithms for the shortest path problem. Journal of the ACM, 37:213 223, 1990. 4 T. Cormen, C. Leiserson, and R. Rivest. Introduction to Algorithms. MIT Press, Cambridge, MA, 1990. 5 R. Dial. Shortest path forest with topological ordering. Communications of the ACM, 12:632 633, 1969. 6 E. W. Dijkstra. A note on two problems in connection with graphs. Numer. Math., 1:269 271, 1959. 7 J. Edmonds and R. M. Karp. Theoretical improvements in algorithmic e ciency for network ow problems. Journal of the ACM, 19:248 264, 1972. 8 L. R. Ford and D. R. Fulkerson. Maximal ow through a network. Canad. J. Math., 8:399 404, 1956. 9 L. R. Ford and D. R. Fulkerson. Flows in Networks. Princeton Univ. Press, Princeton, NJ, 1963. 10 M. L. Fredman and R. E. Tarjan. Fibonacci heaps and their uses in improved network optimization problems. Journal of the ACM, 34:569 615, 1987. 11 H. N. Gabow. Scaling algorithms for network problems. Journal of Computer and System Sciences, 31:148 168, 1985. Flow-18 12 A. V. Goldberg, E. Tardos, and R. E. Tarjan. Network ow algorithms. In B. Korte, L. Lovasz, H. J. Promel, and A. Schrijver, editors, Paths, ows, and VLSI-layout, volume 9 of Algorithms and Combinatorics, pages 101 164. Springer-Verlag, 1990. 13 A. V. Goldberg and R. E. Tarjan. A new approach to the maximum ow problem. Journal of the ACM, 35:921 940, 1988. Preliminary version in Proc. 18th Symposium on Theory of Computing, pages 136 146, 1986. 14 A. V. Goldberg and R. E. Tarjan. Finding minimum-cost circulations by canceling negative cycles. Journal of the ACM, 36:873 886, 1989. Preliminary version in Proceedings of the 20th Annual ACM Symposium on Theory of Computing, pages 388 397, 1987. 15 D. Goldfarb and J. Hao. A primal simplex algorithm that solves the maximum ow problem in at most nm pivots and on2m time. Mathematical Programming, 47:353 365, 1990. 16 D. Johnson. A priority queue in which initialization and queue operations take Olog log D. Math. Systems Theory, 15:295 309, 1982. 17 M. Klein. A primal method for minimal cost ows with applications to the assignment and transportation problems. Management Science, 14:205 220, 1967. 18 J. B. Orlin. A faster strongly polynomial minimum cost ow algorithm. In Proceedings of the 20th Annual ACM Symposium on Theory of Computing, pages 377 387, 1988. 19 E. Tardos. A strongly polynomial minimum cost circulation algorithm. Combinatorica, 5:247 255, 1985. 20 R. E. Tarjan. Algorithms for maximum network ow. Mathematical Programming Study, 26:1 11, 1986. Flow-19 Flow-20 ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online