NPcomplete

NPcomplete - Harvard CS 121 and CSCI E-207 Lecture 21:...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Harvard CS 121 and CSCI E-207 Lecture 21: NP-Completeness Harry Lewis November 24, 2009 Reading: Sipser § 7.4, § 7.5. For “culture”: Computers and Intractability: A Guide to the Theory of NP-completeness , by Garey & Johnson.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Harvard CS 121 November 24, 2009 Boolean logic Boolean formulas Def : A Boolean formula (B.F.) is either: · a “Boolean variable” x,y,z,. .. · ( α β ) where α,β are B.F.’s. · ( α β ) where α,β are B.F.’s. · ¬ α where α is a B.F. e.g. ( x y z ) ( ¬ x ∨ ¬ y ∨ ¬ z ) [Omitting redundant parentheses] 1
Background image of page 2
Harvard CS 121 November 24, 2009 Boolean satisfiability Def: A truth-assignment is a mapping A : Boolean variables → { 0 , 1 } . [ 0 = false, 1 = true] A T-A is extended to all B.F.’s by the rules: · A ( α β ) = 1 iff A ( α ) = 1 or A ( β ) = 1 · A ( α β ) = 1 iff A ( α ) = 1 and A ( β ) = 1 · A ( ¬ α ) = 1 iff A ( α ) = 0 A satisfies α (written A | = α ) iff A ( α ) = 1 . In this case, α is satisfiable . If no A satisfies α , then α is unsatisfiable . SAT = { α : α is a satisfiable Boolean formula } . Prop: SAT NP 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Harvard CS 121 November 24, 2009 A “similar” problem in P: 2-SAT A 2-CNF formula is one that looks like ( x y ) ( ¬ y z ) ( ¬ y ∨ ¬ x ) i.e., a conjunction of clauses , each of which is the disjunction of 2 literals (or 1 literal, since ( x ) ( x x ) ) 2-SAT = the set of satisfiable 2-CNF formulas. e.g. ( x y ) ( ¬ x ∨ ¬ y ) ( ¬ x y ) ( x ∨ ¬ y ) / SAT 3
Background image of page 4
Harvard CS 121 November 24, 2009 2-SAT P Method (resolution): 1. If x and ¬ x are both clauses, then not satisfiable e.g. ( x ) ( z y ) ( ¬ x ) 2. If ( x y ) ( ¬ y z ) are both clauses, add clause ( x z ) (which is implied). 3. Repeat. If no contradiction emerges satisfiable. O ( n 2 ) repetitions of step 2 since only 2 literals/clause. 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Harvard CS 121 November 24, 2009 P vs. NP We would like to solve problems in NP efficiently. We know P NP. Problems in P can be solved “fairly” quickly. What is the relationship between P and NP? 5
Background image of page 6
Harvard CS 121 November 24, 2009 NP and Exponential Time Claim : NP S k TIME (2 n k ) Of course, this gets us nowhere near P. Is P = NP? i.e., do all the NP problems have polynomial time algorithms? It doesn’t “feel” that way but as of today there is no NP problem that has been proven to require exponential time! 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
November 24, 2009 The Strange, Strange World if P = NP Thousands of important languages can be decided in polynomial time, e.g. S
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 31

NPcomplete - Harvard CS 121 and CSCI E-207 Lecture 21:...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online