P, NP, and Exponential Problems Should have had all this in CS 252 – Quick review Many problems have an exponential number of possibilities and we can.

Slides:



Advertisements
Similar presentations
CS211 Problems: unsolvable, unfeasible and unsolved Topic 3: P and NP.
Advertisements

NP-Hard Nattee Niparnan.
Time Complexity P vs NP.
JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
Reducibility Class of problems A can be reduced to the class of problems B Take any instance of problem A Show how you can construct an instance of problem.
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,
The Theory of NP-Completeness
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
© The McGraw-Hill Companies, Inc., Chapter 8 The Theory of NP-Completeness.
Computability and Complexity 13-1 Computability and Complexity Andrei Bulatov The Class NP.
Tractable and intractable problems for parallel computers
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Fall 2004COMP 3351 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
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.
1.1 Chapter 1: Introduction What is the course all about? Problems, instances and algorithms Running time v.s. computational complexity General description.
Programming & Data Structures
NP-Complete Problems CSC 331: Algorithm Analysis NP-Complete Problems.
MCS312: NP-completeness and Approximation Algorithms
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
CSCE350 Algorithms and Data Structure
A. Levitin “Introduction to the Design & Analysis of Algorithms,” 3rd ed., Ch. 11 ©2012 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved.
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
Scott Perryman Jordan Williams.  NP-completeness is a class of unsolved decision problems in Computer Science.  A decision problem is a YES or NO answer.
CMPS 3223 Theory of Computation Automata, Computability, & Complexity by Elaine Rich ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Slides provided.
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.
Lecture 30. P, NP and NP Complete Problems 1. Recap Data compression is a technique to compress the data represented either in text, audio or image form.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
CSC 413/513: Intro to Algorithms NP Completeness.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
CSE 3813 Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
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.
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 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.
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
Lecture 12 P and NP Introduction to intractability Class P and NP Class NPC (NP-complete)
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.
Limits to Computation How do you analyze a new algorithm? –Put it in the form of existing algorithms that you know the analysis. –For example, given 2.
CS 3343: Analysis of Algorithms Lecture 25: P and NP Some slides courtesy of Carola Wenk.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
CS 461 – Nov. 18 Section 7.1 Overview of complexity issues –“Can quickly decide” vs. “Can quickly verify” Measuring complexity Dividing decidable languages.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Chapter.
Costas Busch - LSU1 Time Complexity. Costas Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
NP-Completeness  For convenience, the theory of NP - Completeness is designed for decision problems (i.e. whose solution is either yes or no).  Abstractly,
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
1 Time Complexity We use a multitape Turing machine We count the number of steps until a string is accepted We use the O(k) notation.
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.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Prof. Busch - LSU1 Time Complexity. Prof. Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
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.
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.
ICS 353: Design and Analysis of Algorithms NP-Complete Problems King Fahd University of Petroleum & Minerals Information & Computer Science Department.
Chapter 10 NP-Complete Problems.
Lecture 22 Complexity and Reductions
Analysis and design of algorithm
How Hard Can It Be?.
CLASSES P AND NP.
Chapter 11 Limitations of Algorithm Power
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 Polynomial Hierarchy Enumeration Problems 7.3.3
Approximation Algorithms
Our old list of problems
Presentation transcript:

P, NP, and Exponential Problems Should have had all this in CS 252 – Quick review Many problems have an exponential number of possibilities and we can try each option against some objective to get an answer – Note that this "testing" is fast (always polynomial!) This approach is intractable In many cases (Edit distance, longest increasing subsequence, etc.) we have been able to use smart algorithms (Greedy, DP, LP) to search a small subset of the exponential possibilities and get optimal solutions in polynomial time In other tasks (TSP, ILP) there are no known polynomial solutions CS 312 – NP Problems1

NP vs P Examples For the problems in P we were able to find diverse algorithmic approaches to solve them efficiently with different complexities, but all within P There is a consistency amongst the problems in NP which make them all equally hard to solve CS 312 – NP Problems2

Tasks as Search Problems We can consider all these tasks as search problems Given an instance I of the problem, can we find a solution S to I, or state that no solutions exists – I could be a CNF equation for 3SAT and S would be a particular variable setting For NP search problems we have an efficient mechanism, C(I,S) which checks to see if a particular variable setting S is a solution to I We would also like an efficient verification approach for optimization problems (like TSP) We recast as: For an instance I does there exists an S ≤ b – For TSP I would be a city distribution, S a path, and b an arbitrary distance – This is still an NP problem for arbitrary b – Now, for any particular path S we can quickly answer the question of whether S ≤ b (i.e. C(I,S)) – How could we find the optimal solution with this recasting? CS 312 – NP Problems3

P –Polynomial Time Now we have the basis of a consistent search algorithm Try each case and test it (i.e. see if it solves the problem or calculate what value it gives for doing optimization) If we have a deterministic algorithm which can make the decision by only checking a polynomial number of possibilities, then the task is in P (polynomial time) P = Those problems which can be decided in polynomial time Problems in P are efficient CS 312 – NP Problems4

NP – Non-Deterministic Polynomial Time If not in P then task is in NP (Non-Deterministic Polynomial Time) or worse – Class NP are those problems that can be solved in polynomial time on a non-deterministic machine Remember that a non-deterministic machine basically tries all alternatives in parallel, with the time complexity being equal to the longest path (always polynomial length) in the potentially exponentially wide search tree – Thus, the class NP are those problems that can be tested/verified in polynomial time Deterministic implementations of non-deterministic machines require checking all possible solutions leading to exponential time complexity CS 312 – NP Problems5

P P = problems that can be solved in polynomial time on a deterministic Turing Machine.

P, NP P = problems that can be solved in polynomial time on a deterministic Turing Machine. NP = problems that can be solved in polynomial time on a non-deterministic Turing machine P  NP, because every problem in P has a solution in NP

Reductions Again As long as f and h are polynomial time translations (have complexity ≤ B) then algorithm A will have the same complexity as algorithm B We say A reduces to B A search problem is NP-Complete if all other search problems in NP reduce to it CS 312 – NP Problems8

NP-Completeness Thus if we can find a polynomial time solution to any of the NP-complete problems, then we can solve all of them in polynomial time, and then P = NP CS 312 – NP Problems9

Unsolvable Problems There are problems in higher complexity classes than NP – Guaranteed exponential, super-exponential, etc. – List all possible paths in a TSP problem – List the power-set of all possible paths in TSP, etc. There is an even larger infinite class of unsolvable problems regardless of time available – For any arbitrary polynomial equation in many variables e.g.: – x 2 yz 3 + 3y 2 z – 4xy 5 z 2 = 7 – Are there integer values of the variables which solve it? (x, y, and z in this case) Problems as Functions – Regularity vs Random – Also many regular problems that are not solvable: halting, etc. CS 312 – NP Problems10