Lecture 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)

Slides:



Advertisements
Similar presentations
Time Complexity P vs NP.
Advertisements

What is Intractable? Some problems seem too hard to solve efficiently. Question 1: Does an efficient algorithm exist?  An O(a ) algorithm, where a > 1,
 2004 SDU Lecture17-P,NP, NPC.  2004 SDU 2 1.Decision problem and language decision problem decision problem and language 2.P and NP Definitions of.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
The Theory of NP-Completeness
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
1 L is in NP means: There is a language L’ in P and a polynomial p so that L 1 · L 2 means: For some polynomial time computable map r : 8 x: x 2 L 1 iff.
Complexity Theory CSE 331 Section 2 James Daly. Reminders Project 4 is out Due Friday Dynamic programming project Homework 6 is out Due next week (on.
1 Polynomial Church-Turing thesis A decision problem can be solved in polynomial time by using a reasonable sequential model of computation if and only.
1 dKS, Spring Some practical information Lecturers: Kristoffer Arnsfelt Hansen and Peter Bro Miltersen. Homepage:
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
NP-Complete Problems Problems in Computer Science are classified into
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
NP-complete and NP-hard problems
Analysis of Algorithms CS 477/677
CSE 421 Algorithms Richard Anderson Lecture 27 NP Completeness.
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
The Theory of NP-Completeness 1. What is NP-completeness? Consider the circuit satisfiability problem Difficult to answer the decision problem in polynomial.
MCS312: NP-completeness and Approximation Algorithms
CSCE350 Algorithms and Data Structure
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
1 The Theory of NP-Completeness 2012/11/6 P: the class of problems which can be solved by a deterministic polynomial algorithm. NP : the class of decision.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
חישוביות וסיבוכיות Computability and Complexity Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
CSCI 2670 Introduction to Theory of Computing December 1, 2004.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
1 Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples: b number of comparisons needed to find the.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
Instructor: Shengyu Zhang 1. Tractable While we have introduced many problems with polynomial-time algorithms… …not all problems enjoy fast computation.
CSCI 3160 Design and Analysis of Algorithms Tutorial 10 Chengyu Lin.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
1 Design and Analysis of Algorithms Yoram Moses Lecture 11 June 3, 2010
NP-Complete Problems. Running Time v.s. Input Size Concern with problems whose complexity may be described by exponential functions. Tractable problems.
1 Chapter 34: NP-Completeness. 2 About this Tutorial What is NP ? How to check if a problem is in NP ? Cook-Levin Theorem Showing one of the most difficult.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness and course wrap up.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Design and Analysis of Algorithms - Chapter 101 Our old list of problems b Sorting b Searching b Shortest paths in a graph b Minimum spanning tree b Primality.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CSE 589 Part V One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important. Bertrand Russell.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NPC.
1 Ch 10 - NP-completeness Tractable and intractable problems Decision/Optimization problems Deterministic/NonDeterministic algorithms Classes P and NP.
CSCI 2670 Introduction to Theory of Computing December 2, 2004.
CSCI 2670 Introduction to Theory of Computing December 7, 2005.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
1 The Theory of NP-Completeness 2 Review: Finding lower bound by problem transformation Problem X reduces to problem Y (X  Y ) iff X can be solved by.
The NP class. NP-completeness Lecture2. The NP-class The NP class is a class that contains all the problems that can be decided by a Non-Deterministic.
34.NP Completeness. Computer Theory Lab. Chapter 34P.2.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
The Theory of NP-Completeness
Chapter 10 NP-Complete Problems.
Richard Anderson Lectures NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
ICS 353: Design and Analysis of Algorithms
NP-Complete Problems.
CS 3343: Analysis of Algorithms
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
The Theory of NP-Completeness
Our old list of problems
Presentation transcript:

Lecture 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)

Roadmap Introduction to intractability Class P and NP Class NPC

Questions on Computation What is a general-purpose computer? Are there limits on the power of digital computers?

Turing machine Alan Turing, 23 June 1912 – 7 June 1954 (Source from Wikipedia) Artistic representation of a Turing Machine (Source from Wikipedia)

Turing machine Definition: TuringMachine A (one-tape) Turing machine is a 6-tuple wheretuple ‑ Q: is a finite, non-empty set of states ‑ Γ: is a finite, non-empty set of the tape alphabet/symbols ‑ b: is the blank symbol ‑ q 0 : is the initial state ‑ F: is the set of final or accepting states. ‑ δ: is the transition function Q\F × Γ → Q×Γ×{L,R}

