CS 461 – Nov. 18 Section 7.1 Overview of complexity issues –“Can quickly decide” vs. “Can quickly verify” Measuring complexity Dividing decidable languages.

Slides:



Advertisements
Similar presentations
Discrete Structures CISC 2315
Advertisements

Polynomial-time reductions We have seen several reductions:
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 class NP Section 7.3 Giorgi Japaridze Theory of Computability.
NP-Completeness Lecture for CS 302. Traveling Salesperson Problem You have to visit n cities You want to make the shortest trip How could you do this?
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
CPE702 Complexity Classes Pruet Boonma Department of Computer Engineering Chiang Mai University Based on Material by Jenny Walter.
Theory of Computing Lecture 16 MAS 714 Hartmut Klauck.
P and NP Sipser (pages ). CS 311 Fall Polynomial time P = ∪ k TIME(n k ) … P = ∪ k TIME(n k ) … TIME(n 3 ) TIME(n 2 ) TIME(n)
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
The Theory of NP-Completeness
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
Analysis of Algorithms CS 477/677
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture NP-Completeness Jan Maluszynski, IDA, 2007
Chapter 11: Limitations of Algorithmic Power
Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
CS 461 – Nov. 21 Sections 7.1 – 7.2 Measuring complexity Dividing decidable languages into complexity classes. Algorithm complexity depends on what kind.
Programming & Data Structures
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
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
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.
חישוביות וסיבוכיות Computability and Complexity Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
Theory of Computing Lecture 15 MAS 714 Hartmut Klauck.
Tonga Institute of Higher Education Design and Analysis of Algorithms IT 254 Lecture 8: Complexity Theory.
CSE 326: Data Structures NP Completeness Ben Lerner Summer 2007.
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.
Polynomial-time reductions We have seen several reductions:
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.
Complexity Non-determinism. NP complete problems. Does P=NP? Origami. Homework: continue on postings.
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.
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.
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
Measuring complexity Section 7.1 Giorgi Japaridze Theory of Computability.
NP-COMPLETE PROBLEMS. Admin  Two more assignments…  No office hours on tomorrow.
Lecture 6 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
NP-Complete problems.
Beauty and Joy of Computing Limits of Computing Ivona Bezáková CS10: UC Berkeley, April 14, 2014 (Slides inspired by Dan Garcia’s slides.)
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.
NP-Completeness (Nondeterministic Polynomial Completeness) Sushanth Sivaram Vallath & Z. Joseph.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 7 Time complexity Contents Measuring Complexity Big-O and small-o notation.
Fundamentals of Informatics Lecture 14 Intractability and NP-completeness Bas Luttik.
CSCI 2670 Introduction to Theory of Computing November 17, 2005.
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.
Lecture 25 NP Class. P = ? NP = ? PSPACE They are central problems in computational complexity.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
CSC 413/513: Intro to Algorithms
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.
Optimization/Decision Problems Optimization Problems – An optimization problem is one which asks, “What is the optimal solution to problem X?” – Examples:
Lecture. Today Problem set 9 out (due next Thursday) Topics: –Complexity Theory –Optimization versus Decision Problems –P and NP –Efficient Verification.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
Algorithm Complexity By: Ashish Patel and Alex Golebiewski.
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
Theory of Computational Complexity TA : Junichi Teruyama Iwama lab. D3
NP-Complete Problems.
CSE 105 theory of computation
Chapter 11 Limitations of Algorithm Power
CSC 4170 Theory of Computation Time complexity Section 7.1.
CSE 105 theory of computation
CSC 4170 Theory of Computation Time complexity Section 7.1.
Presentation transcript:

CS 461 – Nov. 18 Section 7.1 Overview of complexity issues –“Can quickly decide” vs. “Can quickly verify” Measuring complexity Dividing decidable languages into complexity classes. Next, please finish sections 7.1 – 7.2: –Algorithm complexity depends on what kind of TM you use –Formal definition of P, NP, NP-complete

P and NP P = Problems where  deterministic polynomial- time algorithm. –“can quickly decide” (in the TM sense) –The run time is O(n 2 ) or O(n 3 ), etc. NP = Problems where  non-deterministic polynomial-time algorithm. –“can quickly verify” –A deterministic algorithm would require exponential time, which isn’t too helpful. –(NP – P) consists of problems where we don’t know of any deterministic polynomial algorithm. Revisit:

Conjecture P and NP are distinct. –Meaning that some NP problems are not in P. –There are some problems that seem inherently exponential. Major unsolved question! –For each NP problem, try to find a deterministic polynomial algorithm, so it can be reclassed as P. –Or, prove that such an algorithm can’t exist. We don’t know how to do this. Therefore, it’s still possible that P = NP. Ex. Primality was recently shown to be in P.

Example Consider this problem: subset-sum. Given a set S of integers and a number n, is there a subset of S that adds up to n? –If we’re given the subset, easy to check.  NP –Nobody knows of a deterministic polynomial algorithm. What about the complement? –In other words, there is no subset with that sum. –Seems even harder. Nobody knows of a non- deterministic algorithm to check. Seems like we need to check all subsets and verify none adds up to n.  –Another general unsolved problem: are complements of NP problems also NP?

Graph examples The “clique” problem. Given a graph, does it contain a subgraph that’s complete? –Non-deterministically, we would be “given” the clique, then verify that it’s complete. –What is the complexity? –(Complement of Clique: not known to be in NP.) Hamiltonian path: Given a graph, can we visit each vertex exactly once? –Non-deterministically, we’d be given the itinerary.

Inside NP There are generally 2 kinds of NP problems. –Smaller category: Problems where a deterministic polynomial algorithm is lurking out there, and we’ll eventually find it. –Larger category: Problems that seem hopelessly exponential. When you distill these problems, they all have the same structure. If a polynomial solution exists for one, they would all be solvable! These problems are called NP-complete.

Examples Some graph problems –Finding the shortest path –Finding the cheapest network (spanning tree) –Hamiltonian and Euler cycles –Traveling salesman problem Why do similar sounding problems have vastly different complexity?

“O” review Order of magnitude upper bound Rationale: 1000 n 2 is fundamentally less than n 3, and is in the same family as n 2. Definition: f(n) is O(g(n)) if there exist integer constants c and n 0 such that f(n)  c g(n) for all n  n 0. –In other words: in the long run, f(n) can be bounded by g(n) times a constant. –e.g. 7n is O(n 2 ) and also O(n 3 ) but not O(n). O(n 2 ) would be a tight or more useful upper bound. –e.g. Technically, 2 n is O(3 n ) but 3 n is not O(2 n ). –log(n) is between 1 and n. Ordering of common complexities: O(1), O(log n), O(n), O(n log n), O(n 2 ), O(n 3 ), O(2 n ), O(n!)

Measuring complexity Complexity can be defined: –as a function of n, the input length –It’s the number of Turing machine moves needed. –We’re interested in order analysis, not exact count. E.g. About how many moves would we need to recognize { 0 n 1 n } ? –Repeatedly cross of outermost 0 and 1. –Traverse n 0’s, n 1’s twice, (n-1) 0’s twice, (n-1) 1’s twice, etc. –The total number of moves is approximately: 3n + 4((n-1)+(n-2)+(n-3)+…+1) = 3n + 2n(n-1) = 2n 2 + n ~ 2n 2 –2n 2 steps for input size 2n  O(n 2 ).

Complexity class We can classify the decidable languages. TIME(t(n)) = set of all languages that can be decided by a TM with running time O(t(n)). –{ 0 n 1 n }  TIME(n 2 ). –1*00*1(0+1)*  TIME(n). –{ 1 n 2 n 3 n }  TIME(n 2 ). –CYK algorithm  TIME(n 3 ). –{ ε, 0, 1101 }  TIME(1). Technically, you can also belong to a “worse” time complexity class. L  TIME(n)  L  TIME(n 2 ). It turns out that { 0 n 1 n }  TIME(n log n). (p. 252)