Sample Problems • Independent Set CSE 421 – Graph G = (V, E), a subset S of the vertices is independent if there are no edges between Algorithms vertices in S Richard Anderson 1 2 Lecture 29 3 5 4 NP-Completeness 6 7 Satisfiability Definitions • Boolean variable: x 1 , …, x n • Given a boolean formula, does there exist a truth assignment to the variables to • Term: x i or its negation !x i make the expression true • Clause: disjunction of terms – t 1 or t 2 or … t j • Problem: – Given a collection of clauses C 1 , . . ., C k , does there exist a truth assignment that makes all the clauses true – (x 1 or !x 2 ), (!x 1 or !x 3 ), (x 2 or !x 3 ) 3-SAT Theorem: 3-SAT < P IS • Build a graph that represents the 3-SAT instance • Each clause has exactly 3 terms • Vertices y i , z i with edges (y i , z i ) • Variables x 1 , . . ., x n – Truth setting • Clauses C 1 , . . ., C k • Vertices u j1 , u j2 , and u j3 with edges (u j1 , u j2 ), (u j2 ,u j3 ), (u j3 , u j1 ) – C j = (t j1 or t j2 or t j3 ) – Truth testing • Connections between truth setting and truth • Fact: Every instance of SAT can be testing: converted in polynomial time to an – If t jl = x i , then put in an edge (u jl , z i ) equivalent instance of 3-SAT – If t jl = !x i , then put in an edge (u jl , y i ) 1
Thm: 3-SAT instance is satisfiable Example iff there is an IS of size n + k C 1 = x 1 or x 2 or !x 3 C 2 = x 1 or !x 2 or x 3 C 3 = !x 1 or x 2 or x 3 What is NP? Certificate examples • Problems solvable in non-deterministic • Independent set of size K polynomial time . . . – The Independent Set • Satifisfiable formula • Problems where “yes” instances have – Truth assignment to the variables polynomial time checkable certificates • Hamiltonian Circuit Problem – A cycle including all of the vertices • K-coloring a graph – Assignment of colors to the vertices NP-Completeness Cook’s Theorem • A problem X is NP-complete if • The Circuit Satisfiability Problem is NP- Complete – X is in NP – For every Y in NP, Y < P X • X is a “hardest” problem in NP • If X is NP-Complete, Z is in NP and X < P Z – Then Z is NP-Complete 2
Garey and Johnson History • Jack Edmonds – Identified NP • Steve Cook – Cook’s Theorem – NP-Completeness • Dick Karp – Identified “standard” collection of NP-Complete Problems • Leonid Levin – Independent discovery of NP-Completeness in USSR Populating the NP-Completeness Hamiltonian Circuit Problem Universe • Circuit Sat < P 3-SAT • Hamiltonian Circuit – a simple cycle • 3-SAT < P Independent Set including all the vertices of the graph • Independent Set < P Vertex Cover • 3-SAT < P Hamiltonian Circuit • Hamiltonian Circuit < P Traveling Salesman • 3-SAT < P Integer Linear Programming • 3-SAT < P Graph Coloring • 3-SAT < P Subset Sum • Subset Sum < P Scheduling with Release times and deadlines Traveling Salesman Problem Thm: HC < P TSP • Given a complete graph with edge weights, determine the shortest tour that includes all of the vertices (visit each vertex exactly once, and get back to the starting point) 3 7 7 2 2 5 4 1 1 4 3
Recommend
More recommend