CS21 Decidability and Tractability

Similar documents
CS21 Decidability and Tractability

NP-Complete Reductions 1

Classes of Problems. CS 461, Lecture 23. NP-Hard. Today s Outline. We can characterize many problems into three classes:

NP-Hardness reductions

Essential facts about NP-completeness:

NP-Complete Reductions 2

UC Berkeley CS 170: Efficient Algorithms and Intractable Problems Handout 22 Lecturer: David Wagner April 24, Notes 22 for CS 170

Intro to Theory of Computation

CS154, Lecture 15: Cook-Levin Theorem SAT, 3SAT

NP Completeness. CS 374: Algorithms & Models of Computation, Spring Lecture 23. November 19, 2015

NP-Complete Problems. More reductions

1. Introduction Recap

More NP-Complete Problems

CS154, Lecture 13: P vs NP

NP Complete Problems. COMP 215 Lecture 20

Lecture 19: Finish NP-Completeness, conp and Friends

NP-Complete Reductions 3

Polynomial-time reductions. We have seen several reductions:

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

Lecture 4: NP and computational intractability

Correctness of Dijkstra s algorithm

NP-Completeness. Andreas Klappenecker. [based on slides by Prof. Welch]

CSCI 1590 Intro to Computational Complexity

CS154, Lecture 13: P vs NP

BBM402-Lecture 11: The Class NP

Lecture 13, Fall 04/05

CS5371 Theory of Computation. Lecture 19: Complexity IV (More on NP, NP-Complete)

CS 583: Algorithms. NP Completeness Ch 34. Intractability

P P P NP-Hard: L is NP-hard if for all L NP, L L. Thus, if we could solve L in polynomial. Cook's Theorem and Reductions

Lecture 18: More NP-Complete Problems

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

CSC 373: Algorithm Design and Analysis Lecture 15

NP and NP-Completeness

Theory of Computation Chapter 9

NP and NP Completeness

Hardness of Approximation

NP-complete Problems

NP-Completeness. Subhash Suri. May 15, 2018

SAT, NP, NP-Completeness

NP-Complete problems

Lecture 18: PCP Theorem and Hardness of Approximation I

15-451/651: Design & Analysis of Algorithms October 31, 2013 Lecture #20 last changed: October 31, 2013

CSI 4105 MIDTERM SOLUTION

NP-Completeness Review

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Umans Complexity Theory Lectures

Introduction to Computational Complexity

NP and Computational Intractability

CSE 135: Introduction to Theory of Computation NP-completeness

CS151 Complexity Theory. Lecture 15 May 22, 2017

NP Completeness and Approximation Algorithms

CSE 3500 Algorithms and Complexity Fall 2016 Lecture 25: November 29, 2016

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

Theory of Computation Time Complexity

SAT, Coloring, Hamiltonian Cycle, TSP

NP-Completeness. Dr. B. S. Panda Professor, Department of Mathematics IIT Delhi, Hauz Khas, ND-16

CS 561, Lecture 12. Jared Saia University of New Mexico

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

Lecture 15 - NP Completeness 1

NP-completeness. Chapter 34. Sergey Bereg

Geometric Steiner Trees

Algorithms Design & Analysis. Approximation Algorithm

Today s Outline. CS 362, Lecture 23. Classes of Problems. NP-Hard. Review NP-Hardness and three more reductions. Jared Saia University of New Mexico

Introduction. Pvs.NPExample

CSE 421 NP-Completeness

1 Primals and Duals: Zero Sum Games

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Summer School on Introduction to Algorithms and Optimization Techniques July 4-12, 2017 Organized by ACMU, ISI and IEEE CEDA.

Complexity Classes V. More PCPs. Eric Rachlin

Chapter 2. Reductions and NP. 2.1 Reductions Continued The Satisfiability Problem (SAT) SAT 3SAT. CS 573: Algorithms, Fall 2013 August 29, 2013

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

CS 3719 (Theory of Computation and Algorithms) Lectures 23-32

NP-Completeness. A language B is NP-complete iff B NP. This property means B is NP hard

