Вы находитесь на странице: 1из 9

Solving NP-Complete Problems with Quantum

Search

Martin Furer

Department of Computer Science and Engineering


Pennsylvania State University
University Park, PA 16802, USA
furer@cse.psu.edu
http://cse.psu.edu/~furer

Abstract. In his seminal paper, Grover points out the prospect of faster
solutions for an NP-complete problem like SAT. If there are n variables,
then an obvious classical deterministic algorithm checks out all 2n truth
assignments in about 2n steps, while his quantum search algorithm can
nd a satisfying truth assignment in about 2n/2 steps.
For several NP-complete problems, many sophisticated classical algo-
rithms have been designed. They are still exponential, but much faster

than the brute force algorithms. The question arises whether their run-
ning time can still be decreased from T (n) to O( T (n)) by using a quan-
tum computer. Isolated positive examples are known, and some speed-up

has been obtained for wider classes. Here, we present a simple method to
obtain the full T (n) to O( T (n)) speed-up for most of the many non-
trivial exponential time algorithms for NP-hard problems. The method
works whenever the widely used technique of recursive decomposition is
employed.
This included all currently known algorithms for which such a speed-
up has not yet been known.

1 Introduction

Grovers [1,2] quantum algorithm for searching a database to nd a needle in a


haystack has an obvious application for solving many hard combinatorial prob-
lems. In the example of SAT (Satisability of boolean formulas), the quantum
computer goes into a uniformly weighted superposition of 2n states representing
all possible truth assignments to the n variables, each represented by a binary
string of length n.
For a given formula and a given truth assignment the trivial satisability test
runs in polynomial time. The quantum algorithm uses the same kind of test,
but runs it simultaneously for all the 2n truth assignments. Every one of the
2n superpositioned computations stores the result in the same boolean variable.
Then all auxiliary results are erased by an operation sometimes referred to as

Research supported in part by NSF Grant CCR-0209099 and CCF-0728921.

E.S. Laber et al. (Eds.): LATIN 2008, LNCS 4957, pp. 784792, 2008.

c Springer-Verlag Berlin Heidelberg 2008
Solving NP-Complete Problems with Quantum Search 785

uncomputing. If there are successful truth assignments, then their values are
Grovers needles in the haystack. With constant probability, one of them is found
in time O(2n/2 )1 .
This example seems to suggest that Grovers method can only be applied to
a class of very simply structured brute force search algorithms. It is certainly
unrealistic to believe that a method could be designed that could speed up every
thinkable satisability test by the use of quantum computers.
Nevertheless, Angelsmark, Dahllof, and Jonsson [3] have shown that for some
nontrivial nicely structured classical algorithms, a signicant speed-up by using
quantum computers is indeed possible. They present a quantum algorithm for
constraint satisfaction problems and a special version for 3-coloring running in
time O(1.2185n). This is in drastic contrast to our approach. Our goal is to
provide a quadratic speed-up for every known deterministic test. This is pos-
sible, because all such non-trivial tests are based on recursive decomposition.
We can take any state of the art classical algorithm based on recursive decom-
position, like Eppsteins [4] 3-coloring algorithm with a provable running time
of O(1.3289n). We immediately obtain a quantum algorithm running in time
O(1.3289n/2 ) = O(1.1527n). Our method applies as well to all the known deter-
ministic algorithms for other NP-complete decision problems.
Our method does not provide a mechanical transformation from classical de-
cision algorithms to quantum algorithms. To build the quantum algorithm, we
have to take the time analysis of the classical algorithm too, and build it into
the quantum algorithm.
A dierent approach has been taken by Cerf et al. [5]. For well structured
classical solutions, they propose to speed up the search by doing many nested
quantum searches, applied to subtrees of a given search tree. Our method is
much simpler, more widely applicable, and provides a higher speed-up.
Cerf et al. [5] cut a search tree at a small number of levels. Useless subtrees
rooted at a cut level can be omitted. The others have still to be fully searched
down to the next level. They obtain a quadratic speed-up compared to a classical
algorithm that also searches these complete subtrees. But naturally, a classical
algorithm has no need to fully search these sutrees and  could often stop ear-
lier. Therefore, instead of speeding up from T (n) to O( T (n)), their quadratic
speed-up is from the running time of an articially slow classical algorithm. As
an example, the authors point out that while the currently best classical algo-
rithm for 3-SAT runs in time O(20.446n ), their quantum algorithm runs in time
O(20.34n ). As this is a signicant improvement, they consider it a success for
their algorithm, even though the exponent is far from being divided by 2.
A more widely applicable method has been proposed by Brassard, Hyer,
Mosca and Tapp [6]. They show how any randomized classical algorithm with
one-sided error can be transformed into a faster quantum algorithm. The idea
is to run a superposition of the computations with all possible strings produced
by coin tossing. The needles in the haystack are then the accepting computation
paths.
1
Here, O refers to upper bounds up to polynomial factors.
786 M. Furer

