48 4 Reductions – Algorithmic Relationships Between Problems
any clauses that contain it. (Any empty clause is unsatisfiable.) If the result-
ing set of clauses still has an optimal value of w
opt
,thenx
1
=1belongsto
an optimal variable assignment, and we can look for suitable assignments for
x
2
,...,x
n
in the resulting clause set. If the resulting set of clauses has an
optimal value that is smaller than w
opt
(larger is impossible), then we know
that x
1
= 1 does not belong to an optimal variable assignment. Thus x
1
=0
must belong to an optimal solution and we can search for suitable assignments
for x
2
,...,x
n
in the clause set that results from setting x
1
= 0 in the original
clause set. The number of calls to the algorithm for the evaluation problem is
bounded by n + 1, all the calls are for instances that are no larger than the
original, and the additional overhead is modest.
For the clique problem
Clique, we first determine the size w
opt
of the
largest clique. In order to decide if a vertex v must belong to a largest clique,
we can remove the vertex and the edges incident to it from the graph, and
check if the remaining graph still has a clique of size w
opt
. If this is the case,
then there is a clique of size w
opt
that does not use vertex v. Otherwise the
vertex v must belong to every maximal clique, so we remove v, the edges
incident to v, and all vertices not adjacent to v from the graph and look for
a clique of size w
opt
− 1 in the remaining graph. By adding the vertex v to
such a clique, we obtain the desired clique of size w
opt
. Once again, n +1
queries about graphs that are no larger than the original input suffice to find
the optimal solution.
For
TSP we can output any tour if w
opt
= ∞. Otherwise, we can tem-
porarily set finite distances d
i,j
to ∞ to see if the stretch from i to j must be
in an optimal tour. If it is required for an optimal tour, then we return d
i,j
to its original value, otherwise we leave the value ∞.Oncewehavedonethis
sequentially for all distances we obtain a distance matrix in which exactly the
edges of an optimal tour have finite values. In this case the number of queries
to the algorithm for the evaluation problem is N +1, where N is the number
of finite distance values.
The situation for the bin packing problem is somewhat more complicated.
If we decide that certain objects go in certain bins, then the remaining capacity
of those bins is no longer b, and we obtain a problem with bins of various sizes,
which by the definition of
BinPacking is no longer a bin packing problem,
so we can’t get information about this situation by querying the evaluation
problem. For a generalized version of
BinPacking with bins of potentially
different sizes, this approach would work. But in our case we can employ a
little trick. We can “glue together” two objects so that they become one new
object with size equal to the sum of the sizes of the two original objects. If
this doesn’t increase the number of bins required, we can leave the two objects
stuck together and work with a new instance that has one fewer object. If
object i cannot be glued to object j, then this will subsequently be the case
for all pairs of new superobjects one of which contains object i and the other
of which contains object j.So
n
2
tests are sufficient. In the end we will have