Vous êtes sur la page 1sur 7

CSC310

NP-Complete Problems (Chapter 45) A category of problems thought to be very hard to solve 2 best-known algorithms are exponential time T (N ) = (N ) for constant > 1 impractical for non-trivial problems intractable Deterministic algorithms 2 only one step at a time 2 no lucky guesses 2 ordinary (serial) algorithms Deterministic polynomial-time algorithms 2 deterministic algorithms that run in polynomial time 2 log(N ), N log(N ), N , N 2, N 5, etc 2 P={problems that can be solved by deterministic algorithms in polynomial time}

CSC310

NP-complete - 1

Non-Deterministic Algorithms A non-deterministic algorithm can simultaneously check all possible solutions 2 i.e., choose correct solution non-deterministically 2 very powerful, but not real an analysis tool 2 run time is time required to check one possible solution Example: Traveling Salesman Problem 2 nd the shortest circuit in a weighted graph (circuit = cycle that visits every node once) 2 best known algorithm: try every possible ordering of nodes exponential time 2 non-deterministic algorithm: guess the best solution (and check it) polynomial time NP={problems that can be solved by non-deterministic algorithms in polynomial time}
CSC310 NP-complete - 2

P = NP ? P NP Many problems are known to be in P Many problems known to be in NP are thought not to be in P No problem in NP is known not to be in P Most important open question in theoretical computer science: P = NP ? 2 most think the answer is no 2 verication requires nding a single problem in NP that can be proven unsolvable by a deterministic algorithm in polynomial time 2 answer this question and become rich and famous

CSC310

NP-complete - 3

NP-Complete Problems Problems in NP thought to be hard 2 hard means P A problem in NP is said to be NP-complete if the discovery of a p-time (deterministic polynomial time) algorithm to solve would result in p-time solutions for every problem in NP NP-complete = { NP | ( P) (P = NP)}

If P = NP
P

NP

NPcomplete

CSC310

NP-complete - 4

Identication of NP-Complete Problems Steps to show that a problem, , is NP-complete: 1. show that NP 2 nd a non-deterministic polynomial time algorithm to solve 2 usually easy, since non-deterministic algorithms are very powerful 2 only bizarre problems are NP 2. select a problem known to be NP-complete 3. describe a deterministic algorithm that can transform an arbitrary instance of into an instance of 4. show that the above transformation algorithm is p-time Suppose we nd a p-time deterministic algorithm to solve 2 every instance, , of can now be solved in p-time, as follows: 1. transform into an instance, , of using the above transformation (p-time) 2. solve (p-time) 2 p-time + p-time = p-time, thus: P P P = NP
CSC310 NP-complete - 5

The First NP-Complete Problem Above proof technique requires at least one problem that is known to be NP-complete! Satisability Problem (SAT): given a boolean expression, is there an assignment of truth values to the variables that renders the expression true? e = (x1 x3 x5) (x1 x2 x4) (x3 x6 x1) 2 are there values of x1 x6 that result in e true? SAT NP 2 try all combinations of truth values simultaneously Cook (1971) proved: if a p-time algorithm to SAT is found, this algorithm can be used to solve any problem in NP 2 SAT is NP-complete 2 all other proofs of NP-completeness are based, directly or indirectly, on Cooks result

CSC310

NP-complete - 6

Vous aimerez peut-être aussi