CS21 Decidability and Tractability

Slides:



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

CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
CS21 Decidability and Tractability
February 23, 2015CS21 Lecture 201 CS21 Decidability and Tractability Lecture 20 February 23, 2015.
Computability and Complexity 15-1 Computability and Complexity Andrei Bulatov NP-Completeness.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
February 25, 2015CS21 Lecture 211 CS21 Decidability and Tractability Lecture 21 February 25, 2015.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Lecture 22 More NPC problems
CSEP 521 Applied Algorithms Richard Anderson Lecture 10 NP Completeness.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
NP-complete Problems SAT 3SAT Independent Set Hamiltonian Cycle
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
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.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Given this 3-SAT problem: (x1 or x2 or x3) AND (¬x1 or ¬x2 or ¬x2) AND (¬x3 or ¬x1 or x2) 1. Draw the graph that you would use if you want to solve this.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
 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.
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
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
Hard Problems Introduction to NP
NP-Completeness (36.4-5) P: yes and no in pt NP: yes in pt NPH  NPC
NP-complete problems The Chinese University of Hong Kong Fall 2008
NP-Completeness Yin Tat Lee
Intro to Theory of Computation
CS154, Lecture 16: More NP-Complete Problems; PCPs
CS21 Decidability and Tractability
ICS 353: Design and Analysis of Algorithms
Intro to NP Completeness
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
Richard Anderson Lecture 28 NP Completeness
NP-Complete Problems.
NP-completeness The Chinese University of Hong Kong Fall 2008
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
CS21 Decidability and Tractability
NP-Completeness Yin Tat Lee
More on NP-completeness
CS154, Lecture 16: More NP-Complete Problems; PCPs
CS21 Decidability and Tractability
More NP-complete problems
Umans Complexity Theory Lectures
Trevor Brown DC 2338, Office hour M3-4pm
Richard Anderson Lecture 25 NP Completeness
Instructor: Aaron Roth
NP-Completeness (2) NP-Completeness Graphs 7/9/2019 6:12 AM x x x x x
CHAPTER 7 Time complexity
Lecture 23 NP-Hard Problems
Presentation transcript:

CS21 Decidability and Tractability Lecture 18 February 16, 2018 February 16, 2018 CS21 Lecture 18

Outline the complexity class NP 3-SAT is NP-complete NP-complete problems: independent set, vertex cover, clique NP-complete problems: Hamilton path and cycle,Traveling Salesperson Problem February 16, 2018 CS21 Lecture 18

Cook-Levin Theorem Gateway to proving lots of natural, important problems NP-complete is: Theorem (Cook, Levin): 3SAT is NP-complete. Recall: 3SAT = {φ : φ is a CNF formula with 3 literals per clause for which there exists a satisfying truth assignment} February 16, 2018 CS21 Lecture 18

Cook-Levin Theorem Proof outline show CIRCUIT-SAT is NP-complete CIRCUIT-SAT = {C : C is a Boolean circuit for which there exists a satisfying truth assignment} show 3SAT is NP-complete (reduce from CIRCUIT SAT) February 16, 2018 CS21 Lecture 18

3SAT is NP-complete Theorem: 3SAT is NP-complete Proof: 3SAT = {φ : φ is a 3-CNF formula for which there exists a satisfying truth assignment} Proof: Part 1: need to show 3-SAT  NP already done Part 2: need to show 3-SAT is NP-hard we will give a poly-time reduction from CIRCUIT-SAT to 3-SAT February 16, 2018 CS21 Lecture 18

3SAT is NP-complete given a circuit C variables x1, x2, …, xn AND (), OR (), NOT () gates g1, g2, …, gm reduction f(C) produces these clauses for φ on variables x1, x2, …, xn, g1, g2, …, gm:  gi (gi  z) (z  gi) (z  gi) z February 16, 2018 CS21 Lecture 18

3SAT is NP-complete  given a circuit C variables x1, x2, …, xn AND (), OR (), NOT () gates g1, g2, …, gm reduction f(C) produces these clauses for φ on variables x1, x2, …, xn, g1, g2, …, gm: (z1  gi) (z2  gi) (gi  z1  z2)  gi (z1 z2  gi) z1 z2 February 16, 2018 CS21 Lecture 18

