NP and Computational Intractability

Similar documents
COP 4531 Complexity & Analysis of Data Structures & Algorithms

Algorithm Design and Analysis

4/19/11. NP and NP completeness. Decision Problems. Definition of P. Certifiers and Certificates: COMPOSITES

4/22/12. NP and NP completeness. Efficient Certification. Decision Problems. Definition of P

8.1 Polynomial-Time Reductions. Chapter 8. NP and Computational Intractability. Classify Problems

Algorithms Design & Analysis. Approximation Algorithm

Intro to Theory of Computation

Algorithm Design and Analysis

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

3/22/2018. CS 580: Algorithm Design and Analysis. 8.3 Definition of NP. Chapter 8. NP and Computational Intractability. Decision Problems.

CS 580: Algorithm Design and Analysis. Jeremiah Blocki Purdue University Spring 2018

Computational Intractability 2010/4/15. Lecture 2

Chapter 8. NP and Computational Intractability. CS 350 Winter 2018

7.8 Intractability. Overview. Properties of Algorithms. Exponential Growth. Q. What is an algorithm? A. Definition formalized using Turing machines.

Announcements. Analysis of Algorithms

NP completeness and computational tractability Part II

NP and Computational Intractability

Polynomial-Time Reductions

Intro to Theory of Computation

CS 580: Algorithm Design and Analysis

3/22/2018. CS 580: Algorithm Design and Analysis. Circuit Satisfiability. Recap. The "First" NP-Complete Problem. Example.

CS 301: Complexity of Algorithms (Term I 2008) Alex Tiskin Harald Räcke. Hamiltonian Cycle. 8.5 Sequencing Problems. Directed Hamiltonian Cycle

4/12/2011. Chapter 8. NP and Computational Intractability. Directed Hamiltonian Cycle. Traveling Salesman Problem. Directed Hamiltonian Cycle

8.5 Sequencing Problems

8. INTRACTABILITY I. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley. Last updated on 2/6/18 2:16 AM

4/20/11. NP-complete problems. A variety of NP-complete problems. Hamiltonian Cycle. Hamiltonian Cycle. Directed Hamiltonian Cycle

Chapter 11. Approximation Algorithms. Slides by Kevin Wayne Pearson-Addison Wesley. All rights reserved.

7.8: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

SAT, Coloring, Hamiltonian Cycle, TSP

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Lecture 4: NP and computational intractability

Algorithm Design and Analysis

1. Introduction Recap

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

4/30/14. Chapter Sequencing Problems. NP and Computational Intractability. Hamiltonian Cycle

Chapter 8. NP and Computational Intractability

More NP-Complete Problems

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

SAT, NP, NP-Completeness

8.5 Sequencing Problems. Chapter 8. NP and Computational Intractability. Hamiltonian Cycle. Hamiltonian Cycle

10.3: Intractability. Overview. Exponential Growth. Properties of Algorithms. What is an algorithm? Turing machine.

CS 580: Algorithm Design and Analysis

Approximation and Randomized Algorithms (ARA) Lecture 2, September 1, 2010

CSC 373: Algorithm Design and Analysis Lecture 15

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

NP and NP Completeness

Reductions. Reduction. Linear Time Reduction: Examples. Linear Time Reductions

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

NP and NP-Completeness

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

Polynomial-time Reductions

CS154, Lecture 13: P vs NP

1.1 P, NP, and NP-complete

CHAPTER 3 FUNDAMENTALS OF COMPUTATIONAL COMPLEXITY. E. Amaldi Foundations of Operations Research Politecnico di Milano 1

CS154, Lecture 13: P vs NP

Design and Analysis of Algorithms

Chapter 34: NP-Completeness

A difficult problem. ! Given: A set of N cities and $M for gas. Problem: Does a traveling salesperson have enough $ for gas to visit all the cities?

Intractability. A difficult problem. Exponential Growth. A Reasonable Question about Algorithms !!!!!!!!!! Traveling salesperson problem (TSP)

Lecture 19: Finish NP-Completeness, conp and Friends

NP-Complete Problems. More reductions

P and NP. Inge Li Gørtz. Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides

Computability and Complexity

NP-complete Problems

NP Complete Problems. COMP 215 Lecture 20

ECS122A Handout on NP-Completeness March 12, 2018

Complexity, P and NP

P and NP. Warm Up: Super Hard Problems. Overview. Problem Classification. Tools for classifying problems according to relative hardness.

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

Theory of Computation CS3102 Spring 2014 A tale of computers, math, problem solving, life, love and tragic death

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

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

Automata Theory CS Complexity Theory I: Polynomial Time

NP Completeness and Approximation Algorithms

CSE 135: Introduction to Theory of Computation NP-completeness

COMP 382. Unit 10: NP-Completeness

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

NP-Complete Reductions 1

Algorithms 6.5 REDUCTIONS. designing algorithms establishing lower bounds classifying problems intractability

Correctness of Dijkstra s algorithm

Computability and Complexity Theory: An Introduction

CSL 356: Analysis and Design of Algorithms. Ragesh Jaiswal CSE, IIT Delhi

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

CSC373: Algorithm Design, Analysis and Complexity Fall 2017

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

Theory of Computation Chapter 9

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

BBM402-Lecture 11: The Class NP

COMP Analysis of Algorithms & Data Structures

CS/COE

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Limitations of Algorithm Power

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

NP-Completeness. Subhash Suri. May 15, 2018

CSE 421 NP-Completeness

NP-Complete problems

Chapter 3. Complexity of algorithms

NP-Completeness. Until now we have been designing algorithms for specific problems

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

Transcription:

NP and Computational Intractability 1

Review Basic reduction strategies. Simple equivalence: INDEPENDENT-SET P VERTEX-COVER. Special case to general case: VERTEX-COVER P SET-COVER. Encoding with gadgets: 3-SAT P INDEPENDENT-SET. Transitivity. If X P Y and Y P Z, then X P Z. Pf idea. Compose the two algorithms. Ex: 3-SAT P INDEPENDENT-SET P VERTEX-COVER P SET-COVER. 2

Hamiltonian Cycle HAM-CYCLE: given an undirected graph G = (V, E), does there exist a simple cycle that contains every node in V. 1 1' 2 2' 3 3' 4 4' 5 NO: bipartite graph with odd number of nodes. 3

Directed Hamiltonian Cycle DIR-HAM-CYCLE: given a digraph G = (V, E), does there exists a simple directed cycle that contains every node in V? Claim. DIR-HAM-CYCLE P HAM-CYCLE. Pf. Given a directed graph G = (V, E), construct an undirected graph G' with 3n nodes. a a out d in d b c G v e b out c out v in G' v v out e in 4

Directed Hamiltonian Cycle Claim. G has a Hamiltonian cycle iff G' does. Pf. Suppose G has a directed Hamiltonian cycle. Then G' has an undirected Hamiltonian cycle (same order). Pf. Suppose G' has an undirected Hamiltonian cycle '. ' must visit nodes in G' using one of following two orders:, B, G, R, B, G, R, B, G, R, B,, B, R, G, B, R, G, B, R, G, B, Blue nodes in ' make up directed Hamiltonian cycle in G, or reverse of one. 5

3-SAT Reduces to Directed Hamiltonian Cycle Claim. 3-SAT P DIR-HAM-CYCLE. Pf. Given an instance of 3-SAT, we construct an instance of DIR- HAM-CYCLE that has a Hamiltonian cycle iff is satisfiable. Construction. First, create graph that has 2 n Hamiltonian cycles which correspond in a natural way to 2 n possible truth assignments. 6

3-SAT Reduces to Directed Hamiltonian Cycle Construction. Given 3-SAT instance with n variables x i and k clauses. Construct G to have 2 n Hamiltonian cycles. Intuition: traverse path i from left to right set variable x i = 1. s x 1 x 2 x 3 t 3k + 3 7

3-SAT Reduces to Directed Hamiltonian Cycle Construction. Given 3-SAT instance with n variables x i and k clauses. For each clause: add a node and 6 edges. C1 x1 V x2 V x3 C2 x1 V x2 V x3 clause node clause node s x 1 x 2 x 3 t 8

Polynomial-Time Reductions constraint satisfaction 3-SAT Dick Karp (1972) 1985 Turing Award INDEPENDENT SET DIR-HAM-CYCLE GRAPH 3-COLOR SUBSET-SUM VERTEX COVER HAM-CYCLE PLANAR 3-COLOR SCHEDULING SET COVER TSP packing and covering sequencing partitioning numerical 9

Definition of NP

Decision Problems Decision problem. X is a set of strings. Instance: string s. Algorithm A solves problem X: A(s) = yes iff s X. Polynomial time. Algorithm A runs in poly-time if for every string s, A(s) terminates in at most p( s ) "steps", where p( ) is some polynomial. length of s PRIMES: X = { 2, 3, 5, 7, 11, 13, 17, 23, 29, 31, 37,. } Algorithm. [Agrawal-Kayal-Saxena, 2002] p( s ) = s 8. 11

Definition of P P. Decision problems for which there is a poly-time algorithm. Problem Description Algorithm Yes No MULTIPLE Is x a multiple of y? Grade school division 51, 17 51, 16 RELPRIME Are x and y relatively prime? Euclid (300 BCE) 34, 39 34, 51 PRIMES Is x prime? AKS (2002) 53 51 EDIT- DISTANCE Is the edit distance between x and y less than 5? Dynamic programming niether neither acgggt ttttta LSOLVE Is there a vector x that satisfies Ax = b? Gauss-Edmonds elimination 0 1 1 2 4 2, 0 3 15 4 2 36 1 0 0 1 1 1, 0 1 1 1 1 1 12

NP Certification algorithm intuition. Certifier views things from "managerial" viewpoint. Certifier doesn't determine whether s X on its own; rather, it checks a proposed proof t that s X. Def. Algorithm C(s, t) is a certifier for problem X if for every string s, s X iff there exists a string t such that C(s, t) = yes. "certificate" or "witness" NP. Decision problems for which there exists a poly-time certifier. C(s, t) is a poly-time algorithm and t p( s ) for some polynomial p( ). Remark. NP stands for nondeterministic polynomial-time. 13

Certifiers and Certificates: Composite COMPOSITES. Given an integer s, is s composite? Certificate. A nontrivial factor t of s. Note that such a certificate exists iff s is composite. Moreover t s. Certifier. boolean C(s, t) { if (t 1 or t s) return false else if (s is a multiple of t) return true else return false } Instance. s = 437,669. Certificate. t = 541 or 809. 437,669 = 541 809 Conclusion. COMPOSITES is in NP. 14

Certifiers and Certificates: 3-Satisfiability SAT. Given a CNF formula, is there a satisfying assignment? Certificate. An assignment of truth values to the n boolean variables. Certifier. Check that each clause in has at least one true literal. Ex. x 1 x 2 x 3 x 1 x 2 x 3 x 1 x 2 x 4 x 1 x 3 x 4 instance s x 1 1, x 2 1, x 3 0, x 4 1 certificate t Conclusion. SAT is in NP. 15

Certifiers and Certificates: Hamiltonian Cycle HAM-CYCLE. Given an undirected graph G = (V, E), does there exist a simple cycle C that visits every node? Certificate. A permutation of the n nodes. Certifier. Check that the permutation contains each node in V exactly once, and that there is an edge between each pair of adjacent nodes in the permutation. Conclusion. HAM-CYCLE is in NP. instance s certificate t 16

P, NP, EXP P. Decision problems for which there is a poly-time algorithm. EXP. Decision problems for which there is an exponential-time algorithm. NP. Decision problems for which there is a poly-time certifier. Claim. P NP. Pf. Consider any problem X in P. By definition, there exists a poly-time algorithm A(s) that solves X. Certificate: t =, certifier C(s, t) = A(s). Claim. NP EXP. Pf. Consider any problem X in NP. By definition, there exists a poly-time certifier C(s, t) for X. To solve input s, run C(s, t) on all strings t with t p( s ). Return yes, if C(s, t) returns yes for any of these. 17

The Main Question: P Versus NP Does P = NP? [Cook 1971, Edmonds, Levin, Yablonski, Gödel] Is the decision problem as easy as the certification problem? Clay $1 million prize. EXP P NP EXP P = NP If P NP If P = NP would break RSA cryptography (and potentially collapse economy) If yes: Efficient algorithms for 3-COLOR, TSP, FACTOR, SAT, If no: No efficient algorithms possible for 3-COLOR, TSP, SAT, Consensus opinion on P = NP? Probably no. 18

NP-Completeness

NP-Complete NP-complete. A problem Y in NP with the property that for every problem X in NP, X p Y. Theorem. Suppose Y is an NP-complete problem. Then Y is solvable in poly-time iff P = NP. Pf. If P = NP then Y can be solved in poly-time since Y is in NP. Pf. Suppose Y can be solved in poly-time. Let X be any problem in NP. Since X p Y, we can solve X in poly-time. This implies NP P. We already know P NP. Thus P = NP. Fundamental question. Do there exist "natural" NP-complete problems? 20

NP-Completeness Observation. All problems below are NP-complete and polynomial reduce to one another! CIRCUIT-SAT by definition of NP-completeness 3-SAT INDEPENDENT SET DIR-HAM-CYCLE GRAPH 3-COLOR SUBSET-SUM VERTEX COVER HAM-CYCLE PLANAR 3-COLOR SCHEDULING SET COVER TSP 21