In their expository articles, Ambainis [7] as well as Dantsin et al. [8] point out
in particular that Schonings classical algorithm [9], as well as its later improve-
ments can easily be modied for a quantum computation with a quadratic speed
up. The reason is that these algorithms do many runs of the same procedure from
dierent starting points. Where these algorithms use sequential repetitions, a
quantum algorithm just uses quantum amplitude amplication instead, in eect
doing many searches from dierent starting points in parallel.
If a classical randomized algorithm with one-sided error succeeds with proba-
bility cn in polynomial time T (n), then the directly corresponding quantum al-
gorithm running these superpositions also has a success probability of order cn .
In the classical setting the algorithm can be repeated cn times to obtain con-
stant success probability and running time O(T (n)cn ). The quantum algorithm
instead can use amplitude amplication [6], which is a generalization of Grovers
searching algorithm. Using amplitude amplication, a constant success proba-
bility can already be obtained by a quantum computation with running time
n
O(T (n)c 2 ). This is a quadratic improvement, because T (n) is a polynomial.
The resulting running time is much better than the time obtained by a direct
application of Grovers method to a trivial algorithm. The classical randomized
algorithm running in time T (n) does not have to be the brute force search
algorithm that tosses a coin for every boolean variable and checks whether it
denes a satisfying assignment. Instead, the classical algorithm can already be
a sophisticated search algorithm. Hence, this is a signicant generalization of
Grovers algorithm.
In the current paper we do something similar, corresponding to (sophisticated)
deterministic exponential time algorithms. We focus on the wide middle ground
between simplistic brute force approaches or other well structured algorithms
on one hand, and unstructured or arbitrarily structured methods on the other
hand. There might be some mere heuristics, but in all algorithms published with
a complexity analysis, there is just enough regularity to allow the full quantum
search speed-up. We are considering the broad class of algorithms using recursive
decomposition based on self reducibility known as the Davis-Putnam [10,11] pro-
cedure. Thus our method applies to all the classical and recent exponential time
algorithms for NP-hard problems based on recursive decomposition, including
dynamic programming and search tree pruning techniques. For a recent survey
see Woeginger [12].
For our method to work, we have to assume that the recursive decomposition
does not happen completely irregularly. It can be quite complicated, but it has
to be so predictable as to allow the proof of a rigorous complexity bound for the
classical algorithm. Thus all the many algorithms based on recursive decomposi-
tion qualify, if they have been published together with a provable time analysis
(upper bound). The presentation of such an ecient exponential time algorithm
always comes in two quite distinct parts, the denition of the algorithm and the
analysis of its running time. Here, we use both, a classical algorithm and also its
time analysis as building blocks for a quantum algorithm. Thus to be precise,
our algorithm does not produce a quadratic speed-up form an unknown running
Solving NP-Complete Problems with Quantum Search 787

time of an arbitrary classical algorithm, but from the currently provable upper
bound on the classical running time of such an algorithm.
Our quantum algorithm directly applies to all deterministic exponential time
algorithms for NP-hard search problems, that have been published with rigorous
time bounds. Our method is not directly applicable to the few randomized algo-
rithms in this area, like the one based on the approach pioneered by Schoning
[9]. His method is based on local search starting from random points.
As mentioned before, a quadratic speed-up is possible for Schonings algorithm
due to its regularity. Our algorithm can easily handle the derandomized version
of his algorithm [13]. The important point is that this derandomized version
is based on a computation tree with strict bounds on the sizes of its subtrees
rooted at any internal node.
Alternatively, we can easily extend our method using the ideas of Brassard et
al. [6]. Every coin toss is expanded to a branching where both paths are followed.
It does not matter that the resulting deterministic algorithm would be too slow.
When many paths are accepting, then the amplitude amplication is less costly.
In this way we could also handle algorithms that might be composed of ran-
domized parts and parts based on recursive decomposition. For example, one
could imagine an algorithm for SAT based on a random selection of sub-clauses
followed by a sophisticated deterministic satisability test of the resulting for-
mula by recursive decomposition.

2 The Classical Analysis of Algorithms Based on


