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

Similar documents
COSE215: Theory of Computation. Lecture 21 P, NP, and NP-Complete Problems

Intractable Problems [HMU06,Chp.10a]

Problems, and How Computer Scientists Solve Them Manas Thakur

ECS 120 Lesson 24 The Class N P, N P-complete Problems

CSC 1700 Analysis of Algorithms: P and NP Problems

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

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

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

Limitations of Algorithm Power

Introduction to Complexity Theory

BBM402-Lecture 11: The Class NP

Data Structures in Java

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

CS154, Lecture 17: conp, Oracles again, Space Complexity

Lecture 17: Cook-Levin Theorem, NP-Complete Problems

Data Structures and Algorithms

Lecture 4: NP and computational intractability

NP Complete Problems. COMP 215 Lecture 20

Computational Models Lecture 11, Spring 2009

Lecture 19: Finish NP-Completeness, conp and Friends

CSE 135: Introduction to Theory of Computation NP-completeness

Chapter 7: Time Complexity

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

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

CS154, Lecture 13: P vs NP

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

Polynomial time reduction and NP-completeness. Exploring some time complexity limits of polynomial time algorithmic solutions

conp, Oracles, Space Complexity

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

Definition: conp = { L L NP } What does a conp computation look like?

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

NP-Completeness and Boolean Satisfiability

Turing Machines and Time Complexity

P vs NP & Computational Complexity

NP and NP Completeness

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

Analysis of Algorithms. Unit 5 - Intractable Problems

CISC 4090 Theory of Computation

P = k T IME(n k ) Now, do all decidable languages belong to P? Let s consider a couple of languages:

Intro to Theory of Computation

1 Non-deterministic Turing Machine

P,NP, NP-Hard and NP-Complete

Lecture 8: Alternatation. 1 Alternate Characterizations of the Polynomial Hierarchy

SAT, Coloring, Hamiltonian Cycle, TSP

Review of unsolvability

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

SAT, NP, NP-Completeness

Complexity, P and NP

CS154, Lecture 13: P vs NP

Complexity: moving from qualitative to quantitative considerations

CP405 Theory of Computation

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

Computability and Complexity CISC462, Fall 2018, Space complexity 1

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

Friday Four Square! Today at 4:15PM, Outside Gates

NP Completeness and Approximation Algorithms

Computability Theory

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Design and Analysis of Algorithms

VIII. NP-completeness

ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017

Space Complexity. The space complexity of a program is how much memory it uses.

Polynomial-time Reductions

Lecture 3: Nondeterminism, NP, and NP-completeness

Computational Complexity

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

Computational Complexity

NP-Completeness. NP-Completeness 1

13.1 Nondeterministic Polynomial Time

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

The P versus NP Problem. Dean Casalena University of Cape Town CSLDEA001

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

Quantum Complexity Theory. Wim van Dam HP Labs MSRI UC Berkeley SQUINT 3 June 16, 2003

CSE 105 THEORY OF COMPUTATION

NP-Complete Reductions 1

Tractable & Intractable Problems

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

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

CS/COE

Lecture 22: PSPACE

P, NP, NP-Complete. Ruth Anderson

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

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

ECS122A Handout on NP-Completeness March 12, 2018

CMSC 441: Algorithms. NP Completeness

NP, polynomial-time mapping reductions, and NP-completeness

Complexity (Pre Lecture)

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

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

Complexity - Introduction + Complexity classes

Spring Lecture 21 NP-Complete Problems

Complexity Theory Part II

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates.

Lecture 16: Time Complexity and P vs NP

Data Structures in Java. Session 22 Instructor: Bert Huang

Computability Theory

P, NP, NP-Complete, and NPhard

NP-complete problems. CSE 101: Design and Analysis of Algorithms Lecture 20

CS 350 Algorithms and Complexity

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

Transcription:

COSE215: Theory of Computation Lecture 20 P, NP, and NP-Complete Problems Hakjoo Oh 2018 Spring Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 1 / 14

Contents 1 P and N P Polynomial-time reductions NP-complete problems 1 The slides are partly based on Siddhartha Sen s slides ( P, NP, and NP-Completeness ) Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 2 / 14

