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

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

Polynomial-Time Reductions

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

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Intro to Theory of Computation

Algorithm Design and Analysis

1. Introduction Recap

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

NP and Computational Intractability

NP and Computational Intractability

CS 583: Algorithms. NP Completeness Ch 34. Intractability

Algorithms Design & Analysis. Approximation Algorithm

NP completeness and computational tractability Part II

Lecture 4: NP and computational intractability

NP Complete Problems. COMP 215 Lecture 20

Algorithm Design and Analysis

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

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

Data Structures in Java

ECS122A Handout on NP-Completeness March 12, 2018

NP and NP Completeness

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

CSC 1700 Analysis of Algorithms: P and NP Problems

SAT, NP, NP-Completeness

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

CS/COE

NP Completeness and Approximation Algorithms

Intro to Theory of Computation

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

Algorithm Design and Analysis

VIII. NP-completeness

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

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

Analysis of Algorithms. Unit 5 - Intractable Problems

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

Design and Analysis of Algorithms

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

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

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)

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

Correctness of Dijkstra s algorithm

Lecture 19: Finish NP-Completeness, conp and Friends

Limitations of Algorithm Power

CS Fall 2011 P and NP Carola Wenk

NP-Complete Problems. More reductions

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

NP-Completeness. Subhash Suri. May 15, 2018

NP-Completeness. NP-Completeness 1

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.

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

8.5 Sequencing Problems

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

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

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

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

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

NP-Complete Reductions 1

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

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

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

The P-vs-NP problem. Andrés E. Caicedo. September 10, 2011

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

NP-Complete Reductions 2

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

Data Structures and Algorithms (CSCI 340)

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

CMSC 441: Algorithms. NP Completeness

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

CS 350 Algorithms and Complexity

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

CS 580: Algorithm Design and Analysis

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

8.3 Hamiltonian Paths and Circuits

Spring Lecture 21 NP-Complete Problems

CS 350 Algorithms and Complexity

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

Essential facts about NP-completeness:

Chapter 8. NP and Computational Intractability

NP-COMPLETE PROBLEMS. 1. Characterizing NP. Proof

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

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

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

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.

Announcements. Analysis of Algorithms

NP-Complete problems

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

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

P,NP, NP-Hard and NP-Complete

Instructor N.Sadagopan Scribe: P.Renjith. Lecture- Complexity Class- P and NP

Data Structures and Algorithms

COSE215: Theory of Computation. Lecture 20 P, NP, and NP-Complete Problems

Topics in Complexity Theory

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

Polynomial-time Reductions

1 Primals and Duals: Zero Sum Games

Agenda. What is a complexity class? What are the important complexity classes? How do you prove an algorithm is in a certain class

Transcription:

Overview Problem classification Tractable Intractable P and NP Reductions Tools for classifying problems according to relative hardness Inge Li Gørtz Thank you to Kevin Wayne, Philip Bille and Paul Fischer for inspiration to slides Warm Up: Super Hard Problems Undecidable. No algorithm possible. Example. Halt (P, x) = true iff and only if P halts on input x. Claim. There is no general algorithm to solve Halt(P, x) Problem Classification Q. Which problems will we be able to solve in practice? A. Those with polynomial-time algorithms. (working definition) [von Neumann 1953, Godel 1956, Cobham 1964, Edmonds 1965, Rabin 1966] Proof (by contradiction) Suppose algorithm for Halt(P, x) exists. Consider algorithm A(P) which loops infinitely if Halt(P,P) and otherwise halts. Since Halt(P,x) exists for all algorithms P we can use it on A(A) and the following happens: If Halt(A,A) then we loop infinitely. Else (not Halt(A,A)) we halt. Yes Shortest path Min cut Soccer championship (2-point rule) Primality testing No Longest path Max cut Soccer championship (3-point rule) Factoring

Problem Classification Ideally, classify problems according to those that can be solved in polynomial-time and those that cannot. Provably requires exponential-time. Given a board position in an n-by-n generalization of chess, can black guarantee a win? Provably undecidable. Given a program and input there is no algorithm to decide if program halts. P and NP A problem (problem type) is the general, abstract term: Examples: Shortest Path, Maximum Flow, Closest Pair, Euler Cycle, Hamilton Cycle. A problem instance is the concrete realization of a problem. Example: Maximum flow. The instance consist of flow network. Example: Closest Pair. The instance is a set of points Frustrating news. Huge number of fundamental problems have defied classification for decades. The class P P ~ problems solvable in deterministic polynomial time. Given a problem type T, there is a deterministic algorithm A which for every problem instance I T solves I in a time that is polynomial in I, the size of I. I.e., the running time of A is O( I k ) for all I T,where k is constant independent of the instance T. Hard problems: Example Problem [POTATO SOUP]. A recipe calls for B grams of potatoes. You have a K kilo bag with n potatoes. Can one select some of them such that their weight is exactly B grams? Examples. Closest pair: There is an algorithm A such that for every set S of points, A finds a closest pair in time O( S 2 ). Maximum flow: There is an algorithm A such that for any network, A finds a closest pair in time O( V 3 ), where V is the set of vertices. Best known solution: create all 2 n subsets and check each one.