Recursive Decomposition
Typical recursive decomposition algorithms for SAT branch on a variable x oc-
curring in the boolean formula with n variables. Two branches are created by
setting x true and false respectively, and simplifying the resulting formulas. A
bound on the branching depth of n and a bound on the number of leaves of
2n follows immediately. Many more ecient exponential time algorithms have a
computation tree with only O(cn ) leaves for some c < 2.
Typical ecient exponential algorithms for this and other problems can be
quite complicated and involve many cases. This implies a little more program-
ming, but is not an obstacle for obtaining a fast quantum algorithm based on
our general design.
Just to illustrate the principle, let us consider a simple but still much improved
algorithm for 3SAT. Instead of branching on an arbitrary variable, it branches on
a variable occurring in a shortest clause. Naturally, clauses of size 1 just simplify
without any branching. If we are always lucky and nd a clause with 2 variables,
then on one branch the occurring literal is set to false and the other literal is
forced to be true for free. This would result in a computation tree with at most
L(n) leaves, where L(n) satises the following recurrence.

L(n) L(n 1) + L(n 2)


788 M. Furer

The resulting running time is also L(n) up to a polynomial factor. Clearly in


the worst case we would not always be so lucky. Sometimes, we have to branch
on variables from 3 literal clauses. Still on one branch we have then produced a
2 literal clause, resulting in

L(n) L(n 1) + L(n 2) + L(n 3)

Using the terminology of Kullmann [14,15], we say that in the rst case, the
corresponding node in the tree has 2 branches labeled 1 and 2. The branching
tuple for is (1, 2). In the second case, the corresponding node  in the tree
has 3 branches and a branching tuple of (1, 2, 3), representing the decreases of
the number of variables in each branch.
When a node has a branching tuple (t1 , . . . , td ), then its branching number is
the unique positive real solution of the equation

d
xtj = 1
j=1

It is important to notice that the branching number is not at all an upper


bound on the degree of the computation tree, even though for a trivial brute-
force algorithm, the branching number is just 2. In general the branching number
is a tool to measure the progress in one recursive step even when the tree is very
unbalanced and not nicely structured.
If x is the largest branching number in a tree, then xn is an upper bound on
the number of leaves (and thus an upper bound on the corresponding running
time up to a polynomial factor).
For various NP-complete problems, many nontrivial (but still exponential
time) algorithms have been designed based on this principle. Sometimes, such
algorithms need an elaborate case analysis. Nevertheless, they are immediately
amenable to our solution.

3 The Quantum Algorithm Based on Recursive


Decomposition
We consider a problem in NP for which we know a classical exponential time
algorithm based on recursive decomposition. This means that the problem is self
reducible, and a computation consists of repeated reductions of a current instance
to a nite number of smaller instances. The size of an instance is measured by
a real parameter value p. Often the parameter is actually restricted to be a
non-negative integer, like p = n, the number of variables in our 3SAT example.
We represent the algorithm by a computation tree. The children of a node
can be viewed as the recursive calls made form that node. Hence, a sequential
algorithm traverses the whole computation tree. On a parallel machine with an
unbounded number of processors, one could handle all nodes of the same depth
simultaneously, resulting in a parallel running time given by the height of the
computation tree.
Solving NP-Complete Problems with Quantum Search 789

This is not how our quantum algorithm works. Its running time is the square
root of the upper bound on the number of leaves (up to a polynomial factor), as
long as the height is polynomial. For the sequential algorithm, this upper bound
on the number of leaves (based on using the worst case branching number in
each vertex) is the proved upper bound on the running time (up to a polyno-
mial factor). The corresponding quantum algorithm runs a superposition of the
computations corresponding to all paths from the root to any leaf.
The root of the computation tree represents the input instance. Every node in
the tree represents an instance and its children represent the smaller instances
to which the parent instance is reduced. Every node has a branching number,
based on the decreases of the parameter value from the parent to its children,
as dened in the previous section. We know an upper bound on all branching
numbers in the tree. Typically, we have a small xed number of possible types
of nodes (2 in our simple 3SAT example) and thus a small number of dierent
branching numbers.
If x is an upper bound on the branching numbers of a computation tree, then
it is easy to see that every subtree of a node with size parameter p has at most
xp leaves. Imposing an arbitrary xed order on the children of every node, it
is very easy to compute an estimate of the number of leaves to the left of the
subtree of a currently visited node, inductively assuming that such an estimate
is available for the parent node, and that the type of branching in the parent
node is known.
As x is just a real algebraic number, there might well be some rounding
problems involved, because we want our estimate not just to be an approximate
value, but an exact upper bound. On the other hand, the bound does not have to
be tight. By just doubling the estimate and rounding, we are safe. Every partial
result 2xp is rounded to any one of the two adjacent integers. (If we cannot
easily gure out what the 2 integers are, then we are actually very close to one
of them, and we obviously choose that one.)
What we have done in eect is enumerating the leaves from left to right, but
with using at most half the numbers in the appropriate range. The gaps between
any two numbers assigned to adjacent leaves uctuate due to the rounding errors,
with additional gaps introduced by overestimation of some branching numbers by
the maximal branching number. But in any case, the leaves are enumerated from
left to right, and no two leaves are assigned the same number. The dierences
between adjacent numbers assigned to leaves are at least 1 (and in the average
at least 2).
We assume now that our problem instance has just one solution. Then the
quantum algorithm proceeds as follows.
Algorithm A:
Let x be the maximal branching number and p the size parameter value for the
input.
Let k = log2 (2xp ) = p log2 x + 1.
Start with the input and the string 0k
Apply a Fourier transform to obtain a superposition of all non-negative integers less
790 M. Furer

