Docsity

Completeness - Data Structures and Algorithm - Lecture Slides, Slides of Data Structures and Algorithms

Partial preview of the text

Download Completeness - Data Structures and Algorithm - Lecture Slides and more Slides Data Structures and Algorithms in PDF only on Docsity!

Introduction to NP-Completeness

Reporting to the Boss

Suppose you fail to find a fast algorithm. What can you tell your boss?

  • “I guess I’m too dumb... ” (dangerous confession)
  • “There is no fast algorithm!” (lower bound proof)
  • “I can’t solve it, but no one else in the world can, either... ” (NP-completeness reduction)

The Main Idea

Suppose I gave you the following algorithm to solve the bandersnatch problem:

Bandersnatch(G) Convert G to an instance of the Bo-billy problem Y. Call the subroutine Bo-billy on Y to solve this instance. Return the answer of Bo-billy(Y ) as the answer to G.

Such a translation from instances of one type of problem to instances of another type such that answers are preserved is called a reduction.

What Does this Imply?

Now suppose my reduction translates G to Y in O(P (n)):

  1. If my Bo-billy subroutine ran in O(P ′(n)) I can solve the Bandersnatch problem in O(P (n) + P ′(n′))
  2. If I know that Ω(P ′(n)) is a lower-bound to compute Bandersnatch, then Ω(P ′(n) − P (n′)) must be a lower- bound to compute Bo-billy.

The second argument is the idea we use to prove problems hard!

What is an Instance?

An instance is a problem with the input parameters specified. TSP instance: d[v 1 , d 2 ] = 10, d[v 1 , d 3 ] = 5, d[v 1 , d 4 ] = 9, d[v 2 , d 3 ] = 6, d[v 2 , d 4 ] = 9, d[v 3 , d 4 ] = 3

3 2 4

1 10 5 3 9

6 9

Solution: {v 1 , v 2 , v 3 , v 4 } cost= 27

Input Encodings

Note that there are many possible ways to encode the input graph: adjacency matrices, edge lists, etc. All reasonable encodings will be within polynomial size of each other. The fact that we can ignore minor differences in encoding is important. We are concerned with the difference between algorithms which are polynomial and exponential in the size of the input.

The Traveling Salesman Decision Problem

Given a weighted graph G and integer k, does there exist a traveling salesman tour with cost ≤ k? Using binary search and the decision version of the problem we can find the optimal TSP solution.

Reductions

Reducing (tranforming) one algorithm problem A to another problem B is an argument that if you can figure out how to solve B then you can solve A. We showed that many algorithm problems are reducible to sorting (e.g. element uniqueness, mode, etc.). A computer scientist and an engineer wanted some tea...

Not Satisfiabl

Example 2: V = v 1 , v 2 ,

C = {{v 1 , v 2 }, {v 1 , v 2 }, {v 1 }}

Although you try, and you try, and you try and you try, you can get no satisfaction. There is no satisfying assigment since v 1 must be FALSE (third clause), so v 2 must be FALSE (second clause), but then the first clause is unsatisfiable!