Lecture #14: NP-Completeness (Chapter 34 Old Edition Chapter 36) Discussion here is from the old edition.

Polynomial-time Reductions

Algorithm Design and Analysis

NP and Computational Intractability

CS Fall 2011 P and NP Carola Wenk

NP-Completeness. NP-Completeness 1

CSE 105 THEORY OF COMPUTATION

Design and Analysis of Algorithms

Complexity Theory: The P vs NP question

Instructor N.Sadagopan Scribe: P.Renjith

1.1 P, NP, and NP-complete

Design and Analysis of Algorithms

CSCI3390-Lecture 17: A sampler of NP-complete problems

Lecture 7: Polynomial time hierarchy

Discrete Optimization 2010 Lecture 10 P, N P, and N PCompleteness

NP Completeness. Richard Karp, 1972.

CS Lecture 28 P, NP, and NP-Completeness. Fall 2008

CS 161: Design and Analysis of Algorithms

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Lecture 16: Time Complexity and P vs NP

Chapter 2 : Time complexity

ITCS:CCT09 : Computational Complexity Theory Apr 8, Lecture 7

Admin NP-COMPLETE PROBLEMS. Run-time analysis. Tractable vs. intractable problems 5/2/13. What is a tractable problem?

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Transcription:

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

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 2

Cook-Levin Theorem Gateway to proving lots of natural, important problems NP-complete is: Theorem (Cook, Levin): 3SAT is NPcomplete. 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 3

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 4

3SAT is NP-complete Theorem: 3SAT is NP-complete 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 5

3SAT is NP-complete given a circuit C variables x 1, x 2,, x n AND (Ù), OR (Ú), NOT ( ) gates g 1, g 2,, g m reduction f(c) produces these clauses for φ on variables x 1, x 2,, x n, g 1, g 2,, g m : g i z (g i Ú z) ( z Ú g i ) (z Û g i ) February 16, 2018 CS21 Lecture 18 6

3SAT is NP-complete given a circuit C variables x 1, x 2,, x n AND (Ù), OR (Ú), NOT ( ) gates g 1, g 2,, g m reduction f(c) produces these clauses for φ on variables x 1, x 2,, x n, g 1, g 2,, g m : z 1 Ú g i z 2 ( z 1 Ú g i ) ( z 2 Ú g i ) ( g i Ú z 1 Ú z 2 ) (z 1 Ú z 2 Û g i ) February 16, 2018 CS21 Lecture 18 7

3SAT is NP-complete given a circuit C variables x 1, x 2,, x n AND (Ù), OR (Ú), NOT ( ) gates g 1, g 2,, g m reduction f(c) produces these clauses for φ on variables x 1, x 2,, x n, g 1, g 2,, g m : z 1 Ù g i z 2 ( g i Ú z 1 ) ( g i Ú z 2 ) ( z 1 Ú z 2 Ú g i ) (z 1 Ù z 2 Û g i ) February 16, 2018 CS21 Lecture 18 8

3SAT is NP-complete finally, reduction f(c) produces single clause (g m ) where g m 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 9

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 g m 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 10

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 11

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 12

Ind. Set is NP-complete Theorem: the following language is NPcomplete: 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 13

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 14

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 15

Ind. Set is NP-complete φ = (x Ú y Ú z) Ù ( x Ú w Ú z) Ù Ù ( ) f(φ) = (G, # clauses) x x 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 16

Ind. Set is NP-complete φ = (x Ú y Ú z) Ù ( x Ú w Ú z) Ù Ù ( ) f(φ) = (G, # clauses) x x 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 17

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 18

Vertex Cover is NP-complete Theorem: the following language is NPcomplete: 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 19

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 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 16, 2018 CS21 Lecture 18 21

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 22

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 23

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 24

Clique is NP-complete Theorem: the following language is NPcomplete: 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 25

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 26

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 27

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 28

Clique is NP-complete The reduction: 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 29

Hamilton Path 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 30

HAMPATH is NP-complete Theorem: the following language is NPcomplete: 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 31

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 32