Algorithm Design
Algorithm Design
Algorithm Design
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
410<br />
Chapter 7 Network Flow<br />
Finally, we have to consider how to initialize the algorithm, so as to get it<br />
underway. We initialize M to be the empty set, define p(x) = 0 for all x ~ X,<br />
and define p(y), for y a Y, to be the minimum cost of an edge entering y. Note<br />
that these prices are compatible with respect to M = ¢.<br />
We summarize the algorithm below.<br />
Start with M equal to the empty set<br />
Define p(x)=0 for x~X, and p(y)--- win c e for y~Y<br />
e into y<br />
While M is not a perfect matching<br />
Find a minimum-cost s-[ path P in G M using (7.64) with prices p<br />
Augment along P to produce a new matching M r<br />
Find- a set of compatible prices with respect to M r via (7.65)<br />
Endwhile<br />
The final set of compatible prices yields a proof that GM has no negative<br />
cycles; and by (7.63), this implies that M has minimum cost.<br />
(7.66) The minimum-cost perfect matching can be found in the time required<br />
i<br />
Extensions: An Economic Interpretation of the Prices<br />
To conclude our discussion of the Minimum-Cost Perfect Matching Problem,<br />
we develop the economic interpretation of the prices a bit further. We consider<br />
the following scenario. Assume X is a set of n people each looking to buy a<br />
house, and Y is a set of n houses that they are all considering. Let v(x, y) denote<br />
the value of house y to buyer x. Since each buyer wants one of the houses,<br />
one could argue that the best arrangement would be to find a perfect matching<br />
M that maximizes ~(x,y)~4 v(x, y). We can find such a perfect matching by<br />
using our minimum-cost perfect matching algorithm with costs ce = -v(x, y)<br />
if e = (x, y).<br />
The question we will ask now is this: Can we convince these buyers to<br />
buy the house they are allocated? On her own, each buyer x would want to<br />
buy the house y that has maximum value v(x, y) to her. How can we convince<br />
her to buy instead the house that our matching M al!ocated ~. We will use prices<br />
to change the incentives of the buyers. Suppose we set a price P(y) for each<br />
house y, that is, the person buying the house y must pay P(Y). With these<br />
prices in mind, a buyer will be interested in buying the house with maximum<br />
net value, that is, the house y that maximizes v(x, y) -P(Y). We say that a<br />
Solved Exercises<br />
perfect matching M and house prices P are in equilibrium if, for all edges<br />
(x, y) ~ M and all other houses y’, we have<br />
v(x, y) - P(~) > v(x, y’) - P(y’).<br />
But can we find a perfect matching and a set of prices so as to achieve this<br />
state of affairs, with every buyer ending up happy? In fact, the minimum-cost<br />
perfect matching and an associated set of compatible prices provide exactly<br />
what we’re lookin.g for.<br />
(7,67) LetM be aperfect matchingofminimum cost, where c e = ~v(x, y) for<br />
each edge e ~ (x, y), and let p be a compatible set of prices, Then the matching<br />
M and the set ofprices {P(y) = -p(y):y ~ Y} are in equilibrium,<br />
Proof. Consider an edge e = (x, y) ~ M, and let e’ = (x, y’). Since M and p are<br />
compatible, we have p(x) + c e = p(y) and p(x) + c e, > p(y’). Subtracting these<br />
two inequalities to cance! p(x), and substituting the values of p and c, we get<br />
the desired inequality in the definition of equilibrium. []<br />
Solved Exercises<br />
Solved Exercise 1<br />
Suppose you are given a directed graph G = (V, E), with a positive integer<br />
capacity c e on each edge e, a designated source s ~ V, and a designated sink<br />
t ~ V. You are also given an integer maximum s-t flow in G, defined by a flow<br />
value fe on each edge e.<br />
Now suppose we pick a specific edge e ~ E and increase its capacity by<br />
one unit. Show how to find a maximum flow in the resulting capacitated graph<br />
in time O(m + n), where m is the number of edges in G and n is the number<br />
of nodes.<br />
Solution The point here is that O(m + n) is not enough time to compute a<br />
new maximum flow from scratch, so we need to figure out how to use the flow<br />
f that we are given. Intuitively, even after we add 1 to the capacity of edge e,<br />
the flow f can’t be that far from maximum; after all, we haven’t changed the<br />
network very much.<br />
In fact, it’s not hard to show that the maximum flow value can go up by<br />
at most 1.<br />
(7.68) Consider the flow network G’ obtained by adding 1 to the capacity of<br />
e. The value of the maximum flow in G’ is either v(f) or v(f) + 1.<br />
411