QUIZ Construct a Turing machine to solve the Palindrome problem.  10101bbbbb...

Palindrome M = s, b -> a, b, R s, 0 -> q 0, b, R s, 1 -> q 1, b, R q 0, 0 -> q 0, 0, R q 0, 1 -> q 0, 1, R q 0, b -> q 0 ’, b, L q 0 ’, 0 -> f, b, L q 0 ’, 1 -> r, _, _ f, 0 -> f, 0, L f, 1 -> f, 1, L f, b -> s, b, R q 1, 0 -> q 1, 0, R q 1, 1 -> q 1, 1, R q 1, b -> q 1 ’, b, L q 1 ’, 0 -> r, _, _ q 1 ’, 1 -> f, b, L  10101bbbbb...

Nondeterministic Turing machine M = s, b -> a, b, R s, 0 -> q 0, b, R s, 1 -> q 1, b, R q 0, 0 -> q 0, 0, R q 0, 1 -> q 0, 1, R q 0, 0 -> f, b, L q 0, 1 -> r, _, _ q 0, b -> r, _, _ f, 0 -> f, 0, L f, 1 -> f, 0, L f, b -> s, b, R q 1, 0 -> q 1, 0, R q 1, 1 -> q 1, 1, R q 1, 0 -> r, _, _ q 1, 1 -> f, b, L q 1, b -> r, _, _

Church-Turing Thesis ChurchTuringThesis. Every effectively calculable function is a computable function. (can be computed by a turing machine.) Remark. "Thesis" is not a mathematical theorem because it's a statement about the physical world and not subject to proof. Models equivalent: simulation. ・ Android simulator on iPhone. ・ iPhone simulator on Android.

Questions on Algorithms Q: Which algorithms are useful in practice? A: Useful in practice ("efficient") = polynomial time for all inputs. (efficient) Sorting N items takes N log N compares using mergesort. (inefficient) Finding best TSP tour on N points takes N ! steps using brute search.

Exponential growth Suppose you have a giant parallel computing device... With as many processors as electrons in the universe... And each processor has power of today's supercomputers... And each processor works for the life of the universe... Will not help solve 1,000 city TSP problem via brute force. 1000! >> 10^1000 >> 10^{ }

Exponential growth (Source from Wikipedia) Sessa, the inventor of chess (Source from Wikipedia) = 18,446,744,073,709,551,615

Tractability Some problems can be solved in polynomial time. (Tractable) For some problems, we still cannot find polynomial time solutions. (Intractable) Decision problems Turing machine

Decision problems are those whose solutions have only two possible outcomes: Yes or No. Decision problems v.s. optimization problem Decision problems

Decision v.s. Optimization DecisionProblem: Coloring Input: An undirected graph G = (V, E ) and a positive integer k Output: Is G k-colorable? OptimizationProblem: Coloring Input: An undirected graph G = (V, E ) Output: The chromatic number of G

Decision v.s. Optimization DecisionProblem: Clique Input: An undirected graph G = (V, E ) and a positive integer k Output: Does G have a clique of size k? OptimizationProblem: MaxClique Input: An undirected graph G = (V, E ) Output: The maximum clique size of G Given an algorithm for decision problem, how to solve its corresponding optimization problem?

Efficiency Some problems can be solved in polynomial time. (Tractable) For some problems, we still cannot find polynomial time solutions. (Intractable) Decision problems Turing machine

Where are we? Introduction to intractability Class P and NP Class NPC

Class P Definition: ClassP A problem π is in class P if and only if there exists a deterministic Turing machine M, such that ‐ M runs in polynomial time on all inputs ‐ For all instance with Yes answer, M terminates with accept state ‐ For all instance with No answer, M terminates with reject state

Class NP Definition: ClassNP A problem π is in class NP if and only if there exists a nondeterministic Turing machine M, such that ‐ M runs in polynomial time on all inputs ‐ For all instance with Yes answer, there exists a path of M that terminates with accept state ‐ For all instance with No answer, all paths terminates with reject state Guess a witness --> verify the witness is valid

Examples DecisionProblem: 3-Coloring Input: A graph G= Output: Is G 3-colorable? DecisionProblem: 2-Coloring Input: A graph G= Output: Is G 2-colorable?

