











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A set of lecture notes from a university course on algorithm design & analysis (cs 410/584). The notes cover various topics related to np-complete problems, including the circuit satisfiability problem, its relationship to formula satisfiability and 3-sat, and the concept of reductions to prove other problems are np-complete. The document also introduces the concept of approximation algorithms for np-complete problems, specifically focusing on the vertex cover problem.
Typology: Study notes
1 / 19
This page cannot be seen from the preview
Don't miss anything!












2009 David Maier
Algorithm Design & Analysis
Exhibiting an NP-Complete Problem
Q
Lecture Notes 10 David Maier (^1)
Q1 Q
Algorithm Design & Analysis
Initial Problem
Lecture Notes 10 David Maier (^2)
2009 David Maier
Algorithm Design & Analysis
Configurations of an Algorithm
Lecture Notes 10 David Maier (^3)
(registers, program counter), then one configuration of the machine needs
Algorithm Design & Analysis
All Configurations
Lecture Notes 10 David Maier (^4)
certificate y, |y|
2009 David Maier
Algorithm Design & Analysis
Example
Lecture Notes 10 David Maier (^7)
Algorithm Design & Analysis
Circuit Satisfiability is in NP
Certificate = assignment of 0 or 1 N d t h k
Lecture Notes 10 David Maier (^8)
Need to check:
2009 David Maier
Algorithm Design & Analysis
Circuit Sat is NP-Hard
Need a polynomial-time function f that maps a string x to a circuit C such that x is in Qa string x to a circuit C, such that x is in Q if and only if
Lecture Notes 10 David Maier (^9)
Algorithm Design & Analysis
Configurations of Computation of A
A PC Aux state x y Memory
Initial configuration
Lecture Notes 10 David Maier (^10)
A PC Aux state x y Memory
2009 David Maier
Algorithm Design & Analysis
Formula Satisfiability
PlPl us parens and Boolean variablesd B l i bl
Lecture Notes 10 David Maier (^13)
Algorithm Design & Analysis Reducing Circuit Sat to Formula Sat Might seem like we can just work backwards from the output of the circuit, and write down formula
B
Lecture Notes 10 David Maier (^14)
2009 David Maier
Algorithm Design & Analysis Instead, Variable per Wire, Sub-formula per Gate Plus, output wire is true
B
A w
w
w w7 w
w
w w
(w1 ↔ (A ∧ B)) (w2 ↔ (C ∧ D)) (w3 ↔ ¬w1) (w4 ↔ ¬w2)
w
Lecture Notes 10 David Maier (^15)
(w5 ↔ (w1 ∨ w2)) (w6 ↔ (w3 ∨ w4)) (w7 ↔ (w5 ∧ w6)) (w8↔ ¬w7) w
Algorithm Design & Analysis
Properties of Resulting Formula
Lecture Notes 10 David Maier (^16)
So formula sat is NP-Hard Is formula sat in NP?
2009 David Maier
Algorithm Design & Analysis
Each Component Formula Has 3 Literals
(b2 ↔ (x ∧ b1)) F T T (¬b2 ∧ x ∧ b1) ∨ T F T (b2 ∧ ¬x ∧ b1) ∨ T T F (b2 ∧ x ∧ ¬b1) ∨ T F F (b2 ∧ ¬x ∧ ¬b1)
Lecture Notes 10 David Maier (^19)
¬(x ∧ y) = ¬x ∨ ¬y ¬(x ∨ y) = ¬x ∧ ¬y
Algorithm Design & Analysis
Result is in 3-CNF
(b2 ∨ ¬x ∨ ¬b1) ∧ (¬b2 ∨ x ∨ ¬b1) ∧ ((¬¬b2b2 ∨ ¬∨ ¬xx ∨∨ b1)b1) ∧∧ (¬b2 ∨ x ∨ b1)
(x ∨ ¬z) Add a new variable p (x ∨ ¬z ∨ p) ∧ (x ∨ ¬z ∨ ¬p)
Lecture Notes 10 David Maier (^20)
2009 David Maier
Algorithm Design & Analysis
Things to Check
Lecture Notes 10 David Maier (^21)
Algorithm Design & Analysis
Branching Out from Logic
Set of nodes M such that (m1, m2) in E for every
Does this graph have a clique of 4
Lecture Notes 10 David Maier (^22)
nodes? Does it have a clique of 5 nodes?
2009 David Maier
Algorithm Design & Analysis Equivalence
Must make at least one literal true in each clause These literals must be compatible, so there are
So there must be a
Must have exactly one node corresponding to each clause (why?) T ll hi h lit l t k t h
Lecture Notes 10 David Maier (^25)
Tells us which literals to make true, hence which variables to make true or false
Must be compatible literals
Algorithm Design & Analysis
How Big is This Graph?
Lecture Notes 10 David Maier (^26)
2009 David Maier
Algorithm Design & Analysis
Vertex Cover
Does this graph have a vertex cover
Lecture Notes 10 David Maier (^27)
of 2 nodes? Does it have a vertex cover of 1 node?
Algorithm Design & Analysis
Complement Graph
HHas exactly the missing edges tl th i i d
Lecture Notes 10 David Maier (^28)
2009 David Maier
Algorithm Design & Analysis
Examples
Lecture Notes 10 David Maier (^31)
Algorithm Design & Analysis
Reduction from 3-SAT
Lecture Notes 10 David Maier (^32)
2009 David Maier
Algorithm Design & Analysis
Approximation Algorithms for NP-Complete Problems
For example for 3 SAT is there a poly time
Lecture Notes 10 David Maier (^33)
For example, for 3-SAT, is there a poly-time algorithm that is guaranteed to find an assignment (if it exists) that
Algorithm Design & Analysis
Approximating Vertex Cover
Lecture Notes 10 David Maier (^34)
2009 David Maier
Algorithm Design & Analysis
Approximation Bound
L t F bLet F be chosen edges. So C = h d S C
Lecture Notes 10 David Maier (^37)