CMSC 441: Algorithms. NP Completeness

Similar documents
Design and Analysis of Algorithms

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Tractability. Some problems are intractable: as they grow large, we are unable to solve them in reasonable time What constitutes reasonable time?

NP Completeness and Approximation Algorithms

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

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

Polynomial-time reductions. We have seen several reductions:

Una descrizione della Teoria della Complessità, e più in generale delle classi NP-complete, possono essere trovate in:

1. Introduction Recap

Tractable & Intractable Problems

Limitations of Algorithm Power

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

NP-Completeness. NP-Completeness 1

NP Complete Problems. COMP 215 Lecture 20

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

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

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

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

Spring Lecture 21 NP-Complete Problems

ECS122A Handout on NP-Completeness March 12, 2018

Data Structures in Java

1.1 P, NP, and NP-complete

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

VIII. NP-completeness

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

Computational Complexity

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

CS/COE

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

BBM402-Lecture 11: The Class NP

Introduction to Complexity Theory

NP-Complete Problems. More reductions

Notes for Lecture Notes 2

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

Automata Theory CS Complexity Theory I: Polynomial Time

Intractable Problems [HMU06,Chp.10a]

INTRO TO COMPUTATIONAL COMPLEXITY

NP-Complete Problems and Approximation Algorithms

CSC 1700 Analysis of Algorithms: P and NP Problems

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity

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

Turing Machines and Time Complexity

NP-Complete and Non-Computable Problems. COMP385 Dr. Ken Williams

1 Computational Problems

The Beauty and Joy of Computing

Review of unsolvability

1 Primals and Duals: Zero Sum Games

CSE 548: (Design and) Analysis of Algorithms

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

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

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

Polynomial-time Reductions

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness

NP and Computational Intractability

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Computers and Intractability

CSCI3390-Lecture 14: The class NP

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

The Beauty and Joy of Computing

NP and NP Completeness

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

Analysis of Algorithms. Unit 5 - Intractable Problems

} } } Lecture 23: Computational Complexity. Lecture Overview. Definitions: EXP R. uncomputable/ undecidable P C EXP C R = = Examples

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

Unit 6 Chapter 17 TRACTABLE AND NON-TRACTABLE PROBLEMS

Algorithms and Theory of Computation. Lecture 19: Class P and NP, Reduction

Computational Complexity

P,NP, NP-Hard and NP-Complete

CSC 421: Algorithm Design & Analysis. Spring 2018

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

CS 5114: Theory of Algorithms. Tractable Problems. Tractable Problems (cont) Decision Problems. Clifford A. Shaffer. Spring 2014

CS151 Complexity Theory. Lecture 1 April 3, 2017

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

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

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

Introduction to Computational Complexity

Problems and Solutions. Decidability and Complexity

P versus NP. Math 40210, Spring April 8, Math (Spring 2012) P versus NP April 8, / 9

Computational Intractability 2010/4/15. Lecture 2

Introduction. Pvs.NPExample

Comparison of several polynomial and exponential time complexity functions. Size n

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

Complexity Theory Part Two

Data Structures and Algorithms

Recap from Last Time

NP-Completeness Theory

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

No Harder Than. We want these transformations to effectively be a problem-hardness version of #, which we will call No Harder Than.

Notes for Lecture 21

Data Structures and Algorithms

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

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

SAT, NP, NP-Completeness

Algorithms Design & Analysis. Approximation Algorithm

Essential facts about NP-completeness:

A Working Knowledge of Computational Complexity for an Optimizer

P, NP, NP-Complete, and NPhard

/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: NP-Completeness I Date: 11/13/18

Transcription:

CMSC 441: Algorithms NP Completeness

Intractable & Tractable Problems Intractable problems: As they grow large, we are unable to solve them in reasonable time What constitutes reasonable time? Standard working definition: polynomial time Polynomial time: O(n 2 ), O(n 3 ), O(1), O(n lg n) Not in polynomial time: O(2 n ), O(n n ), O(n!)

