Mm7 Intro to distributed computing (jmp) Mm8 Backtracking, 2-player games, genetic algorithms (hps) Mm9 Complex Problems in Network Planning (JMP)

Size: px
Start display at page:

Download "Mm7 Intro to distributed computing (jmp) Mm8 Backtracking, 2-player games, genetic algorithms (hps) Mm9 Complex Problems in Network Planning (JMP)"

Transcription

1 Algorithms and Architectures II H-P Schwefel, Jens M. Pedersen Mm6 Advanced Graph Algorithms (hps) Mm7 Intro to distributed computing (jmp) Mm8 Backtracking, 2-player games, genetic algorithms (hps) Mm9 Complex Problems in Network Planning (JMP) Mm10 Complexity Theory, Task scheduling examples Page 1 Complexity: Some examples Graph Theory Finding shortest paths between all node pairs in a graph: Floyd Algorithm, time O(N^3), space O(N^2), N= Number of Nodes Find shortest paths from specific node to all destinations: Dijkstra Algorithm, time O(N^2) Search & Optimization Problems: Binary search in ordered set: O(log(N)) Ordering set of N elements: O(N log (N)) Traveling Salesman problem (shortest tour between N cities): Exhaustive Search, time O(N!) Finding an allocation of the N boolean variables x 1,...,x N such that the boolean function f(x 1,...,X N )=true: exhaustive search, time O(2^N) Finding the prime-factors of a large composite n=p*q with p,q=prime Interesting Questions: Can these (and other) problems be solved faster? Are there problems that cannot be computed by an algorithm at all? Page 2

2 Content 1. Motivation: Example Algorithms 2. Computation models Register Machines, Turing Machine Church s Thesis Non-determinism 3. Main sequential complexity classes Uncomputable problems P time, NP time, P space, NP space P-time and log-space reductions NP complete problem examples P complete problems examples 4. Task scheduling examples 5. Summary/Exercises Page 3 Computational Models & Computability Finite program (normally represented as string over some alphabet) Finite number of registers Assignments and basic arithmetics: Ri=0, Ri=Rj+Rk, INC/DEC Ri Different types of repetitive instructions Loop Ri While Ri 0 If Ri 0 goto label Recursion Tail recursion/primitive recursion μ-recursion/partial recursion Loop computable functions = Tail-recursive functions While-computable functions = if-goto computable functions = partial recursive functions Page 4

3 Computational Models: Turing Machine Informal Definition Turing Machine = automaton with finite state-set working on an infinite storage organized as read/write tape Operation: read one symbol from the current position on the tape; depending on read symbol and current state determine New state New symbol to be written at the current tape position Movement of current position to right or left For certain states and certain input symbols, the Turing machine may stop operation Turing Machine <Q,Γ,b,X, q 0,F,δ> Finite State-space Q Finite working alphabet Γ Empty symbol b Finite input Alphabet X Γ/{b} Starting state q 0 Q F Q is set of accepting final states Transition function δ: (Q/F) x Γ Γ x {L,R} x Q Page 5 Turing Machines & Computability Turing machines (cntd) Example: Addition of unary numbers Equally power-ful models (with respect to computability) Only one-sided infinite tape Multiple tapes Multiple read/write heads Multiple dimensions Turing computable = if-goto computable (extended on X* = set of sequences over X) Church Thesis: Any algorithmic computable function is Turing computable Page 6

4 Acceptance, decidability; diagonalisation L X* is called Turing acceptable (recursive enumerable), iff there is a TM M that Stops on all inputs v L in an acceptance state q f F For all v L, M may or may not stop, but if it stops, then in a state F L X* is called decidable (recursive), if there is a TM M that Stops on all inputs v X* but only accepts if v L Corollaries: L decidable X*/L decidable L acceptable and X*/L acceptable L decidable Diagonalisation: Let <M> be a binary encoding of the Turing Machine M Hence, all possible TMs can be enumerated w i =<M i > L d := { w i w i L(M i )}, there does not exist any TM that accepts L d Page 7 Non-determinism Non-deterministic Turing Machine M nd =<Q,Γ,b,X, q 0,F,τ> Finite State-space Q Finite working alphabet Γ Empty symbol b Finite input Alphabet X Γ/{b} Starting state q 0 Q F Q is set of accepting final states Transition function τ: (Q/F) x Γ (Γ x {L,R} x Q) Consequence: At each computation step, multiple (but finite) number of choices v X* accepted by M nd iff there exists one computation in the computation tree that accepts v L X* acceptable by a deterministic TM L acceptable by a non-determinstic TM Page 8

5 Content 1. Motivation: Example Algorithms 2. Computation models Register Machines, Turing Machine Church s Thesis Non-determinism 3. Main sequential complexity classes Uncomputable problems P time, NP time, P space, NP space P-time and log-space reductions NP complete problem examples P complete problems examples 4. Task Scheduling Example Problems 5. Summary/Exercises Page 9 Un-computable Problems Examples: L NE :={ w i L(M i ) } is Turing acceptable (recursive enumerable) L E :={ w i L(M i ) = } is not Turing decidable (recursive), hence also not Turing acceptable L h :={<M,w> M stops on input w}; L nh :=X*/L h ={<M,w> M does not stop on input w} L h is Turing acceptable but not decidable, L nh is not Turing acceptable It is not decidable whether a context-free grammar creates a regular language It is not decidable whether two context-free grammars have a non-empty intersection Page 10

