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.

Slides:



Advertisements
Similar presentations
Lecture 7. Network Flows We consider a network with directed edges. Every edge has a capacity. If there is an edge from i to j, there is an edge from.
Advertisements

Min Cost Flow: Polynomial Algorithms. Overview Recap: Min Cost Flow, Residual Network Potential and Reduced Cost Polynomial Algorithms Approach Capacity.
Lecture 5: Network Flow Algorithms Max-Flow Min-Cut Single-Source Shortest-Path (SSSP) Job Sequencing.
Introduction to Algorithms
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.
Chapter 6 Maximum Flow Problems Flows and Cuts Augmenting Path Algorithm.
Network Optimization Models: Maximum Flow Problems
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
Chapter 10: Iterative Improvement The Maximum Flow Problem The Design and Analysis of Algorithms.
Chapter 7 Maximum Flows: Polynomial Algorithms
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
HW2 Solutions. Problem 1 Construct a bipartite graph where, every family represents a vertex in one partition, and table represents a vertex in another.
A New Approach to the Maximum-Flow Problem Andrew V. Goldberg, Robert E. Tarjan Presented by Andrew Guillory.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
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.
1 Maximum flow: The preflow/push method of Goldberg and Tarjan (87)
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
Lecture 8. Why do we need residual networks? Residual networks allow one to reverse flows if necessary. If we have taken a bad path then residual networks.
A New Approach to the Maximum-Flow Problem Andrew V. Goldberg, Robert E. Tarjan Presented by Andrew Guillory.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
NetworkModel-1 Network Optimization Models. NetworkModel-2 Network Terminology A network consists of a set of nodes and arcs. The arcs may have some flow.
and 6.855J The Capacity Scaling Algorithm.
Modeling and Evaluation with Graph Mohammad Khalily Dermany Islamic Azad University, Khomein branch.
1 Minimum Cost Flows Goal: Minimize costs to meet all demands in a network subject to capacities (combines elements of both shortest path and max flow.
Lecture 5: Network Flow Algorithms Single-Source Shortest-Path (SSSP) (Dijkstra's Algorithm) Max Flow - Min Cut (Ford-Fulkerson) Job Sequencing.
Advanced Algorithms Piyush Kumar (Lecture 5: Preflow Push) Welcome to COT5405.
15.082J and 6.855J and ESD.78J October 19, 2010 Max Flows 3 Preflow-Push Algorithms.
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Maximum Flow Algorithms —— ACM 黄宇翔. 目录 Max-flow min-cut theorem 12 Augmenting path algorithms 3 Push-relabel maximum flow algorithm.
CS 4407, Algorithms University College Cork, Gregory M. Provan Network Optimization Models: Maximum Flow Problems In this handout: The problem statement.
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.
CS223 Advanced Data Structures and Algorithms 1 Maximum Flow Neil Tang 3/30/2010.
15.082J & 6.855J & ESD.78J October 7, 2010 Introduction to Maximum Flows.
15.082J and 6.855J March 4, 2003 Introduction to Maximum Flows.
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.
1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
Data Structures & Algorithms Network Flow Richard Newman based on book by R. Sedgewick.
Suppose G = (V, E) is a directed network. Each edge (i,j) in E has an associated ‘length’ c ij (cost, time, distance, …). Determine a path of shortest.
CSE 421 Algorithms Richard Anderson Lecture 22 Network Flow.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
15.082J and 6.855J and ESD.78J October 21, 2010 Max Flows 4.
1 Maximum Flows CONTENTS Introduction to Maximum Flows (Section 6.1) Introduction to Minimum Cuts (Section 6.1) Applications of Maximum Flows (Section.
::Network Optimization:: Minimum Spanning Trees and Clustering Taufik Djatna, Dr.Eng. 1.
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Algorithms and Networks Hans Bodlaender
Maximum flow: The preflow/push method of Goldberg and Tarjan (87)
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
Introduction to Maximum Flows
Introduction to Maximum Flows
Richard Anderson Lecture 21 Network Flow
Not Always Feasible 2 (3,5) 1 s (0,2) 3 (, u) t.
Primal-Dual Algorithm
Algorithms (2IL15) – Lecture 7
EE5900 Advanced Embedded System For Smart Infrastructure
and 6.855J March 6, 2003 Maximum Flows 2
Maximum Flow c v 3/3 4/6 1/1 4/7 t s 3/3 w 1/9 3/5 1/1 3/5 u z 2/2
Min Global Cut Animation
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
The Shortest Augmenting Path Algorithm for the Maximum Flow Problem
and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem Obtain a network, and use the same network to illustrate the.
and 6.855J The Goldberg-Tarjan Preflow Push Algorithm for the Maximum Flow Problem Obtain a network, and use the same network to illustrate the.
Maximum flow: The preflow/push method of Goldberg and Tarjan (87)
Not Always Feasible 2 (3,5) 1 s (0,2) 3 (, u) t.
Max Flows 3 Preflow-Push Algorithms
Class 11 Max Flows Obtain a network, and use the same network to illustrate the shortest path problem for communication networks, the max flow.
Presentation transcript:

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 of flow between two specified vertices s and t. The capacity v of a path P is the sum of its constituent edge flows: v = Σx ij where x ij is the flow from vertex i to vertex j. Applications to design: supply networks oil pipelines road traffic

2 Background Assumptions: Integer data Directed network Nonnegative capacities on each arc Vertex s is the source Vertex t is the sink Definitions: Residual network Cut Techniques: 1.Augmenting Paths – Examine residual network for s-t paths. 2.Preflow-Push – Flow moved according to individual edge not path.

3 Maximum Flow as Linear Programming Problem subject to

4 Example t s ,9 1,2 2,4 8,8 7,9 4,7 2,6 Each edge is labeled as (x ij, u ij ) = (flow, capacity). However, this flow value, v(x) = 11, is not a maximum.

5 Residual Network Given a current flow x, keep track of how much further the flow can be increased in each direction of the edge. For any edge in G: ij x ij, u ij The corresponding edge (with capacities) in residual network of G: ij u ij - x ij x ij The residual network of G, G(x), has edges with positive residual capacity, r ij = u ij – x ij + x ji. In general, it is the amount by which we can further increase flow from i to j in the current network.

6 Example – Re-examined t s ,9 1,2 2,4 8,8 7,9 4,7 2,6 Network with flows and capacities. t s Residual network with capacities We know this network flow is not a maximum. How can we get a better one? What do we do in general?

7 A cut is defined by a partition of the vertex set E into subsets S and S* = E – S. The cut [S,S*] consists of all edges with one endpoint in S and the other in S*. The forward edges of [S,S*] are denoted (S, S*). The backward edges are denoted as (S*,S). An s-t cut [S,S*] has s in S and t in S*. The removal of the forward edges in an s-t cut will separate vertices s and t. That is, there is no longer a directed s to t path. The capacity of any cut [S,S*], u[S,S*], is the sum of the capacities of the forward edges of the cut. u[S,S*] is an upper bound on the amount of flow sent from S to S*. A minimum s-t cut has the smallest capacity among all s-t cuts. Cuts

Examples of 1-6 cuts S = { } S* = { } Forward edges of [S,S*]= { } u[S, S*] = = 44 S = { } S* = { } Forward edges of [S,S*]= { } u[S, S*] = =

9 Theorem If x is any feasible flow and if [S,S*] is any s-t cut, then the flow value, v(x), from s to t is at most u[S,S*]. Corollary the max flow value ≤ the minimum cut capacity Max-Flow Min-Cut Theorem For any capacitated network, the value of the maximum s-t flow, x’, equals the capacity of a minimum s-t cut, [S,S*]. v(x’) = u [S,S*] Theorems

10 Given the flow x, look for a path P from s to t in the residual network G(x) along which flow can be sent. Then send as much flow along P as possible. We call any directed path P from s to t in the residual network an augmenting path. The residual capacity of such a path is δ(P) = min{r ij :(i, j)  P). To augment along P is to send δ(P) units of flow along each edge of the path. We then modify x and the residual capacities r ij appropriately. r ij := r ij – δ(P) for each edge (i,j)  P r ji := r ji + δ(P) for each edge (i, j)  P Result: flow value, v, increases by δ(P). Improving a Flow

11 Example t s ,9 1,2 2,4 8,8 7,9 4,7 2,6 Network with flows and capacities. v =11 t s Residual network with capacities Augment along path P = s-2-4-t. δ(P) = min{6, 2, 3} = 2. new flow value =13 t s ,9 1,2 4,4 8,8 7,9 6,7 2,6 t s

12 Example – Augmenting Paths Step 1: Push 4 units along path Step 2: Push 5 units along path Step 3: Push 2 units along path Step 4: Push 1 units along path Step 0: initial residual graph is original

13 Example – continued No more augmenting paths Maximum Flow in G is ,6 0,2 4,4 6,85,5 7,8 3,3 2,2 6,

14 THEOREM The following are equivalent statements 1.The s-t flow x’ with value v(x’) is maximum 2.G(x’) contains no augmenting path. 3.There is an s-t cut [S,S*] with u[S,S*] = v(x’)

15 Generic Augmenting Path Algorithm In this algorithm, we keep sending flow along augmenting paths until no s-t path exists in the residual network. Can carry out calculations entirely on G(x). Flows in G are found at the very end. algorithm augmenting_path; begin x := 0 while G(x) contains a directed path from s to t do begin P = Find_Path(s, t, G(x)); δ (P) := min{r ij : (i,j)  P}; augment δ (P) units of flow along P; update G(x); end;

16 Find_Path Options More than one way to pick an augmenting path “Poor” choices can lead to many augmentations. Info lost when successive paths are found. Balance effort to find a “good” path with the reduction in # of augmentations. Maximum capacity – select path P such that δ(P) is as large as possible. Shortest path – use the path with the minimum number of edges. Scaling – successively solve subproblems with a certain capacity

17 Distance Labels For the “shortest path” version of the augmenting path algorithm and for another max flow algorithm, the pre-flow push, the notion of distance labels is needed. The distance label d(j) is a nonnegative integer assigned to each j in G(x). The distance labels are valid if d(t) = 0 d(i) ≤ d(j)+1 for each (i,j)  G(x) If d(j) are valid, then d(j) is a lower bound on the shortest distance from j to t. If d(s) ≥ n then there is no s-t path in G(x). (n = number of vertices in G) An admissible edge in G(x) is one where d(i) = d(j) + 1. An admissible path is a path from s to t consisting of admissible edges and is a shortest augmenting path from s to t

18 Shortest Distance Algorithm Admissible paths are successively built by advancing until vertex t is reached. If no admissible edge is available at some point, then retreat and relabel will be a way of updating distances in the new residual graph. In this way, we maintain valid distance labels without starting from scratch. algorithm shortest augmenting path; begin x:= 0; calculate exact distance labels, d(j) to vertex t; j := s; while d(s) <n do begin if j has an admissible edge then begin advance(j); if j = t then augment and set j := s; end; else retreat(j); end;

19 algorithm retreat(j); begin d(j) := min{d(k)+1: (j,k) in E(j) with r jk > 0}; if E(j) with r jk > 0 empty then d(j) = n; if j ≠ s then j := pred(k); end; algorithm advance(j); begin let (j,k) be an admissible edge from j; pred(k)=j; j := k; end; algorithm augment; begin derive path P from pred; δ(P) := min{r ij : (i,j)  P}; augment δ(P) units of flow along P; end;

20 Example Calculate d(j) d(3)=1 d(2)= d(4)=0 d(1)=2 2. Advance 1-2-4, δ(P) =1, augment d(3)=1 d(2)= d(4)=0 d(1)= Advance 1-3-4, δ(P) =4, augment d(3)=1 3. Advance 1-2, retreat, relabel vertex 2 d(2)= d(4)=0 d(1)=2 1

21 Example 5. Advance 1, retreat relabel 1 6. Advance , δ(P) =1, augment d(3)=1 d(2)= d(4)=0 d(1)=3 7. Advance 1, retreat, relabel 1 8. Maximum Flow achieved d(2)= d(4)=0 d(1)=3 1 1 d(3)=1 1 d(2)= d(4)=0 d(1)=4 1 d(3)=1 d(2)= d(4)=0 d(1)=2 1 1 d(3)=1

22 Example - Results ,4 1,3 5,5 2,2 1,1 Note monotonicity of path lengths Note monotonicity of distance labels d(1) d(2) d(3) d(4)

23 Additional Exercises source sink

24 Preflow-push Algorithm Distance labels – d(t) = 0; d(i) ≤d(j) + 1 for each (i,j) in G(x) Excess flow – e(i) = excess at each vertex for a given preflow Active vertices – vertices with positive excess Admissible edges – edges that satisfy the condition that d(i) = d(j) + 1 Preflow – infeasible solution; Algorithm strives for feasibility/optimality when all excess at sink and source algorithm preflow-push; begin preprocess; while network contains an active vertex do begin select an active node i; push/relabel(i); end;

25 algorithm push/relabel(i); begin if the networks contains an admissible edge (i,j) then push δ = min{e(i), r ij } units of flow from vertex i to vertex j; else replace d(i) by min{d(j)+1: (i,j) in E(i) and r ij > 0}; end; algorithm preprocess; begin x := 0; compute the exact distance labels d(i) from s; x sj := u sj for each edge (s,j) in E(s); d(s) := n end;

26 Example e(4)=0 d(4)=0 e(3)=0 d(3)=1 e(2)=0 d(2)=1 e(1)=0 d(1)= e(4)=0 d(4)=0 e(3)=4 d(3)=1 e(2)=2 d(2)=1 e(1)=0 d(1)=4 1. Network G Active nodes: 2. preprocess: first residual graph Active nodes: 2, 3

27 Example e(4)=5 d(4)=0 e(3)=0 d(3)=1 e(2)=1 d(2)=2 e(1)=0 d(1)= e(4)=1 d(4)=0 e(3)=4 d(3)=1 e(2)=1 d(2)=2 e(1)=0 d(1)= Saturating push of 1 unit along 2-4; Relabel distance node 2 Selected node: 2 Active nodes: 3 Active nodes: 3, 2 4. Push of 4 units along 3-4 Selected node: 3 Active nodes: 2

28 Example e(4)=6 d(4)=0 e(3)=0 d(3)=1 e(2)=0 d(2)=2 e(1)=0 d(1)= Push of 1 unit along 2-3 Selected node: 2 Active nodes: Active nodes: 3 6. Saturating Push of 1 units along 3-4 Selected node: 3 Active nodes: e(4)=5 d(4)=0 e(3)=1 d(3)=1 e(2)=0 d(2)=2 e(1)=0 d(1)=

Preflow-Push: Example 2

30 Let G = (V,E) be a network with supplies and demands at each vertex b(j) > 0 indicates supply at vertex j b(j)<0 indicates demand at vertex j Assumption: Σb(j) = 0 Does a flow, x, exist? Transform into a maximum flow network, G’ Add a source vertex, s, and a sink vertex, t. Add edge (s, j) with capacity, r sj =b(j), if b(j)>0 Add edge (j, t) with capacity, r jt =b(j), if b(j)<0 Solve max flow from s to t Result: If the max flow in G’ saturates all the source and sink edges, then the original problem has a feasible solution. Otherwise, infeasible. Checking if feasible flow exists

b(1) = 4 Example 1-Feasible Flow? b(2) = 5 b(3) = -2 b(4) = -7

b(1) = 4 Example 2-Feasible flow? b(2) = 5 b(3) = -2 b(4) = -7