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

Slides:



Advertisements
Similar presentations
 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.
Advertisements

1 More NP-Complete Problems NP-Hard Problems Tautology Problem Node Cover Knapsack.
The class NP Section 7.3 Giorgi Japaridze Theory of Computability.
Department of Computer Science & Engineering
NP-complete and NP-hard problems Transitivity of polynomial-time many-one reductions Concept of Completeness and hardness for a complexity class Definition.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
Recap CS605: The Mathematics and Theory of Computer Science.
1 More Undecidable Problems Rice’s Theorem Post’s Correspondence Problem Some Real Problems.
Complexity 18-1 Complexity Andrei Bulatov Probabilistic Algorithms.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
1 The Satisfiability Problem Cook’s Theorem: An NP-Complete Problem Restricted SAT: CSAT, 3SAT.
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.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
1 Decidability Turing Machines Coded as Binary Strings Diagonalizing over Turing Machines Problems as Languages Undecidable Problems.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
February 20, 2015CS21 Lecture 191 CS21 Decidability and Tractability Lecture 19 February 20, 2015.
Computability and Complexity 17-1 Computability and Complexity Andrei Bulatov Strong NP-Completeness.
1 Polynomial Space The classes PS and NPS Relationship to Other Classes Equivalence PS = NPS A PS-Complete Problem.
Halting Problem. Background - Halting Problem Common error: Program goes into an infinite loop. Wouldn’t it be nice to have a tool that would warn us.
Properties of Context-Free Languages
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
Definition: Let M be a deterministic Turing Machine that halts on all inputs. Space Complexity of M is the function f:N  N, where f(n) is the maximum.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Machines with Memory Chapter 3 (Part B). Turing Machines  Introduced by Alan Turing in 1936 in his famous paper “On Computable Numbers with an Application.
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.
Complexity theory and combinatorial optimization Class #2 – 17 th of March …. where we deal with decision problems, finite automata, Turing machines pink.
February 18, 2015CS21 Lecture 181 CS21 Decidability and Tractability Lecture 18 February 18, 2015.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
Computational Complexity Theory Lecture 2: Reductions, NP-completeness, Cook-Levin theorem Indian Institute of Science.
CSC 413/513: Intro to Algorithms NP Completeness.
Week 10Complexity of Algorithms1 Hard Computational Problems Some computational problems are hard Despite a numerous attempts we do not know any efficient.
EMIS 8373: Integer Programming NP-Complete Problems updated 21 April 2009.
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.
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.
Lecture 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
NP-completeness Class of hard problems. Jaruloj ChongstitvatanaNP-complete Problems2 Outline  Introduction  Problems and Languages Turing machines and.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 7 Time complexity Contents Measuring Complexity Big-O and small-o notation.
Introduction to Finite Automata
LIMITATIONS OF ALGORITHM POWER
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Donghyun (David) Kim Department of Mathematics and Computer Science North Carolina Central University 1 Chapter 7 Time Complexity Some slides are in courtesy.
Computability NP complete problems. Space complexity. Homework: [Post proposal]. Find PSPACE- Complete problems. Work on presentations.
CS 3813: Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
1 Chapter 10 Intractable Problems Switzerland Lion Monument in Lucerne.
Chapter 15 P, NP, and Cook’s Theorem. 2 Computability Theory n Establishes whether decision problems are (only) theoretically decidable, i.e., decides.
Young CS 331 D&A of Algo. NP-Completeness1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and.
COMPLEXITY. Satisfiability(SAT) problem Conjunctive normal form(CNF): Let S be a Boolean expression in CNF. That is, S is the product(and) of several.
Deterministic Finite Automata
1 P and NP. 2 Introduction The Traveling Salesperson problem and thousands of other problems are equally hard in the sense that if we had an efficient.
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
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.
1 8.4 Extensions to the Basic TM Extended TM’s to be studied: Multitape Turing machine Nondeterministic Turing machine The above extensions make no increase.
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
 2005 SDU Lecture14 Mapping Reducibility, Complexity.
The NP class. NP-completeness
Intractable Problems Time-Bounded Turing Machines Classes P and NP
Probabilistic Algorithms
Intractable Problems Time-Bounded Turing Machines Classes P and NP
Intractable Problems Time-Bounded Turing Machines Classes P and NP
Intractable Problems Time-Bounded Turing Machines Classes P and NP
CLASSES P AND NP.
NP-Complete Problems.
CS21 Decidability and Tractability
More Undecidable Problems
Presentation transcript:

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

2 Time-Bounded TM’s uA Turing machine that, given an input of length n, always halts within T(n) moves is said to be T(n)-time bounded. wThe TM can be multitape. wSometimes, it can be nondeterministic. uThe deterministic, multitape case corresponds roughly to “an O(T(n)) running-time algorithm.”

3 The class P uIf a DTM M is T(n)-time bounded for some polynomial T(n), then we say M is polynomial-time (“polytime ”) bounded. uAnd L(M) is said to be in the class P. uImportant point: when we talk of P, it doesn’t matter whether we mean “by a computer” or “by a TM” (next slide).

4 Polynomial Equivalence of Computers and TM’s uA multitape TM can simulate a computer that runs for time O(T(n)) in at most O(T 2 (n)) of its own steps. uIf T(n) is a polynomial, so is T 2 (n).

