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.

616<br />

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

1<br />

1/2<br />

1/3<br />

y = 1/x<br />

Figure 11.7 Upper and lower bounds for the Harmonic Function H(n).<br />

is no loss of generality in doing this, since it simply involves a renaming of the<br />

elements in U.<br />

Now consider the iteration in which element s 1 is covered by~e g,reedy<br />

Sd ~ R by<br />

our labeling of the elements. This implies that ISk r3 RI is at least d -] + 1, and<br />

so the average cost of the set Sk is at most<br />

Wk<br />

ISknR -d-j+1<br />

Note that this is not necessarily an equality, since sj may be covered in the<br />

same iteration as some of the other elements sy for j’ < j. In this iteration, the<br />

greedy algorithm selected a set S i of minimum average cost; so this set Si has<br />

average cost at most that of S~. It is the average cost of S i that gets assigned<br />

to sp and so we have<br />

We now simply add up these inequalities for all elements s ~ S~:<br />

d<br />

]=1<br />

Wk Wk<br />

1 d<br />

o<br />

wt~ = H(d) . w k.<br />

We now complete our plan to use the bound in (11.10) for comparing the<br />

greedy algorithm’s set cover to the optimal one. Letting d* = max~ ISgl denote<br />

the maximum size of any set, we have the following approximation result.<br />

(11.11) The set cover e selected by Greedy-Set-Cover has weight at most<br />

H (d*) times the optimal weight<br />

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

Proof. Let e* denote the optimum set cover, so that w* = ~si~e* wi. For each<br />

of the sets in e*, (11.10) implies<br />

Because these sets form a set cover, we have<br />

1<br />

s~S i<br />

s~U<br />

Cs.<br />

Combining these with (11.9), we obtain the desired bound:<br />

w,= E w,_>E 1 " 1 1<br />

E Cs > E Cs =- E w,. []<br />

size* s~e* s~si - H(d*) s~U H(d*) Si~<br />

Asymptotically, then, the bound in (11. !1) says that the greedy algorithm<br />

finds a solution within a factor O(log d*) of optimal. Since the maximum set<br />

size d* can be a constant fraction of the tota! number of elements n, this is a<br />

worst-case upper bound of O(log n). However, expressing the bound in terms<br />

of d* shows us that we’re doing much better if the largest set is small.<br />

It’s interesting to note that this bound is essentially the best one possible,<br />

since there are instances where the greedy algorithm can do this badly. To<br />

see how such instances arise, consider again the example in Figure 11.6. Now<br />

suppose we generalize this so that the underlying set of elements U consists<br />

of two tall columns with n/2 elements each. There are still two sets, each of<br />

weight 1 + ~, for some small e > 0, that cover the columns separately. We also<br />

create O(log n) sets that generalize the structure of the other sets in the figure:<br />

there is a set that covers the bottommost n/2 nodes, another that covers the<br />

next n/4, another that covers the next rt/8, and so forth. Each of these sets<br />

will have weight 1.<br />

Now the greedy algorithm will choose the sets of size n/2, n/4, n/8 .....<br />

in the process producing a solution of weight S2(!og n). Choosing the two<br />

sets that cover the columns separately, on the other hand, yields the optimal<br />

solution, with weight 2 + 2e. Through more complicated constructions, one<br />

can strengthen this to produce instances where the greedy algorithm incurs<br />

a weight that is very close to H(n) times t_he optimal weight. And in fact, by<br />

much more complicated means, it has been shown that no polynomial-time<br />

approximation algorithm can achieve an approximation bound much better<br />

than H(n) times optimal, unless P = NP.<br />

617

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

Saved successfully!

Ooh no, something went wrong!