NP-problems continued

Similar documents
NP-problems continued

Formal definition of P

1. Introduction Recap

Polynomial-time Reductions

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

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

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

Lecture 18: More NP-Complete Problems

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Chapter 34: NP-Completeness

NP Complete Problems. COMP 215 Lecture 20

1.1 P, NP, and NP-complete

Theory of Computation Chapter 9

NP-Hardness reductions

Combinatorial Optimization

Essential facts about NP-completeness:

NP-Complete Reductions 1

Design and Analysis of Algorithms

NP and Computational Intractability

CMPT307: Complexity Classes: P and N P Week 13-1

NP-Complete Reductions 2

Limitations of Algorithm Power

Introduction to Computational Complexity

More NP-Complete Problems

NP-Complete problems

Introduction to Complexity Theory

Polynomial-time reductions. We have seen several reductions:

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

The Class NP. NP is the problems that can be solved in polynomial time by a nondeterministic machine.

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

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

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Limitations of Algorithms

Notes for Lecture 21

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Chapter 3: Proving NP-completeness Results

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

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

Automata Theory CS S-18 Complexity Theory II: Class NP

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

NP-complete Problems

P is the class of problems for which there are algorithms that solve the problem in time O(n k ) for some constant k.

NP-completeness. Chapter 34. Sergey Bereg

Lecture 13, Fall 04/05

ECS122A Handout on NP-Completeness March 12, 2018

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

Computational Intractability 2010/4/15. Lecture 2

Computational Complexity

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

Complexity, P and NP

Comp487/587 - Boolean Formulas

NP Completeness and Approximation Algorithms

Lecture 19: Finish NP-Completeness, conp and Friends

The Complexity of Optimization Problems

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

NP-Completeness. NP-Completeness 1

SAT, Coloring, Hamiltonian Cycle, TSP

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

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

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

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

1 Non-deterministic Turing Machine

CSC 1700 Analysis of Algorithms: P and NP Problems

Computability Theory

Algorithms: COMP3121/3821/9101/9801

NP-Complete Problems. More reductions

NP and Computational Intractability

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

A.Antonopoulos 18/1/2010

NP-Completeness. Sections 28.5, 28.6

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Intractable Problems. Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions

Automata Theory CS Complexity Theory I: Polynomial Time

NP-Completeness and Boolean Satisfiability

CS/COE

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

Correctness of Dijkstra s algorithm

CMSC 441: Algorithms. NP Completeness

8.5 Sequencing Problems

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Computational Complexity. IE 496 Lecture 6. Dr. Ted Ralphs

Intro to Theory of Computation

Algorithms and Complexity Theory. Chapter 8: Introduction to Complexity. Computer Science - Durban - September 2005

More on NP and Reductions

SAT, NP, NP-Completeness

CSCI3390-Second Test with Solutions

Lecture 18: P & NP. Revised, May 1, CLRS, pp

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

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Data Structures in Java

Computability and Complexity Theory: An Introduction

Introduction. Pvs.NPExample

CS21 Decidability and Tractability

Lecture 4: NP and computational intractability

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.

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

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

NP-Complete Reductions 3

Transcription:

NP-problems continued Page 1 Since SAT and INDEPENDENT SET can be reduced to each other we might think that there would be some similarities between the two problems. In fact, there is one such similarity. In SAT we want to know if something exists. We are looking for aset of values for to coordinate such that the formula is true. It is hard to find such a set of values but if we have found it, it is easy to check if it makes the formula true. In INDEPENDENT SET we are looking for a set of nodes of size K such that the set forms an independent set. I is hard to find the set but if we have found it, it is easy to check if it really is an independent set. Both the problems have a so called yes-certificate, something that tells us that the answer to the problem is yes. For SAT, the certificate is the values for the variables. For INDEPENDENT SET, the certificate is the K-set. Informally, the class NP is the set of decision problems such that if the answer to the problem with input x is yes, then is a certificate y, at most polynomial in the size of x such that it can be checked in polynomial time ( in the size of x) that y is a yes- certificate. We will give a more formal definition of this. The definition identify problems with something we will call languages. Then we will describe the property of being an NPproblems as a property for languages.

Page 2 Formal definition of P A formal language L is a set of strings. Example: { abc, qwerty, xyzzy } {binary strings of odd lenght} {binary strings that represents prime numbers } {syntactically correct C-programs} A language can be describe in different ways: An enumeration of the strings in the language. A set of rules defining the language. An algorithm which recognize the strings in the language.

Page 3 To every decision problem there is a corresponding language: The language of all yes-instances. We say that the algorithm A decides L if A(x) =Yes if x 2 L, A(x) =No if x 62 L. A runs in polynomial time if A(x) runs in time O( x k ) for all x and some integer k. P = {L : 9A that decides L i polynomial time}

Page 4 AformaldefinitionofNP A verifies the instance x of the problem L if there is a certificate y such that y 2 O( x s ) and A(x, y) =Yes, x 2 L This means that A decides the language L = {x 2 {0, 1} : 9y 2 {0, 1} : A(x, y) =Ja} NP = {L : 9A that verifies L in polynomial time} NP P since all problem that can be decided in polynomial time also can be verified in polynomial time.

