Discrete Optimization Lecture Notes 3
Discrete Optimization Lecture Notes 3
(ii) the net inflow at vertex w equals the demand b(w) for every vertex w.
The goal is to minimize a linear objective function cT x over the set of feasible flows. The case that
u(e) = ∞ for every edge e (i.e. no upper bounds) is called the transshipment problem. We will see that
if u and b are integral (u(e) = ∞ also allowed), then there is always an optimal integral solution if an
optimal solution exists. We have seen that a.o. the maximum-flow problem, the shortest path problem
and the assignment problem can be seen as special cases of the min-cost flow problem.
The goal is to find an (efficient) algorithm for the min cost flow problem. The first observation is, that
already the feasibility problem is non-trivial. A feasible flow (if it exists) can however be found using the
max-flow algorithm of last week.
For finding an optimal flow, we find a better (cheaper) feasible flow in each iteration, by modifying the
flow along a negative cost circuit in the auxiliary graph, much like we did in the max-fow algorithm. The
main difference is that we are now considering the length of a circuit in terms of the cost-function (and
we consider circuits instead of r–s paths).
Just as for the max-flow algorithm, the algorithm does not converge if you choose the negative circuits
in a very bad way. However, if we always choose a negative circuit of minimum mean cost, (total cost
divided by the number of arcs in the circuit), then the algorithm terminates afer a polynomial number
(O(m2 n log n)) of iterations as was proved by Goldberg and Tarjan. It is an exercise to show that such a
minimum mean cost cycle can be found in time O(nm).
A key ingredient in proving this bound on the running time is a lemma similar to the one we used for
max-flow.
Lemma 1. Let G = (V, E) be a digraph, c : E → R a cost function. Let C be a minimum mean length
directed circuit, say of mean length k < 0. Let e be an edge traversed by C. Denote by G0 the digraph
obtained from G by adding the reverse arc e−1 to G (the cost of this reverse arc is −c(e)). Then, any
directed circuit C 0 in G0 traversing e−1 , has mean length at least n−2
n k > k.
In each iteration of our algorithm, we find a minimum mean cost directed circuit C in the auxiliary
digraph. After augmentation, the auxiliary graph changes only by:
• removing at least one edge that was on C
1
The ‘only if’ part is clear since any negative cost dicircuit gives an improved flow. The ‘if’ part can
be shown using LP-duality. Consider the primal program that corresponds to finding a minimum cost
feasible flow:
X
minimize cvw xvw
vw∈E
subject to fx (v) = bv for all v ∈ V
−xvw ≥ −uvw for all vw ∈ E
x ≥ 0
X X
maximize y v bv − uvw zvw
v vw
subject to −yv + yw − zvw ≤ cvw for all vw ∈ E
z ≥ 0
Writing out weak duality for feasible primal solution x and feasible dual solution y, z we get
X X
xvw cvw ≥ xvw [−yv + yw − zvw ]
vw vw
X X
= yv fx (v) − xvw zvw
v vw
X X
= y v bv − xvw zvw
v vw
X X
≥ y v bv − uvw zvw
v vw
Observe that equality holds if and only the following two conditions are met:
If xvw < uvw , then zvw = 0.
(1)
If xvw > 0, then cvw = −yv + yw − zvw .
To show that the flow x produced by our algorithm is optimal, it suffices to produce a dual feasible
solution y, z that satisfies the complementary slackness conditions with respect to the primal solution
(the flow x). What we can use is the fact that Gx has no negative cost circuit. This implies that it has a
potential: a function y : V → R such that yv + cvw ≥ yw for every edge vw of Gx . In terms of the original
network G this means:
If xvw < uvw , then yv + cvw − yw ≥ 0.
(2)
If xvw > 0, then yw − cvw − yv ≥ 0.
Setting zvw = max(0, yw − cvw − yv ), we obtain a feasible dual solution. Moreover, (2) implies that (1)
holds.
Network simplex
Another method for min cost flow, that is not polynomial time but is used most often in practice, is the
network simplex method. One advantage of this method is, that the individual iterations are much cheaper
than the O(nm) for the previous algorithm. This method was not discussed in class, but you should read
this part yourself (second half of Chapter 4.2). A detailed example can be found on Brightspace.
Exercises
CH 4.1: 4.5, 4.8, 4.9, 4.11
CH 4.2: 4.20, 4.21, 4.22, 4.27