CS21 Decidability and Tractability

Slides:



Advertisements
Similar presentations
CSci 4011 INHERENT LIMITATIONS OF COMPUTER PROGRAMS.
Advertisements

Proof of correctness; More reductions
Theory of Computing Lecture 18 MAS 714 Hartmut Klauck.
NP-Completeness: Reductions
CSC5160 Topics in Algorithms Tutorial 2 Introduction to NP-Complete Problems Feb Jerry Le
Complexity 11-1 Complexity Andrei Bulatov NP-Completeness.
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.
Approximation Algorithms Lecture for CS 302. What is a NP problem? Given an instance of the problem, V, and a ‘certificate’, C, we can verify V is in.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
Fall 2006Costas Busch - RPI1 More NP-complete Problems.
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
February 25, 2015CS21 Lecture 211 CS21 Decidability and Tractability Lecture 21 February 25, 2015.
Lecture 22 More NPC problems
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.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
28.
NPC.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
Prof. Busch - LSU1 Busch Complexity Lectures: More NP-complete Problems.
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
Costas Busch - LSU 1 More NP-complete Problems. Costas Busch - LSU 2 Theorem: If: Language is NP-complete Language is in NP is polynomial time reducible.
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
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
Polynomial-Time Reduction
More NP-complete Problems
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 (36.4-5) P: yes and no in pt NP: yes in pt NPH  NPC
NP-Completeness Yin Tat Lee
CS21 Decidability and Tractability
Intro to Theory of Computation
CS154, Lecture 16: More NP-Complete Problems; PCPs
CS21 Decidability and Tractability
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
Additional NP-complete problems
Richard Anderson Lecture 28 NP Completeness
NP-Complete Problems.
CS 3343: Analysis of Algorithms
Richard Anderson Lecture 26 NP-Completeness
NP-Completeness Yin Tat Lee
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
CSE 589 Applied Algorithms Spring 1999
Lecture 24 Classical NP-hard Problems
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:

CS21 Decidability and Tractability Lecture 20 February 25, 2019 February 25, 2019 CS21 Lecture 20

Grades so far An idea of eventual scale: 2018 2017 2016 2015 2014 2013 2019 (ps1, ps2, ps3, midterm): mean 77.4; median 81.2 2018: mean 78.7; median 79.9 2017: mean 75.4; median 73.6 2016: mean 80.1; median 79.5 2015: mean 77.5; median 80.3 2014: mean 79.8; median 80.3 97-100 A+ 90-97 A 86-89 A- 82-85 B+ 77-81 B 74-76 B- 70-73 C+ 65-69 C 62-64 C- 57-61 D+ 52-56 D <52 E/F 98-100 A+ 92-97 A 90-91 A- 85-89 B+ 80-84 B 77-79 B- 72-76 C+ 68-71 C 62-67 C- 59-61 D+ 54-58 D <54 E/F 97-100 A+ 90-96 A 87-89 A- 84-86 B+ 79-83 B 74-78 B- 70-73 C+ 66-69 C 62-65 C- 57-61 D+ 52-56 D <51 E/F 96-100 A+ 89-95 A 85-88 A- 79-84 B+ 74-78 B 70-73 B- 66-69 C+ 63-66 C 57-62 C- 53-56 D+ 47-52 D <47 E/F 98-100 A+ 93-97 A 88-92 A- 83-87 B+ 78-82 B 75-77 B- 71-74 C+ 67-70 C 64-66 C- 57-63 D+ 52-56 D <52 E/F 97-100 A+ 90-97 A 87-89 A- 82-86 B+ 77-81 B 74-76 B- 70-73 C+ 65-69 C 62-64 C- 57-61 D+ 52-56 D <52 E/F 2018 2017 2016 2015 2014 2013

Outline NP-complete problems: independent set, vertex cover, clique NP-complete problems: Hamilton path and cycle,Traveling Salesperson Problem February 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

φ = (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 25, 2019 CS21 Lecture 20

φ = (x ∨ y ∨¬z) ∧ (¬x ∨ w ∨ z) ∧… ∧ (…) Ind. Set is NP-complete φ = (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 25, 2019 CS21 Lecture 20

φ = (x ∨ y ∨¬z) ∧ (¬x ∨ w ∨ z) ∧… ∧ (…) Ind. Set is NP-complete φ = (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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 ∈ V’ has no edge between them in G. Therefore they have an edge between them in G’. February 25, 2019 CS21 Lecture 20

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 ∈ V’ has an edge between them in G’. Therefore they have no edge between them in G. February 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

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 25, 2019 CS21 Lecture 20

HAMPATH is NP-complete We want to construct a graph from φ with the following properties: a satisfying assignment to φ translates into a Hamilton Path from s to t a Hamilton Path from s to t can be translated into a satisfying assignment for φ We will build the graph up from pieces called gadgets that “simulate” the clauses and variables of φ. February 25, 2019 CS21 Lecture 20

HAMPATH is NP-complete The variable gadget (one for each xi): xi true: … … … xi false: February 25, 2019 CS21 Lecture 20

HAMPATH is NP-complete … path from s to t translates into a truth assignment to x1…xm why must the path be of this form? “x1” … “x2” : … “xm” t February 25, 2019 CS21 Lecture 20