NP-problems continued

Similar documents
Formal definition of P

NP-problems continued

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

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

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

Theory of Computation Chapter 9

1. Introduction Recap

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

1.1 P, NP, and NP-complete

Limitations of Algorithm Power

NP-Complete problems

Design and Analysis of Algorithms

Introduction to Complexity Theory

Chapter 34: NP-Completeness

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

NP-Complete Reductions 1

Polynomial-time Reductions

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

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

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

Algorithms: COMP3121/3821/9101/9801

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

Notes for Lecture 21

Essential facts about NP-completeness:

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

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

SAT, NP, NP-Completeness

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

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

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

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

NP and Computational Intractability

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

Show that the following problems are NP-complete

Computability Theory

Introduction to Computational Complexity

ECS122A Handout on NP-Completeness March 12, 2018

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

NP and NP Completeness

Correctness of Dijkstra s algorithm

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

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

Lecture 19: Finish NP-Completeness, conp and Friends

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

NP-Complete Problems. More reductions

Complexity, P and NP

More NP-Complete Problems

NP Complete Problems. COMP 215 Lecture 20

NP-completeness. Chapter 34. Sergey Bereg

Comp487/587 - Boolean Formulas

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

Review of unsolvability

The Complexity of Optimization Problems

Intro to Theory of Computation

Lecture 18: More NP-Complete Problems

NP-Hardness reductions

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.

NP Completeness and Approximation Algorithms

DESIGN AND ANALYSIS OF ALGORITHMS. Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

A.Antonopoulos 18/1/2010

CS 350 Algorithms and Complexity

NP-Complete Reductions 2

Lecture 4: NP and computational intractability

Geometric Steiner Trees

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

NP-Completeness and Boolean Satisfiability

In complexity theory, algorithms and problems are classified by the growth order of computation time as a function of instance size.

Computability and Complexity Theory: An Introduction

More Completeness, conp, FNP,etc. CS254 Chris Pollett Oct 30, 2006.

NP-Completeness. NP-Completeness 1

Intro to Theory of Computation

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

1 Primals and Duals: Zero Sum Games

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

IE418 Integer Programming

Turing Machines and Time Complexity

CS 350 Algorithms and Complexity

Polynomial-time reductions. We have seen several reductions:

More on NP and Reductions

1 Reductions and Expressiveness

1 Non-deterministic Turing Machine

Spring Lecture 21 NP-Complete Problems

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

COP 4531 Complexity & Analysis of Data Structures & Algorithms

SAT, Coloring, Hamiltonian Cycle, TSP

Combinatorial Optimization

Computational Complexity

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

NP-Completeness Review

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

Graph Theory and Optimization Computational Complexity (in brief)

CS154, Lecture 13: P vs NP

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Automata Theory CS Complexity Theory I: Polynomial Time

CS/COE

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

Lecture 5. 1 Review (Pairwise Independence and Derandomization)

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 L, A(x) =No if x L. A runs in polynomial time if A(x) runs in time O( x k ) for all x and some integer k. P = {L : A 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 O( x s ) and A(x, y) =Yes x L This means that A decides the language L = {x {0, 1} : y {0, 1} : A(x, y) =Ja} NP = {L : A 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 L A(x) =Yes with probabilty > 0 x/ L A(x) =No with probability 1 NP = {L : polynomial time non-deterministic algorithm that decides L}

THE BIG QUESTION Page 6: r It follows from the definition that P NP. Is P = NP? Since 1971 this is the most famous open problem in computer science. Most people believe that the answer is no. Then there must be problems in NP - P. SAT would be a plausible candidate. It seems as if hard NP-Problems can be reduced to each other. This observation leads us to the following definition. NP-Completeness: A problem Q is NP-Complete if 1. Q is in NP. 2. For each A in NP, there is a reduction from A to Q, i.e. all NP problems can be reduced to Q. Are there any NP-Complete problems? Well, there are: Cook's Theorem: SAT is NP-Complete

Other NP-Complete problems Page 7 It is ease to see that reductions are transitive, i.e. A B and B C A C We know that SAT INDEPENDENT SET. We also know that for each A in NP we have A SAT. But this means that for all A in NP we have A INDEPENDENT SET So INDEPENDENT SET is an NP-Complete problem. We realize that the NP-Complete problems must be the hardest problems in NP. If any NP-Complete problem can be solved efficiently then all can! So we wouldn't expect to be able to find efficient solutions to NP-Complete problems. The best way to "show" that a problem is impossible to solve efficiently is to show that it is NP-Complete. This is the core of applied Complexity Theory. But how do we show that a problem is NP-Complete?

Page 8 Proving NP-Completeness In order to show that A is NP-Complete it is enough to show that A NP and SAT P A. Why: If X we know that X SAT. Ifwe also have SAT A we know that X A! This shows that A is NP-Complete. Another approach: We can form i directed graph such that A B means A 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 A.

Page 9 HAMILTONIAN CYCLE TSP TSP Input: A weighted complete graph G and a number K. Goal: Is there a Hamiltonian cycle of length at most 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 with w(e) =0if e G and w(e) =1if e/ G. Then set K =0. This will be the input to the TSP.

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 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.

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 12 Partition is NP-Complete Given a set S of positive integers. Can we split S into two disjoint parts S 1 and S 2 such that x S 1 x = x S 2 x? The problem is obviously in NP. We reduce from Subset Sum: Given an instance p 1,p 2,...,p n and K of Subset Sum we create the following instance of Partitioning: Set P = p i p 1,p 2,...p n,p 2K if K P/2 and p 1,p 2,...p n, 2K P otherwise. There is a partitioning precisely when there is a subset sum K.

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 {0, 1} such that Ax b? The problem is in NP since, given x, wecan check in time O(n 2 ) if Ax 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 {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!