CS154, Lecture 16: More NP-Complete Problems; PCPs

Slides:



Advertisements
Similar presentations
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
Advertisements

NP-Completeness More Reductions. Definitions P: is the class of all decision problems which can be solved in polynomial time, O(n^k) for some constant.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
Clique Cover Cook’s Theorem 3SAT and Independent Set
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
Lecture 22 More NPC problems
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
Prabhas Chongstitvatana1 NP-complete proofs The circuit satisfiability proof of NP- completeness relies on a direct proof that L  p CIRCUIT-SAT for every.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSE 6311 – Spring 2009 ADVANCED COMPUTATIONAL MODELS AND ALGORITHMS Lecture Notes – Feb. 3, 2009 Instructor: Dr. Gautam Das notes by Walter Wilson.
NP Completeness Piyush Kumar. Today Reductions Proving Lower Bounds revisited Decision and Optimization Problems SAT and 3-SAT P Vs NP Dealing with NP-Complete.
CSC 413/513: Intro to Algorithms
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
 2005 SDU Lecture15 P,NP,NP-complete.  2005 SDU 2 The PATH problem PATH = { | G is a directed graph that has a directed path from s to t} s t
TU/e Algorithms (2IL15) – Lecture 10 1 NP-Completeness, II.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
NP-Completeness (2) NP-Completeness Graphs 4/13/2018 5:22 AM x x x x x
More NP-Complete and NP-hard Problems
More NP-complete problems
P & NP.
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
More NP-complete Problems
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness (2) NP-Completeness Graphs 7/23/ :02 PM x x x x
NP-Completeness Proofs
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
Intro to Theory of Computation
Intro to Theory of Computation
CS154, Lecture 16: More NP-Complete Problems; PCPs
ICS 353: Design and Analysis of Algorithms
NP-Completeness (2) NP-Completeness Graphs 11/23/2018 2:12 PM x x x x
More NP-complete Problems
Richard Anderson Lecture 25 NP-Completeness
Richard Anderson Lecture 28 NP-Completeness
Chapter 34: NP-Completeness
NP-Complete Problems.
CSC 4170 Theory of Computation The class NP Section 7.3.
Prabhas Chongstitvatana
CS154, Lecture 13: P vs NP.
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
CSE 6408 Advanced Algorithms.
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
The Theory of NP-Completeness
Trevor Brown DC 2338, Office hour M3-4pm
CSE 589 Applied Algorithms Spring 1999
Instructor: Aaron Roth
Instructor: Aaron Roth
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
Lecture 23 NP-Hard Problems
Presentation transcript:

CS154, Lecture 16: More NP-Complete Problems; PCPs

Is 3SAT solvable in O(n) time on a multitape TM? Are there logic circuits of size 6n for 3SAT? If yes, then not only is P=NP, but there would be a “dream machine” that could crank out short proofs of theorems, quickly optimize all aspects of life… recognizing quality work is all you need to produce

There are thousands of NP-complete problems Your favorite topic certainly has an NP-complete problem somewhere in it Even the other sciences are not safe: biology, chemistry, physics have NP-complete problems too!

Given a favorite problem   NP, how can we prove it is NP-hard? Generic Recipe: Take a problem  that you know to be NP-hard (3-SAT) Prove that  P  Then for all A  NP, A P  and  P  We conclude that A P , and  is NP-hard

 is NP-Complete NP P  

The Clique Problem Given a graph G and positive k, does G contain a complete subgraph on k nodes? CLIQUE = { (G,k) | G is an undirected graph with a k-clique } Theorem (Karp): CLIQUE is NP-complete

Proof Idea: 3SAT P CLIQUE Transform a 3-cnf formula  into (G,k) such that   3SAT  (G,k)  CLIQUE Want transformation that can be done in time that is polynomial in the length of  How can we encode a logic problem as a graph problem?

3SAT P CLIQUE We transform a 3-cnf formula  into (G,k) such that   3SAT  (G,k)  CLIQUE Let C1, C2, …, Cm be clauses of . Assign k := m. Make a graph G with m groups of 3 nodes each. Group i corresponds to clause Ci of . Each node in group i is labeled with a literal of Ci Put edges between all pairs of nodes in different groups, except pairs of nodes with labels 𝑥 𝑖 and  𝑥 𝑖 Put no edges between nodes in the same group When done putting in all the edges, erase the labels

(x1  x1  x2)  (x1  x2  x2)  (x1  x2  x2) |V| = 9 k = 3

(x1  x1  x1)  (x1  x1  x2)  (x2  x2  x2)  (x2  x2  x1)

Claim:   3SAT  (G,m)  CLIQUE Claim: If   3SAT then (G,m)  CLIQUE Proof: Given a SAT assignment A of , for every clause C there is at least one literal in C that’s set true by A For each clause C, let vC be a vertex from group C whose label is a literal that is set true by A Claim: S = {vC : C  } is an m-clique Proof: Let vC,vC’ be in S. Suppose (vC,vC’) ∉ E. Then vC and vC’ must label inconsistent literals, call them x and x But assignment A cannot satisfy both x and x Therefore (vC,vC’)  E, for all vC, vC’  S. Hence S is an m-clique, and (G,m)  CLIQUE

Claim:   3SAT  (G,m)  CLIQUE Claim: If (G,m)  CLIQUE then   3SAT Proof: Let S be an m-clique of G. We construct a satisfying assignment A of . Claim: S contains exactly one node from each group. Now for each variable x of , make assignment A: Assign x to 1  There is a vertex v ϵ S with label x For all i = 1,…,m, at least one vertex from group i is in S. Therefore, for all i = 1,…,m. A satisfies at least one literal in the ith clause of . Therefore A is a satisfying assignment to 

