Computational Complexity

Slides:



Advertisements
Similar presentations
Fall 2006Costas Busch - RPI1 Time Complexity. Fall 2006Costas Busch - RPI2 Consider a deterministic Turing Machine which decides a language.
Advertisements

Complexity Classes: P and NP
Time Complexity P vs NP.
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
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 25-1 Complexity Andrei Bulatov #P-Completeness.
Computability and Complexity 23-1 Computability and Complexity Andrei Bulatov Search and Optimization.
Complexity 15-1 Complexity Andrei Bulatov Hierarchy Theorem.
Complexity 11-1 Complexity Andrei Bulatov Space Complexity.
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)
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Read sections 7.1 – 7.3 of the book for next time.
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.
The Theory of NP-Completeness
NP-Complete Problems Problems in Computer Science are classified into
1 Other Models of Computation. 2 Models of computation: Turing Machines Recursive Functions Post Systems Rewriting Systems.
CS 310 – Fall 2006 Pacific University CS310 P vs NP the steel cage death match Section 7.2 November 29, 2006.
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.
Final Exam Review Cummulative Chapters 0, 1, 2, 3, 4, 5 and 7.
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
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:
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.
CSCI 2670 Introduction to Theory of Computing November 29, 2005.
CSCI 2670 Introduction to Theory of Computing December 1, 2004.
CSE 024: Design & Analysis of Algorithms Chapter 9: NP Completeness Sedgewick Chp:40 David Luebke’s Course Notes / University of Virginia, Computer Science.
Complexity Non-determinism. NP complete problems. Does P=NP? Origami. Homework: continue on postings.
1 The Theory of NP-Completeness 2 Cook ’ s Theorem (1971) Prof. Cook Toronto U. Receiving Turing Award (1982) Discussing difficult problems: worst case.
“One ring to rule them all” Analogy (sort of) Lord of The Rings Computational Complexity “One problem to solve them all” “my preciousss…”
CS 3813: Introduction to Formal Languages and Automata Chapter 14 An Introduction to Computational Complexity These class notes are based on material from.
Costas Busch - LSU1 Time Complexity. Costas Busch - LSU2 Consider a deterministic Turing Machine which decides a language.
Chapter 11 Introduction to Computational Complexity Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
NPC.
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.
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.
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.
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.
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.
Computability Examples. Reducibility. NP completeness. Homework: Find other examples of NP complete problems.
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.
The Theory of NP-Completeness
NP-Completeness A problem is NP-complete if: It is in NP
The NP class. NP-completeness
NP-Complete Problems.
Chapter 10 NP-Complete Problems.
Richard Anderson Lecture 26 NP-Completeness
Time Complexity Costas Busch - LSU.
Linear Bounded Automata LBAs
Other Models of Computation
ICS 353: Design and Analysis of Algorithms
Intro to NP Completeness
Time Complexity We use a multitape Turing machine
CLASSES P AND NP.
Halting Problem.
NP-Complete Problems.
Time Complexity Classes
NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979.
Our First NP-Complete Problem
The Theory of NP-Completeness
NP-Completeness Lecture for CS 302.
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
Presentation transcript:

Computational Complexity

Time Complexity: The number of steps during a computation Space Complexity: Space used during a computation

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

Example: Algorithm to accept a string : Use a two-tape Turing machine Copy the on the second tape Compare the and

Time needed: Copy the on the second tape Compare the and Total time:

For string of length time needed for acceptance:

Language class: A Deterministic Turing Machine accepts each string of length in time

In a similar way we define the class for any time function: Examples:

Example: The membership problem for context free languages (CYK - algorithm) Polynomial time

Theorem:

Polynomial time algorithms: Represent tractable algorithms: For small we can compute the result fast

The class for all Polynomial time All tractable problems

CYK-algorithm

Exponential time algorithms: Represent intractable algorithms: Some problem instances may take centuries to solve

Example: the Traveling Salesperson Problem 5 3 1 2 4 2 6 10 8 3 Question: what is the shortest route that connects all cities?

Question: what is the shortest route that connects all cities? 5 3 1 2 4 2 6 10 8 3 Question: what is the shortest route that connects all cities?

A solution: search exhuastively all hamiltonian paths L = {shortest hamiltonian paths} Exponential time Intractable problem

Example: The Satisfiability Problem Boolean expressions in Conjunctive Normal Form: Variables Question: is expression satisfiable?

Example: Satisfiable:

Example: Not satisfiable

For variables: exponential Algorithm: search exhaustively all the possible binary values of the variables

Non-Determinism Language class: A Non-Deterministic Turing Machine accepts each string of length in time

Example: Non-Deterministic Algorithm to accept a string : Use a two-tape Turing machine Guess the middle of the string and copy on the second tape Compare the two tapes

Time needed: Use a two-tape Turing machine Guess the middle of the string and copy on the second tape Compare the two tapes Total time:

In a similar way we define the class for any time function: Examples:

Non-Deterministic Polynomial time algorithms:

The class for all Non-Deterministic Polynomial time

Example: The satisfiability problem Non-Deterministic algorithm: Guess an assignment of the variables Check if this is a satisfying assignment

Time for variables: Guess an assignment of the variables Check if this is a satisfying assignment Total time:

The satisfiability problem is an - Problem

Observation: Deterministic Polynomial Non-Deterministic Polynomial

Open Problem: WE DO NOT KNOW THE ANSWER

Open Problem: Example: Does the Satisfiability problem have a polynomial time deterministic algorithm? WE DO NOT KNOW THE ANSWER

NP-Completeness A problem is NP-complete if: It is in NP Every NP problem is reduced to it (in polynomial time)

Observation: If we can solve any NP-complete problem in Deterministic Polynomial Time (P time) then we know:

Observation: If we prove that we cannot solve an NP-complete problem in Deterministic Polynomial Time (P time) then we know:

Cook’s Theorem: The satisfiability problem is NP-complete Proof: Convert a Non-Deterministic Turing Machine to a Boolean expression in conjunctive normal form

Other NP-Complete Problems: The Traveling Salesperson Problem Vertex cover Hamiltonian Path All the above are reduced to the satisfiability problem

Observations: It is unlikely that NP-complete problems are in P The NP-complete problems have exponential time algorithms Approximations of these problems are in P