11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sec. 17.2 Hard Problems 547for TRAVELING SALESMAN <strong>and</strong> all rel<strong>at</strong>ed problems. Because TRAVELINGSALESMAN is known to be N P-complete, if a polynomial time algorithm were tobe found for this problem, then all problems in N P would also be solvable in polynomialtime. Conversely, if we were able to prove th<strong>at</strong> TRAVELING SALESMANhas an exponential time lower bound, then we would know th<strong>at</strong> P ≠ N P.17.2.2 N P-Completeness ProofsTo start the process of being able to prove problems are N P-complete, we need toprove just one problem H is N P-complete. After th<strong>at</strong>, to show th<strong>at</strong> any problemX is N P-hard, we just need to reduce H to X. When doing N P-completenessproofs, it is very important not to get this reduction backwards! If we reduce c<strong>and</strong>id<strong>at</strong>eproblem X to known hard problem H, this means th<strong>at</strong> we use H as a step tosolving X. All th<strong>at</strong> means is th<strong>at</strong> we have found a (known) hard way to solve X.However, when we reduce known hard problem H to c<strong>and</strong>id<strong>at</strong>e problem X, th<strong>at</strong>means we are using X as a step to solve H. And if we know th<strong>at</strong> H is hard, th<strong>at</strong>means X must also be hard (because if X were not hard, then neither would H behard).So a crucial first step to getting this whole theory off the ground is finding oneproblem th<strong>at</strong> is N P-hard. The first proof th<strong>at</strong> a problem is N P-hard (<strong>and</strong> becauseit is in N P, therefore N P-complete) was done by Stephen Cook. For this fe<strong>at</strong>,Cook won the first Turing award, which is the closest <strong>Computer</strong> <strong>Science</strong> equivalentto the Nobel Prize. The “gr<strong>and</strong>-daddy” N P-complete problem th<strong>at</strong> Cook used iscall SATISFIABILITY (or SAT for short).A Boolean expression includes Boolean variables combined using the oper<strong>at</strong>orsAND (·), OR (+), <strong>and</strong> NOT (to neg<strong>at</strong>e Boolean variable x we write x). Aliteral is a Boolean variable or its neg<strong>at</strong>ion. A clause is one or more literals OR’edtogether. Let E be a Boolean expression over variables x 1 , x 2 , ..., x n . Then wedefine Conjunctive Normal Form (CNF) to be a Boolean expression written as aseries of clauses th<strong>at</strong> are AND’ed together. For example,E = (x 5 + x 7 + x 8 + x 10 ) · (x 2 + x 3 ) · (x 1 + x 3 + x 6 )is in CNF, <strong>and</strong> has three clauses. Now we can define the problem SAT.SATISFIABILITY (SAT)Input: A Boolean expression E over variables x 1 , x 2 , ... in Conjunctive NormalForm.Output: YES if there is an assignment to the variables th<strong>at</strong> makes E true,NO otherwise.Cook proved th<strong>at</strong> SAT is N P-hard. Explaining Cook’s proof is beyond thescope of this book. But we can briefly summarize it as follows. Any decision

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!