15.082J and 6.855J and ESD.78J October 26, 2010: Introduction To Minimum Cost Flows
15.082J and 6.855J and ESD.78J October 26, 2010: Introduction To Minimum Cost Flows
Overview of lecture
Quick review of min cost flow problem An application of min cost flows The residual network, again The cycle canceling algorithm for solving the min cost flow problem Reduced costs and optimality conditions
Minimize
j xij -
(i,j)A cijxij
j xji = bi for all i N.
2
b(1) = 1 1 4 3 0 3 5 0 1 2 3
2
6 b(6) = -1 2
The optimal flow is to send one unit of flow along 1-2-5-6. This transformation works so long as there are no negative cost cycles in G. (What if there are negative cost cycles?)
10, 8 s 6, 5
1 1,1 2 13
8,7
add arc (t,s) with a cost of -1 and large capacity. The cost of every other arc is 0.
The optimal solution in the corresponding minimum cost flow problem will send as much flow in (t,s) as possible.
5
Transshipment Problems
Plants with given production capabilities for a product. One can ship directly from the plants to retailers, or from plants to warehouses, and then from warehouses to retailers. There is a given demand for each retailer. Costs of shipment are given. What is the minimum cost method for satisfying demands?
6
A Network Representation
4
Demands
190 1 6
310 2 7 180 400
Assumptions: there is no initial inventory of napkins at the end, no clean napkins remain
2-day cleaning
0
$1
100
1
clean napkins
4 5 25 6 7
100
1
125
50 6
100 2
100 3
100 4
100 75 5
75
125
n+1
9
dirty napkins
Clean napkins
0
4
a
5
dirty napkins
flow = 5 d5
n+1
Dirty napkins
Flow = d5
5
0
n+1
Dirty napkins on day 5 go to Dirty napkins on day 5 come from being used on day 5 (5, 5)
never cleaned
1-day cleaning 2- day cleaning
(5, n+1)
(5, 6) (5, 7)
11
n+1
12
Find a minimum cost circulation such that the flow on (j, j) = dj on arcs (j, j) for j = 1 to n. Lower bound = upper bound = dj
Simplifying assumptions Finding a feasible flow The residual network The cycle canceling algorithm Reduced costs and optimality conditions
13
Some Assumptions
1. All data is integral. (Needed for some proofs, and some running time analysis). 2. The network is directed and connected
3. i=1 to n b(i) = 0.
(Otherwise, there cannot be a feasible solution.)
14
If b(j) > 0, create arc (s, j) with usj = b(j), If b(j) < 0, create arc (j, t) with ujt = - b(j)
2 s
2 2
-4 4
5 1
3 3 5
-4 6
4 4 2
15
-2
Add nodes s and t with b(s) = b(t) = 0 If b(j) > 0, create arc (j, t) with ujt = b(j) and cjt = 0 If b(j) < 0, create arc (s, j) with usj = - b(j) and cjt = 0
4.
2 2
-4 4
5 1 3 3 3 5 -2
-4
4 4 2 cost = - M
16
5 1 3 3 5
3
Initial solution. If b(j) > 0, then xjt =
b(j) If b(j) < 0, then xsj = - b(j) xts = b(j)>0 b(j) xij = 0 otherwise
-2
(supplies are satisfied) (demands are satisfied) (flow into t = flow out of t)
In an optimal feasible solution, xts = 0. There is no flow in any of the artificial arcs)
17
Mental Break
Why is the word ring part of boxing ring? They used to be round.
Was tug of war ever an Olympic event? Yes. Between 1900 and 1920.
18
Mental Break
Where did karate originate?
In India.
What do the following nicknames for sports teams have in common: the Miami Heat, the Minnesota Wild, the Utah Jazz, the Boston Red Sox, and the Chicago White Sox ? None of them ends in the letter s.
19
uij cij
$10
Suppose x12 = 3
5 $10
2 3 -$10
xij -cij
Reducing the flow in (i, j) by 1 is equivalent to sending one unit of flow from j to i. It reduces the cost by cij.
20
To augment around a cycle C is to send units of flow around C, where = min {rij : (i, j) C}
The cycle 1-3-2-1 had negative cost. Its capacity is 15.
22
10
20
5
20 3 5 5
23
update G(x);
Negative Cycle Algorithm
24
25
Finiteness
Theorem. The Negative Cycle Algorithm is finite if all data are finite and integral. Proof. By flow decomposition, we can express the min cost flow as the sum of n+m paths and cycles. Each path and cycle has a cost bounded by nC, where C = max (|cij| : (i,j) A). The cost of the flow is at most (nC)(n+m)U, where U is the largest capacity. At each iteration of cycle canceling, the cost improves by at least one.
26
Optimality
Theorem. The Negative Cycle Algorithm terminates with an optimal flow. Proof. Consider the final residual network G(x*). Suppose that x* is not optimal. Equivalently, the flow y = 0 is not optimal for the circulation problem in G(x*). Let y* be a minimum cost circulation in G(x*). Then y* can be decomposed into flows around cycles. At least one of these cycles (say C) has negative cost. But this contradicts that the algorithm terminated.
27
Optimality conditions
Most iterative optimization algorithms stop when optimality conditions are satisfied. We describe optimality conditions for the min cost flow problem.
28
For unit of flow out of node i, subtract i from the cost. For unit of flow into node j, add j to the cost. $3 1 + 2
1 -$5
$3
2 $1
-$5 3 + 1 3
$1 2 + 3
29
1 -$5
2
$1 2 + 3
-$5 3 + 1
Corollary. Optimizing with respect to reduced costs is equivalent to optimizing with respect to the original costs.
30
Optimality Conditions
Theorem. A flow x* is optimal if and only if there is a vector * so that c*ij 0 for all (i, j) G(x*). Proof. We already know that x* is optimal if and only if there is no negative cost cycle in G(x*). It remains to show that there is no negative cycle in G(x*) if * so that c*ij 0 for all (i, j) G(x*). Suppose first that there is such a vector *. Then the reduced cost of every cycle in G(x*) must be non-negative
31
Optimality Conditions
Proof. Continued. Suppose now that there is no negative cycle cycle in G(x*). Let d(i) be the shortest path length from node 1 to node i in G(x*) using original costs. (Assume that such a path exists). Then for all (i, j) in G(x*), d(j) d(i) + cij (i, j) G(x*) Let *i = - d(i) for all i. Then c*ij = cij + d(i) d(j) 0 for all (i, j) G(x*). QED
32
ui
j c*ij
Optimality conditions.
1.
If x*ij = uij, then (i, j) G(x*) and c*ij 0 (so that c*ji 0)
If 0 < x*ij < uij, then (i, j) G(x*) and (j, i) G(x*) and c*ij = 0.
-c*ij
3.
33
2.
3.
Optimality conditions 2.
1.
2.
3.
It is a very generic algorithm for solving minimum cost flows. Key subroutine: finding a negative cost cycle. It can be done in different ways.
35
POSSIBILITY 3. Augment along the cycle that minimizes COST(C)/|C|. (The cost divided by the number of arcs.)
36
Summary
Some applications of the minimum cost flow problem Cycle Canceling Algorithm
37
MITOpenCourseWare http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.