1 ford-fulkerson method ford-fulkerson(g) f = 0 while( 9 simple path p from s to t in g f ) f := f +...
Post on 22-Dec-2015
217 views
TRANSCRIPT
1
Ford-Fulkerson method
Ford-Fulkerson(G) f = 0
while(9 simple path p from s to t in Gf)
f := f + fp
output f
• Runs in time O(|fmax| |E|) where fmax 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
MaximumCardinalityMatching
Max Flow
Min Cost Flow
Alternating PathAlgorithm
Linear Programs
Reduction
Reduction
Reduction
Ford-Fulkerson,Edmonds-Karp
Augmenting cyclealgorithm
Simplex Algorithm,Interior point alg.
Algorithm
Algorithm
Algorithm
Incr
easi
ng g
ener
ality
Dec
reas
ing
effic
ienc
y
Algorithm
Reduction
AlgorithmMixed Int. Lin. Prog. Branch and Bound,Branch and Cut
7
Standard state-of-the-art software
• ILOG CPLEX (www.ilog.com)
• X-press MP (www.dashoptimization.com)
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 u2V–{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 u2V: 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!! Unknown Balance!!
18
Circulation networks
• Flow networks with b ´ 0 are called circulation networks.
• A feasible flow in a circulation network is called a feasible circulation.
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)).
24
Capacity 1, Lower Bound 1, Cost 0
Capacity 1, Cost 0
Capacity 4, Cost 1All 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.
• bij passengers want to go from city i to city j and will pay fij for the trip.
• How many passengers should be picked up at each city in order to maximize profits?