than 2k , represented by all 0-1-strings s of length k, each with amplitude 2k/2 .


In parallel for each s in the superposition execute the one branch of the exponential
size classical computation tree that leads to the leaf numbered s (if it exists). (This
takes polynomial time.)
Produce a result bit b of 1, if the searched branch of the computation has found a
solution. The result bit is 0, if no solution has been found. The latter includes the
case where s does not occur as the name of any leaf (because there is a gap at this
point).
Undo the computation, erasing auxiliary partial results, just keeping the result bit b
(together with s and the input).
Run Grovers algorithm to search for b = 1.

This algorithm is of the 1-sided Monte Carlo type. If solutions exist, then one
of them is found with high probability, but no proof of nonexistence of solutions
is accomplished.
As the running time is dominated by Grovers search algorithm, we obtain
the following result.

Theorem 1. Let P be a problem in NP that has a classical solution by recursive


decomposition. Assume the maximal branching number is x with respect to a
parameter with initial value p. Further assume, the input is an instance with a
constant probability, the quantum Algorithm A nds
unique solution. Then with
the solution in time O( xp ).

If the problem instance possibly has multiple solutions, then we employ the
generalization of Grovers algorithm to multiobject search by Boyer, Brassard,
Hyer and Tapp [16]. The algorithm A obtained by this replacement gives us
the following result.

Theorem 2. Let P be a problem in NP that has a classical solution by recur-


sive decomposition. Assume the maximal branching number is x with respect to
a parameter with initial value p. Then with
constant probability, the quantum
Algorithm A nds the solution in time O( xp ).

One could also use any one of a newer class of search algorithms by Grover
[17,18]. These algorithms have been extended to multiobject search by Chen
and Sun [19].
Repeating A polynomially often immediately produces the following result.

Corollary 1. Let P be a problem in NP that has a classical solution by recursive


decomposition. Assume the maximal branching number is x with respect to a
parameter with initial value p. Then there is a polynomial time algorithm solving
P with exponentially
small error probability by making a polynomial number of
calls to an O( xp ) time quantum algorithm.

Note that under the conditions of the Corollary, the corresponding classical
algorithm takes time O(xp ).
Solving NP-Complete Problems with Quantum Search 791

4 Applications

There are plenty of applications. After a slow start, many sophisticated and
ecient exponential time deterministic algorithms have appeared over the last
dacade, e.g., [20,14,21,4,22,23,24]. All of these algorithms for NP-hard problems
t into the scheme of recursive decomposition. This includes algorithms for Sat-
isability, Maximum Independent Set, Graph Coloring, and other Constraint
Satisfaction Problems. The method works ne for optimization problems too.
One just applies binary search for the optimal value. Thus, for example, to nd
a maximum independent set, one would run the quantum algorithm with a log-
arithmic number of choices for the size of such a set.

