1 Ford-Fulkerson method Ford-Fulkerson(G) f = 0 while( 9 simple path p from s to t in G f ) f := f + f p output f Runs in time O(|f max | |E|) where f.

Slides:



Advertisements
Similar presentations
Introduction to Algorithms
Advertisements

1 EE5900 Advanced Embedded System For Smart Infrastructure Static Scheduling.
1 Review of some graph algorithms Graph G(V,E) (Chapter 22) –Directed, undirected –Representation Adjacency-list, adjacency-matrix Breadth-first search.
MS&E 211 Minimum Cost Flow LP Ashish Goel. Minimum Cost Flow (MCF) Need to ship some good from “supply” nodes to “demand” nodes over a network – Example:
Introduction To Algorithms CS 445 Discussion Session 8 Instructor: Dr Alon Efrat TA : Pooja Vaswani 04/04/2005.
MAXIMUM FLOW Max-Flow Min-Cut Theorem (Ford Fukerson’s Algorithm)
The Maximum Network Flow Problem. CSE Network Flows.
Advanced Algorithm Design and Analysis (Lecture 8) SW5 fall 2004 Simonas Šaltenis E1-215b
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
Nick McKeown Spring 2012 Maximum Matching Algorithms EE384x Packet Switch Architectures.
1 The Max Flow Problem. 2 Flow networks Flow networks are the problem instances of the max flow problem. A flow network is given by 1) a directed graph.
CS138A Network Flows Peter Schröder. CS138A Flow Networks Definitions a flow network G=(V,E) is a directed graph in which each edge (u,v)
1 Generality of Languages Maximum Cardinality Matching Max (s,t)-Flow Min Cost Flow Hopcroft-Karp Linear Programs Reduction Edmonds-Karp Klein’s algorithm.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2001 Lecture 4 Tuesday, 2/19/02 Graph Algorithms: Part 2 Network.
1 Maximum flow problems. 2 - Introduction of: network, max-flow problem capacity, flow - Ford-Fulkerson method pseudo code, residual networks, augmenting.
1 Maximum Flow Maximum Flow Problem The Ford-Fulkerson method Maximum bipartite matching.
1 Optimization Spring 2007 (Third Quarter). 2 Some practical remarks Homepage: Exam: Written, 3 hours. There.
CSE 589 Part III The computer is useless It can only answer questions. -- Pablo Picasso.
Network Optimization Models: Maximum Flow Problems In this handout: The problem statement Solving by linear programming Augmenting path algorithm.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Lecture 4 Tuesday, 10/2/01 Graph Algorithms: Part 2 Network.
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.
Flows sourcesink s t Flows sourcesink edge-weights = capacities.
Maximum flow Algorithms and Networks. A&N: Maximum flow2 Today Maximum flow problem Variants Applications Briefly: Ford-Fulkerson; min cut max flow theorem.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2006 Lecture 5 Wednesday, 10/4/06 Graph Algorithms: Part 2.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2004 Lecture 5 Wednesday, 10/6/04 Graph Algorithms: Part 2.
1 The Min Cost Flow Problem. 2 Flow Networks with Costs Flow networks with costs are the problem instances of the min cost flow problem. A flow network.
1 Integrality constraints Integrality constraints are often crucial when modeling optimizayion problems as linear programs. We have seen that if our linear.
Maximum Flow Maximum Flow Problem The Ford-Fulkerson method
1 The Min Cost Flow Problem. 2 The Min Cost Flow problem We want to talk about multi-source, multi-sink flows than just “flows from s to t”. We want to.
Maximum Flow Chapter 26.
CS774. Markov Random Field : Theory and Application Lecture 13 Kyomin Jung KAIST Oct
Lecture 16 Maximum Matching. Incremental Method Transform from a feasible solution to another feasible solution to increase (or decrease) the value of.
Theory of Computing Lecture 13 MAS 714 Hartmut Klauck.
Single Source Shortest-Path: The General Case (with negative edges) Bellman-Ford algorithm. Iteratively relax all edges |V|-1 times Running time? O(VE).
1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
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.
Chapter 7 April 28 Network Flow.
Algorithm Design and Analysis (ADA)
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.
Data Structures & Algorithms Network Flow Richard Newman based on book by R. Sedgewick.
Flow Networks Ching-Chen Huang Hsi-Yue Hsiao. CONTENTS Network flows on directed acyclic graphs Ford-fulkerson Algorithms -Residual networks.
Theory of Computing Lecture 12 MAS 714 Hartmut Klauck.
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
A directed graph G consists of a set V of vertices and a set E of arcs where each arc in E is associated with an ordered pair of vertices from V. V={0,
Maximum Flow Problem Definitions and notations The Ford-Fulkerson method.
Instructor Neelima Gupta Edited by Divya Gaur(39, MCS '09) Thanks to: Bhavya(9), Deepika(10), Deepika Bisht(11) (MCS '09)
TU/e Algorithms (2IL15) – Lecture 12 1 Linear Programming.
The Maximum Network Flow Problem
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)
The Maximum Network Flow Problem
Maximum Flow Chapter 26.
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
The assignment problem
Algorithms and Networks Hans Bodlaender
Network flow problem [Adapted from M.Chandy].
Network Flow & Linear Programming
Algorithms and Networks
Network Flows and Matching (Supplementary)
Lecture 10 Network flow Max-flow and Min-cut Ford-Fulkerson method
Flow Networks Topics Flow Networks Residual networks
Problem Solving 4.
Flow Networks and Bipartite Matching
Algorithms (2IL15) – Lecture 7
Algorithms and Networks
Lecture 22 Network Flow, Part 2
Presentation transcript:

