04.09.2013 Views

Algorithm Design

Algorithm Design

Algorithm Design

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

614<br />

Chapter 11 Approximation <strong>Algorithm</strong>s<br />

I+£<br />

1<br />

I:~.<br />

wo sets can be used to ~<br />

over everything, but the|<br />

reedy algorithm doesn’t|<br />

nd them. J<br />

Figure 11.6 An instance of the Set Cover Problem where the weights of sets are either<br />

1 or 1 + e for some small e > 0. The greedy algorithm chooses sets of tot.a1 weight 4,<br />

rather than the optimal solution of weight 2 + 2e.<br />

As in Sections 11.1 and 11.2, our analysis will require a good lower bound<br />

on this optimum. In the case of the Load Balancing Problem, we used lower<br />

bounds that emerged naturally from the statement of the problem: the average<br />

load, and the maximum iob size. The Set Cover Problem wil! turn out to be<br />

more subtle; "simple" lower bounds are not very useful, and instead we will<br />

use a lower bound that the greedy algorithm implicitly constructs as a byproduct.<br />

Recall the intuitive meaning of the ratio wi/ISi ~ RI used by the algorithm; it<br />

is the "cost paid" for covering each new element. Let’s record this cost paid for<br />

11.3 Set Cover: A General Greedy Heuristic<br />

element s in the quantity c s. We add the following line to the code immediately<br />

after selecting the set S t.<br />

Define Cs=Wi/]Sig~ R[ for all s~SiN R<br />

The values c s do not affect the behavior of the algorithm at all; we view<br />

them as a bookkeeping device to help in our comparison with the optimum<br />

w*. As each set S i is selected, its weight is distributed over the costs c s of the<br />

elements that are ~ewly covered. Thus these costs completely account for the<br />

total weight of the set cover, and so we have<br />

(11.9) If ~ is the set cover obtained by Greedy-Set-Cover, then ~s~e wi =<br />

~s~u Cs.<br />

The key to the analysis is to ask how much total cost any single set S k<br />

can account for--in other words, to give a bound on ~,s~sk Cs relative to the<br />

weight w k of the set, even for sets not selected by the greedy algorithm. Giving<br />

an upper bound on the ratio<br />

~k<br />

that holds for every set says, in effect, "To cover a lot of cost, you must use a lot<br />

of weight." We know that the optimum solution must cover the full cost ~s~u Cs<br />

via the sets it selects; so this type of bound will establish that it needs to use<br />

at least a certain amount of weight. This is a lower bound on the optimum,<br />

just as we need for the analysis.<br />

Our analysis will use the harmonic function<br />

n<br />

H(n) = ~ 1<br />

i---1 l<br />

To understand its asymptotic size as a function of n, we can interpret it as a<br />

sum approximating the area under the curve y = 1Ix. Figure 11.7 shows how<br />

it is naturally bounded above by 1 + f{ nl~<br />

dx = 1 + In n, and bounded below<br />

. rn+l 1<br />

by dl ~ ax = ln(n + !). Thus we see that H(n) = ® (lnn).<br />

Here is the key to establishing a bound on the performance of the algo-<br />

(11.10) For every set Sk, the sum ~s~sk Cs is at most H (ISk[ ) ¯<br />

Proof. To simplify the notation, we will assume that the elements of S~ are<br />

sa]. Furthermore,<br />

let us assume that these elements are labeled in the order in which they are<br />

assigned a cost cs~ by the greedy algorithm (with ties broken arbitrarily). There<br />

615

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!