References
1. Grover, L.K.: Quantum mechanics helps in searching for a needle in a haystack.
Physical Review Letters 79(2), 325328 (1997)
2. Grover, L.K.: A framework for fast quantum mechanical algorithms. In: Proceed-
ings of the 30th Annual ACM Symposium on Theory of Computing (STOC 1998),
pp. 5362. ACM Press, New York (1998)
3. Angelsmark, O., Dahllof, V., Jonsson, P.: Finite domain constraint satisfaction
using quantum computation. In: Diks, K., Rytter, W. (eds.) MFCS 2002. LNCS,
vol. 2420, pp. 93103. Springer, Heidelberg (2002)
4. Eppstein, D.: Improved algorithms for 3-Coloring, 3-Edge-Coloring, and constraint
satisfaction. In: Proceedings of the Twelfth Annual ACM-SIAM Symposium on
Discrete Algorithms (SODA 2001), pp. 329337. ACM Press, New York (2001)
5. Cerf, N., Grover, L., Williams, C.: Nested quantum search and structured problems.
Phys. Rev. A 61(3) (2000) 14 032303.
6. Brassard, G., Hyer, P., Mosca, M., Tapp, A.: Quantum amplitude amplication
and estimation. In: Lomonaco Jr., S.J., Brandt, H.E. (eds.) Quantum Computation
and Information, AMS Contemporary Mathematics, vol. 305, pp. 5374 (2002),
http://arxiv.org/abs/quant-ph/0005055
7. Ambainis, A.: Quantum search algorithms. ACM SIGACT News 35(2), 2235
(2004)
8. Dantsin, E., Kreinovich, V., Wolpert, A.: On quantum versions of record-breaking
algorithms for sat. ACM SIGACT News 36(4), 103108 (2005)
9. Schoning, U.: A probabilistic algorithm for k-SAT and constraint satisfaction prob-
lems. In: 40th Annual Symposium on Foundations of Computer Science (FOCS
1999), Washington - Brussels - Tokyo, pp. 410414. IEEE, Los Alamitos (1999)
10. Davis, M., Putnam, H.: A computing procedure for quantication theory. Journal
of Association Computer Machinery 7, 201215 (1960)
11. Davis, M., Logemann, G., Loveland, D.: A machine program for theorem-proving.
Communications of the ACM 5(7), 394397 (1962)
12. Woeginger, G.: Exact algorithms for NP-hard problems: A survey. In: Junger, M.,
Reinelt, G., Rinaldi, G. (eds.) Combinatorial Optimization - Eureka, You Shrink!
LNCS, vol. 2570, pp. 185207. Springer, Heidelberg (2003)
13. Dantsin, E., Goerdt, A., Hirsch, E.A., Kannan, R., Kleinberg, J., Papadimitriou,
C., Raghavan, P., Schoning, U.: A deterministic (2 2/(k + 1))n algorithm for
k-SAT based on local search. Theoretical Computer Science 289(1), 6983 (2002)
792 M. Furer

14. Kullmann, O.: New methods for 3-SAT decision and worst-case analysis. Theoret-
ical Computer Science 223, 172 (1999)
15. Dahllof, V., Jonsson, P., Wahlstrom, M.: Counting models for 2SAT and 3SAT
formulae. Theoretical Computer Science 332(1-3), 265291 (2005)
16. Boyer, M., Brassard, G., Hyer, P., Tapp, A.: Tight bounds on quantum searching.
Fortsch. Phys. 46, 493506 (1998)
17. Grover, L.K.: Quantum computers can search rapidly by using almost any trans-
formation. Physical Review Letters 80, 43294332 (1998)
18. Grover, L.K.: Rapid sampling through quantum computing. In: Proceedings of
the 32nd Annual ACM Symposium on Theory of Computing (STOC 2000), pp.
618626 (2000)
19. Chen, G., Sun, S.: Generalization of Grovers algorithm to multiobject search in
quantum computing, Part II: general unitary transformations. In: Brylinski, R.,
Chen, G. (eds.) Mathematics of Quantum Computation. Computational Mathe-
matics, pp. 161168. Chapman & Hall/CRC, Boca Raton, London, New York,
Washington, D.C (2002)
20. Tarjan, R.E., Trojanowski, A.E.: Finding a maximum independent set. SIAM J.
Comput. 6(3), 537546 (1977)
21. Beigel, R.: Finding maximum independent sets in sparse and general graphs. In:
SODA 1999. Proceedings of the tenth annual ACM-SIAM symposium on Discrete
algorithms, Society for Industrial and Applied Mathematics, pp. 856857 (1999)
22. Dantsin, E., Hirsch, E.A., Ivanov, S., Vsemirnov, M.: Algorithms for SAT and upper
bounds on their complexity. Technical Report TR01-012, Electronic Colloquium on
Computational Complexity (ECCC) (2001)
23. Furer, M.: A faster algorithm for nding maximum independent sets in sparse
graphs. In: Correa, J.R., Hevia, A., Kiwi, M. (eds.) LATIN 2006. LNCS, vol. 3887,
pp. 491501. Springer, Heidelberg (2006)
24. Furer, M., Kasiviswanathan, S.P.: Exact Max 2-SAT: Easier and faster. In: van
Leeuwen, J., Italiano, G.F., van der Hoek, W., Meinel, C., Sack, H., Plasil, F.
(eds.) SOFSEM 2007. LNCS, vol. 4362, pp. 272283. Springer, Heidelberg (2007)

Вам также может понравиться