Sei sulla pagina 1di 5

Week 7

1 Network Flow
We continue considering network flow problems.
We consider the uncapacitated problem

min cT f
s.t. Af = b (1)
0 ≤ f.

1.1 Dual algorithms


1.1.1 Dual ascent and Primal dual
Dual ascent methods work on the dual problem
Pn
max i=1 pi bi (2)
s.t. pi ≤ cij + pj , ∀(i, j) ∈ A.

In each iteration there is a dual feasible solution and the algorithm checks wether
there exists a direction d with p + θd is another feasible solution and dT b > 0.
Such a direction is called a dual ascent direction. It so happens that for the
search for such directions d we can concentrate on those that are of the form
½
1, if i ∈ S
di =
0, otherwise

for some subset S ⊂ N . Such a direction, which we write as dS is called an


elementary direction. Feasibility of dS is in fact characterised by

i ∈ S and pi = cij + pj ⇒ j ∈ S.

In the book such arcs, for which equality holds in the dual restriction, are
called balanced arcs. According to complementary slackness, fij (cij + pj − pi ) =
0, ∀(i, j) ∈ A, these are the only arcs in an optimal primal solution that can
carry positive flow.

Let Q+ = {i | bi > 0} and Q− = {i | bi < 0}. Create the equivalent problem


with only one auxiliary source node s and one auxiliary sink node t, and aux-
iliary arcs (s, i) with capacity bi for every i ∈ Q+ and auxiliary arcs (i, t) with
capacity |bi | for i ∈ Q− . Capacities on all other arcs remain infinite. Call this
network Gst .

Now delete from Gst all arcs that are not balanced, yielding the network Gbalanced ,
that next to the auxiliary arc includes only balanced arcs.PSolve the max flow
problem on this network. If the max flow happens to be {i|bi >0} bi then we

1
have a feasible flow and a dual solution that satisfy the complementary slack-
ness conditions and therefore it is optimal. In this case, at termination the cut
found is just s since all the arcs going out of s are all saturated, used to their
full capacity.

Otherwise at termination, the max flow algorithm will give us a cut S, contain-
ing a subset of Q+ . The claim is that dS is a dual ascent direction.

Feasibility. Take into account that there is no coefficient for s in dS . If i ∈ S,


i 6= s, and j ∈
/ S, j 6= t, then, because the capacity on (i, j) is infinite, this must
imply that (i, j) simply does not exist in Gbalanced . Thus (i, j) is not a balanced
arc. Hence, indeed dS is a feasible direction.

Improvement. Again, because of the infinite P capacities of the non-auxiliary


arcs, the flow from s into nodes in S ∩ Q+ , i∈S∩Q+ fsi , must reach nodes in
S ∩ Q− because of flow-conservation on all intermediary nodes and this flow
saturates all the arcs {(j, t) | j ∈ S ∩ Q− }, because otherwise we would have an
augmenting path. Thus,
X X
fsi = |bj |.
i∈S∩Q+ j∈S∩Q−

Now,
X X X X X X
(dS )T b = bi + bj = bi + bj > fsi − |bj | = 0.
i∈S∩Q+ j∈S∩Q− i∈S∩Q+ j∈S∩Q− i∈S∩Q+ j∈S∩Q−

The strict inequality is due to the fact that i ∈ S ∩ Q+ implies that the arc (s, i)
is not saturated: fsi < bi .

What we just showed is

Theorem 1.1 A dual solution p is optimal or there exists an elementary direc-


tion for improvement.
Given such an improving dS we reset p → p + θdS and we choose θ as large as
possible, i.e., such that all dual restrictions remain satisfied. This is automat-
ically true for i, j both in S or i, j both not in S. In particular, this implies
that all arcs that were balanced remain balanced. Also, if i ∈ / S and j ∈ S the
dual constraint remain satisfied: pi ≤ cij + pj + θ. Thus we only need to take
care that

pi + θ ≤ cij + pj , ∀i ∈ S, j ∈
/ S, (i, j) ∈ A.

We therefore choose

θ∗ = min {cij + pj − pi }.
i∈S, j ∈S,
/ (i,j)∈A

2
In doing so, at least one extra arc becomes balanced, and we start a new max
flow search in the larger graph. We continue the process until, either a flow
augmentation has been found, in which case we augment the flow and restart
the search for a new augmenting path, or no elementary dual ascent direction
is found, and we conclude optimality.

This is the description of the so-called primal-dual algorithm. A little thought


should make it clear that after a dual update, we don’t need to compute a flow
from scratch, since the update simply adds some extra arcs with infinite capac-
ity to the network, making extra nodes reachable from s, next to the ones that
were already reachable before the update. The search for the extra reachable
nodes can therefore be started with the cut from before the update.

Assuming that the total supply (is total demand) is B, there are at most B
flow augmentations. In between two consecutive augmentations there can be at
most n dual updates (at most n nodes can become reachable), giving in total at
most nB dual updates. Straightforward calculation of θ∗ in each update would
cost O(m) making the total running time O(mnB).

1.1.2 Auction algorithm


