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.
5OO<br />
Chapter 8 NP and Computational Intractability<br />
the total weight of the objects selected. This, for example, is what happened in<br />
the proof of (8.24), showing that Scheduling with Release Times and Deadlines<br />
is NP-complete.<br />
At the same time, one must heed the warning that Subset Sum only<br />
becomes hard with truly large integers; when the magnitudes of the input<br />
numbers are bounded by a polynomial function of n, the problem is solvable<br />
in polynomial time by dynamic programming.<br />
Constraint Satisfaction Problems<br />
Finally, we considered basic constraint satisfaction problems, including Circuit<br />
Safisfiability, SAT, and B-SAT. Among these, the most useful for the purpose of<br />
designing reductions is B-SAT.<br />
o 3-SAT: Given a set of clauses C1 ..... Ck, each of length B, over a set of<br />
variables X = {xl ..... xn}, does there exist a satisfying truth assignment?<br />
Because of its expressive flexibility, B-SAT is often a useful starting point for<br />
reductions where none of the previous five categories seem to fit naturally onto<br />
the problem being considered. In designing B-SAT reductions, it helps to recall<br />
the advice given in the proof of (8.8), that there are two distinct ways to view<br />
an instance of B-SAT: (a) as a search over assignments to the variables, subject<br />
to the constraint that al! clauses must be satisfied, and (b) as a search over<br />
ways to choose a single term (to be satisfied) from each clause, subject to the<br />
constraint that one mustn’t choose conflicting terms from different clauses.<br />
Each of these perspectives on B-SAT is useful, and each forms the key idea<br />
behind a large number of reductions.<br />
Solved Exercises<br />
Solved Exercise 1<br />
You’re consulting for a small high-tech company that maintains a high-security<br />
computer system for some sensitive work that it’s doing. To make sure this<br />
system is not being used for any i~icit purposes, they’ve set up some logging<br />
software that records the IP addresses that all their users are accessing over<br />
time. We’ll assume that each user accesses at most one IP address in any given<br />
minute; the software writes a log file that records, for each user ~ and each<br />
minute m, a value I(~, m) that is equal to the IP address (if any) accessed by<br />
user u during minute m. It sets I(~, m) to the null symbol 3_ if u did not access<br />
any IP address during minute m.<br />
The company management iust learned that yesterday the system was<br />
used to lannch a complex attack on some remote sites. The attack was carried<br />
out by accessing t distinct IP addresses over t consecutive minutes: In minute<br />
Solved Exercises<br />
1, the attack accessed address is; in minute 2, it accessed address i2; and so<br />
on, up to address i t in minute t.<br />
Who could have been responsible for carrying out this attack? The company<br />
checks the logs and finds to its surprise that there’s no single user u who<br />
accessed each of the IP addresses involved at the appropriate time; in other<br />
words, there’s no u so that I(u, ra) = i m for each minute ra from I to t.<br />
So the question becomes: What if there were a small coalition of k users<br />
that collectively might have carried out the attack? We will say .a subset S of<br />
users is a suspicious coalition if, for each minute m from 1 to t, tiiere is at least<br />
one user u ~ S for which I(u, m) = im. (In other words, each IP address Was<br />
accessed at the appropriate time by at least one user in the coalition. )<br />
The Suspicious Coalition Problem asks: Given the collection of all values<br />
I(u, ra), and a number k, is there a suspicious coalition of size at most<br />
Solution First of all, Suspicious Coalition is clearly in ~:P: If we were to be<br />
shown a set S of users, we could check that S has size at most k, and that<br />
for each minute ra from 1 to t, at least one of the users in S accessed the IP<br />
address im.<br />
Now we want to find a known NP-complete problem and reduce it to<br />
Suspicious Coalition. Although Suspicious Coalition has lots of features (users,<br />
minutes, IP addresses), it’s very clearly a covering problem (following the<br />
taxonomy described in the chapter): We need to explain all t suspicious<br />
accesses, and we’re allowed a limited number of users (k) with which to do<br />
this. Once we’ve decided it’s a covering problem, it’s natural to try reducing<br />
Vertex Cover or Set Cover to it. And in order to do this, it’s useful to push most<br />
of its complicated features into the background, leaving just the bare-bones<br />
features that will be used to encode Vertex Cover or Set Cover.<br />
Let’s focus on reducing Vertex Cover to it. In Vertex Cover, we need to cover<br />
every edge, and we’re only al!owed k nodes. In Suspicious Coalition, we need<br />
to "cover" all the accesses, and we’re only allowed k users. This parallelism<br />
strongly suggests that, given an instance of Vertex Cover consisting of a graph<br />
G = (V, E) and a bound k, we should construct an instance of Suspicious<br />
Coalition in which the users represent the nodes of G and the suspicious<br />
accesses represent the edges.<br />
So suppose the graph G for the Vertex Cover instance has ra edges<br />
el .....%, and ej = (vj, wj). We construct an instance of Suspici6us Coalition<br />
as follows. For each node of G we construct a user, and for each edge<br />
et = (vt, wt) we construct a minute t. (So there will be m minutes total.) In<br />
minute t, the users associated with the two ends of et access an IP address it,<br />
and all other users access nothing. Finally, the attack consists of accesses to<br />
addresses il, i2 ..... irn in minutes 1, 2 ..... m, respectively.<br />
501