3SAT is NP-complete  given a circuit C variables x1, x2, …, xn AND (), OR (), NOT () gates g1, g2, …, gm reduction f(C) produces these clauses for φ on variables x1, x2, …, xn, g1, g2, …, gm: (gi  z1) (gi  z2) (z1  z2  gi)  gi (z1 z2  gi) z1 z2 February 16, 2018 CS21 Lecture 18

3SAT is NP-complete finally, reduction f(C) produces single clause (gm) where gm is the output gate. f(C) computable in poly-time? yes, simple transformation YES maps to YES? if C(x) = 1, then assigning x-values to x-variables of φ and gate values of C when evaluating x to the g-variables of φ gives satsifying assignment. February 16, 2018 CS21 Lecture 18

3SAT is NP-complete NO maps to NO? show that φ satisfiable implies C satisfiable satisfying assignment to φ assigns values to x-variables and g-variables output gate gm must be assigned 1 every other gate must be assigned value it would take given values of its inputs. the assignment to the x-variables must be a satisfying assignment for C. February 16, 2018 CS21 Lecture 18

given G, find the largest independent set Search vs. Decision Definition: given a graph G = (V, E), an independent set in G is a subset V’ V such that for all u,w  V’ (u,w)  E A problem: given G, find the largest independent set This is called a search problem searching for optimal object of some type comes up frequently February 16, 2018 CS21 Lecture 18

Search vs. Decision We want to talk about languages (or decision problems) Most search problems have a natural, related decision problem by adding a bound “k”; for example: search problem: given G, find the largest independent set decision problem: given (G, k), is there an independent set of size at least k February 16, 2018 CS21 Lecture 18

IS = {(G, k) : G has an IS of size  k}. Ind. Set is NP-complete Theorem: the following language is NP-complete: IS = {(G, k) : G has an IS of size  k}. Proof: Part 1: IS  NP. Proof? Part 2: IS is NP-hard. reduce from 3-SAT February 16, 2018 CS21 Lecture 18

IS = {(G, k) : G has an IS of size  k}. Ind. Set is NP-complete We are reducing from the language: 3SAT = { φ : φ is a 3-CNF formula that has a satisfying assignment } to the language: IS = {(G, k) : G has an IS of size  k}. February 16, 2018 CS21 Lecture 18

φ = (x  y  z)  (x  w  z)  …  (…) Ind. Set is NP-complete The reduction f: given φ = (x  y  z)  (x  w  z)  …  (…) we produce graph Gφ:  x x … y z w z one triangle for each of m clauses edge between every pair of contradictory literals set k = m February 16, 2018 CS21 Lecture 18

