Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computability and Complexity 16-1 Computability and Complexity Andrei Bulatov NP-Completeness.

Similar presentations


Presentation on theme: "Computability and Complexity 16-1 Computability and Complexity Andrei Bulatov NP-Completeness."— Presentation transcript:

1 Computability and Complexity 16-1 Computability and Complexity Andrei Bulatov NP-Completeness

2 Computability and Complexity 16-2 NP-Completeness of SubsetSum Instance: A sequence of positive integers and a target integer t. Question: Is there a subset T  S such that ? SubsetSum Step 1: The problem SubsetSum is in NP : the set T is the certificate

3 Computability and Complexity 16-3 Step 2: To show that SubsetSum is NP-complete we shall reduce Satisfiability to SubsetSum Given a formula  with clauses Choose t so that T must contain exactly one of each pair and at least one from each clause This construction can be carried out in polynomial time For each clause of length create integers For each variable X create 2 integers and

4 Computability and Complexity 16-4 Example Construction =10000100 = 010 =1000100 = 001 =100100 = 001 =10001 = 010 =1001 =1000 =100 =100 =010 =001 =001 =001 t=11111324

5 Computability and Complexity 16-5 NP-Completeness of HamCircuit Instance: A graph G. Question: Does G contain a Hamilton circuit? HamCircuit Theorem HamCircuit is NP-complete Theorem HamCircuit is NP-complete Step 1: The problem HamCircuit is in NP : the Hamilton circuit is the certificate

6 Computability and Complexity 16-6 Step 2: To show that HamCircuit is NP-complete we shall reduce 3- Satisfiability to HamCircuit Given a formula  with clauses and variables What is to be encoded? Boolean variables a choice between two values (for each variable) consistency: all occurrences of X must have the same truth value constraints on the possible values imposed by clauses

7 Computability and Complexity 16-7 the choice gadget We assume that all gadgets are connected with the rest of the graph only through their endpoints, shown as full dots; there are no edges connecting other vertices of the gadget to the rest of the graph This gadget will allow the Hamiltonian circuit, approaching from above, to pick either left or right edge, thus communicating to a truth value

8 the consistency gadget Computability and Complexity 16-8 - This graph can be traversed by the Hamiltonian circuit in one of the two ways

9 Computability and Complexity 16-9 the constraint gadget - If, using the choice and consistency devices, we have made sure that each side of the triangle is traversed by the Hamilton circuit if and only if the corresponding literal is false ; then at least one literal has to be true

10 Computability and Complexity 16-10 Properties of the Gadgets the choice gadget can be traversed in exactly two ways the internal vertices of the consistency gadget (“exclusive or” gadget) can be traversed in exactly two ways, so that exactly one pair of the external vertices is involved any Hamilton circuit traverses at most two of the edges of a constraint gadget

11 Computability and Complexity 16-11 X Y Z 1 2 true false all these vertices are connected

12 Computability and Complexity 16-12 NP-Completeness of TSP(D) Instance: A finite set of cities, a positive integer distance, between each pair and an integer B. Question: Is there a permutation  of such that Travelling Salesperson(D) Step 1: The problem TSP(D) is in NP : a route satisfying the inequality is the certificate

13 Computability and Complexity 16-13 Step 2: To show that TSP(D) is NP-complete we shall reduce HamCircuit to TSP(D) Given a graph G with vertex set V and edge set E For each vertex v create a city Set if (u,v)  E and otherwise Set B = |V| Then If G has a Hamilton circuit then there is a route of weight B (the Hamilton circuit) If there is a route of weight B, then in G this route goes through edges and therefore is a Hamilton circuit


Download ppt "Computability and Complexity 16-1 Computability and Complexity Andrei Bulatov NP-Completeness."

Similar presentations


Ads by Google