6 Resources: Time and Space complexity Computational Model: Deterministic Turing Machine M with k one-sided infinite tapes Read-only tape that contains input of length n If for all inputs of length n M uses at most S(n) fields on any of the k tapes M has space complexity S(n) M uses at most T(n) steps M has time complexity T(n) Example: L={wbw R w {0,1}*} (Palindromes) Space complexity S(n)=log2(n) (using a binary counter) Time complexity T(n)=n+1 (while using space (n-1)/2) Page 11 Non-deterministic classes and relations L NSpace(S(n)): Iff there exists a non-deterministic TM that decides membership of L with no computation sequence exceeding S(n) fields on any tape L NTime(T(n)): Iff there exists a non-determinstic TM that decides membership of L with no computation requiring more than T(n) steps Similar Complexity classes for deterministic case: Dspace(S(n)), Dtime(T(n)) Relations (by definition): DTime(T(n)) NTime(T(n)) DTime(f(n)) DSpace(f(n)), NTime(f(n)) NSpace(f(n)) DSpace(S(n)) NSpace(S(n)) Reverse Directions: L DSpace(f(n)) and f(n)>log 2 (n) there exists a c>0 with L DTime(c f(n) ) L NTime(T(n)) there exists a c>0 with L DTime(c T(n) ) Page 12

7 Space compression and linear speed-up Due to freedom of choice of state-space and working alphabet (Notation: x=n or x=d, but consistently replaced within one line) Linear factors in complexity classes L xspace(s(n)) L xspace(c*s(n)), for all c>0 L xtime(t(n)), and lim T T(n)/n= L xtime(c*t(n)) for all c>0 L xtime(c*n) L xtime((1+ε)*n) for all ε>0 Reduction from k-tape TM L xspace(s(n)) for k tapes L xspace(s(n)) for TM with one tape L xtime(t(n)) for k>1 tapes L xtime(t 2 (n)) for single tape TM L xtime(t(n)) for k>2 tapes L xtime(t(n) log T(n)) for TM with 2 tapes Page 13 Polynomial time and space: P, NP, PSpace Time Efficient Problems: Polynomial Time P P := PTime := i 1 DTime(n i ) Non-deterministic polynomial Time: NP NP := NPtime := i 1 NTime(n i ) Polynomial Space: Pspace PSpace := i 1 DSpace(n i ) Relation: DSpace(log n) P NP PSpace And it is known: DSpace(log n) PSpace, hence at least one of the relations is a true subset in the chain above, but it is not known which one(s) Page 14

8 Reductions, hard and complete problems Definition: L < g L, L is reducible to L via the function g iff x L g(x) L For complexity investigations: resource limited reductions Polynomial time reductions < p : g(x) computable in deterministic polynomial time Log-Space reductions < l : g(x) computable using deterministic logarithmic space L is called NP-hard, iff for all L NP, L < p L L is called NP-complete, iff L NP-hard and L NP Examples of NP complete problems: SAT: Do the variables X 1,...,X n in a boolean expression have an allocation such that the expression=true? (Directed) Hamilton Circles: Is there a path in the (directed) graph G that visits each node exactly once before returning to its start? Integer Linear Programming: Is there an integer vector x such that Ax>b? Page 15 Other complete problems L is called PSpace-hard (complete), iff for all L NP, L < p L (and L PSpace) Examples of PSpace complete problems: context-sensitive recognition (csr): Is a certain string w recognized by a context-sensitive grammar G? Csr is in NSpace(n) and DSpace(n 2 ) L is called P-hard (complete), iff for all L P, L < l L (and L P) Examples of P-complete problems: Emptyness of context-free grammars: Is the language defined by a context-free Grammar G empty? Circuit Value Problem CVP: Is a certain output y {0,1} m the correct result of a Boolean circuit with binary encoding α for binary input x 1,...,x n Examples of Nspace(log n) complete problems [using log-space reductions] Reachability in graphs: Is there a path from node x to y in a directed graph? Page 16

9 Content 1. Motivation: Example Algorithms 2. Computation models Register Machines, Turing Machine Church s Thesis Non-determinism 3. Main sequential complexity classes Uncomputable problems P time, NP time, P space, NP space P-time and log-space reductions NP complete problem examples P complete problems examples 4. Task Scheduling 1-processor, multi-processor, approximations Page 17 Task Scheduling: Problem formulation Input Set of Tasks T (finite or countable infinite) For each task t i T length : l(t i ) Deadline: d(t i ) Task precedence graph (acyclic) Number of processors to be used for scheduling: N N=1: single processor system N>1: multi-processor system Output Schedule σ, e.g. σ: T + (Task start time) σ: T (time-slotted schedule, slot-allocation) σ: x{1,...,n} T (multi-processor schedule) Goal: most tasks meet deadlines (to be specified better) Page 18