Problems Solvable in Polynomial Time (P) A Turing machine M is said to be of time complexity T (n) if whenever M is given an input w of length n, M halts after making at most T (n) moves, regardless of whether or not M accepts. E.g., T (n) = 5n 2, T (n) = 3 n + 5n 4 Polynomial time: T (n) = a 0 n k + a 1 n k 1 + + a k n + a k+1 We say a language L is in class P if there is some polynomial T (n) such that L = L(M) for some deterministic TM M of time complexity T (n). Problems solvable in polynomial time are called tractable. Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 3 / 14

Example: Kruskal s Algorithm A greedy algorithm for finding a minimum-weight spanning tree for a weighted graph. a spanning tree: a subset of the edges such that all nodes are connected through these edges a minimum-weight spanning tree: a spanning tree with the least total weight Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 4 / 14

Example: Kruskal s Algorithm Consider the edge (1,3) with the lowest weight (10). Because nodes 1 and 3 are not contained in T at the same time, include the edge in T. Consider the next edge in order of weights: (2,3). Since 2 and 3 are not in T at the same time, include (2,3) in T. Consider the next edge: (1,2). Nodes 1 and 2 are in T. Reject (1,2). Consider the next edge (3,4) and include it in T. We have three edges for the spanning tree of a 4-node graph, so stop. The algorithm takes O(m + e log e) steps (O(n 2 ) for multitape TM). Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 5 / 14

Nondeterministic Polynomial Time (N P) We say a language L is in the class N P (nondeterministic polynomial) if there is a nondeterministic TM M and a polynomial time complexity T (n) such that L = L(M), and when M is given an input of length n, there are no sequences of more than T (n) moves of M. Example: TSP (Travelling Salesman Problem) finding a hamiltonian cycle (i.e., a cycle that contains all nodes and each node exactly once) with minimum cost: e.g., To solve TSP, we need to try an exponential number of cycles and compute their total weight. Thus, TSP may not be in P. TSP is in N P because NTM can guess an exponential number of possible solutions and checking a hamiltonian cycle can be done in polynomial time. Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 6 / 14

P = N P? One of the deepest open problems. In words: everything that can be done in polynomial time by an NTM can in fact be done by a DTM in polynomial time? P N P because every deterministic TM is a nondeterministic TM. P N P? Probably not. It appears that N P contains many problems not in P. However, no one proved it. Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 7 / 14

Implications of P = N P If P=NP, then the world would be a profoundly different place than we usually assume it to be. There would be no special value in creative leaps, no fundamental gap between solving a problem and recognizing the solution once it s found. Everyone who could appreciate a symphony would be Mozart; everyone who could follow a step-by-step argument would be Gauss; everyone who could recognize a good investment strategy would be Warren Buffett. Scott Aaronson Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 8 / 14

NP-Complete Problems NP-complete problems are the hardest problems in the NP class. If any NP-complete problem can be solved in polynomial time, then all problems in NP are solvable in polynomial time. How to compare easiness/hardness of problems? Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 9 / 14

Problem Solving by Reduction L 1 : the language (problem) to solve L 2 : the problem for which we have an algorithm to solve Solve L 1 by reducing L 1 to L 2 (L 1 L 2 ) via function f: 1 Convert input x of L 1 to instance f(x) of L 2 x L 1 f(x) L 2 2 Apply the algorithm for L 2 to f(x) Running time = time to compute f + time to apply algorithm for L 2 We write L 1 P L 2 if f(x) is computable in polynomial time Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 10 / 14

Reductions show easiness/hardness To show L 1 is easy, reduce it to something we know is easy L 1 easy Use algorithm for easy language to decide L 1 To show L 1 is hard, reduce something we know is hard to it (e.g., NP-complete problem) hard L 1 If L 1 was easy, hard would be easy too Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 11 / 14

NP-Complete Problems We say L is NP-complete if 1 L is in N P 2 For every language L in N P, there is a polynomial time reduction of L to L (i.e., L P L) Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 12 / 14

The Boolean Satisfiability Problem Determine if the given boolean formula can be true. x x x (y z) The first problem proven to be NP-complete. Theorem (Cook-Levin) SAT is NP-complete. We need to show that 1 SAT is NP, and 2 for every L in NP, there is a polynomial-time reduction of L to SAT. Many problems in artificial intelligence, automatic theorem proving, circuit design, etc reduce to SAT/SMT problems. E.g., see Z3 SMT solver (https://github.com/z3prover/z3) Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 13 / 14

Summary Undecidable Decidable P N P NP-complete Hakjoo Oh COSE215 2018 Spring, Lecture 20 June 6, 2018 14 / 14