NP-complete Problem: Prof. S M Lee Department of Computer Science
NP-complete Problem: Prof. S M Lee Department of Computer Science
NP-complete Problem: Prof. S M Lee Department of Computer Science
Prof. S M Lee
Department of Computer Science
Decision Problems
To keep things simple, we will mainly concern ourselves with
decision problems. These problems only require a single bit output:
``yes'' and ``no''.
How would you solve the following decision problems?
Is this directed graph acyclic?
Is there a spanning tree of this undirected graph with total
weight less than w?
Does this bipartite graph have a perfect (all nodes matched)
matching?
Does the pattern p appear as a substring in text t?
P
P is the set of decision problems that can be solved in worst-case
polynomial time:
If the input is of size n, the running time must be O(nk).
Note that k can depend on the problem class, but not the
particular instance.
All the decision problems mentioned above are in P.
Nice Puzzle
The class NP (meaning non-deterministic polynomial time) is the
set of problems that might appear in a puzzle magazine: ``Nice
puzzle.''
What makes these problems special is that they might be hard to
solve, but a short answer can always be printed in the back, and it
is easy to see that the answer is
correct once you see it.
Example... Does matrix A have an LU decomposition?
No guarantee if answer is ``no''.
NP
Technically speaking:
A problem is in NP if it has a short accepting certificate.
An accepting certificate is something that we can use to
quickly show that the answer is ``yes'' (if it is yes).
Quickly means in polynomial time.
Short means polynomial size.
This means that all problems in P are in NP (since we don't even
need a certificate to quickly show the answer is ``yes'').
But other problems in NP may not be in P. Given an integer x, is
it composite? How do we know this is in NP?
Good Guessing
Another way of thinking of NP is it is the set of problems that can
solved efficiently by a really good guesser.
The guesser essentially picks the accepting certificate out of the air
(Non-deterministic Polynomial time). It can then convince itself that
it is correct using a polynomial
time algorithm. (Like a right-brain, left-brain sort of thing.)
Clearly this isn't a practically useful characterization: how could
we build such a machine?
Exponential Upperbound
Another useful property of the class NP is that all NP problems can
be solved in exponential time (EXP).
This is because we can always list out all short certificates in
exponential time and check all O(2nk) of them.
Thus, P is in NP, and NP is in EXP. Although we know that P is
not equal to EXP, it is possible that NP = P, or EXP, or neither.
Frustrating!
NP-hardness
As we will see, some problems are at least as hard to solve as any
problem in NP. We call such problems NP-hard.
How might we argue that problem X is at least as hard (to within
a polynomial factor) as problem Y?
If X is at least as hard as Y, how would we expect an algorithm
that is able to solve X to behave?
co-NP
NP
P
One of the central (and widely and intensively studied 30 years) problems of
(theoretical) computer science is to prove that
(a) PNP
(b) NP co-NP.
f ( Ri ) w xi
( a ,B )
aB C
w ( a ,B )
( a ,B )
aB C
{a Ri b | bB \{a }}
T ({a b | b B \ {a}})
( a ,B ) i
Dynamic Programming:
For every a C do Value({a}): = w(a,{a})
For i=2n, do
For every B such that |B|=i, do
Find
The prob.distr. over the set of all n! rankings explains the data
Given the set of queries D:
If the number of queries d < f(n) for some polynomial f,
finding CLD for the corresponding polytope is likely to be hopeless.
If the number of queries d > Kan, there is hope.
Exercise: Show that the linear optimization problem corresponding to the
membership problem for the Approval Voting Polytope is easy (i.e., can be
solved in polynomial time).
Hint: What is the input size?
Hint: Devise a dynamic programming algorithm for finding a
max. weight maximal chain.
S1 , S2 ,, S s
p1 , p2 ,, ps
pi 0, pi 1
i 1
D {Q1 , Q2 ,, Qd }
The finite set of queries/questions:
1 if Q true in Sm
Tm (Q ) : P(Q | pm 1)
n!
0 otherwise
P (Q ) pi Ti (Q )
Then, for any Q, the probability that Q holds is
Get polytopal representation of the model.
How to choose D?
i 1
Linear
Optimization
Queries
(d of them)
Polytope
(in [0,1]d)
Model
Characterization
NP-Complete Problems