10 Task Scheduling: Problem formulation II Metrics Finish time of task set T Mean flow time Weighted mean flow time Fraction of tasks missing deadlines Etc. Many Variations, e.g. pre-emptive/non pre-emptive Communication costs/delays processor failures resource allocation probabilistic variations Page 19 Single processor scheduling: Example 1 Maximum constrained sequencing Given: Taskset T, length l(t i ), deadline d(t i ) Weight ( penalty ): w(t i ) Upper Bound on Penalty: K Goal: One-processor schedule σ: T + such that penalties of all tasks that miss deadlines does not exceed K: Σ F w(t i ) <= K, where F={t i σ(t i )+l(t i )>d(t i )} Discussion: branch-and-bound, A*, heuristics Page 20

11 Single processor scheduling: Example 2 Minimum precedence constrained sequencing with delays Given: Taskset T [,length l(t i )] Precedence graph: G=(T,E) Delays (with supremum D): 0<= d(t i ) <=D Goal: One-processor schedule σ: T + that Obeys precedence constraints Obeys delay constraints: < t i, t k > E, σ(t k )-σ(t i )> d(t i ) such that finish-time is minimized Discussion Page 21 Multi-processor scheduling: Example Minimum multi-processor scheduling Given: N processors Taskset T, length l(p,t i ), p=1,...,n Goal: N-processor schedule σ: T {1,...,N} such that finish-time is minimzed: max p {1,...,p} Σ σ -1 (p) l(p,t i ) Discussion Longest Processing Time (LPT) heuristics <= 4/3 of optimal schedule, even 4/3-1/(3N) for identical processors Minimized mean flow time: shortest processing time (SPT) first schedule optimal, O(n log n) for n tasks Page 22

12 Summary 1. Motivation: Example Algorithms 2. Computation models Register Machines, Turing Machine Church s Thesis Non-determinism 3. Main sequential complexity classes Uncomputable problems P time, NP time, P space, NP space P-time and log-space reductions NP complete problem examples P complete problems examples 4. Task Scheduling 1-processor, multi-processor, approximations Page 23 References Lecture notes: Computability and decidability, WS93/94, Prof. K-J Lange, TU Munich J. Hopcroft, J. Ullman: Introduction to automata theory, languages, and computation. Addison Wesley, Chapters 12 & 13 (Sects , , ) Garey, Johnson: Computers and Intractability: A Guide to the Theory of NP- Completeness, Freeman & Co, 1979 El-Rewini, Lewis, Ali: Task scheduling in parallel and distributed systems. Prentice Hall, Horowitz, Sahni: Exact and approximate algorithms for scheduling non-identical processors. Journal of the ACM, Vol. 23, No. 2, pp Page 24

Complexity: Some examples

Complexity: Some examples Algorithms and Architectures III: Distributed Systems H-P Schwefel, Jens M. Pedersen Mm6 Distributed storage and access (jmp) Mm7 Introduction to security aspects (hps) Mm8 Parallel complexity (hps) Mm9

More information

Advanced Topics in Theoretical Computer Science

Advanced Topics in Theoretical Computer Science Advanced Topics in Theoretical Computer Science Part 5: Complexity (Part II) 30.01.2014 Viorica Sofronie-Stokkermans Universität Koblenz-Landau e-mail: sofronie@uni-koblenz.de 1 Contents Recall: Turing