(G, k)  CLIQUE iff (G’, k)  IS Independent Set IS: Given a graph G = (V, E) and integer k, is there S  V such that |S|=k and no two vertices in S have an edge? IS = {(G,k) | G is an undirected graph with an IS of size k} CLIQUE: Given G = (V, E) and integer k, is there S  V such that |S|=k and every pair of vertices in S have an edge? CLIQUE ≤P IS: Given G = (V, E), output G’ = (V, E’) where E’ = {(u,v) | (u,v) ∉ E}. (G, k)  CLIQUE iff (G’, k)  IS

The Vertex Cover Problem a e c d b a e c d vertex cover = set of nodes C that cover all edges: For all edges, at least one endpoint is in C

VERTEX-COVER = { (G,k) | G is a graph with a vertex cover of size at most k} Theorem: VERTEX-COVER is NP-Complete (1) VERTEX-COVER  NP (2) IS P VERTEX-COVER

IS P VERTEX-COVER Want to transform a graph G and integer k into G’ and k’ such that (G,k)  IS  (G’,k’)  VERTEX-COVER

IS P VERTEX-COVER Claim: For every graph G = (V,E), and subset S  V, S is an independent set if and only if (V – S) is a vertex cover Proof: S is an independent set (8 u, v  V)[ (u  S and v  S) ) (u,v) ∉ E ] (8 u, v  V)[ (u,v)  E ) (u ∉ S or v ∉ S) ] (V – S) is a vertex cover Therefore (G,k)  IS  (G,|V| – k)  VERTEX-COVER Our polynomial time reduction: f(G,k) := (G, |V| – k)

The Subset Sum Problem Given: Set S = {a1,…, an} of positive integers and a positive integer t Is there an A µ {1, … ,n} such that t = i 2 A ai ? SUBSET-SUM = {(S, t) | 9 A µ S s.t. t = i 2 A ai } A simple number-theoretic problem Theorem: SUBSET-SUM is NP-complete Note: There is an O(n ⋅ t) time algorithm for Subset Sum. Does this prove P=NP?

VC P SUBSET-SUM Want to reduce a graph to a set of numbers Given (G, k), let E = {e0,…,em-1} and V = {1,…,n} Our subset sum instance (S, t) will have |S| = n+m “Edge numbers”: For every ej 2 E, put bj = 4j in S “Node numbers”: For every i 2 V, put ai = 4m + j : i 2 ej 4j in S Set the target number: t = k ¢ 4m + j=0m-1 (2 ¢ 4j)

For every ej 2 E, put bj = 4j in S For every i 2 V, put ai = 4m + j : i 2 ej 4j in S Set the target number: t = k ¢ 4m + j=0m-1 (2 ¢ 4j) Claim: If (G,k)  VC then (S,t)  SUBSET-SUM Suppose C µ V is a VC with k vertices. Let S’ = {ai : i 2 C}  {bj : |ej \ C| = 1} S’ = (node numbers corresponding to nodes in C) plus (edge numbers corresponding to edges covered only once by C) Claim: The sum of all numbers in S’ equals t Think of the numbers as being in “base 4”… as vectors with m+1 components

i 2 C ai + ej 2 F bj = t = k ¢ 4m + j=0m-1 (2 ¢ 4j) For every ej 2 E, put bj = 4j in S For every i 2 V, put ai = 4m + j : i 2 ej 4j in S Set the target number: t = k ¢ 4m + j=0m-1 (2 ¢ 4j) Claim: If (S,t)  SUBSET-SUM then (G,k)  VC Suppose C µ V and F µ E satisfy i 2 C ai + ej 2 F bj = t = k ¢ 4m + j=0m-1 (2 ¢ 4j) Claim: C is a vertex cover of size k. Proof: Subtract out the bj numbers from the above sum. What remains is a sum of the form: i 2 C ai = k ¢ 4m + j=0m-1 (cj ¢ 4j) where each cj > 0. But cj = number of nodes in C covering ej This implies C is a vertex cover!

Finding Paths - Two Problems Let G denote a graph, and s and t denote nodes. SHORTEST PATH = {(G, s, t, k) | G has a simple path of length < k from s to t } LONGEST PATH = {(G, s, t, k) | G has a simple path of length > k from s to t } Are either of these in P? Are both of them?

HAMPATH = { (G,s,t) | G is an directed graph with a Hamiltonian path from s to t} Theorem: HAMPATH is NP-Complete (1) HAMPATH  NP (2) 3SAT P HAMPATH See Sipser for the proof

HAMPATH P LONGEST-PATH = {(G, s, t, k) | G has a simple path of length > k from s to t } Can reduce HAMPATH to LONGEST-PATH by observing: (G, s, t) 2 HAMPATH  (G, s, t, |V|) 2 LONGEST-PATH Therefore LONGEST-PATH is NP-hard.

Coping with NP-Completeness [Advanced Topics] There are thousands of NP-complete problems Many are solved all the time !?! Average Case vs. Worst Case; Heuristics vs. Algorithms [Beyond Worst-Case Analysis (CS264)] Special cases/parameters that make a problem easy Approximation Algorithms

Approximating Vertex Cover Vertex Cover = set of nodes that cover all edges. Minimization problem: find the smallest VC A very simple (greedy) approximation algorithm A: finds a VC that is at most twice as large as the optimal (a 2-approximation). Algorithm: Set C= and while there exist uncovered edge e, add both endpoints of such e to C Why does it work?