CSCE 411 Lecture 31

From Notes
Jump to navigation Jump to search
Lecture Slides

« previous | Friday, November 9, 2012 | next »


Culture Assignments: Turing centennial things on course website.

Polynomial Reduction

How can we be so convinced that P and NP are not the same? We don't have any evidence that they are or are not the same.

Transformation between two languages so that a YES in one language maps to a YES in the other, and the same with NOs

Anything not in the first language must map to something not in the second language.

Example: Turn a graph into a sudoku problem. If the sudoku has a solution, then the graph must have a Hamiltonian cycle. If the sudoku is unsolvable, then the graph must not have a Hamiltonian cycle.

Theorem

If and is in , then is in

Proof

Let be a polynomial time algorithm for . Here is a polynomial time algorithm for :

input: x
compute f(x)
run A[2] on input f(x)

Implications

Suppose that

  • If there is a polynomial time algorithm for , then there is a poly time algorithm for
  • If there is no poly time alg for then there is no poly time alg for

Hamiltonian Cycles (HC) and the Traveling Salesman Problem (TSP)

TSP: Given a set of cities, distances between all pairs of cities, and bound , does there exist a tour that returns to the start and requires at most distance to be traveled?

TSP is in NP: Given a candidate solution, add up all the distances and compare total with

Theorem

Proof

Find a way to transform (reduce) any HC input (G) into a TSP input (cities, distances, B) such that

  • the transformation takes poly time
  • HC input is a YES instance (G has HC) iff TSP input constructed is a YES instance (has a tour that meets the bound)

Given undirected graph with nodes, construct TSP like this:

  • set of cities, labeled with names of nodes in
  • distance betw. and is 1 if , 2 otherwise
  • bound

Check that input is in HC iff the input constructed is in TSP.

Suppose has HC . Then TSP input is a tour and its distance is

Suppose TSP input has tour of length at most . Since all distances are ethier 1 or 2, and there are edges in a tour, all distances in the tour must be 1.

Transitivity of Reduction

If and , then .

If and , then


NP-Completeness

is NP-Complete iff

  1. is in NP and
  2. for all in NP,

In other words, is at least as hard as every language in NP.

Theorem

Suppose is NP-complete.

  1. If there is a poly time algorithm for , then
  2. If there is no poly time algorithm for , then there is no poly time algorithm for any NP-complete language.

Showing NP-Completeness

How to show that a problem (language) is NP-complete Show that

  1. is in NP
  2. every other language in NP is polynomially reducible to

Better approach. Once we know some NP-complete problems, we can use reduction to show other problems are also NP-complete.

Suppose that is an NP-complete problem.

Given we know

For all , we know and . By transitivity,