5 Examples of Problems in P uIs w in L(G), for a given CFG G? wInput = w. wUse CYK algorithm, which is O(n 3 ). uIs there a path from node x to node y in graph G? wInput = x, y, and G. wUse Dijkstra’s algorithm, which is O(n log n) on a graph of n nodes and arcs.

6 Running Times Between Polynomials uYou might worry that something like O(n log n) is not a polynomial. uHowever, to be in P, a problem only needs an algorithm that runs in time less than some polynomial. uSurely O(n log n) is less than the polynomial O(n 2 ).

7 A Tricky Case: Knapsack uThe Knapsack Problem is: given positive integers i 1, i 2,…, i n, can we divide them into two sets with equal sums? uPerhaps we can solve this problem in polytime by a dynamic-programming algorithm: w Maintain a table of all the differences we can achieve by partitioning the first j integers.

8 Knapsack – (2) uBasis: j = 0. Initially, the table has “true” for 0 and “false” for all other differences. uInduction: To consider i j, start with a new table, initially all false. uThen, set k to true if, in the old table, there is a value m that was true, and k is either m+i j or m-i j.

9 Knapsack – (3) uSuppose we measure running time in terms of the sum of the integers, say m. uEach table needs only space O(m) to represent all the positive and negative differences we could achieve. uEach table can be constructed in time O(n).

10 Knapsack – (4) uSince n < m, we can build the final table in O(m 2 ) time. uFrom that table, we can see if 0 is achievable and solve the problem.

11 Subtlety: Measuring Input Size u“Input size” has a specific meaning: the length of the representation of the problem instance as it is input to a TM. uFor the Knapsack Problem, you cannot always write the input in a number of characters that is polynomial in either the number-of or sum-of the integers.

12 Knapsack – Bad Case uSuppose we have n integers, each of which is around 2 n. uWe can write integers in binary, so the input takes O(n 2 ) space to write down. uBut the tables require space O(n2 n ). uThey therefore require at least that order of time to construct.

13 Bad Case – (2) uThus, the proposed “polynomial” algorithm actually takes time O(n 2 2 n ) on an input of length O(n 2 ). uOr, since we like to use n as the input size, it takes time O(n2 sqrt(n) ) on an input of length n. uIn fact, it appears no algorithm solves Knapsack in polynomial time.

14 Redefining Knapsack uWe are free to describe another problem, call it Pseudo-Knapsack, where integers are represented in unary. uPseudo-Knapsack is in P.

15 The Class NP uThe running time of a nondeterministic TM is the maximum number of steps taken along any branch. uIf that time bound is polynomial, the NTM is said to be polynomial-time bounded. uAnd its language/problem is said to be in the class NP.

16 Example: NP uThe Knapsack Problem is definitely in NP, even using the conventional binary representation of integers. uUse nondeterminism to guess one of the subsets. uSum the two subsets and compare.

17 P Versus NP uOriginally a curiosity of Computer Science, mathematicians now recognize as one of the most important open problems the question P = NP? uThere are thousands of problems that are in NP but appear not to be in P. uBut no proof that they aren’t really in P.

18 Complete Problems uOne way to address the P = NP question is to identify complete problems for NP. uAn NP-complete problem has the property that if it is in P, then every problem in NP is also in P. uDefined formally via “polytime reductions.”

19 Complete Problems – Intuition uA complete problem for a class embodies every problem in the class, even if it does not appear so. uCompare: PCP embodies every TM computation, even though it does not appear to do so. uStrange but true: Knapsack embodies every polytime NTM computation.

20 Polytime Reductions uGoal: find a way to show problem L to be NP-complete by reducing every language/problem in NP to L in such a way that if we had a deterministic polytime algorithm for L, then we could construct a deterministic polytime algorithm for any problem in NP.

21 Polytime Reductions – (2) uWe need the notion of a polytime transducer – a TM that: 1.Takes an input of length n. 2.Operates deterministically for some polynomial time p(n). 3.Produces an output on a separate output tape. uNote: output length is at most p(n).

22 Polytime Transducer state n input scratch tapes output < p(n) Remember: important requirement is that time < p(n).

23 Polytime Reductions – (3) uLet L and M be langauges. uSay L is polytime reducible to M if there is a polytime transducer T such that for every input w to T, the output x = T(w) is in M if and only if w is in L.

24 Picture of Polytime Reduction T in L not in L in M not in M

25 NP-Complete Problems uA problem/language M is said to be NP- complete if for every language L in NP, there is a polytime reduction from L to M. uFundamental property: if M has a polytime algorithm, then L also has a polytime algorithm. wI.e., if M is in P, then every L in NP is also in P, or “P = NP.”

26 The Plan NP SAT All of NP polytime reduces to SAT, which is therefore NP-complete 3- SAT SAT polytime reduces to 3-SAT 3-SAT polytime reduces to many other problems; they’re all NP-complete

27 Proof That Polytime Reductions “Work” uSuppose M has an algorithm of polynomial time q(n). uLet L have a polytime transducer T to M, taking polynomial time p(n). uThe output of T, given an input of length n, is at most of length p(n). uThe algorithm for M on the output of T takes time at most q(p(n)).

28 Proof – (2) uWe now have a polytime algorithm for L: 1.Given w of length n, use T to produce x of length < p(n), taking time < p(n). 2.Use the algorithm for M to tell if x is in M in time < q(p(n)). 3.Answer for w is whatever the answer for x is. uTotal time < p(n) + q(p(n)) = a polynomial.