1 Ford-Fulkerson method Ford-Fulkerson(G) f = 0 while( 9 simple path p from s to t in G f ) f := f + f p output f Runs in time O(|f max | |E|) where f max is the maximum flow found.

2 Edmonds-Karp Edmonds-Karp: Implement Ford-Fulkerson by always choosing the shortest possible augmenting path, i.e., the one with fewest possible edges. Edmonds-Karp can be implemented to run in time O(|V| |E| 2 ).

3 Maximum Matching Suppose we use the max flow formulation formulation of the maximum matching problem and solve the resulting flow instance using Edmonds-Karp. How fast an algorithm do we get?

4 Maximum Matching Answer 1: O(|V| |E| 2 ). Answer 2: O(|E| |f|) = O(|V| |E|). Morale: Exponential time/polynomial time distinction removes a lot of information.

5 How do I get my (very big) max flow instance solved? Edmonds-Karp is not the most efficient known algorithm. Preflow-Push algorithms are better, both theoretically and in practice. Should I implement such algorithms myself?

6 Maximum Cardinality Matching Max Flow Min Cost Flow Alternating Path Algorithm Linear Programs Reduction Ford-Fulkerson, Edmonds-Karp Augmenting cycle algorithm Simplex Algorithm, Interior point alg. Algorithm Increasing generality Decreasing efficiency Algorithm Reduction Algorithm Mixed Int. Lin. Prog. Branch and Bound, Branch and Cut

7 Standard state-of-the-art software ILOG CPLEX ( ) X-press MP ( )

8 The Min Cost Flow Problem

9 The Min Cost Flow problem We want to impose lower bounds as well as capacities on a given arc. Also, arcs should have costs. Rather than maximize the value (i.e. amount) of the flow through the network we want to minimize the cost of the flow.

10 Flow Networks with Costs Flow networks with costs are the problem instances of the min cost flow problem. A flow network with costs is given by 1) a directed graph G = (V,E) 2) capacities c: E ! R. 3) balances b: V ! R. 4) costs k: V £ V ! R. k(u,v) = -k(u,v). Convention: c(u,v)=0 for (u,v) not in E.

11 Feasible Flows Given a flow network with costs, a feasible flow is a feasible solution to the min cost flow problem. A feasible flow is a map f: V £ V ! R satisfying capacity constraints: 8 (u,v): f(u,v) · c(u,v). Skew symmetry: 8 (u,v): f(u,v) = – f(v,u). Balance Constraints: 8 u 2 V:  v 2 V f(u,v) =b(u)

12 Cost of Feasible Flows The cost of a feasible flow f is cost(f)= ½  (u,v) 2 V £ V k(u,v) f(u,v) The Min Cost Flow Problem: Given a flow network with costs, find the feasible flow f that minimizes cost(f).

13 Max Flow Problem vs. Min Cost Flow Problem Max Flow Problem Problem Instance: c: E ! R +. Special vertices s,t. Feasible solution: 8 u 2 V–{s,t}:  v 2 V f(u,v) = 0 Objective: Maximize |f(s,V)| Min Cost Flow Problem Problem Instance: c: E ! R. Maps b,k. Feasible solution: 8 u 2 V:  v 2 V f(u,v) = b(u) Objective: Minimize cost(f)

14 Negative Capacities c(u,v) < 0. Let l(v,u) = – c(u,v). f(u,v) · c(u,v) iff f(v,u) ¸ – c(u,v) = l(v,u). l(v,u) is a lower bound on the net flow from v to u for any feasible flow.

15 Balance Constraints Vertices u with b(u)>0 are producing flow. Vertices u with b(u)<0 are consuming flow Vertices u with b(u)=0 are shipping flow.

16. Can we solve the max-flow problem using software for the min-cost flow problem? Unknown Balance!!

17 Capacity 29, Cost -1 All other costs 0, all balances 0. Capacity 29, Cost 0

18 Circulation networks Flow networks with b ´ 0 are called circulation networks. A feasible flow in a circulation network is called a feasible circulation.

19 Unknown Balances!!

20

21 Integrality theorem for min cost flow If a flow network with costs has capacities and balances integer valued and a feasible flow in the network exists, then there is a minimum cost feasible flow which is integer valued. (shown later by “type checking”)

22 Minimum Weight Perfect Matching Given integer weight matrix (w(i,j)), 1 · i,j · n. Find a permutation  on {1,..,n} minimizing  i w(i,  (i)).

23 Tanker Scheduling Problem

24 Capacity 1, Lower Bound 1, Cost 0 Capacity 1, Cost 0 Capacity 4, Cost 1 All balances 0 Capacity 1, Cost 0

25 Hopping Airplane Problem Airplane must travel from city 1, to city 2, to city 3,.., to city n. At most p passengers can be carried at any time. b ij passengers want to go from city i to city j and will pay f ij for the trip. How many passengers should be picked up at each city in order to maximize profits?

26