Polynomial-Time Algorithms Are some problems solvable in polynomial time? Of course: every algorithm we ve studied provides polynomial-time solution to some problem We define P to be the class of problems solvable in polynomial time Are all problems solvable in polynomial time? No: Turing s Halting Problem is not solvable by any computer, no matter how much time is given Such problems are clearly intractable, not in P

NP-Complete Problems The NP-Complete problems are an interesting class of problems whose status is unknown No polynomial-time algorithm has been discovered for an NP-Complete problem We call this the P = NP question The biggest open problem in CS

An NP-Complete Problem: Hamiltonian Cycles An example of an NP-Complete problem: A hamiltonian cycle of an undirected graph is a simple cycle that contains every vertex The hamiltonian-cycle problem: given a graph G, does it have a hamiltonian cycle?

P and NP As mentioned, P is set of problems that can be solved in polynomial time NP (nondeterministic polynomial time) is the set of problems that can be solved in polynomial time by a nondeterministic computer; verifiable in polynomial time.

Nondeterminism Think of a non-deterministic computer as a computer that magically guesses a solution, then has to verify that it is correct If a solution exists, computer always guesses it One way to imagine it: a parallel computer that can freely spawn an infinite number of processes Have one processor work on each possible solution All processors attempt to verify that their solution works If a processor finds it has a working solution So: NP = problems verifiable in polynomial time

P and NP Summary so far: P = problems that can be solved in polynomial time NP = problems for which a solution can be verified in polynomial time Unknown whether P = NP (most suspect not) Hamiltonian-cycle problem is in NP: Cannot solve in polynomial time Easy to verify solution in polynomial time

NP-Complete Problems We will see that NP-Complete problems are the hardest problems in NP: If any one NP-Complete problem can be solved in polynomial time then every NP-Complete problem can be solved in polynomial time and in fact every problem in NP can be solved in polynomial time (which would show P = NP) Thus: solve hamiltonian-cycle in O(n 100 ) time, you ve proved that P = NP.

Reduction The crux of NP-Completeness is reducibility Informally, a problem P can be reduced to another problem Q if any instance of P can be easily rephrased as an instance of Q, the solution to which provides a solution to the instance of P This rephrasing is called transformation Intuitively: If P reduces to Q, P is no harder to solve than Q

Reducibility An example: P: Given a set of Boolean variables, is at least one TRUE? Q: Given a set of integers, is their sum positive? Transformation: (x 1, x 2,, x n ) = (y 1, y 2,, y n ) where y i = 1 if x i = TRUE, y i = 0 if x i = FALSE

Using Reductions If P is polynomial-time reducible to Q, we denote this P p Q Definition of NP-Complete: If P is NP-Complete, P NP and all problems R are reducible to P Formally: R p P R NP If P p Q and P is NP-Complete, Q is also NP-Complete

NP-Complete Problems Given one NP-Complete problem, we can prove many interesting problems NP-Complete Graph coloring (= register allocation) Hamiltonian cycle Hamiltonian path Knapsack problem Traveling salesman Job scheduling with penalities Many, many more

An Aside: Terminology What is the difference between a problem and an instance of that problem? To formalize things, we will express instances of problems as strings How can we express a instance of the hamiltonian cycle problem as a string? To simplify things, we will worry only about decision problems with a yes/no answer Many problems are optimization problems, but we can often re-cast those as decision problems

NP-Hard and NP-Complete If P is polynomial-time reducible to Q, we denote this P p Q Definition of NP-Hard and NP-Complete: If all problems R NP are reducible to P, then P is NP-Hard We say P is NP-Complete if P is NP-Hard and P NP If P p Q and P is NP-Complete, Q is also NP- Complete

Space of Problems NP P NPC

Why Prove NP-Completeness? Though nobody has proven that P!= NP, if you prove a problem NP- Complete, most people accept that it is probably intractable Therefore it can be important to prove that a problem is NP-Complete Don t need to come up with an efficient algorithm Can instead work on approximation algorithms

Proving NP-Completeness What steps do we have to take to prove a problem P is NP-Complete? Pick a known NP-Complete problem Q Reduce Q to P Describe a transformation that maps instances of Q to instances of P, s.t. yes for P = yes for Q Prove the transformation works Prove it runs in polynomial time Prove P NP