Ind. Set is NP-complete Is f poly-time computable? YES maps to YES? φ = (x  y  z)  (x  w  z)  …  (…) x  x f(φ) = (G, # clauses) … y z w z Is f poly-time computable? YES maps to YES? 1 true literal per clause in satisfying assign. A choose corresponding vertices (1 per triangle) IS, since no contradictory literals in A February 16, 2018 CS21 Lecture 18

Ind. Set is NP-complete NO maps to NO? φ = (x  y  z)  (x  w  z)  …  (…) x  x f(φ) = (G, # clauses) … y z w z NO maps to NO? IS can have at most 1 vertex per triangle IS of size  # clauses must have exactly 1 per since IS, no contradictory vertices can produce satisfying assignment by setting these literals to true February 16, 2018 CS21 Lecture 18

Vertex cover Definition: given a graph G = (V, E), a vertex cover in G is a subset V’ V such that for all (u,w)  E, u  V’ or w  V’ A search problem: given G, find the smallest vertex cover corresponding language (decision problem): VC = {(G, k) : G has a VC of size ≤ k}. February 16, 2018 CS21 Lecture 18

Vertex Cover is NP-complete Theorem: the following language is NP-complete: VC = {(G, k) : G has a VC of size ≤ k}. Proof: Part 1: VC  NP. Proof? Part 2: VC is NP-hard. reduce from? February 16, 2018 CS21 Lecture 18

Vertex Cover is NP-complete We are reducing from the language: IS = {(G, k) : G has an IS of size  k} to the language: VC = {(G, k) : G has a VC of size ≤ k}. February 16, 2018 CS21 Lecture 18

Vertex Cover is NP-complete How are IS, VC related? Given a graph G = (V, E) with n nodes if V’  V is an independent set of size k then V-V’ is a vertex cover of size n-k Proof: suppose not. Then there is some edge with neither endpoint in V-V’. But then both endpoints are in V’. contradiction. February 16, 2018 CS21 Lecture 18

Vertex Cover is NP-complete How are IS, VC related? Given a graph G = (V, E) with n nodes if V’  V is a vertex cover of size k then V-V’ is an independent set of size n-k Proof: suppose not. Then there is some edge with both endpoints in V-V’. But then neither endpoint is in V’. contradiction. February 16, 2018 CS21 Lecture 18

Vertex Cover is NP-complete The reduction: given an instance of IS: (G, k) f produces the pair (G, n-k) f poly-time computable? YES maps to YES? IS of size  k in G  VC of size ≤ n-k in G NO maps to NO? VC of size ≤ n-k in G  IS of size  k in G February 16, 2018 CS21 Lecture 18

Clique Definition: given a graph G = (V, E), a clique in G is a subset V’ V such that for all u,v  V’, (u, v)  E A search problem: given G, find the largest clique corresponding language (decision problem): CLIQUE = {(G, k) : G has a clique of size  k}. February 16, 2018 CS21 Lecture 18

CLIQUE = {(G, k) : G has a clique of size  k} Clique is NP-complete Theorem: the following language is NP-complete: CLIQUE = {(G, k) : G has a clique of size  k} Proof: Part 1: CLIQUE  NP. Proof? Part 2: CLIQUE is NP-hard. reduce from? February 16, 2018 CS21 Lecture 18

Clique is NP-complete We are reducing from the language: IS = {(G, k) : G has an IS of size  k} to the language: CLIQUE = {(G, k) : G has a CLIQUE of size  k}. February 16, 2018 CS21 Lecture 18

Clique is NP-complete How are IS, CLIQUE related? Given a graph G = (V, E), define its complement G’ = (V, E’ = {(u,v) : (u,v)  E}) if V’  V is an independent set in G of size k then V’ is a clique in G’ of size k Proof: Every pair of vertices u,v 2 V’ has no edge between them in G. Therefore they have an edge between them in G’. February 16, 2018 CS21 Lecture 18

Clique is NP-complete How are IS, CLIQUE related? Given a graph G = (V, E), define its complement G’ = (V, E’ = {(u,v) : (u,v)  E}) if V’  V is a clique in G’ of size k then V’ is an independent set in G of size k Proof: Every pair of vertices u,v 2 V’ has an edge between them in G’. Therefore they have no edge between them in G. February 16, 2018 CS21 Lecture 18

Clique is NP-complete The reduction: f poly-time computable? given an instance of IS: (G, k) f produces the pair (G’, k) f poly-time computable? YES maps to YES? IS of size  k in G  CLIQUE of size  k in G’ NO maps to NO? CLIQUE of size  k in G’  IS of size  k in G February 16, 2018 CS21 Lecture 18

HAMPATH = {(G, s, t) : G has a Hamilton path from s to t} Definition: given a directed graph G = (V, E), a Hamilton path in G is a directed path that touches every node exactly once. A language (decision problem): HAMPATH = {(G, s, t) : G has a Hamilton path from s to t} February 16, 2018 CS21 Lecture 18

HAMPATH is NP-complete Theorem: the following language is NP-complete: HAMPATH = {(G, s, t) : G has a Hamilton path from s to t} Proof: Part 1: HAMPATH  NP. Proof? Part 2: HAMPATH is NP-hard. reduce from? February 16, 2018 CS21 Lecture 18

HAMPATH is NP-complete We are reducing from the language: 3SAT = { φ : φ is a 3-CNF formula that has a satisfying assignment } to the language: HAMPATH = {(G, s, t) : G has a Hamilton path from s to t} February 16, 2018 CS21 Lecture 18