Discrete Event Systems Exam

Similar documents
Name: Student ID: Instructions:

Alternating nonzero automata

STAT 516 Midterm Exam 2 Friday, March 7, 2008

Johns Hopkins Math Tournament Proof Round: Automata

Sri vidya college of engineering and technology

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

Part I: Definitions and Properties

NANYANG TECHNOLOGICAL UNIVERSITY SEMESTER I EXAMINATION MH4702/MAS446/MTH437 Probabilistic Methods in OR

Theory of computation: initial remarks (Chapter 11)

7. Queueing Systems. 8. Petri nets vs. State Automata

CS375 Midterm Exam Solution Set (Fall 2017)

IE 5112 Final Exam 2010

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Please give details of your answer. A direct answer without explanation is not counted.

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Notes on State Minimization

1 More finite deterministic automata

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Finite Automata Theory and Formal Languages TMV026/TMV027/DIT321 Responsible: Ana Bove

57:022 Principles of Design II Final Exam Solutions - Spring 1997

Statistics 253/317 Introduction to Probability Models. Winter Midterm Exam Friday, Feb 8, 2013

Decision, Computation and Language

1. Induction on Strings

Theory Bridge Exam Example Questions

Automata Theory (2A) Young Won Lim 5/31/18

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u,

DES. 4. Petri Nets. Introduction. Different Classes of Petri Net. Petri net properties. Analysis of Petri net models

Quiz 1 Date: Monday, October 17, 2016

CSCE 551 Final Exam, April 28, 2016 Answer Key

EECS 126 Probability and Random Processes University of California, Berkeley: Fall 2014 Kannan Ramchandran November 13, 2014.

Statistics 433 Practice Final Exam: Cover Sheet and Marking Sheet

CP405 Theory of Computation

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

6.045 Final Exam Solutions

Chapter 2: Finite Automata

3515ICT: Theory of Computation. Regular languages

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

(Refer Slide Time: 0:21)

Computer Sciences Department

False. They are the same language.

Context Free Languages: Decidability of a CFL

Finite Automata. Finite Automata

CSE 105 Theory of Computation

CS/ECE 374 Final Exam Study Problems Fall 2016

EECS 126 Probability and Random Processes University of California, Berkeley: Fall 2014 Kannan Ramchandran September 23, 2014.

IEOR 6711: Stochastic Models I, Fall 2003, Professor Whitt. Solutions to Final Exam: Thursday, December 18.

Final Exam (Version B) December 16, 2014 Name: NetID: Section: 1 2 3

REVIEW QUESTIONS. Chapter 1: Foundations: Sets, Logic, and Algorithms

Theory of Computation

3130CIT Theory of Computation

UNIT-VI PUSHDOWN AUTOMATA

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman

Finite Automata. BİL405 - Automata Theory and Formal Languages 1

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

The exam is closed book, closed calculator, and closed notes except your one-page crib sheet.

Automata-based Verification - III

1.225 Transportation Flow Systems Quiz (December 17, 2001; Duration: 3 hours)

Theory of computation: initial remarks (Chapter 11)

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

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

Lecture 17: Language Recognition

CSCE 551 Final Exam, Spring 2004 Answer Key

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata


CSE 355 Test 2, Fall 2016

Theory of Computation

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

Finite Automata and Languages

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

10. The GNFA method is used to show that

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

Introduction to Formal Languages, Automata and Computability p.1/42

CS 250/251 Discrete Structures I and II Section 005 Fall/Winter Professor York

Constructions on Finite Automata

Name of the Student:

1 Functions, relations, and infinite cardinality

Finite Automata. Mahesh Viswanathan

CPSC 421: Tutorial #1

CS 154 Introduction to Automata and Complexity Theory

University of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2013

Readings: Finish Section 5.2

Solutions to Old Final Exams (For Fall 2007)

Pushdown Automata. Chapter 12

Test 2 VERSION B STAT 3090 Spring 2017

CpSc 421 Final Exam December 15, 2006

University of Toronto Scarborough. Aids allowed: None... Duration: 3 hours.

EP2200 Course Project 2017 Project II - Mobile Computation Offloading

Advanced topic: Space complexity

CISC4090: Theory of Computation

Announcements. Problem Set Four due Thursday at 7:00PM (right before the midterm).

Decentralized Control of Discrete Event Systems with Bounded or Unbounded Delay Communication

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

The efficiency of identifying timed automata and the power of clocks

Proofs, Strings, and Finite Automata. CS154 Chris Pollett Feb 5, 2007.

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Overview. Discrete Event Systems Verification of Finite Automata. What can finite automata be used for? What can finite automata be used for?

Chapter 5. Finite Automata

A Note on Turing Machine Design

Accept or reject. Stack

Transcription:

Computer Engineering and Networks Laboratory TEC, NSG, DISCO HS 2016 Prof. L. Thiele, Prof. L. Vanbever, Prof. R. Wattenhofer Discrete Event Systems Exam Friday, 3 rd February 2017, 14:00 16:00. Do not open until told to by the supervisors! The exam lasts 120 minutes, and there is a total of 120 points. The maximal number of points for each question is indicated in parentheses. Your answers must be in English. Be sure to always justify your answers. Give your solutions on the page corresponding to the exam question and/or the empty one(s) following it. In case you run out of space, we also added extra pages in case you use them, please indicate which question you are solving! Should even this not be enough, please contact a supervisor. Please write down your name and Legi number (student ID) in the boxes below. Once the exam starts, also write your name on every page in the top right corner. Name Legi-Nr. Points Question Topic Achieved Points Maximal Points 1 Regular Languages 25 2 Context-free Languages 15 3 Electronics Store 15 4 Online Gas Station Search 25 5 True or False Automata & Petri Nets 10 6 Binary Decision Diagram 10 7 Petri Net 20 Total 120

1 Regular Languages (25 points) 1.1 Draw an automaton [9 points] Consider the alphabet Σ t0, 1u. For each of the following languages, draw a DFA recognizing it: a) [2] all the strings whose length is not divisible by 3. For example, strings with length of 0, 3, 6, 9 characters should not be accepted. The designed DFA should have at most 3 states. b) [3] all the strings that contain 1 in every even position. For example, the strings ɛ, 0, 1, 01, 010, should be accepted, while the string 0100, should not. The designed DFA should have at most 3 states. c) [4] all the strings whose length is not divisible by 3 and that contain 1 in every even position. The designed DFA should have at most 9 states. 2

Additional space for question 1.1 3

1.2 Regular or not? [16 points] Are the following languages regular? If so, exhibit a finite automaton (deterministic or not) or a regular expression for it. If not, prove it formally using the pumping lemma or the closure properties of regular languages. a) [4] L tw w P ta, bu such that if w contains the substring ab then it should contain the substring bau. b) [4] L tw w P t0, 1u and w is not a palindromeu. c) [4] L twtw t, w P t0, 1u u. d) [4] L txwtw x, w, t P t0, 1u u. 4

Additional space for question 1.2 5

2 Context-free Languages (15 points) 2.1 Write me a grammar [5] Give a context-free grammar (the production rules) for the following language: L ta n b m c m d 3n n 0, m 0u 6

2.2 Ambiguous or Not? [5] Let G be the context-free grammar given by the following production rules: S Ñ asa ɛ A Ñ bac ɛ Is G ambiguous grammar? Explain your answer. 7

2.3 Draw me a PDA [5] Let L tw P ta, bu the length of w is an odd number and the first, middle, and last character of w are identicalu. Design a PDA that accepts L. The designed PDA should have at most 7 states. 8

3 Electronics Store (15 points) A new electronics store has opened its doors in Infinityland. It consists of a showroom and a checkout area. People arrive at the showroom according to a Poisson process with parameter λ. The time that a person spends in the showroom is exponentially distributed with parameter µ. The showroom has unlimited capacity, i.e., there can be arbitrarily many people in the showroom at the same time. The population of Infinityland is infinite. a) [4] Model the showroom as a Continuous Time Markov Chain. b) [4] Derive a formula for π k, i.e., the steady state probability that exactly k people are in the showroom. The formula should not depend on π 0. Hint: 8 x k k! ex. k0 9

Once a customer has put all items in his/her cart, he/she proceeds to the checkout counters. Assume now that on average one customer per minute arrives at the checkout counters. There are m checkout counters, each one with its own waiting queue. Customers choose one of the checkout counters independently and uniformly at random. The service time at each checkout counter is exponentially distributed with an average of 20 customers per hour. c) [2] How many checkout counters are necessary so that the waiting queues do not grow indefinitely? d) [5] Calculate the expected time a customer spends at the checkout counter (waiting time and service time combined). 10

4 Online Gas Station Search (25 points) You rent a car to drive from A to B. You start at A and must return the car fully fueled at B. You want to refuel at the cheapest price. You only know that the highest gas price can be up to twice as high as the lowest one. Having no more information, you plan to not deviate from the path, but instead to decide online whether you should refuel at the current gas station. You know that there are exactly three gas stations ahead of you. If you are at a gas station, you will either refuel the whole tank or nothing at all. Assume that the fuel consumption between the gas stations and B is negligible. Consider the following deterministic strategy: You check the price at the first gas station, but do not refuel. If the price at the second gas station is better, you refuel there. Otherwise, you refuel at the third gas station. a) [5] Is this strategy c-competitive for some constant c? Compute the competitive ratio. In order to improve the competitive ratio, you are allowed to use randomization. Consider the following randomized strategy: You toss a fair coin at the first gas station. If you get heads, you refuel. If not, you proceed to the next gas station, repeat the coin toss and refuel at heads. If the coin tosses were tails at both stations, you refuel at the third gas station. b) [5] Compute the expected competitive ratio for this strategy. c) [5] Let p 1 be the probability with which you refuel at the first gas station, and p 2 at the second. How would you choose p 1 and p 2 to get the best expected price? Compute the expected competitive ratio and show that your choice of p 1 and p 2 is best possible. 11