Hard problems Many problems share the above features Can be solved in time 2 T (by trying all possibilities.) Given a potential solution, it can be checked in time O( T k ), whether it is a solution or not. These problems are called polynomially checkable. A solution can be guessed, and then verified in polynomial time. The class NP A problem T is in the class NP (Non-deterministic Polynomial time) if There is randomized algorithm A and a constant k such that given an instance T T, algorithm A guesses and checks a solution for T in time O( T k ) and there is a positive chance that A guesses a correct solution (if T has a solution). For the running time, only the correct guessing is counted. Optimization vs decision problems Consider decision problems (yes-no-problems). Example. [POTATO SOUP]. A recipe calls for B grams of potatoes. You have a K kilo bag with n potatoes. Can one select some of them such that their weight is exactly B grams? Optimization vs decision problem [OPTIMIZATION LONGEST PATH] Given a graph G and integer k. What is the length of the longest simple path? [DECISION LONGEST PATH] Given a graph G and integer k. Is a there a simple path of length k? The class NP Definition. A yes-no-problem is in NP if there is a polynomial p and a randomized p( I )-bounded algorithm A such that for every instance I the following holds: True answer for I is YES then P[A(I) = YES] > 0 True answer for I is NO then P[A(I) = YES] = 0 where P[Z] denotes the probability of event Z over the algorithms randomization. Exercise. Show that OPT can be solved in polynomial time if and only if DEC can be solved in polynomial time.

P vs NP P solvable in deterministic polynomial time. NP solvable in non-deterministic (with guessing) polynomial time. Only the time for the right guess is counted. P NP (every problem T which is in P is also in NP). It is not known (but strongly believed) whether the inclusion is proper, that is whether there is a problem in NP which is not in P. There is subclass of NP which contains the hardest problems, NP-complete problems. Examples of NP-complete problems Preparing potato soup Packing your suitcase Satisfiability of clauses Partition, Subset-sum Hamilton Cycle, Travelling Salesman Bin Packing, Knapsack Clique, Independent Set Vertex Cover NP-complete problems [SOCCER CHAMPIONSHIP 3-POINT RULE] In a football league n teams compete for the championship. The leagues uses the 3-point rule, i.e., the points of match are distributed as 3:0, 1:1, or 0:3. Input. The table with the points of every team at some point in the season, a list of the matches to be played in that season and the name of some team. Output. YES if the named team still can become champion NO otherwise. NP-complete problems [SATISFIABILITY] Input: A set of clauses C = {c1,..., ck} over n boolean variables x1,,xn. Output: YES if there is a satisfying assignment, i.e., if there is an assignment a: {x1,...,xn} {0,1} such that every clause is satisfied, NO otherwise. ( 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 proposed solution/certificate t

NP-complete problems [HAMILTONIAN CYCLE]. Input: Undirected graph G Output: YES if there exists a simple cycle that visits every node NO otherwise NP-completeness Intuition: The NP-Complete problem are the hardest problems within NP. All NP-Complete problems poly-time reduce to each other. instance s certificate t Polynomial-time reduction Reduction. Problem X polynomial reduces 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. Traveling Salesperson Problem TSP: Given a set of n cities and a pairwise distance function d(u, v), is there a tour of length D? Notation. X P Y. We pay for time to write down instances sent to black box instances of Y must be of polynomial size. All 13,509 cities in US with a population of at least 500 Reference: http://www.tsp.gatech.edu

Traveling Salesperson Problem TSP: Given a set of n cities and a pairwise distance function d(u, v), is there a tour of length D? Reduction example [HAMILTONIAN CYCLE]. Given a undirected graph G=(V,E), does there exists a simple cycle that visits every node? [TRAVELLING SALESMAN (TSP)] Given a set of n cities and a pairwise distance function d(u, v), is there a tour of length D? Show Hamiltonian Cycle P TSP: For every instance of Hamiltonian Cycle create an instance of TSP such that the TSP instance has tour of length n if and only if G has a Hamiltonian cycle. Reduction. Given instance G=(V,E) of Hamiltonian Cycle, create n cities with distance function $ 1 if (u, v) E d(u, v) = % & 2 if (u, v) E TSP instance has tour of length n if and only if G has a Hamiltonian cycle. Optimal TSP tour Reference: http://www.tsp.gatech.edu Reduction example [GLASSES IN A CUPBOARD]. You have n glasses of equal height. If glass gj is put into glass gi let dij be the amount of gj above the rim of gi. You want to stack them into a single stack, so they fit into a cupboard of height h; is that possible? Reduction example Let G = (E, V) a directed graph. Make one glass for every node i V. If (i, j) E ensure: Glasses in a Cupboard in NP: Proposed solution can be verified in polynomial time. NP-completeness: Reduction from Directed Hamiltonian Path (DHP). Directed Hamiltonian Path: Given a directed graph G, is there a directed simple path visiting all vertices. DHP is NP-complete Reduction: For every instance (graph) of DHP make a set of glasses and a cupboard, such that the glasses can be stacked into the cupboard if and only if the graph has a Hamiltonian path. If (i, j) E ensure: Glass i is red, glass j is yellow. Height of the cupboard is V 1 + height of glass

Reduction Example Reduction Example The Main Question: P Versus NP The Simpsons: P = 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 Consensus opinion on P = NP? Probably no. Copyright 1990, Matt Groening

The P versus NP page Lately several papers/notes claiming to resolve P versus NP problem have appeared (especially after $ 1 million reward in 2000) Gerhard Woeginger maintains a webpage collecting the contributions: www.win.tue.nl/~gwoegi/p-versus-np.htm Scott Aaronson on why you should believe P not equal to NP : http://www.scottaaronson.com/blog/?p=1720