lecture_18 - More NP complete problems 3SAT Clique Knapsack...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: More NP complete problems 3SAT Clique Knapsack 3D matching Hamiltonian path Vertex Cover subset sum set cover TSP 1 Hamiltonian path Today’s lecture sketches some reductions. You should fill in the details and proof of correctness. Given n integers a 1 , a 2 , … , a n together with a target number t , find a collection of a i ’s adding up to t . Lemma: 3SAT ≤ p the knapsack problem e want to transform a 3CNF formula o a set of numbers. The Knapsack problem is NP The Knapsack problem is NP The Knapsack problem is NP The Knapsack problem is NP-complete complete complete complete 2 We want to transform a 3CNF formula F to a set of numbers. E.g., F = (x 1 or x 2 or ~x 3 ) and (~x 1 or x 2 or x 3 ) What are the a i ’s ? t ? Assume that F has N variables and m clauses. • a 1 , a 2 , … , a n where n = 2(N + m), each with ( N+m ) digits; • t is also a number with N+m digits. For each variable x i in the formula F, we create two numbers a j and a j+1 . The idea is that if x i is true, we must choose a j ; otherwise we must choose a j+1 . And we can never choose both. ow to enforce such a relationship? Make use of “t”. True/false True/false True/false True/false → pick 1 out of 2 numbers pick 1 out of 2 numbers pick 1 out of 2 numbers pick 1 out of 2 numbers 3 How to enforce such a relationship? Make use of “t”. a 1 (x 1 ) 1 … a 2 (~x 1 ) 1 … a 3 (x 2 ) 1 … a 4 (~x 2 ) 1 … t 1 1 N+m digits For each variable C in the formula F, we want at least one of the tree literals are assigned to true. That is, we want at least one of the three corresponding three numbers are picked. How ? Each clause defines a column of digits. xample: C = x r ~x r x Clause Clause Clause Clause lause C 4 Example: C = x 1 or ~x 2 or x 5 a 1 (x 1 ) 1 1 … a 2 (~x 1 ) 1 0 … a 3 (x 2 ) 1 0 … a 4 (~x 2 ) 1 1 … t 1 1 1 (2, or 3) N+m digits Clause C a 1 (x 1 ) 1 1 a 2 (~x 1 ) 1 1 a 3 (x 2 ) 1 1 1 a 4 (~x 2 ) 1 3 variables Clause 1 Clause 2 Each column contains 2 or 5 ones. F = (x1 or x2 or ~x3) and (~x1 or x2 or x3) 5 a 5 (x 3 ) 1 1 a 6 (~x 3 ) 1 1 a 7 1 a 8 1 a 9 1 a 10 1 t 1 1 1 3 3 Clause 1 Clause 2 If there exists a collection B whose sum is exactly t , then • for each variable x i , B includes either the number associated with x i or the number associated with ~x i ; • for each clause, B includes at least one literal of the clause. I.e., B defines a satisfying assignment for the formula F. The key idea The key idea The key idea The key idea 6 If F has a satisfying assignment A, define B as follows: 1. Include the number associated with x i if A sets x i true; otherwise include the number associate with ~x i . 2. For each column associated with a clause, the numbers chosen in step 2 must contain x ≥ 1 in this column; include another 3-x numbers associated with this clause....
View Full Document

This note was uploaded on 03/01/2010 for the course CS 1234 taught by Professor Chan during the Spring '10 term at University of the Bío-Bío.

Page1 / 36

lecture_18 - More NP complete problems 3SAT Clique Knapsack...

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

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