Algorithm Design
Algorithm Design
Algorithm Design
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
426<br />
Chapter 7 Network Flow<br />
Thus the hospital relaxes the requirements as follows. They add<br />
a new parameter c > 0, and the system now should try to return to<br />
each doctor j a list L~ with the following properties.<br />
(A*) L~ contains at most c days that do not appear on the list Lj.<br />
L~,<br />
(B) (Same as before) If we consider the whole set of lists L~ .....<br />
it causes exactly Pi doctors to be present on day i, for i = 1, 2 ..... n.<br />
Describe a polynomial-time algorithm that implements this revised<br />
system. It should take the numbers Pl, Pz ..... Pn, the lists<br />
L1 ..... Lk, and the parameter c > 0, and do one of the following two<br />
things.<br />
- Return lists L1, , , L. ’ satisfying properties (A*) and (B); or<br />
2 .... Lk ’ that<br />
- Report (correctly) that there is no set of lists Lv L2 ..... Lk<br />
satisfies both properties (A*) and (B).<br />
20. Your friends are involved in a large-scale atmospheric science experiment.<br />
They need to get good measurements on a set S of n different<br />
conditions in the atmosphere (such as the ozone level at various places),<br />
and they have a set of m balloons that they plan to send up to make these<br />
measurements. Each balloon can make at most two measurements.<br />
Unfortunately, not all balloons are capable of measuring all conditions,<br />
so for each balloon i = 1 ..... m, they have a set Si of conditions<br />
that balloon i can measure. Finally, to make the results more reliable, they<br />
plan to take each measurement from at least k different balloons. (Note<br />
that a single balloon should not measure the same condition twice.) They<br />
are having trouble figuring out which conditions to measure on which<br />
balloon.<br />
Example. Suppose that k = 2, there are n = 4 conditions labeled q, c2, c3, c4,<br />
and there are rn = 4 balloons that can measure conditions, subject to<br />
the limitation that S~ = Sz = {q, c2, c3}, and $3 = $4 = {q, q, c4}..Then one<br />
possible way to make sure that each condition is measured at least k = 2<br />
times is to have<br />
¯ balloon I measure conditions<br />
¯ balloon 2 measure conditions cz, cs,<br />
¯ balloon 3 measure conditions q, c4, and<br />
¯ balloon 4 measure conditions c~, c4.<br />
(a) Give a polynomial-time algorithm that takes the input to an instance<br />
of this problem (the n conditions, the sets Si for each of the ra<br />
balloons, and the parameter k) and decides whether there is a way to<br />
measure each condition by k different balloons, while each balloon<br />
only measures at most two conditions.<br />
21.<br />
Exercises<br />
You show your friends a solution computed by your algorithm from<br />
(a), and to your surprise they reply, "This won’t do at all--one of the<br />
conditions is only being measured by balloons from a single subcontractor."<br />
You hadn’t heard anything about subcontractors before; it<br />
turns out there’s an extra wrinkle they forgot to mention ....<br />
Each of the balloons is produced by one of three different sub.<br />
contractors involved in the experiment. A requirement of the experiment<br />
is that there be no condition for which all k measurements<br />
come from balloons produced by a single subcontractor.<br />
For example, suppose balloon 1 comes from the first subcontractor,<br />
balloons 2 and 3 come from the second subcontractor, and<br />
balloon 4 comes from the third subcontractor. Then our previous solution<br />
no longer works, as both of the measurements for condition<br />
c~ were done by balloons from the second subcontractor. However,_<br />
we could use balloons 1 and 2 to each measure conditions c1, c2, and<br />
use balloons 3 and 4 to each measure conditions c3, c4.<br />
Explain how to modify your polynomial-time algorithm for part<br />
(a) into a new algorithm that decides whether there exists a solution<br />
satisfying all the conditions from (a), plus the new requirement about<br />
subcontractors.<br />
You’re helping to organize a class on campus that has decided to give all<br />
its students wireless laptops for the semester. Thus there is a collection<br />
of n wireless laptops; there is also have a collection of n wireless access<br />
points, to which a laptop can connect when it is in range.<br />
The laptops are currently scattered across campus; laptop e is within<br />
range of a set S~ of access points. We will assume that each laptop is within<br />
range of at least one access point (so the sets S~ are nonempty); we will<br />
also assume that every access point p has at least one laptop within range<br />
of it.<br />
To make sure that all the wireless connectivity software is working<br />
correctly, you need to try having laptops make contact with access points<br />
in such a way that each laptop and each access point is involved in at<br />
least one connection. Thus we will say that a test set T is a collection of<br />
ordered pairs of the form (e, p), for a laptop e and access point p, with<br />
the properties that<br />
(i) If (LP) ~ T, then e is within range ofp (i.e., p ~ Se).<br />
(ii) Each laptop appears in at least one ordered pair in T.<br />
(i~) Each access point appears in at least one ordered pair in T.<br />
427