More information

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE Chapter 1 - Time and Space Complexity deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE 1 / 41 Deterministic Turing machines Definition 1.1 A (deterministic

More information

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages and and Department of Computer Science and Information Systems Birkbeck, University of London ptw@dcs.bbk.ac.uk Outline and Doing and analysing problems/languages computability/solvability/decidability

More information

Space Complexity. Master Informatique. Université Paris 5 René Descartes. Master Info. Complexity Space 1/26

Space Complexity. Master Informatique. Université Paris 5 René Descartes. Master Info. Complexity Space 1/26 Space Complexity Master Informatique Université Paris 5 René Descartes 2016 Master Info. Complexity Space 1/26 Outline Basics on Space Complexity Main Space Complexity Classes Deterministic and Non-Deterministic

More information

The space complexity of a standard Turing machine. The space complexity of a nondeterministic Turing machine

The space complexity of a standard Turing machine. The space complexity of a nondeterministic Turing machine 298 8. Space Complexity The space complexity of a standard Turing machine M = (Q,,,, q 0, accept, reject) on input w is space M (w) = max{ uav : q 0 w M u q av, q Q, u, a, v * } The space complexity of

More information

P vs. NP Classes. Prof. (Dr.) K.R. Chowdhary.

P vs. NP Classes. Prof. (Dr.) K.R. Chowdhary. P vs. NP Classes Prof. (Dr.) K.R. Chowdhary Email: kr.chowdhary@iitj.ac.in Formerly at department of Computer Science and Engineering MBM Engineering College, Jodhpur Monday 10 th April, 2017 kr chowdhary

More information

CS601 DTIME and DSPACE Lecture 5. Time and Space functions: t,s : N N +

CS601 DTIME and DSPACE Lecture 5. Time and Space functions: t,s : N N + CS61 DTIME and DSPACE Lecture 5 Time and Space functions: t,s : N N + Definition 5.1 A set A U is in DTIME[t(n)] iff there exists a deterministic, multi-tape TM, M, and a constantc, such that, 1. A = L(M)

More information

Time Complexity. Definition. Let t : n n be a function. NTIME(t(n)) = {L L is a language decidable by a O(t(n)) deterministic TM}

Time Complexity. Definition. Let t : n n be a function. NTIME(t(n)) = {L L is a language decidable by a O(t(n)) deterministic TM} Time Complexity Definition Let t : n n be a function. TIME(t(n)) = {L L is a language decidable by a O(t(n)) deterministic TM} NTIME(t(n)) = {L L is a language decidable by a O(t(n)) non-deterministic

More information

Computability and Complexity Theory

Computability and Complexity Theory Discrete Math for Bioinformatics WS 09/10:, by A Bockmayr/K Reinert, January 27, 2010, 18:39 9001 Computability and Complexity Theory Computability and complexity Computability theory What problems can

More information

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65

Undecidable Problems. Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, / 65 Undecidable Problems Z. Sawa (TU Ostrava) Introd. to Theoretical Computer Science May 12, 2018 1/ 65 Algorithmically Solvable Problems Let us assume we have a problem P. If there is an algorithm solving

More information

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity

Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity CSE 531: Computational Complexity I Winter 2016 Lecture 6: Oracle TMs, Diagonalization Limits, Space Complexity January 22, 2016 Lecturer: Paul Beame Scribe: Paul Beame Diagonalization enabled us to separate

More information

Introduction to Computational Complexity

Introduction to Computational Complexity Introduction to Computational Complexity A 10-lectures Graduate Course Martin Stigge, martin.stigge@it.uu.se Uppsala University, Sweden 13.7. - 17.7.2009 Martin Stigge (Uppsala University, SE) Computational

More information

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages COMP/MATH 300 Topics for Spring 2017 June 5, 2017 Review and Regular Languages Exam I I. Introductory and review information from Chapter 0 II. Problems and Languages A. Computable problems can be expressed

More information

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1)

Time Complexity (1) CSCI Spring Original Slides were written by Dr. Frederick W Maier. CSCI 2670 Time Complexity (1) Time Complexity (1) CSCI 2670 Original Slides were written by Dr. Frederick W Maier Spring 2014 Time Complexity So far we ve dealt with determining whether or not a problem is decidable. But even if it

More information

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar

Q = Set of states, IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar IE661: Scheduling Theory (Fall 2003) Primer to Complexity Theory Satyaki Ghosh Dastidar Turing Machine A Turing machine is an abstract representation of a computing device. It consists of a read/write

More information

Resource-Bounded Computation

Resource-Bounded Computation Resource-Bounded Computation Previously: can something be done? Now: how efficiently can it be done? Goal: conserve computational resources: Time, space, other resources? Def: L is decidable within time

More information

Lecture 25: Cook s Theorem (1997) Steven Skiena. skiena

Lecture 25: Cook s Theorem (1997) Steven Skiena.   skiena Lecture 25: Cook s Theorem (1997) Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Prove that Hamiltonian Path is NP

More information

Computational Complexity III: Limits of Computation

Computational Complexity III: Limits of Computation : Limits of Computation School of Informatics Thessaloniki Seminar on Theoretical Computer Science and Discrete Mathematics Aristotle University of Thessaloniki Context 1 2 3 Computability vs Complexity

More information

CSCI 1590 Intro to Computational Complexity

CSCI 1590 Intro to Computational Complexity CSCI 59 Intro to Computational Complexity Overview of the Course John E. Savage Brown University January 2, 29 John E. Savage (Brown University) CSCI 59 Intro to Computational Complexity January 2, 29

More information

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK

Artificial Intelligence. 3 Problem Complexity. Prof. Dr. Jana Koehler Fall 2016 HSLU - JK Artificial Intelligence 3 Problem Complexity Prof. Dr. Jana Koehler Fall 2016 Agenda Computability and Turing Machines Tractable and Intractable Problems P vs. NP Decision Problems Optimization problems

More information

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates.

Polynomial Time Computation. Topics in Logic and Complexity Handout 2. Nondeterministic Polynomial Time. Succinct Certificates. 1 2 Topics in Logic and Complexity Handout 2 Anuj Dawar MPhil Advanced Computer Science, Lent 2010 Polynomial Time Computation P = TIME(n k ) k=1 The class of languages decidable in polynomial time. The

More information

Computational Complexity IV: PSPACE

Computational Complexity IV: PSPACE Seminar on Theoretical Computer Science and Discrete Mathematics Aristotle University of Thessaloniki Context 1 Section 1: PSPACE 2 3 4 Time Complexity Time complexity of DTM M: - Increasing function t:

More information

MTAT Complexity Theory October 13th-14th, Lecture 6

MTAT Complexity Theory October 13th-14th, Lecture 6 MTAT.07.004 Complexity Theory October 13th-14th, 2011 Lecturer: Peeter Laud Lecture 6 Scribe(s): Riivo Talviste 1 Logarithmic memory Turing machines working in logarithmic space become interesting when

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Lecture 10 More examples of problems in P Closure properties of the class P The class NP given by Jiri Srba Lecture 10 Computability and Complexity 1/12 Example: Relatively

More information

Introduction to Complexity Theory

Introduction to Complexity Theory Introduction to Complexity Theory Read K & S Chapter 6. Most computational problems you will face your life are solvable (decidable). We have yet to address whether a problem is easy or hard. Complexity

More information

Computability and Complexity CISC462, Fall 2018, Space complexity 1

Computability and Complexity CISC462, Fall 2018, Space complexity 1 Computability and Complexity CISC462, Fall 2018, Space complexity 1 SPACE COMPLEXITY This material is covered in Chapter 8 of the textbook. For simplicity, we define the space used by a Turing machine

More information

Complexity Theory of Polynomial-Time Problems

Complexity Theory of Polynomial-Time Problems Complexity Theory of Polynomial-Time Problems Lecture 1: Introduction, Easy Examples Karl Bringmann and Sebastian Krinninger Audience no formal requirements, but: NP-hardness, satisfiability problem, how

More information

Part I: Definitions and Properties

Part I: Definitions and Properties Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY THURSDAY APRIL 3 REVIEW for Midterm TUESDAY April 8 Definition: A Turing Machine is a 7-tuple T = (Q, Σ, Γ, δ, q, q accept, q reject ), where: Q is a

More information

About the relationship between formal logic and complexity classes

About the relationship between formal logic and complexity classes About the relationship between formal logic and complexity classes Working paper Comments welcome; my email: armandobcm@yahoo.com Armando B. Matos October 20, 2013 1 Introduction We analyze a particular

More information

Theory of Computation

Theory of Computation Theory of Computation Unit 4-6: Turing Machines and Computability Decidability and Encoding Turing Machines Complexity and NP Completeness Syedur Rahman syedurrahman@gmail.com Turing Machines Q The set

More information

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes

Complexity. Complexity Theory Lecture 3. Decidability and Complexity. Complexity Classes Complexity Theory 1 Complexity Theory 2 Complexity Theory Lecture 3 Complexity For any function f : IN IN, we say that a language L is in TIME(f(n)) if there is a machine M = (Q, Σ, s, δ), such that: L

More information

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information Theory of Computation Lecture Notes Prof. Yuh-Dauh Lyuu Dept. Computer Science & Information Engineering and Department of Finance National Taiwan University Problems and Algorithms c 2004 Prof. Yuh-Dauh

More information

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

CSE 105 Theory of Computation

CSE 105 Theory of Computation CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s Agenda P and NP (7.2, 7.3) Next class: Review Reminders and announcements: CAPE & TA evals are open: Please

More information

Computability THEORY OF COMPUTATION

Computability THEORY OF COMPUTATION 11/27/14 9-1 Computability 1 Computability THEORY OF COMPUTATION Formal Languages, Automata, and Complexity J. Glenn Brokshear The Benjamin/Cummings Pub. Comp., Inc. 1989 1.1 Foundation of Recursive Function

More information

CS151 Complexity Theory. Lecture 1 April 3, 2017

CS151 Complexity Theory. Lecture 1 April 3, 2017 CS151 Complexity Theory Lecture 1 April 3, 2017 Complexity Theory Classify problems according to the computational resources required running time storage space parallelism randomness rounds of interaction,

More information

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018

Outline. Complexity Theory. Example. Sketch of a log-space TM for palindromes. Log-space computations. Example VU , SS 2018 Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 3. Logarithmic Space Reinhard Pichler Institute of Logic and Computation DBAI Group TU Wien 3. Logarithmic Space 3.1 Computational

More information

CS20a: Turing Machines (Oct 29, 2002)

CS20a: Turing Machines (Oct 29, 2002) CS20a: Turing Machines (Oct 29, 2002) So far: DFA = regular languages PDA = context-free languages Today: Computability 1 Handicapped machines DFA limitations Tape head moves only one direction 2-way DFA

More information

Chap. 4 Computability

Chap. 4 Computability THEORY OF COMPUTATION Formal Languages, Automata, and Complexity Chap. 4 Computability J. Glenn Brokshear The Benjamin/Cummings Pub. Comp., Inc. 1989 1 4.1 Foundation of Recursive Function Theory computation

More information

Space Complexity. The space complexity of a program is how much memory it uses.

Space Complexity. The space complexity of a program is how much memory it uses. Space Complexity The space complexity of a program is how much memory it uses. Measuring Space When we compute the space used by a TM, we do not count the input (think of input as readonly). We say that

More information

ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017

ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness. Prof. Peter Bermel January 11, 2017 ECE 695 Numerical Simulations Lecture 2: Computability and NPhardness Prof. Peter Bermel January 11, 2017 Outline Overview Definitions Computing Machines Church-Turing Thesis Polynomial Time (Class P)

More information

CS154, Lecture 13: P vs NP

CS154, Lecture 13: P vs NP CS154, Lecture 13: P vs NP The EXTENDED Church-Turing Thesis Everyone s Intuitive Notion of Efficient Algorithms Polynomial-Time Turing Machines More generally: TM can simulate every reasonable model of

More information

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death

Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death Theory of Computation CS3102 Spring 2015 A tale of computers, math, problem solving, life, love and tragic death Robbie Hott www.cs.virginia.edu/~jh2jf Department of Computer Science University of Virginia

More information

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010 CS311 Computational Structures NP-completeness Lecture 18 Andrew P. Black Andrew Tolmach 1 Some complexity classes P = Decidable in polynomial time on deterministic TM ( tractable ) NP = Decidable in polynomial

More information

Complexity Theory 112. Space Complexity

Complexity Theory 112. Space Complexity Complexity Theory 112 Space Complexity We ve already seen the definition SPACE(f(n)): the languages accepted by a machine which uses O(f(n)) tape cells on inputs of length n. Counting only work space NSPACE(f(n))

More information

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005

Complexity Theory. Knowledge Representation and Reasoning. November 2, 2005 Complexity Theory Knowledge Representation and Reasoning November 2, 2005 (Knowledge Representation and Reasoning) Complexity Theory November 2, 2005 1 / 22 Outline Motivation Reminder: Basic Notions Algorithms

More information

Exam Computability and Complexity

Exam Computability and Complexity Total number of points:... Number of extra sheets of paper:... Exam Computability and Complexity by Jiri Srba, January 2009 Student s full name CPR number Study number Before you start, fill in the three

More information

1 Showing Recognizability

1 Showing Recognizability CSCC63 Worksheet Recognizability and Decidability 1 1 Showing Recognizability 1.1 An Example - take 1 Let Σ be an alphabet. L = { M M is a T M and L(M) }, i.e., that M accepts some string from Σ. Prove

More information

Finish K-Complexity, Start Time Complexity

Finish K-Complexity, Start Time Complexity 6.045 Finish K-Complexity, Start Time Complexity 1 Kolmogorov Complexity Definition: The shortest description of x, denoted as d(x), is the lexicographically shortest string such that M(w) halts

More information

Computational complexity theory

Computational complexity theory Computational complexity theory Introduction to computational complexity theory Complexity (computability) theory deals with two aspects: Algorithm s complexity. Problem s complexity. References S. Cook,

More information

Lecture 3: Nondeterminism, NP, and NP-completeness

Lecture 3: Nondeterminism, NP, and NP-completeness CSE 531: Computational Complexity I Winter 2016 Lecture 3: Nondeterminism, NP, and NP-completeness January 13, 2016 Lecturer: Paul Beame Scribe: Paul Beame 1 Nondeterminism and NP Recall the definition

More information

Lecture 22: PSPACE

Lecture 22: PSPACE 6.045 Lecture 22: PSPACE 1 VOTE VOTE VOTE For your favorite course on automata and complexity Please complete the online subject evaluation for 6.045 2 Final Exam Information Who: You On What: Everything

More information

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Turing Machines Review An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Varieties of TMs Multi-Tape TMs Nondeterministic TMs String Enumerators

More information

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,

More information

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Turing Machines Review An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM Varieties of TMs Multi-Tape TMs Nondeterministic TMs String Enumerators

More information

Lecture 21: Space Complexity (The Final Exam Frontier?)

Lecture 21: Space Complexity (The Final Exam Frontier?) 6.045 Lecture 21: Space Complexity (The Final Exam Frontier?) 1 conp NP MIN-FORMULA conp P NP FIRST-SAT TAUT P FACTORING SAT NP NP NP 2 VOTE VOTE VOTE For your favorite course on automata and complexity

More information

Computational complexity theory

Computational complexity theory Computational complexity theory Introduction to computational complexity theory Complexity (computability) theory deals with two aspects: Algorithm s complexity. Problem s complexity. References S. Cook,

More information

15-251: Great Theoretical Ideas in Computer Science Lecture 7. Turing s Legacy Continues

15-251: Great Theoretical Ideas in Computer Science Lecture 7. Turing s Legacy Continues 15-251: Great Theoretical Ideas in Computer Science Lecture 7 Turing s Legacy Continues Solvable with Python = Solvable with C = Solvable with Java = Solvable with SML = Decidable Languages (decidable

More information

Lecture 16: Time Complexity and P vs NP

Lecture 16: Time Complexity and P vs NP 6.045 Lecture 16: Time Complexity and P vs NP 1 Time-Bounded Complexity Classes Definition: TIME(t(n)) = { L there is a Turing machine M with time complexity O(t(n)) so that L = L(M) } = { L L is a language

More information

Chapter 7: Time Complexity

Chapter 7: Time Complexity Chapter 7: Time Complexity 1 Time complexity Let M be a deterministic Turing machine that halts on all inputs. The running time or time complexity of M is the function f: N N, where f(n) is the maximum

More information

13.1 Nondeterministic Polynomial Time

13.1 Nondeterministic Polynomial Time CS125 Lecture 13 Fall 2016 13.1 Nondeterministic Polynomial Time Now we turn to incorporating nondeterminism in universal models of computation, namely Turing Machines and Word-RAMs. For Nondeterministic

More information

CP405 Theory of Computation

CP405 Theory of Computation CP405 Theory of Computation BB(3) q 0 q 1 q 2 0 q 1 1R q 2 0R q 2 1L 1 H1R q 1 1R q 0 1L Growing Fast BB(3) = 6 BB(4) = 13 BB(5) = 4098 BB(6) = 3.515 x 10 18267 (known) (known) (possible) (possible) Language:

More information

The Cook-Levin Theorem

The Cook-Levin Theorem An Exposition Sandip Sinha Anamay Chaturvedi Indian Institute of Science, Bangalore 14th November 14 Introduction Deciding a Language Let L {0, 1} be a language, and let M be a Turing machine. We say M

More information

Parallelism and Machine Models

Parallelism and Machine Models Parallelism and Machine Models Andrew D Smith University of New Brunswick, Fredericton Faculty of Computer Science Overview Part 1: The Parallel Computation Thesis Part 2: Parallelism of Arithmetic RAMs

More information

INAPPROX APPROX PTAS. FPTAS Knapsack P

INAPPROX APPROX PTAS. FPTAS Knapsack P CMPSCI 61: Recall From Last Time Lecture 22 Clique TSP INAPPROX exists P approx alg for no ε < 1 VertexCover MAX SAT APPROX TSP some but not all ε< 1 PTAS all ε < 1 ETSP FPTAS Knapsack P poly in n, 1/ε

More information

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness

Computers and Intractability. The Bandersnatch problem. The Bandersnatch problem. The Bandersnatch problem. A Guide to the Theory of NP-Completeness Computers and Intractability A Guide to the Theory of NP-Completeness The Bible of complexity theory Background: Find a good method for determining whether or not any given set of specifications for a

More information

Time Complexity. CS60001: Foundations of Computing Science

Time Complexity. CS60001: Foundations of Computing Science Time Complexity CS60001: Foundations of Computing Science Professor, Dept. of Computer Sc. & Engg., Measuring Complexity Definition Let M be a deterministic Turing machine that halts on all inputs. The

More information

Computers and Intractability

Computers and Intractability Computers and Intractability A Guide to the Theory of NP-Completeness The Bible of complexity theory M. R. Garey and D. S. Johnson W. H. Freeman and Company, 1979 The Bandersnatch problem Background: Find

More information

Chapter 2 Algorithms and Computation

Chapter 2 Algorithms and Computation Chapter 2 Algorithms and Computation In this chapter, we first discuss the principles of algorithm and computation in general framework, common both in classical and quantum computers, then we go to the

More information

Harvard CS 121 and CSCI E-121 Lecture 20: Polynomial Time

Harvard CS 121 and CSCI E-121 Lecture 20: Polynomial Time Harvard CS 121 and CSCI E-121 Lecture 20: Polynomial Time Harry Lewis November 12, 20123 Review of Asymptotic Notation For f, g : N R + f = O(g): c > 0 s.t. f(n) c g(n) for all sufficiently large n. f

More information

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP

CS Lecture 29 P, NP, and NP-Completeness. k ) for all k. Fall The class P. The class NP CS 301 - Lecture 29 P, NP, and NP-Completeness Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata Equivalence of

More information

Computational Complexity

Computational Complexity Computational Complexity Algorithm performance and difficulty of problems So far we have seen problems admitting fast algorithms flow problems, shortest path, spanning tree... and other problems for which

More information

NP-completeness. Chapter 34. Sergey Bereg

NP-completeness. Chapter 34. Sergey Bereg NP-completeness Chapter 34 Sergey Bereg Oct 2017 Examples Some problems admit polynomial time algorithms, i.e. O(n k ) running time where n is the input size. We will study a class of NP-complete problems

More information

Review of Basic Computational Complexity

Review of Basic Computational Complexity Lecture 1 Review of Basic Computational Complexity March 30, 2004 Lecturer: Paul Beame Notes: Daniel Lowd 1.1 Preliminaries 1.1.1 Texts There is no one textbook that covers everything in this course. Some

More information

MTAT Complexity Theory October 20th-21st, Lecture 7

MTAT Complexity Theory October 20th-21st, Lecture 7 MTAT.07.004 Complexity Theory October 20th-21st, 2011 Lecturer: Peeter Laud Lecture 7 Scribe(s): Riivo Talviste Polynomial hierarchy 1 Turing reducibility From the algorithmics course, we know the notion

More information

BBM402-Lecture 11: The Class NP

BBM402-Lecture 11: The Class NP BBM402-Lecture 11: The Class NP Lecturer: Lale Özkahya Resources for the presentation: http://ocw.mit.edu/courses/electrical-engineering-andcomputer-science/6-045j-automata-computability-andcomplexity-spring-2011/syllabus/

More information

CS154, Lecture 17: conp, Oracles again, Space Complexity

CS154, Lecture 17: conp, Oracles again, Space Complexity CS154, Lecture 17: conp, Oracles again, Space Complexity Definition: conp = { L L NP } What does a conp computation look like? In NP algorithms, we can use a guess instruction in pseudocode: Guess string

More information

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness

Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harvard CS 121 and CSCI E-121 Lecture 22: The P vs. NP Question and NP-completeness Harry Lewis November 19, 2013 Reading: Sipser 7.4, 7.5. For culture : Computers and Intractability: A Guide to the Theory

More information

Turing Machine Recap

Turing Machine Recap Turing Machine Recap DFA with (infinite) tape. One move: read, write, move, change state. High-level Points Church-Turing thesis: TMs are the most general computing devices. So far no counter example Every

More information

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational 1 The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational model. We'll remind you what a Turing machine is --- you

More information

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

More information

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs

satisfiability (sat) Satisfiability unsatisfiability (unsat or sat complement) and validity Any Expression φ Can Be Converted into CNFs and DNFs Any Expression φ Can Be Converted into CNFs and DNFs φ = x j : This is trivially true. φ = φ 1 and a CNF is sought: Turn φ 1 into a DNF and apply de Morgan s laws to make a CNF for φ. φ = φ 1 and a DNF

More information

Lecture 1: Course Overview and Turing machine complexity

Lecture 1: Course Overview and Turing machine complexity CSE 531: Computational Complexity I Winter 2016 Lecture 1: Course Overview and Turing machine complexity January 6, 2016 Lecturer: Paul Beame Scribe: Paul Beame 1 Course Outline 1. Basic properties of

More information

Non-Deterministic Time

Non-Deterministic Time Non-Deterministic Time Master Informatique 2016 1 Non-Deterministic Time Complexity Classes Reminder on DTM vs NDTM [Turing 1936] (q 0, x 0 ) (q 1, x 1 ) Deterministic (q n, x n ) Non-Deterministic (q

More information

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler

Complexity Theory VU , SS The Polynomial Hierarchy. Reinhard Pichler Complexity Theory Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 15 May, 2018 Reinhard

More information

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181.

Outline. Complexity Theory EXACT TSP. The Class DP. Definition. Problem EXACT TSP. Complexity of EXACT TSP. Proposition VU 181. Complexity Theory Complexity Theory Outline Complexity Theory VU 181.142, SS 2018 6. The Polynomial Hierarchy Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität

More information

Principles of Knowledge Representation and Reasoning

Principles of Knowledge Representation and Reasoning Principles of Knowledge Representation and Reasoning Complexity Theory Bernhard Nebel, Malte Helmert and Stefan Wölfl Albert-Ludwigs-Universität Freiburg April 29, 2008 Nebel, Helmert, Wölfl (Uni Freiburg)

More information

Space Complexity. then the space required by M on input x is. w i u i. F ) on. September 27, i=1

Space Complexity. then the space required by M on input x is. w i u i. F ) on. September 27, i=1 Space Complexity Consider a k-string TM M with input x. Assume non- is never written over by. a The purpose is not to artificially reduce the space needs (see below). If M halts in configuration (H, w

More information

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness

COMPLEXITY THEORY. PSPACE = SPACE(n k ) k N. NPSPACE = NSPACE(n k ) 10/30/2012. Space Complexity: Savitch's Theorem and PSPACE- Completeness 15-455 COMPLEXITY THEORY Space Complexity: Savitch's Theorem and PSPACE- Completeness October 30,2012 MEASURING SPACE COMPLEXITY FINITE STATE CONTROL I N P U T 1 2 3 4 5 6 7 8 9 10 We measure space complexity

More information

Introduction: Computer Science is a cluster of related scientific and engineering disciplines concerned with the study and application of computations. These disciplines range from the pure and basic scientific

More information

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA Turing Machines A Turing machine is similar to a finite automaton with supply of unlimited memory. A Turing machine can do everything that any computing device can do. There exist problems that even a

More information

Comparison of several polynomial and exponential time complexity functions. Size n

Comparison of several polynomial and exponential time complexity functions. Size n Comparison of several polynomial and exponential time complexity functions Time complexity function n n 2 n 3 n 5 2 n 3 n Size n 10 20 30 40 50 60.00001.00002.00003.00004.00005.00006 second second second

More information

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all

Theory of Computation. Ch.8 Space Complexity. wherein all branches of its computation halt on all Definition 8.1 Let M be a deterministic Turing machine, DTM, that halts on all inputs. The space complexity of M is the function f : N N, where f(n) is the maximum number of tape cells that M scans on

More information

where Q is a finite set of states

where Q is a finite set of states Space Complexity So far most of our theoretical investigation on the performances of the various algorithms considered has focused on time. Another important dynamic complexity measure that can be associated

More information

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1

U.C. Berkeley CS278: Computational Complexity Professor Luca Trevisan August 30, Notes for Lecture 1 U.C. Berkeley CS278: Computational Complexity Handout N1 Professor Luca Trevisan August 30, 2004 Notes for Lecture 1 This course assumes CS170, or equivalent, as a prerequisite. We will assume that the

More information

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1

CS 320, Fall Dr. Geri Georg, Instructor 320 NP 1 NP CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu 320 NP 1 NP Complete A class of problems where: No polynomial time algorithm has been discovered No proof that one doesn t exist 320

More information

1 Computational Problems

1 Computational Problems Stanford University CS254: Computational Complexity Handout 2 Luca Trevisan March 31, 2010 Last revised 4/29/2010 In this lecture we define NP, we state the P versus NP problem, we prove that its formulation

More information