15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.

Slides:



Advertisements
Similar presentations
Max Flow Problem Given network N=(V,A), two nodes s,t of V, and capacities on the arcs: uij is the capacity on arc (i,j). Find non-negative flow fij for.
Advertisements

15.082J & 6.855J & ESD.78J October 14, 2010 Maximum Flows 2.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Maximum flow sender receiver Capacity constraint Lecture 6: Jan 25.
Bioinformatics III1 We will present an algorithm that originated by Ford and Fulkerson (1962). Idea: increase the flow in a network iteratively until it.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Prof. Swarat Chaudhuri COMP 482: Design and Analysis of Algorithms Spring 2012 Lecture 19.
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
1 Maximum Flow Networks Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘capacity’ u ij. Goal: Determine the maximum amount.
1 Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 7 Maximum Flows: Polynomial Algorithms
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
The max flow problem
Maximum Flows Lecture 4: Jan 19. Network transmission Given a directed graph G A source node s A sink node t Goal: To send as much information from s.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
15.082J, 6.855J, and ESD.78J September 21, 2010 Eulerian Walks Flow Decomposition and Transformations.
Yangjun Chen 1 Network Flow What is a network? Flow network and flows Ford-Fulkerson method - Residual networks - Augmenting paths - Cuts of flow networks.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
10. Lecture WS 2006/07Bioinformatics III1 V10: Network Flows V10 follows closely chapter 12.1 in on „Flows and Cuts in Networks and Chapter 12.2 on “Solving.
Max Flow – Min Cut Problem. Directed Graph Applications Shortest Path Problem (Shortest path from one point to another) Max Flow problems (Maximum material.
Maximum Flow Problem (Thanks to Jim Orlin & MIT OCW)
Maximum Flow Chapter 26. Flow Concepts Source vertex s – where material is produced Sink vertex t – where material is consumed For all other vertices.
& 6.855J & ESD.78J Algorithm Visualization The Ford-Fulkerson Augmenting Path Algorithm for the Maximum Flow Problem.
Chapter 7 April 28 Network Flow.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.
15.082J and 6.855J and ESD.78J The Successive Shortest Path Algorithm and the Capacity Scaling Algorithm for the Minimum Cost Flow Problem.
and 6.855J March 6, 2003 Maximum Flows 2. 2 Network Reliability u Communication Network u What is the maximum number of arc disjoint paths from.
Chapter 7 May 3 Ford-Fulkerson algorithm Step-by-step walk through of an example Worst-case number of augmentations Edmunds-Karp modification Time complexity.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Exercise 6.1 Find the number of different shortest paths from point A to point B in a city with perfectly horizontal streets and vertical avenues as shown.
CSCI 256 Data Structures and Algorithm Analysis Lecture 20 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
CSEP 521 Applied Algorithms Richard Anderson Lecture 8 Network Flow.
1 Network Flow CSC401 – Analysis of Algorithms Chapter 8 Network Flow Objectives: Flow networks –Flow –Cut Maximum flow –Augmenting path –Maximum flow.
Fall 2003Maximum Flow1 w s v u t z 3/33/3 1/91/9 1/11/1 3/33/3 4/74/7 4/64/6 3/53/5 1/11/1 3/53/5 2/22/2 
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
EMIS 8374 The Ford-Fulkerson Algorithm (aka the labeling algorithm) Updated 4 March 2008.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
1 Maximum Flows CONTENTS Introduction to Maximum Flows (Section 6.1) Introduction to Minimum Cuts (Section 6.1) Applications of Maximum Flows (Section.
Minimum Cost Flow Algorithms and Networks. Algorithms and Networks: Minimum Cost Flow2 This lecture The minimum cost flow problem: statement and applications.
TU/e Algorithms (2IL15) – Lecture 8 1 MAXIMUM FLOW (part II)
Cycle Canceling Algorithm
V15: Max-Flow Min-Cut V15 continues chapter 12 in Gross & Yellen „Graph Theory“ Theorem [Characterization of Maximum Flow] Let f be a flow in a.
Richard Anderson Lecture 23 Network Flow
Algorithms and Networks
Lecture 22 Network Flow, Part 2
Max Flow – Min Cut Problem
Network Flow 2016/04/12.
Instructor: Shengyu Zhang
Chapter 7 Network Flow Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Introduction to Maximum Flows
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 23 Network Flow
Richard Anderson Lecture 21 Network Flow
Max Flow Min Cut, Bipartite Matching Yin Tat Lee
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
and 6.855J March 6, 2003 Maximum Flows 2
Algorithms and Networks
Lecture 21 Network Flow, Part 1
The Ford-Fulkerson Algorithm
Introduction to Maximum Flows
Richard Anderson Lecture 22 Network Flow
Lecture 21 Network Flow, Part 1
Introduction to Minimum Cost Flows
Lecture 22 Network Flow, Part 2
Introduction to Maximum Flows
Richard Anderson Lecture 22 Network Flow
Presentation transcript:

15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows

2 The Max Flow Problem G = (N,A) x ij = flow on arc (i,j) u ij = capacity of flow in arc (i,j) s = source node t = sink node Maximizev Subject to ∑ j x ij - ∑ k x ki = 0 for each i ≠ s,t ∑ j x sj = v 0  x ij  u ij for all (i,j) ∈ A.

3 Maximum Flows We refer to a flow x as maximum if it is feasible and maximizes v. Our objective in the max flow problem is to find a maximum flow. s 1 2 t A max flow problem. Capacities and a non- optimum flow

4 The feasibility problem: find a feasible flow retailers warehouses Is there a way of shipping from the warehouses to the retailers to satisfy demand?

5 Transformation to a max flow problem warehouses retailers There is a 1-1 correspondence with flows from s to t with 24 units (why 24?) and feasible flows for the transportation problem s t

sending flows along s-t paths 6 s 1 2 t One can find a larger flow from s to t by sending 1 unit of flow along the path s-2-t s 1 2 t

A different kind of path 7 s 1 2 t One could also find a larger flow from s to t by sending 1 unit of flow along the path s-2-1-t. (Backward arcs have their flow decreased.) s 1 2 t Decreasing flow in (1, 2) is mathematically equivalent to sending flow in (2, 1) w.r.t. node balance constraints.

8 The Residual Network s 1 2 t ij x ij u ij ij u - x x ij ij We let r ij denote the residual capacity of arc (i,j) The Residual Network G(x) s 1 2 t

9 A Useful Idea: Augmenting Paths An augmenting path is a path from s to t in the residual network. The residual capacity of the augmenting path P is  (P) = min{r ij : (i,j) ∈ P}. To augment along P is to send  (P) units of flow along each arc of the path. We modify x and the residual capacities appropriately. r ij := r ij -  (P) and r ji := r ji +  (P) for (i,j) ∈ P. s 1 2 t s 1 2 t

10 The Ford Fulkerson Maximum Flow Algorithm x := 0; create the residual network G(x); while there is some directed path from s to t in G(x) do let P be a path from s to t in G(x);  :=  (P); send  units of flow along P; update the r's; Ford- Fulkerson Algorithm Animation

To prove correctness of the algorithm Invariant: at each iteration, there is a feasible flow from s to t. 11 Finiteness (assuming capacities are integral and finite): The residual capacities are always integer valued The residual capacities out of node s decrease by at least one after each update. Correctness If there is no augmenting path, then the flow must be maximum. max-flow min-cut theorem.

12 Integrality Assume that all data are integral. Lemma: At each iteration all residual capacities are integral. Proof. It is true at the beginning. Assume it is true after the first k-1 augmentations, and consider augmentation k along path P. The residual capacity  of P is the smallest residual capacity on P, which is integral. After updating, we modify residual capacities by 0, or , and thus residual capacities stay integral.

13 Theorem. The Ford-Fulkerson Algorithm is finite Proof. The capacity of each augmenting path is at least s4 3 t r sj decreases for some j. So, the sum of the residual capacities of arcs out of s decreases at least 1 per iteration. Number of augmentations is O(nU), where U is the largest capacity in the network. 1 1

Mental Break What are aglets? The plastic things on the ends of shoelaces. How fast does the quartz crystal in a watch vibrate? About 32,000 times per second. If Barbie (the doll) were life size and 5’ 9” tall, how big would her waist be? 18 inches. Incidentally, Barbie’s full name is Barbara Millicent Roberts

True or false. In Alaska it is illegal to shoot a moose from a helicopter or any other flying vehicle. True. True or false. In Athens, Georgia, a driver’s license can be taken away by law if the driver is deemed either “unbathed” or “poorly dressed.” False. However, it is true for Athens, Greece. In Helsinki, Finland that don’t give parking tickets to illegally parked cars. What do they do instead? They deflate the tires of the car. Mental Break

16 To be proved: If there is no augmenting path, then the flow is maximum s 1 2 t 10, 9 8,8 1,1 10,7 6,6 s 1 2 t S* = { j : s ➔ j in G(x*)} T* = N\S* G(x) = residual network for flow x. If there is a directed path from i to j in G, we write i ➔ j. x* = final flow

Lemma: there is no arc in G(x*) from S* to T* 17 s 1 2 t S* = { j : s ➔ j in G(x*)} T* = N\S* Proof. If there were such an arc (i, j), then j would be in S*. i j s We will use this Lemma in 6 slides.

18 Cut Duality Theory s 1 2 t 10, 9 8,8 1,1 10,7 6,6 An (s,t)-cut in a network G = (N,A) is a partition of N into two disjoint subsets S and T such that s ∈ S and t ∈ T, e.g., S = { s, 1 } and T = { 2, t }. The capacity of a cut (S,T) is CAP(S,T) = ∑ i ∈ S ∑ j ∈ T u ij

The flow across a cut 19 We define the flow across the cut (S,T) to be F x (S,T) = ∑ i ∈ S ∑ j ∈ T x ij - ∑ i ∈ S ∑ j ∈ T x ji s 1 2 t 10, 9 8,8 1,1 10,7 6,6 s 1 2 t 10, 9 8,8 1,1 10,7 6,6 If S = {s, 1}, then F x (S,T) = = 15 If S = {s, 2}, then F x (S,T) = = 15

Max Flow Min Cut 20 Theorem. (Max-flow Min-Cut). The maximum flow value is the minimum value of a cut. Proof. The proof will rely on the following three lemmas: Lemma 1. For any flow x, and for any s-t cut (S, T), the flow out of s equals F x (S, T). Lemma 2. For any flow x, and for any s-t cut (S, T), F x (S, T) ≤ CAP(S, T). Lemma 3. Suppose that x* is a feasible s-t flow with no augmenting path. Let S* = {j : s ➔ j in G(x*)} and let T* = N\S. Then F x* (S*, T*) = CAP(S*, T*).

Proof of Theorem (using the 3 lemmas) 21 Let x’ be a maximum flow Let v’ be the maximum flow value Let x* be the final flow. Let v* be the flow out of node s (for x*) Let S* be nodes reachable in G(x*) from s. Let T* = N\S*. 2. v’ = F x’ (S*, T*) by Lemma 1. Thus all inequalities are equalities and v* = v’. 1. v* ≤ v’ by definition of v’ 3. F x’ (S*, T*) ≤ CAP(S*, T*) by Lemma v* = F x* (S*, T*) = CAP(S*, T*) by Lemmas 1,3.

22 Proof of Lemma 1 Proof. Add the conservation of flow constraints for each node i  ∈ S - {s} to the constraint that the flow leaving s is v. The resulting equality is F x (S,T) = v. s 1 2 t 10, 9 8,8 1,1 10,7 6,6 s 1 2 t 10, 9 8,8 1,1 10,7 6,6 x s1 + x s2 = v x 12 + x 1t – x s1 = 0 x s2 + x 12 + x 1t = v x s1 + x s2 = v x 2t – x s2 – x 12 = 0 x s1 - x 12 + x 2t = v

23 Proof of Lemma 2 s 1 2 t 10, 9 8,8 1,1 10,7 6,6 s 1 2 t 10, 9 8,8 1,1 10,7 6,6 CAP(S, T) = 15 CAP(S, T) = 16 Proof. If i ∈ S, and j ∈ T, then x ij ≤ u ij. If i ∈ T, and j ∈ S, then x ij ≥ 0. F x (S,T) = ∑ i ∈ S ∑ j ∈ T x ij - ∑ i ∈ S ∑ j ∈ T x ji CAP(S,T) = ∑ i ∈ S ∑ j ∈ T u ij - ∑ i ∈ S ∑ j ∈ T 0

24 Proof of Lemma 3. We have already seen that there is no arc from S* to T* in G(x*). i ∈  S* and j ∈ T*  x* ij = u ij and x* ji = 0 i j x* ij = u ij x* ji = 0 Otherwise, there is an arc (i, j) in G(x*) Therefore F x* (S*, T*) = CAP(S*, T*)

25 Review Corollary. If the capacities are finite integers, then the Ford-Fulkerson Augmenting Path Algorithm terminates in finite time with a maximum flow from s to t. Corollary. If the capacities are finite rational numbers, then the Ford-Fulkerson Augmenting Path Algorithm terminates in finite time with a maximum flow from s to t. (why?) Corollary. To obtain a minimum cut from a maximum flow x*, let S* denote all nodes reachable from s in G(x), and T* = N\S* Remark. This does not establish finiteness if u ij = ∞ or if capacities may be irrational.

26 A simple and very bad example s 1 2 t MM M M 1

27 After 1 augmentation s 1 2 t M-1M M 1 1 1

28 After two augmentations s 1 2 t M

29 After 3 augmentations s 1 2 t M-2M-1 M-2 M

30 And so on

31 After 2M augmentations s 1 2 t M M M M 1

32 An even worse example In Exercise 6.48, there is an example that takes an infinite number of augmentations on irrational data, and does not converge to the correct flow. But we shall soon see how to solve max flows in a polynomial number of operations, even if data can be irrational.

33 Summary and Extensions 1. Augmenting path theorem 2. Ford-Fulkerson Algorithm 3. Duality Theory. 4. Next Lecture: Polynomial time variants of FF algorithm Applications of Max-Flow Min-Cut

MITOpenCourseWare J / 6.855J / ESD.78J Network Optimization Fall 2010 For information about citing these materials or our Terms of Use, visit: