Computational Intractability 2010/4/15. Lecture 2

Similar documents
NP and Computational Intractability

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

NP and Computational Intractability

8.5 Sequencing Problems

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Algorithm Design and Analysis

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

Algorithm Design and Analysis

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

Chapter 8. NP and Computational Intractability

Polynomial-Time Reductions

Algorithms Design & Analysis. Approximation Algorithm

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

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

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

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

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

SAT, Coloring, Hamiltonian Cycle, TSP

NP completeness and computational tractability Part II

CS 580: Algorithm Design and Analysis

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

NP and NP-Completeness

1. Introduction Recap

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

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

NP-Complete Problems. More reductions

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

Algorithm Design and Analysis

Lecture 4: NP and computational intractability

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

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

Intro to Theory of Computation

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

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

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

Algorithms, Lecture 3 on NP : Nondeterminis7c Polynomial Time

CS 583: Algorithms. NP Completeness Ch 34. Intractability

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

Announcements. Analysis of Algorithms

More NP-Complete Problems

Automata Theory CS Complexity Theory I: Polynomial Time

COMP 382. Unit 10: NP-Completeness

NP Completeness and Approximation Algorithms

The Complexity Classes P and NP. Andreas Klappenecker [partially based on slides by Professor Welch]

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

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

NP-Complete Reductions 2

ECS122A Handout on NP-Completeness March 12, 2018

Complexity, P and NP

Lecture 15 - NP Completeness 1

Intro to Theory of Computation

Design and Analysis of Algorithms

Limits to Approximability: When Algorithms Won't Help You. Note: Contents of today s lecture won t be on the exam

NP and NP Completeness

Chapter 34: NP-Completeness

NP-Complete Reductions 1

Spring Lecture 21 NP-Complete Problems

NP Complete Problems. COMP 215 Lecture 20

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

NP-Complete problems

Limitations of Algorithm Power

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

Correctness of Dijkstra s algorithm

SAT, NP, NP-Completeness

NP-Completeness. ch34 Hewett. Problem. Tractable Intractable Non-computable computationally infeasible super poly-time alg. sol. E.g.

CS21 Decidability and Tractability

CS 580: Algorithm Design and Analysis

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

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

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

Polynomial-time Reductions

Computability and Complexity

Introduction. Pvs.NPExample

NP-Completeness. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Lecture 24 : Even more reductions

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

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

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

CS154, Lecture 13: P vs NP

INTRO TO COMPUTATIONAL COMPLEXITY

NP-Complete Problems. Complexity Class P. .. Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar..

NP-complete Problems

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

NP-completeness. Chapter 34. Sergey Bereg

Hamiltonian Cycle. Hamiltonian Cycle

Non-Approximability Results (2 nd part) 1/19

More on NP and Reductions

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

CS154, Lecture 13: P vs NP

NP-Completeness. Subhash Suri. May 15, 2018

NP-Complete Reductions 3

Essential facts about NP-completeness:

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

Today: NP-Completeness (con t.)

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

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

Some Algebra Problems (Algorithmic) CSE 417 Introduction to Algorithms Winter Some Problems. A Brief History of Ideas

VIII. NP-completeness

Transcription:

Computational Intractability 2010/4/15 Professor: David Avis Lecture 2 Scribe:Naoki Hatta 1 P and NP 1.1 Definition of P and NP Decision problem it requires yes/no answer. Example: 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 and s is length of s Certifier 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. intuition about Certification algorithm Certifier doesn t determine whether s X on its own. Certifier checks a proposed proof t that s X. Certificate Instance which leads the true answer. P Decision problems for which there is a poly-time algorithm. NP Decision problems for which there exists a poly-time certifier. Remark NP stands for nondeterministic polynomial-time. yes is easy to check but no is not!!! 1.2 Examples Example 1: Composite Composites Given 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. 2-1

Certifier C(s,t) that if s is a multiple of t, return true, but otherwise return false. Instance s = 437,669 Certificate t = 541 or 809 (437,669 = 541 * 809) Therefore, Composite is in NP. Example 2: Satisfiability 3-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. Instance (x 1 x 2 x 3 ) (x 1 x 2 x 3 ) (x 1 x 2 x 4 ) (x 1 x 3 x 4 ) Certificate x 1 = 1, x 2 = 1, x 3 = 0, x 4 = 1 Therefore, 3-SAT is in NP. Example 3: 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. Instance & Certificate as figure1 Instance s certificate t Therefore, HAM-CYCLE is in NP. Figure 1: HAM-CYCLE 2-2

1.3 P vs NP P Decision problems for which there exists a poly-time algorithm. NP Decision problems for which there exists a poly-time certifier. EXP Decision problems for which there exists an exponential-time algorithm. Claim P NP. Proof 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. Proof 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. 1.3.1 Does P = NP? Is the decision problem as easy as the certification problem? If yes Efficient algorithms for 3-COLOR,TSP,FACTOR,SAT,... If no No efficient algorithms possible for 3-COLOR,TSP,SAT,... Consensus opinion is P NP! 2 NP-Completeness 2.1 Transformation Def Problem X polynomial reduces(cook) to problem Y if arbitrary instances of problem X can be solved using: Polynomial number of standard computational steps,plus Polynomial number of calls to oracle that solves problem Y. Def Problem X polynomial transforms(karp) to problem Y if given any input x to X, we can construct an input y such that x is a yes instance of X iff y is a yes instance of Y. Note Polynomial transformation is polynomial reduction with just one call to oracle for Y, exactly at the end of the algorithm for X. Almost all previous reductions were of this form. as figure2. Are these two concepts the same? 2-3

poly-time yes Input for X Transform data Input for Y solve Y no X: SAT or TSP or... Y: Integer program or... Figure 2: Transformation 2.2 definition NP-complete A problem Y in NP with the property that for every problem X in NP, X p Y. (X p Y means that problem Y can reduce to problem X in poly-time.) Theorem Suppose Y is an NP-complete problem. Then Y is solvable in poly-time iff P=NP. Proof( ) If P = NP then Y can be solved in poly-time since Y is in NP. Proof( ) 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. Do there exist natural NP-complete problems? The First NP-complete problem is SAT. Remark Once we establish first natural NP-complete problem, others fall like dominoes. Recipe to establish NP-completeness of problem Y step1 Show that Y is in NP. step2 Choose an NP-complete problem X. step3 Prove that X p Y Justification If X is an NP-complete problem, and Y is a problem in NP with the property that X p Y then Y is NP-complete. Proof Let W be any problem in NP. Then W p X p Y. By transitivity, W p Y. Hence Y is NP-complete. Observation All problems in figure3 are NP-complete and polynomial reduce to one another! NP-hard A problem Y is NP-hard if X p Y for an NP-complete problem X. Note A decision problem such that every problem in NP reduces to it. Not necessarily in NP. 2-4

SATISFIABILITY 3-SAT INDEPENDENT SET DIR-HAM-CYCLE GRAPH-3-COLOR SUBSET-SUM VERTEX COVER HAM-CYCLE PLANAR 3-COLOR SCHEDULING SET COVER TSP Figure 3: Reduction Graph 2.3 Reduction example 2.3.1 Directed Hamiltonian cycle 3-SAT Reduces to Directed Hamiltonian Cycle Claim 3-SAT p DIR-HAM-CYCLE Proof Given an instance Φ of 3-SAT, we construct an instance of DIR-HAM-CYCLE that has a Hamiltonian cycle iff Φ is satisfiable. Construction Given 3-SAT instance Φ with n variables x i and k clauses. 1. create graph G that has 2 n Hamiltonian cycles which correspond in a natural way to 2 n possible truth assignments. 2. regard a clause as a node and add it and 6 edges to the graph G for each clause. In this way, the new graph is gained. For example,in case that 1 clause and 3 variables, the graph is like figure4. Intuition traverse path i from left to right set variable x i = 1. Claim Φ is satisfiable iff G has a Hamiltonian cycle. Proof( ) Suppose 3-SAT instance has satisfying assignment x*. Then define Hamiltonian cycle in G as follows if x i = 1, traverse row i from left to right if x i = 0, traverse row i from right to left for each clause C j, there will be at least one row i in which we are going in correct direction to splice node C j into tour 2-5

C = x1 x2 x3 s x1 x2 x3 t 3k+3 (k : num of clause) Figure 4: 3SAT to DHC Proof( ) Suppose G has a Hamiltonian cycle Γ. if Γ enters clause node C j, 1. it must depart on mate edge.(thus, nodes immediately before and after C j are connected by an edge e in G.) 2. removing C j from cycle and replacing it with edge e yields Hamiltonian cycle on G {C j } Continuing in this way, we are left with Hamiltonian cycle Γ in G {C 1, C 2,..., C k }. And then, determine assignment from Γ. Set x i = 1 iff Γ traverses row i left to right. Set x i = 0 iff Γ traverses row i right to left. Since Γ visits each clause node C j, at least one of the paths is traversed in correct direction, and each clause is satisfied. 2.3.2 SUBSET-SUM Given natural numbers w 1, w 2,..., w n and an integer W, is there a subset that adds up to exactly W? Ex: {1, 4, 16, 64, 256, 1040, 1041, 1093, 1284, 1344}, W = 3754. Ans: Yes! (1+16+64+256+1040+1093+1284=3754). 2-6

Remark. With arithmetic problems, input integers are encoded in binary. Polynomial reduction must be polynomial in binary encoding. Claim 3-SAT p SUBSET-SUM Proof Given an instance Φ of 3-SAT, we construct an instance of SUBSET-SUM that has solution iff Φ is satisfiable. Construction Given 3-SAT instance Φ with n variables and k clauses, form 2n+2k decimal integers, each of n+k digits. For example, the instance of 3-SAT. C 1 = x y z C 2 = x y z C 2 = x y z These 3 CNF transform into the instance of SUBSET-SUM, as illustrated table1. x y z C 1 C 2 C 3 w i x 1 0 0 0 1 0 100,110 x 1 0 0 1 0 1 100,001 y 0 1 0 1 0 0 10,000 y 0 1 0 0 1 1 100,001 z 0 0 1 1 1 0 1,010 z 0 0 1 0 0 1 1,101 0 0 0 1 0 0 100 0 0 0 2 0 0 200 0 0 0 0 1 0 10 0 0 0 0 2 0 20 0 0 0 0 0 1 1 0 0 0 0 0 2 2 W 1 1 1 4 4 4 111,444 Table 1: 3SAT to SUBSET-SUM Last 2k rows are the dummies to get clause columns to sum to 4, because that the sum of a C j column equals 4 means that the clause can be satisfiable. Each row correspond the instance (natural number) of SUBSET-SUM, and iff there exists a subset that sums to exactly W (= 111, 444), Φ is satisfiable. References [1] Jon Kleinberg and Eva Tardos, Algorithm Design (ADDISON WESLEY, 2005) 2-7