CSCE 411 Lecture 32

From Notes
Jump to navigation Jump to search
Lecture Slides

« previous | Monday, November 12, 2012 | next »


NP-Completeness

Suppose is NP-complete

  1. If there is a poly time algorithm for , then
  2. If there is no poly time algorithm for , then

Showing NP-Completeness

Direct approach:

  1. Show
  2. Show that every other language in NP is polinomially reducible to .

Better approach:

  1. Show
  2. Choose appropriate known NP complete language
  3. Show

Works by transitivity.

First NP-Complete Problem

Satisfiability problem (SAT): given a boolean function, is there a set of true and false inputs that will return true?

First, some vocab:

Boolean variables
take on values T or F (e.g. )
Literal
a variable or a negation or a variable (e.g. )
Clause
disjunction (OR) of several literals
Conjunctive Normal Form (CNF) formula
is a conjunction (AND) of several clauses (e.g.


Is satisfiable? (Yes, ,

A formula that has variables has possible inputs.

SAT is NP-Complete

SAT is in NP: it's hard to find a solution, but when given a solution, checking it is easy. Just plug it into the function.

Show every language in NP is polynomially reducible to SAT.

key idea: each NP language is solved by some nondeterministic Turing machine in polynomial time.

Given a description of a poly time TM, construct in poly time, a CNF formula that simulates the computation of the turing machine.

3SAT

A special case of SAT: each clause contains exactly 3 literals

3SAT is in NP because SAT is in NP

Is 3SAT NP-complete? Regular structure may be exploited to obtain poly algorithm. (e.g. 2SAT has poly time algorithm)

  1. Use same truth-assignment algorithm as SAT to verify solution
  2. Use SAT as NP-complete problem
  3. reduce 3SAT problem to SAT problem in poly time such that SAT problem is satisfiable iff 3SAT is satisfiable

Reduction

Reduction requires some simple boolean algebra:

Given CNF formula of clauses over set of vars , replace each clause with a set of 3-clauses, and may use some extra variables.

Let .

Case : use 2 extra variables and to replace with 4 clauses:

Case : use 1 extra variable to replace with 2 clauses:

Case : no work necessary

Case : use variables to replace with clauses:

  • ...

Is Reduction Poly Time?

Running time of reduction is proportional to the size of SAT problem.

Size of new formula is constant factor larger than original formula:

  • 1 literal → 4 clauses
  • 2 literals → 2 clauses
  • 3 literals → 1 clause
  • 4+ literals → clauses


Note: Minesweeper is NP-complete: given a configuration of numbers, can we find placement of mines that is coherent with those numbers?