Download presentation

Presentation is loading. Please wait.

Published bySamir Manchester Modified over 2 years ago

1
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 18

2
2 Soviet Rail Network, 1955 Reference: On the history of the transportation and maximum flow problems. Alexander Schrijver in Math Programming, 91: 3, 2002.

3
3 Maximum Flow and Minimum Cut Max flow and min cut. n Two very rich algorithmic problems. n Cornerstone problems in combinatorial optimization. n Beautiful mathematical duality. Nontrivial applications / reductions. n Data mining. n Open-pit mining. n Project selection. n Airline scheduling. n Bipartite matching. n Baseball elimination. n Image segmentation. n Network connectivity. n Network reliability. n Distributed computing. n Egalitarian stable matching. n Security of statistical data. n Network intrusion detection. n Multi-camera scene reconstruction. n Many many more...

4
4 Flow network. n Abstraction for material flowing through the edges. n G = (V, E) = directed graph, no parallel edges. n Two distinguished nodes: s = source, t = sink. n c(e) = capacity of edge e. Minimum Cut Problem s t capacity source sink

5
5 Def. An s-t cut is a partition (A, B) of V with s A and t B. Def. The capacity of a cut (A, B) is: Cuts s t Capacity = = 30 A

6
6 s t A Cuts Def. An s-t cut is a partition (A, B) of V with s A and t B. Def. The capacity of a cut (A, B) is: Capacity = = 62

7
7 Min s-t cut problem. Find an s-t cut of minimum capacity. Minimum Cut Problem s t A Capacity = = 28

8
8 Def. An s-t flow is a function that satisfies: n For each e E: (capacity) n For each v V – {s, t}: (conservation) Def. The value of a flow f is: Flows Value = 4 0 capacity flow s t

9
9 Def. An s-t flow is a function that satisfies: n For each e E: (capacity) n For each v V – {s, t}: (conservation) Def. The value of a flow f is: Flows capacity flow s t Value = 24 4

10
10 Max flow problem. Find s-t flow of maximum value. Maximum Flow Problem capacity flow s t Value = 28

11
11 Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s. Flows and Cuts s t Value = 24 4 A

12
12 Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s. Flows and Cuts s t Value = = A

13
13 Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then, the net flow sent across the cut is equal to the amount leaving s. Flows and Cuts s t Value = = 24 4 A

14
14 Flows and Cuts Flow value lemma. Let f be any flow, and let (A, B) be any s-t cut. Then Pf. by flow conservation, all terms except v = s are 0

15
15 Flows and Cuts Weak duality. Let f be any flow, and let (A, B) be any s-t cut. Then the value of the flow is at most the capacity of the cut. Cut capacity = 30 Flow value 30 s t Capacity = 30 A

16
16 Weak duality. Let f be any flow. Then, for any s-t cut (A, B) we have v(f) cap(A, B). Pf. Flows and Cuts s t A B

17
17 Certificate of Optimality Corollary. Let f be any flow, and let (A, B) be any cut. If v(f) = cap(A, B), then f is a max flow and (A, B) is a min cut. Value of flow = 28 Cut capacity = 28 Flow value s t A

18
Q1: True or false? 1. Let G be an arbitrary flow network, with a source s, a sink t, and a positive integer capacity c e on every edge. If f is a maximum s-t flow in G, then f saturates every edge out of s with flow (i.e., for all edges e out of s, we have f(e) = c e ). 2. Let G be an arbitrary flow network, with a source s, a sink t, and a positive integer capacity c e on every edge e. Let (A, B) be a minimum s-t cut with respect to these capacities. Now suppose we add 1 to every capacity; then (A, B) is still a minimum s-t cut with respect to these new capacities. 18

19
Answer 1. False. 19 s 1 2 t 2 2 1

20
Answer 2. False 20 s 1 2 w t

21
21 Towards a Max Flow Algorithm Greedy algorithm. n Start with f(e) = 0 for all edge e E. n Find an s-t path P where each edge has f(e) < c(e). n Augment flow along path P. n Repeat until you get stuck. s 1 2 t Flow value = 0

22
22 Towards a Max Flow Algorithm Greedy algorithm. n Start with f(e) = 0 for all edge e E. n Find an s-t path P where each edge has f(e) < c(e). n Augment flow along path P. n Repeat until you get stuck. s 1 2 t 20 Flow value = X X X 20

23
23 Towards a Max Flow Algorithm Greedy algorithm. n Start with f(e) = 0 for all edge e E. n Find an s-t path P where each edge has f(e) < c(e). n Augment flow along path P. n Repeat until you get stuck. greedy = 20 s 1 2 t opt = 30 s 1 2 t locally optimality global optimality

24
24 Residual Graph Original edge: e = (u, v) E. n Flow f(e), capacity c(e). Residual edge. n "Undo" flow sent. n e = (u, v) and e R = (v, u). n Residual capacity: Residual graph: G f = (V, E f ). n Residual edges with positive residual capacity. n E f = {e : f(e) 0}. uv 17 6 capacity uv 11 residual capacity 6 flow

25
25 Ford-Fulkerson Algorithm s t G: capacity

26
26 Augmenting Path Algorithm Augment(f, c, P) { b bottleneck(P) foreach e P { if (e E) f(e) f(e) + b else f(e R ) f(e) - b } return f } Ford-Fulkerson(G, s, t, c) { foreach e E f(e) 0 G f residual graph while (there exists augmenting path P) { f Augment(f, c, P) update G f } return f } forward edge reverse edge

27
27 Max-Flow Min-Cut Theorem Augmenting path theorem. Flow f is a max flow iff there are no augmenting paths. Max-flow min-cut theorem. [Ford-Fulkerson 1956] The value of the max flow is equal to the value of the min cut. Proof strategy. We prove both simultaneously by showing that the following are equivalent: (i)There exists a cut (A, B) such that v(f) = cap(A, B). (ii)Flow f is a max flow. (iii)There is no augmenting path relative to f. (i) (ii) This was the corollary to weak duality lemma. (ii) (iii) We show contrapositive. n Let f be a flow. If there exists an augmenting path, then we can improve f by sending flow along path.

28
28 Proof of Max-Flow Min-Cut Theorem (iii) (i) n Let f be a flow with no augmenting paths. n Let A be set of vertices reachable from s in residual graph. n By definition of A, s A. n By definition of f, t A. original network s t A B

29
29 Running Time Assumption. All capacities are integers between 1 and C. Invariant. Every flow value f(e) and every residual capacities c f (e) remains an integer throughout the algorithm. Theorem. The algorithm terminates in at most v(f*) nC iterations. Pf. Each augmentation increase value by at least 1. Corollary. If C = 1, Ford-Fulkerson runs in O(mn) time. Integrality theorem. If all capacities are integers, then there exists a max flow f for which every flow value f(e) is an integer. Pf. Since algorithm terminates, theorem follows from invariant.

30
Q2: Mobile computing Consider a set of mobile computing clients in a certain town who each needed to be connected to one of several base stations. Well suppose there are n clients, with the position of each client specified by its (x,y) coordinates. There are also k base stations, each of them specified by its (x,y) coordinates as well. For each client, we want to connect it to exactly one of the base stations. We have a range parameter ra client can only be connected to a base station that is within distance r. There is also a load parameter Lno more than L clients can be connected to a single base station. Your goal is to design a polynomial-time algorithm for the following problem. Given the positions of the clients and base stations as well as the range and load parameters, decide whether every client can be connected simultaneously to a base station. 30

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google