Chapter 9
Coping with NPcompleteness
You are the junior member of a seasoned project team. Your current task is to write code for
solving a simplelooking problem involving graphs and numbers. What are you supposed to
do?
If you are very lucky, your problem will be among the halfdozen problems concerning
graphs with weights (shortest path, minimum spanning tree, maximum flow, etc.), that we
have solved in this book. Even if this is the case, recognizing such a problem in its natural
habitat—grungy and obscured by reality and context—requires practice and skill. It is more
likely that you will need to reduce your problem to one of these lucky ones—or to solve it using
dynamic programming or linear programming.
But chances are that nothing like this will happen. The world of search problems is a bleak
landscape. There are a few spots of light—brilliant algorithmic ideas—each illuminating a
small area around it (the problems that reduce to it; two of these areas, linear and dynamic
programming, are in fact decently large). But the remaining vast expanse is pitch dark:
NP

complete. What are you to do?
You can start by proving that your problem is actually
NP
complete.
Often a proof by
generalization (recall the discussion on page 270 and Exercise 8.10) is all that you need; and
sometimes a simple reduction from 3
SAT
or
ZOE
is not too difficult to find. This sounds like a
theoretical exercise, but, if carried out successfully, it does bring some tangible rewards: now
your status in the team has been elevated, you are no longer the kid who can’t do, and you
have become the noble knight with the impossible quest.
But, unfortunately, a problem does not go away when proved
NP
complete. The real ques
tion is,
What do you do next?
This is the subject of the present chapter and also the inspiration for some of the most
important modern research on algorithms and complexity.
NP
completeness is not a death
certificate—it is only the beginning of a fascinating adventure.
Your problem’s
NP
completeness proof probably constructs graphs that are complicated
and weird, very much unlike those that come up in your application.
For example, even
though
SAT
is
NP
complete, satisfying assignments for
HORN SAT
(the instances of
SAT
that
come up in logic programming) can be found efficiently (recall Section 5.3). Or, suppose the
graphs that arise in your application are trees.
In this case, many
NP
complete problems,
283
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
284
Algorithms
such as
INDEPENDENT SET
, can be solved in linear time by dynamic programming (recall
Section 6.7).
Unfortunately, this approach does not always work.
For example, we know that 3
SAT
is
NP
complete. And the
INDEPENDENT SET
problem, along with many other
NP
complete
problems, remains so even for planar graphs (graphs that can be drawn in the plane without
crossing edges). Moreover, often you cannot neatly characterize the instances that come up
in your application.
Instead, you will have to rely on some form of
intelligent exponential
search
—procedures such as
backtracking
and
branch and bound
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Viswanathan
 local search, S. Dasgupta, C.H. Papadimitriou, U.V. Vazirani

Click to edit the document details