Difficult Problems. Polynomial-time algorithms A polynomial-time algorithm is an algorithm whose running time is O(f(n)), where f(n) is a polynomial A.

Slides:



Advertisements
Similar presentations
Analysis of Algorithms
Advertisements

NP-Completeness.
1 P, NP, and NP-Complete Dr. Ying Lu RAIK 283 Data Structures & Algorithms.
NP-Hard Nattee Niparnan.
JAYASRI JETTI CHINMAYA KRISHNA SURYADEVARA
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 
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
Computability and Complexity 32-1 Computability and Complexity Andrei Bulatov Boolean Circuits.
1 Polynomial Time Reductions Polynomial Computable function : For any computes in polynomial time.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
Analysis of Algorithms CS 477/677
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Complexity Issues Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
1 The Theory of NP-Completeness 2 NP P NPC NP: Non-deterministic Polynomial P: Polynomial NPC: Non-deterministic Polynomial Complete P=NP? X = P.
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
Programming & Data Structures
CSCE350 Algorithms and Data Structure
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.
Complexity Classes (Ch. 34) The class P: class of problems that can be solved in time that is polynomial in the size of the input, n. if input size is.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
The Complexity of Optimization Problems. Summary -Complexity of algorithms and problems -Complexity classes: P and NP -Reducibility -Karp reducibility.
CSC 413/513: Intro to Algorithms NP Completeness.
CSC 172 P, NP, Etc. “Computer Science is a science of abstraction – creating the right model for thinking about a problem and devising the appropriate.
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.
NP-COMPLETENESS PRESENTED BY TUSHAR KUMAR J. RITESH BAGGA.
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.
CSE332: Data Abstractions Lecture 24.5: Interlude on Intractability Dan Grossman Spring 2012.
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.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
NP-Complete problems.
NP-complete Problems Prof. Sin-Min Lee Department of Computer Science.
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.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
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.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
CS6045: Advanced Algorithms NP Completeness. NP-Completeness Some problems are intractable: as they grow large, we are unable to solve them in reasonable.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
CS216: Program and Data Representation University of Virginia Computer Science Spring 2006 David Evans Lecture 8: Crash Course in Computational Complexity.
CSC 413/513: Intro to Algorithms
The Theory of NP-Completeness 1. Nondeterministic algorithms A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking If the checking.
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.
CSE 332: NP Completeness, Part II Richard Anderson Spring 2016.
CSC 172 P, NP, Etc.
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
The NP class. NP-completeness
Chapter 12: Theory of Computation
Richard Anderson Lecture 26 NP-Completeness
Richard Anderson Lecture 26 NP-Completeness
ICS 353: Design and Analysis of Algorithms
Chapter 11 Limitations of Algorithm Power
NP-Complete Problems.
CSC 380: Design and Analysis of Algorithms
Our old list of problems
RAIK 283 Data Structures & Algorithms
Presentation transcript:

Difficult Problems

Polynomial-time algorithms A polynomial-time algorithm is an algorithm whose running time is O(f(n)), where f(n) is a polynomial A polynomial is an expression of the form: c 0 n k + c 1 n k-1 + c 2 n k c k-1 n + c k An expression that has n as an exponent, such as 2 n, is not a polynomial For large enough values of n, 2 n is larger than any polynomial, no matter what the coefficients or exponents may be Exponential-time problems are said to be intractable

Nondeterministic algorithms A nondeterministic computation is one which finds a solution regardless of the fact that it must make blind choices A nondeterministic computation can be viewed in either of two ways: –When a choice point is reached, an infallible oracle can be consulted to determine the correct choice Problem: There’s no such thing as an oracle –When a choice point is reached, all choices can be made and computation can proceed simultaneously Problem: We don’t have computers with an infinite number of processors

Nondeterministic polynomial-time algorithms A nondeterministic polynomial-time algorithm is an algorithm that can be executed in polynomial time on a nondeterministic machine The machine can either consult an oracle (in constant time), or it can spawn an arbitrarily large number of parallel processes It should be obvious that this would be a nice machine to have