It turns out that the first gas station did not exist and there are exactly two gas stations left. To get the best price, you decide not to gamble. Instead, you are now allowed to refuel parts of the total amount at any gas station you are passing. d) [5] Describe a deterministic online algorithm you should apply in order to get the best out of your situation when allowed to fill your tank partially. Give the competitive ratio of your algorithm. e) [5] Prove that there is no better deterministic strategy for two stations than the one you described in d). 12

5 True or False Automata & Petri Nets (10 points) For each of the following statements, assess if it is true or false and tick the corresponding box. No justification is needed. Every correct answer grants one point. Leaving a statement blank gives 0 point. Every incorrect answer looses one point on the total, with a minimum of 0 point for the whole question. Notes: Automaton A is depicted in Fig.1(a). Petri net P is depicted in Fig.1(b). v p w denotes the set of states which satisfies property p. For example for automaton A, v p w t1, 2, 6 u. Statement True False 1 If an automaton contains a finite number of states, computing the subset of reachable states always takes a finite number of steps. 2 A given Binary Decision Diagram can represent different functions i.e., functions for which a same input returns different outputs. 3 For automaton A, v EG p w t1, 2 u. 4 For automaton A, v EX ( p OR AG p ) w t1, 2, 3, 6 u. 5 Automaton A satisfies AX p. 6 The execution of a Petri net (i.e., the token game) is deterministic. 7 A Petri net never fires multiple transitions simultaneously. 8 A Petri net without deadlock is called a safe Petri net. 9 If the coverability graph of a Petri net contains the state p1, 0, w q, then for any positive integer p, there exists a positive integer q such that p1, 0, p q q is a reachable marking of the Petri net. 10 Assuming the token game starts at time 0, transition t 2 of Petri net P fires at time 3. (a) Automaton A 1 is the initial state. 4 and 5 are accepting (or final) states. Property p is true only in states 1, 2, and 6. (b) Timed Petri net P The delay functions of transitions are constant and indicated by the transitions. Figure 1: Automaton A (1(a)) and Timed Petri net P (1(b)) 13

6 Binary Decision Diagram (10 points) a) [6] Given the boolean expression of function f and the ordering of variables x 1 x 2 x 3 x 4 (i.e., x 1 is the first variable), construct the BDD (Binary Decision Diagram) of f. Merge all equivalent nodes, including the leaves. Note: Use solid lines for True arcs and dashed lines for False arcs. f : px 1 x 2 x 3 q x 4 x 2 x 3 x 4 x 2 x 4 14

b) [2] Consider the BDD of a boolean function g in Fig. 2. Simplify the BDD of g when x 2 is evaluated to 0. g x 1 x 2 x 2 x 3 x 3 0 1 Figure 2: BDD of the boolean function g c) [2] Express g in Fig. 2 as a boolean function. 15

Additional space for question 6 16

7 Petri net (20 points) Throughout this question, we consider the Petri net P in Fig. 3. This question contains 3 independent sub-questions. p1 p2 t1 t2 t3 2 p3 4 t4 p4 2 Figure 3: Petri net P Circles, dots and squares represent places, tokens and transitions, respectively. Arcs weights are marked on the arcs when they are different from 1. Notes X t denotes the transpose of vector X. M t rp 1, p 2, p 3, p 4 s and T t rt 1, t 2, t 3, t 4 s are marking and firing vectors of P respectively. p i denotes the number of tokens in place i. t i denotes the number of firings of transition i. 7.1 Reachability [8 points] a) [2] Derive the incidence matrix A of the Petri net P. b) Consider the firing sequence S t 1 t 3 t 3 t 3 t 3 t 3 t 4 t 3 t 2 and the corresponding firing vector TS t r1, 1, 6, 1s. (i) [2] Assume that S is a valid firing sequence from the initial marking M0 t r1, 1, 0, 0s. Apply the incidence matrix and the state equation of the Petri net P to compute the marking M 1 obtained from M 0 after firing S. (ii) [1] Is S a valid firing sequence with respect to the marking M 0? Why? c) [2] Apply the state equation of the Petri net P to derive the initial marking M 2 for which the marking M3 t r1, 1, 1, 1s is reached after firing the sequence S. d) [1] Assume M 2 is a valid marking. Is it sufficient to conclude that S is a valid firing sequence with respect to M 2? Why? 17

Additional space for question 7.1 18

Additional space for question 7.1 19

7.2 Coverability [4 points] Construct the coverability graph of the Petri net P. Note: The coverability graph is obtained from the coverability tree by merging nodes with the same marking. 20

Additional space for question 7.2 21

7.3 Verification [8 points] We define that the Petri net P is in an accepting state if and only if there is at least one token in the place p 4. Furthermore, we assume that the only observable events are the firing of transitions. For convenience, we denote with t i the event that transition t i fires. For example, t 2 means transition t 2 fires. We define the following properties: A No matter what happens, eventually an accepting state is reached. B No matter what happens, at any point in the execution, there exists a path where eventually an accepting state is reached. a) [4] Write A and B as CTL formulas. b) [4] Does the Petri net P with initial marking M0 t r1, 1, 0, 0s satisfy A? Does it satisfy B? Justify your answers. Note: You may use the results from question 7.2 to help justifying your answers. 22

Additional space for question 7.3 23