lecture_1819 - Assignment 1 • Average 29.4 / 50 [ 58.8 /...

Info iconThis preview shows pages 1–8. 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

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: Assignment 1 • Average 29.4 / 50 [ 58.8 / 100 ] • Difficulty rating: ~4 Assignment 2 verage 70.5 / 100 Glad to see your improvement. • Average 70.5 / 100 • Difficulty rating: ~3.6 Assignment 3 • Average 73.3 (+bonus 3.3) / 100 • Difficulty rating: ~4.5 More NP complete problems 3SAT Clique Knapsack 3D matching Hamiltonian path Vertex Cover subset sum set cover TSP 2 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-complete 3 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 → pick 1 out of 2 numbers 4 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 lause C 5 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) 6 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. Why it works ? 7 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

Page1 / 44

lecture_1819 - Assignment 1 • Average 29.4 / 50 [ 58.8 /...

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

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