Factoring large integers Suppose you wish to factor a 100-bit integer The smallest factor must be 50 bits or fewer So you only need to try 2 50 ( 2 n/2 ) factors –This is still exponential Half of these potential factors are even, so you only need to try a single division by 2 So you only need to try 2 49 ( 2 n/2-1 ) factors –This is still exponential You can find many similar shortcuts, but it will still be exponential –There is no (known) polynomial-time algorithm

Integer bin packing Given a set of n positive integers, arrange them into two piles (bins), such that the sum of the integers in one pile is equal to the sum of the integers in the other pile. For example, given these thirteen integers that sum to 1000: {19, 23, 32, 42, 50, 62, 77, 88, 89, 105, 114, 123, 176} can they be sorted into two bins that total 500 each? Easy nondeterministic O(n) algorithm: Put each number in the correct bin –Remember, we have an oracle to tell us which bin is correct! Another (but unfortunately exponential) algorithm: For all 13- bit numbers to , try putting the corresponding integer into the first bin if the bit is a zero, the second bin if a one

Boolean satisfiability Suppose you have: – n Boolean variables, A, B, C,... –An expression in the propositional calculus (using and, or, and not operators) Is there an assignment of truth values to the variables (such as A= true, B= true, C= false,....) that will make the expression true ? Here is a nondeterministic algorithm to solve the problem: For each Boolean variable, assign it the proper truth value. This is an O(n) algorithm Exponential algorithm: Try all possible assignments of truth values to variables

NP problems in general The preceding problems all had these characteristics in common: –There is a nondeterministic algorithm that solves the problem in polynomial time –Since we don’t have the mythical nondeterministic computer, the best known actual solution for each of these problems requires exponential time It turns out that there are literally hundreds of similar NP problems is a good listhttp://

More NP problems The travelling salesman problem –A salesman, starting in Harrisburg, wants to visit every capital city in the 48 continental United States, returning to Harrisburg as his last stop. In what order should he visit the capital cities so as to minimize the total distance travelled? The Hamiltonian circuit problem –Every capital city has direct air flights to at least some other capital cities. Our intrepid salesman wants to visit all 48 capitals, and return to his starting point, taking only direct air flights. Can he find a path that lets him do this? Equivalence of regular expressions –Do two distinct regular expressions represent the same language?

Still more NP problems Minimum graph coloring –Color the nodes of a graph, using the minimum number of colors, such that no two adjacent nodes are the same color Graph isomorphism –Do two graphs have the same shape? Minimum cover –Given some subsets of a set S, find a minimum number of those subsets such that every element of S is included Longest substring –Given a set of strings, what is the longest substring that they have in common?

NP-complete problems All of the known NP problems have an amazing characteristic: they are all reducible to one another This means that, given any two NP problems X and Y, –There exists a polynomial-time algorithm to restate a problem of type X as a problem of type Y, and –There exists a polynomial-time algorithm to translate a solution to a type Y problem back into a solution for the type X problem In other words: –If you can find a polynomial-time algorithm for even one NP problem, you have found a polynomial-time algorithm for all of them This is what the “complete” refers to when we talk about NP- complete problems

A famous question Does P = NP? No one has ever found a deterministic polynomial-time algorithm for any of the NP problems No one has ever succeeded in proving that no such algorithm exists The status for some years now is this: Most computer scientists don't think a polynomial-time algorithm can exist, but no one knows for sure. This was a hot research topic for a while, but interest has died down on the problem, for the simple reason that no one has made any progress (in either direction)

Why you should care NP programs do not scale up –You can solve small problems of this type –You cannot solve medium or large problems Someday you may well be asked to solve a problem of this type It’s always a good idea to know what you can do and what you can’t do It’s even more helpful to be able to demonstrate to your boss that no one else has been able to do it, either

The End