The auction algorithm is an extremely simple algorithm which works well in
practice and not too bad in theory. It is explained using the
Assignment problem: Given n jobs and n people, and given cij as the cost if
job j is assigned to person i. Find an assignment of jobs to persons, such that
each job is assigned to exactly one person and each person is assigned exactly
one job such that the total cost is minimised.

Pn Pn
min i=1 j=1 cij fij

Pn
s.t. i=1 fij = 1, ∀j = 1, . . . , n
Pn
j=1 fij = 1, ∀i = 1, . . . , n

fij ≥ 0, ∀i, j
In fact we should restrict fij to be either 0 or 1 but we know already that the
optimal solution has integer values given integer right-hand side coefficients. I
remark, as in the book, that the maximization version of this problem with
cij ∈ {0, 1} is the bipartite matching problem.

The idea behind the auction algorithm stems from insights into the optimal dual
solution and the complementary slack conditions:
Pn Pn
max i=1 ri + j=1 pj
Dual :
s.t. ri + pj ≤ cij , ∀i, j,

3
implying ri = minj=1,...,n {cij − pj }.

Compl.Slack : fij > 0 ⇒ ri + pj = cij

implying that

fij > 0 ⇒ pj − cij = −ri = min {pk − cik }.


k=1,...,n

Think of the persons as contractors who try to get a job and interpret pj as the
price paid to the person who will do job j. In this interpretation pj − cij is the
profit that person i makes if he gets assigned job j. Thus, in this interpretation,
according to complementary slack, if i gets assigned j, then j is amongst his
most profitable jobs. Indeed, if in the auction algorithm described below, we
would use for the price of each job j the optimal value of its dual variable pj
then the auction algorithm would give an optimal assignment. The main goal
behind the auction algorithm is to avoid the LP-computations and settle for a
much simpler iterative process of bidding to compute the optimal dual solution.

In a “bidding round,” suppose that under a certain set of prices p1 , . . . , pn per-


son i remains unassigned. Suppose her most profitable job is job j, then she
“bids” a lower price for that job, but making sure that her profit on j will not
be much lower than that of her second most profitable job: she bids the price
pj = maxk6=j {pk − cik } + cij − ². This is done by all unassigned persons. Then,
each job that has received a bid is assigned to the person with the lowest bid
on that job. If previously the job was assigned to some other person then this
person becomes unassigned, since in the bidding round he does not bid being
possessor of some job whence assigned.

If ² would be 0, then we could encounter the following cycling situation: If for


some unassigned person, 3 say, there are two jobs, 1 and 2 say, equally prof-
itable, but job 1 is held by person 1 and job 2 by person 2. Then 3 will bid the
price of job 2 say, but in fact lowering the price by 0, in order not to make job
1 the most profitable one. Thus, person 3 gets job 2 at the expense of person
2. Now suppose that also for person 2 jobs 1 and 2 are equally profitable, then
the situation will be reversed back again in the next bidding round.

On the other hand ² > 0 makes that persons do not get the most profitable
jobs that they would get according to the complementary slack (CS) conditions.
However they get so almost. We say that ²-CS holds for all assigned persons if
each of them gets a job, the profit of which is within ² from the best profit.

Theorem 1.2 (Theorem 7.14 in [B&T]) In each step of the algorithm all
persons assigned satisfy ²-CS.

Proof. The algorithm starts with some initial universal price P , e.g. equal to
maxi,j cij . Notice that the actual value of P is unimportant (as before), but we
may like to work with positive profits. Initially no persons are assigned and the

4
theorem certainly holds.

After bidding, if person i gets assigned job j, then pj is set to pj = maxk6=j {pk −
cik } + cij − ² ⇒ pj − cij ≥ maxk6=j {pk − cik } + cij − ². Changes in prices of other
jobs in the same round keep the statement true since prices are only lowered.
If in a round job j remains in i’s hands then there is no new bid on job j and
hence the price remains the same. 2

Let us assume, w.l.o.g. that the algorithm starts with equal initial price for all
jobs: let us take P = maxi,j cij .
(a) Once a job has received a bid it will always remain assigned to some person.
This means that the algorithm stops at the moment the last job gets a bid.
(b) If the algorithm would not terminate, then some job, k say, never gets a
bid, i.e. remains having value P . But in each round the price of some job is
decreased by at least ². Hence after 1 + (n − 1)P/² rounds at least one job must
have negative profit, whereas job k has still non-negative profit for all persons,
contradicting that it did not receive a bid.

Thus indeed the algorithm terminates after O(n maxi,j cij /²) bidding rounds.
Each bidding round requires determination of the most profitable and the second
most profitable job for each unassigned person, which in its most straightforward
implementation takes O(n2 ). In total the running time is O(n3 maxi,j cij /²).

A nice property is that if we choose ² small enough, and in fact ² = 1/n is small
enough, then the auction algorithm produces an optimal assignment, provided
that the costs-coefficients are integer value (Theorem 7.16 in [B&T]). The proof
is straightforward from Theorem 7.14 (proved above).

Material of Week 7 from [B& T]


Chapter 7, 7.7 – 7.8. We skip Sections 7.9 and 7.10

Exercises of Week 7
7.28, 7.29, 7.32 and you may try 7.30.

Next time
Chapter 8

Potrebbero piacerti anche