Examples DecisionProblem: LongestPath Input: A weighted graph G=, vertex s, t and a number k Output: Does the longest path between s and t have length k? DecisionProblem: ShortestPath Input: A weighted graph G=, vertex s, t and a number k Output: Does the shortest path between s and t have length k?

Examples DecisionProblem: HamiltonianTour Input: A graph G= Output: Does G have a Hamiltonian tour? DecisionProblem: EulerianTour Input: A graph G= Output: Does G have a Eulerian tour?

P is in NP Lemma. P ⊆ NP. NP = P? or P ⊂ NP?

Class co-P and co-NP co-P = P The complement of a decision problem is the decision problem resulting from reversing the yes and no answers.decision problem If problem π is in P (NP), then its complement is in co-P (co-NP). co-NP = NP?

Examples DecisionProblem: Co-3-Coloring Input: A graph G= Output: Is G not 3-colorable? DecisionProblem:3-Coloring Input: A graph G= Output: Is G 3-colorable? DecisionProblem: Co-2-Coloring Input: A graph G= Output: Is G not 2-colorable? DecisionProblem:2-Coloring Input: A graph G= Output: Is G 2-colorable?

Class co-P and co-NP co-P = P The complement of a decision problem is the decision problem resulting from reversing the yes and no answers.decision problem If problem π is in P (NP), then its complement is in co-P (co-NP). co-NP = NP? Hamiltonianco-Hamiltonian

Possible pictures NP co-NP P P=NP=co- NP NP = co-NP P NP co-NP P

P = NP ?

Where are we? Introduction to intractability Class P and NP Class NPC

Reduction “ Give me a lever long enough and a fulcrum on which to place it, and I shall move the world. ” -- Archimedes I shall move the world Give me a lever long enough and a fulcrum on which to place it ∝ reduce to

Polynomial-time reduction Transfo rm An algorithm for problem Q’ Input of Q’ Input of Q An algorithm for Q Q ∝ p Q’ : Q’ is harder than Q Polynomial-time Q is polynomially reduced to Q’ yes no

Examples Median ∝ p Sorting Uniqueness ∝ p Sorting Longest palindrome subsequence ∝ p Longest common subsequence Bipartite matching ∝ p Max flow......

NP complete: The hardest problem in NP Definition: NP-Complete A decision problem π is said to be NP-complete if the following two properties hold: 1. π ∈ NP,and 2. for every problem π′ ∈ NP, π′ ∝ p π. NP P NPC

The first NPC problem Cook-Levin Theorem [Cook, 1971; Levin, 1973] SAT is NP-complete. How to find the second NPC problem? DecisionProblem: SAT Input: A boolean formula Output: Is this formula satisfiable? 2-SAT: 3-SAT:

The 2nd, 3rd,..., NPC problems Lemma For any two decision problem A,B in NP, if A is NP-complete and A ∝ p B, then B is NP-complete.

SAT --> 3-SAT

3-SAT --> Clique

Clique --> Vertex Cover

Vertex Cover --> Hamiltonian

Hamiltonian --> TSP

3-SAT --> Subset Sum

Conclusion NPI = ∅ ? NP P NPC Ladner’s Theorem [Ladner,1975] If P ≠ NP, then NPI is not empty;P ≠ NP Possible candidates: Factoring Graph isomorphism 1. What is P, NP, and NPC? 2. How to prove a problem is NPC? 3. What is the possible picture of NP theory?

Class P A is a deterministic algorithm solving a problem π if A is a algorithm solving π, and when given any instance of the problem π, A has only one choice in each step throughout its execution. A is an algorithm solving a decision problem π, if given any instance I of the problem π, the answer of I is exactly the output of A. A problem π has a deterministic algorithm which runs in polynomial time of the input size, if and only if π is in Class P.

Class NP 1.On input x, a nondeterministic algorithm consists of two phases:The guessing phase. Guess a solution in polynomial time.The verification phase. Use a polynomial-time deterministic algorithm to verify whether the guess is really a solution or not. Let A be a nondeterministic algorithm for a problem π. We say that A accepts an instance I of π iff on input I there is a guess that leads to a ‘yes’ answer. 3-color, k-clique

Class NP The class NP consists of those decision problems for which there exists a nondeterministic algorithm that run in polynomial time.