Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Theory of NP
I cant find an efficient algorithm,
I guess Im just too dumb.
Serious damage to your position within the company !!!
I cant find an efficient algorithm,
because no such algorithm is possible!
Unfortunately, proving intractability of prob can be just
as hard/difficult as finding efficient algorithms !!!
No hope !!!
I cant find an efficient algorithm,
but, neither can all these famous people
Anyway, we have to solve this problem.
Can we satisfy with a reasonable algo ?
Theory of NP
Solving a problem:
Design an efficient algorithm
Analysis it with Lower bound
If cannot find efficient/good algo?
NP-Complete Prob?
If NP_ Complete Prob, approximate(reasonable) algo
Theory of NP
Classification
Turings Halting Prob
Most people believe P = NP !!!
NP
P ? NP-Complete !!!
9.1. Intractability
Intractable difficult to treat or work
(Def) polynomial-time algorithm (worst-case)
Tractable(easy) Problem : Good/efficient algorithm exist
Intractable(difficult) Problem : No good algorithm
(O(p(n))) ) n ( O W(n)
) 1 ( o
e
n! , 2 , 2 , 2 , n
n nlogn, , n n 5 n, 4 n 3 n, 2
n n 0.01 n n
100 10 3
+ +
)
`
e
e
O(p(n)) W(n)
O(p(n)) W(n)
: algorithm "bad"
: orithm "Good" alg
Intractability
Intractable Problem
No polynomial-time(good) algo
I cannot find a polynomial time algo
Theory of NP
Why easy verification easy sol?
Exponential # candidates
Unit time guessing is not realistic
(useful only for problem classification)
Almost all important problems are in NP
Why most researcher believe in P NP ?
1. Too many problems cannot be proven to be in P
2. Only one of them is in P
All of them are in P, i.e, P = NP
c
=
NP-Complete Problems
TSP 0/1-Knapsack
D.P. (n
2
2
n
) (min(2
n
, nW))
B & B (n-1)! leaves 2
n
TSP seems more difficult(intractable)
But, polynomially equivalent
Actually, only one of NP-C probs is p-time solvable,
so are all of them
NP-Complete Problems
CNF-satisfiability prob
Logical variables : x, y, x
1
, x
2
,
Literal : x or
Clause : v (or)
CNF(Conjunctive Normal Form)
) (
3 2 1
x x x v v
) ( ) ( ) (
4 3 1 4 1 3 2 1
x x x x x x x x v v . v . v v
x
NP-Complete Problems
CNF-satisfiability decision prob
A e NP, A B
Thm 9.2: (Cooks Theorem) CNF is NP-C
Thm 9.3: A problem C is NP-C if
1. CeNP, and
2. for a NP-C problem B, B C
NP-Complete Problems
Eg. Clique decision prob is NP-complete
(Proof) CNFClique
Given k, verify whether it is a clique
) ( ) ( ) (
3 2 3 2 1 2 1
X X X X X X X B v . v v . v =
) 2 , (
1
X
) 2 , (
2
X ) 2 , (
3
X
) 1 , (
1
X
) 1 , (
2
X
) 3 , (
3
X
) 3 , (
2
X
9.5. Handling NP-Hard Problems
Dynamic Programming
Backtracking
Branch & Bound
exponential-time(bad) in W.C.
approximation(Heuristic/reasonable) algo
ex. Greedy