5 - Network Flow Problems
5 - Network Flow Problems
Transportation problems
Max-flow problems
Integer solutions
Month 1 2 3 4
Number of boats 40 60 70 25
Month 1 2 3 4
Number of boats 40 60 70 25
5-3
Example: Sailco
Parameters:
d1 , d2 , d3 , d4 : demand at each month
5-4
Example: Sailco
Solution: Sailco.ipynb
5-5
Example: Sailco
R OT R OT R OT R OT
x1 y1 x2 y2 x3 y3 x4 y4
h1 h2 h3 h4 h5
1 2 3 4
d1 d2 d3 d4
5-6
Example: Sailco
R OT R OT R OT R OT
x1 y1 x2 y2 x3 y3 x4 y4
h1 h2 h3 h4 h5
1 2 3 4
d1 d2 d3 d4
5-7
Minimum-cost flow problems
Many optimization problems can be interpreted as
network flow problems on a directed graph.
5-8
Minimum-cost flow problems
1 6
3
2 5 8
4 7
5-9
Minimum-cost flow problems
1 6
3
2 5 8
4 7
5-10
Minimum-cost flow problems
1 6
3
2 5 8
4 7
5-11
Minimum-cost flow problems
1 6
3
2 5 8
4 7
5-12
Minimum-cost flow problems
1 6
3
2 5 8
4 7
minimize c Tx
x∈R|E|
subject to: Ax = b
p≤x ≤q
If
P
i∈N bi = 0, the model is called balanced.
Unbalanced models are always infeasible.
Note: balanced models may still be infeasible.
5-14
Minimum-cost flow problems
Many problem types are actually min-cost flow models:
transportation problems
assignment problems
transshipment problems
shortest path problems
max-flow problems
Let’s look at these in more detail...
5-15
Transportation problems
5-16
Transportation example
Millco has three wood mills and is planning three new logging
sites. Each mill has a maximum capacity and each logging site
can harvest a certain number of truckloads of lumber per day.
The cost of a haul is $2/mile of distance. If distances from
logging sites to mills are given below, how should the hauls be
routed to minimize hauling costs while meeting all demands?
5-18
Transportation example
A B C A
Solution is:
1 20 0 0 20
2 10 20 0 30
3 0 15 30 45
3 30 35 30 30
5-19
Assignment problems
We have n people and n tasks. The goal is to assign each
person to a task. Each person has different preferences (costs)
associated with performing each of the tasks. The goal is to
find an assignment that minimizes the total cost.
5-20
Assignment example
The coach of a swim team needs to assign swimmers to a
200-yard medley relay team to compete in a tournament. The
problem is that his best swimmers are good in more than one
stroke, so it’s not clear which swimmer to assign to which
stroke. Here are the best times for each swimmer:
5-22
Transshipment example: Sailco
R OT R OT R OT R OT
x1 y1 x2 y2 x3 y3 x4 y4
h1 h2 h3 h4 h5
1 2 3 4
d1 d2 d3 d4
R
: sources i : relays customers : sinks
OT
5-24
Longest path example
The house building example is a longest path problem!
t,3
s,2
5-25
Longest path example
The house building example is a longest path problem!
3
Add source and sink nodes l
Move times out of nodes 3 2
1
and onto preceding edges
o m n
Each path says “it takes at 2
3
3
least this long.” Longest t
path gives the shortest time s 2
we have to wait.
0
5-26
Max-flow problems
We are given a directed graph and edge capacities. Find the
maximum flow that we can push from source to sink.
(edge capacity)
5-27
Max-flow problems
We are given a directed graph and edge capacities. Find the
maximum flow that we can push from source to sink.
5-28
Integer solutions
Some minimum-cost flow problems require integer solutions
(assignment problems and shortest path problems). Is there a
way of guaranteeing integer solutions? yes!
5-29
Integer solutions
5-30