Page 5 AseconddefinitionofNP: A non-deterministic algorithm is an algorithm that makes random choices. The output is stochastic. We say that A decides a language L if: x 2 L ) A(x) =Yes with probabilty > 0 x/2 L ) A(x) =No with probability 1 NP = {L : 9polynomial time non-deterministic algorithm that decides L}

Page 8 Proving NP-Completeness In order to show that A is NP-Complete it is enough to show that A 2 NP and SAT apple P A. Why: If X 2 we know that X apple SAT. Ifwe also have SAT apple A we know that X apple A! This shows that A is NP-Complete. Another approach: We can form i directed graph such that A! B means A apple B. SAT! A! B! C!... tells us that A, B, C,... are NP-Complete. To show that A is NP-Complete we can try to find a known NP-Complete problem B such that B apple A.

Reductions: Case studies We have already seen that INDEPENDENT SET is NP-Complete by reducing 3-CNF-SAT to IS. It can be shown that HAMILTONIAN CYCLE is NP-C by reducing 3-CNF-SAT to HC. This reduction is rather complicated and we don't give it here. If we now know that HC is NP-C, we can show that some other problems X are NP-C by explicitly describing reductions HC < X. We will do this for the problems TSP and SUBGRAPH ISOMORPHISM. When you prove that a problem is NP-C you must remember that it is not enough to give a reduction. You also have to show that the problem is in NP. This essentially means that you have to show that solutions (certificates) can be verified in polynomial times. In most cases this is quite simple.

Page 9 HAMILTONIAN CYCLE apple TSP TSP Input: A weighted complete graph G and a number K. Goal: Is there a Hamiltonian cycle of length at most apple K in G? HAMILTONIAN CYCLE Input: A graph G. Goal : Is there a Hamiltonian cycle in G? Let x = G be input to HC. We construct a complete graph G 0 with w(e) =0if e 2 G and w(e) =1if e/2 G. Then set K =0. This will be the input to the TSP.

Page 11 Subgraph isomorphism is NP-Complete Given two graphs G 1 and G 2, Is G 1 a subgraph of G 2? The problem obviously belongs to NP. We reduce from Hamilton Cycle. A graph G =(V,E) contains a Hamiltonian cycle if and only if it contains a subgraph that is a cycle C with V nodes. So we can set G 1 = C and G 2 = G. som G.

Page 10 Other NP-Complete problems Exact Cover Given a set of subsets of a set M, is it possible to find a selection of the subsets such that each element in M is in exactly one of the subsets? Subset Sum Given a set P of positive integers and an integer K, is there a subset of the numbers in P with sum K? Integer Programming Given an m n-matrix A, anm-vektor b, an n-vektor c and a number K, is there an n- vektor x with integer coefficients such that Ax apple b and c x K? If we relax the condition that the coefficients x should be integers we get a special case of Linear Programming.

Some more advanced reductions We will look at some reductions that are more complicated. We will show that 3-COLORABILITY, EXACT COVER and SUBSET SUM are NP-C. 3-COLORABILITY This is the problem of deciding if a given graph G can be colored with 3 colors or not. We will reduce 3-CNF-SAT to this problem. This means that given a general instance of 3-CNF-SAT, we will construct a very special instance of 3-COLORABILITY such that the formula is satisfiable if and only if the graph is 3-colorable. We present one possible solution, take from the literature.

3-COLORABILITY < EXACT COVER

PARTITIONING 6 KNAPSACK Let {a 1,a 2,...,a n } be an instance of PARTI- TIONING. In KNAPSACK we have pairs of numbers {(u i,w i )},U,W and we want to know if there is a selection of pairs such that P u i > U and P w i 6 W. Given our instance of PAR- TITIONING we can set A = P a i and give {(a i,a i )},A/2,A/2 as an instance to KNAPSACK. This KNAPSACK-problem has a solution if and only if there is a partitioning. We already know that SUBSET SUM 6 PAR- TITIONING. This shows that SUBSET SUM 6 KNAPSACK by transitivity. It is easy to give a direct proof this, similar to the proof above. We have shown that all three problems are NP-Complete.

Page 13 0/1-programming is NP-Complete Given an m n-matris A and an m-vektor b. Is there an n-vektor x with coefficients 2 {0, 1} such that Ax apple b? The problem is in NP since, given x, wecan check in time O(n 2 ) if Ax apple b. We reduce from 3-CNF-SAT: Let be an instance of 3-CNF-SAT With n variables. To each x i in we define a corresponding variable y i 2 {0, 1} and let 1 Mean True and 0 mean False. FOr each clause c j = l 1 _ l 2 _ l 3 we define an inequality T (l 1 )+T (l 2 )+T (l 3 ) 1 where T (x i )=y i and T ( x i )=(1 y i ). And that s it!

We have now showed that a set of NP problems are NP-Complete by chains of reductions. TSP HAMILTONIAN CYCLE CNF-SAT 3-CNF-SAT 3-COLORABILITY 0/1-PROGRAMMING INDEPENDENT SET EXACT COVER VERTEX COVER SUBSET SUM PARTITIONING SUBGRAPH ISOMORPHISM KNAPSACK