The University of British Columbia Computer Science 405 Practice Midterm Solutions

Similar documents
EE 368. Weeks 3 (Notes)

Queueing Theory. VK Room: M Last updated: October 17, 2013.

Queuing Analysis. Chapter Copyright 2010 Pearson Education, Inc. Publishing as Prentice Hall

Readings: Finish Section 5.2

Systems Simulation Chapter 6: Queuing Models

Sandwich shop : a queuing net work with finite disposable resources queue and infinite resources queue

ISE/OR 762 Stochastic Simulation Techniques

The exponential distribution and the Poisson process

Slides 9: Queuing Models

Chapter 6 Queueing Models. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation

Introduction to Queuing Theory. Mathematical Modelling

M/G/1 and Priority Queueing

Exercises Stochastic Performance Modelling. Hamilton Institute, Summer 2010

Simulation. Where real stuff starts

ISyE 2030 Practice Test 2

Verification and Validation. CS1538: Introduction to Simulations

BINOMIAL DISTRIBUTION

Simulation & Modeling Event-Oriented Simulations

Simulation. Where real stuff starts

System Simulation Part II: Mathematical and Statistical Models Chapter 5: Statistical Models

MAS1302 Computational Probability and Statistics

CDA6530: Performance Models of Computers and Networks. Chapter 8: Discrete Event Simulation (DES)

PBW 654 Applied Statistics - I Urban Operations Research

Solutions to COMP9334 Week 8 Sample Problems

Probability and Statistics Concepts

Queueing Theory I Summary! Little s Law! Queueing System Notation! Stationary Analysis of Elementary Queueing Systems " M/M/1 " M/M/m " M/M/1/K "

Queueing Theory and Simulation. Introduction

MATH 56A: STOCHASTIC PROCESSES CHAPTER 6

Exercises Solutions. Automation IEA, LTH. Chapter 2 Manufacturing and process systems. Chapter 5 Discrete manufacturing problems

Queuing Theory. The present section focuses on the standard vocabulary of Waiting Line Models.

Figure 10.1: Recording when the event E occurs

Will Landau. Feb 21, 2013

Continuous-time Markov Chains

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

System Simulation Part II: Mathematical and Statistical Models Chapter 5: Statistical Models

Simulation. Version 1.1 c 2010, 2009, 2001 José Fernando Oliveira Maria Antónia Carravilla FEUP

Queuing Theory. Queuing Theory. Fatih Cavdur April 27, 2015

Quiz Queue II. III. ( ) ( ) =1.3333

Course Outline Introduction to Transportation Highway Users and their Performance Geometric Design Pavement Design

HW7 Solutions. f(x) = 0 otherwise. 0 otherwise. The density function looks like this: = 20 if x [10, 90) if x [90, 100]

Continuous Random Variables

Chapter 2 Queueing Theory and Simulation

16:330:543 Communication Networks I Midterm Exam November 7, 2005

COMP9334 Capacity Planning for Computer Systems and Networks

SDS 321: Introduction to Probability and Statistics

Exponential Distribution and Poisson Process

Markov Processes and Queues

IEOR 6711, HMWK 5, Professor Sigman

Queueing Review. Christos Alexopoulos and Dave Goldsman 10/6/16. (mostly from BCNN) Georgia Institute of Technology, Atlanta, GA, USA

Common ontinuous random variables

λ λ λ In-class problems

IEOR 4106: Spring Solutions to Homework Assignment 7: Due on Tuesday, March 22.

Solutions to Homework Discrete Stochastic Processes MIT, Spring 2011

Chapter 8 Queuing Theory Roanna Gee. W = average number of time a customer spends in the system.

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science

Lecture 7: Simulation of Markov Processes. Pasi Lassila Department of Communications and Networking

Introduction to queuing theory

Chapter 1: Revie of Calculus and Probability

Discrete Event Simulation

Basics of Stochastic Modeling: Part II

Page 0 of 5 Final Examination Name. Closed book. 120 minutes. Cover page plus five pages of exam.

Stochastic Models of Manufacturing Systems

Bernoulli Counting Process with p=0.1

Since D has an exponential distribution, E[D] = 0.09 years. Since {A(t) : t 0} is a Poisson process with rate λ = 10, 000, A(0.

Networking = Plumbing. Queueing Analysis: I. Last Lecture. Lecture Outline. Jeremiah Deng. 29 July 2013

Data analysis and stochastic modeling

Chapter 4: Monte Carlo Methods. Paisan Nakmahachalasint

STAT2201. Analysis of Engineering & Scientific Data. Unit 3

Topics for Today. Sampling Distribution. The Central Limit Theorem. Stat203 Page 1 of 28 Fall 2011 Week 5 Lecture 2

Modelling data networks stochastic processes and Markov chains

Review of Queuing Models

Queueing Review. Christos Alexopoulos and Dave Goldsman 10/25/17. (mostly from BCNN) Georgia Institute of Technology, Atlanta, GA, USA

NICTA Short Course. Network Analysis. Vijay Sivaraman. Day 1 Queueing Systems and Markov Chains. Network Analysis, 2008s2 1-1

Class 11 Non-Parametric Models of a Service System; GI/GI/1, GI/GI/n: Exact & Approximate Analysis.

MULTIPLE CHOICE QUESTIONS DECISION SCIENCE

ISyE 6644 Fall 2016 Test #1 Solutions

Introduction to Queueing Theory with Applications to Air Transportation Systems

CDA5530: Performance Models of Computers and Networks. Chapter 4: Elementary Queuing Theory

λ, µ, ρ, A n, W n, L(t), L, L Q, w, w Q etc. These

Continuous Time Processes

Intro to Queueing Theory

Lecture 4: Bernoulli Process

Law of large numbers for Markov chains

STA 584 Supplementary Examples (not to be graded) Fall, 2003

1 st Midterm Exam Solution. Question #1: Student s Number. Student s Name. Answer the following with True or False:

Chapter 2. Poisson Processes. Prof. Shun-Ren Yang Department of Computer Science, National Tsing Hua University, Taiwan

5/15/18. Operations Research: An Introduction Hamdy A. Taha. Copyright 2011, 2007 by Pearson Education, Inc. All rights reserved.

Notes on Continuous Random Variables

Classification of Queuing Models

Queueing systems. Renato Lo Cigno. Simulation and Performance Evaluation Queueing systems - Renato Lo Cigno 1

ISyE 6644 Fall 2014 Test #2 Solutions (revised 11/7/16)

Lecture 13: Conditional Distributions and Joint Continuity Conditional Probability for Discrete Random Variables

Generation of Discrete Random variables

Queuing Theory and Stochas St t ochas ic Service Syste y ms Li Xia

Waiting Line Models: Queuing Theory Basics. Metodos Cuantitativos M. En C. Eduardo Bustos Farias 1

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science

CS 237: Probability in Computing

Output Analysis for a Single Model

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

Chapter 11. Output Analysis for a Single Model Prof. Dr. Mesut Güneş Ch. 11 Output Analysis for a Single Model

Transcription:

The University of British Columbia Computer Science 405 Practice Midterm Solutions Instructor: Kees van den Doel Time: 45 mins Total marks: 100 The solutions provided here are much more verbose than what I expect you to write to give you some additional information. 1. (15) Describe the difference between: a. (3) Discrete time and continuous time simulation. In DT simulation time takes on a discrete set of values, the state changes discontinuously. In cont. time sim. time is a continuous variable. b. (3) Real-time and offline simulation. A real-time simulation is synchronized with actual physical time. It may involve external realworld inputs. An offline simulation runs at its own time rate which can be slower of faster than real time. c. (3) An event and an event notice. An event notice tell you an event is going to happen. THe event is the thing that happens. d. (3) An activity and a delay. An activity is a time period whose duration is known at the time the activity starts. A delay is an unknown time period, which is usually the sum of many activities, some of which do not exist yet. d. (3) A system and a state. A system is a collection of entities that are considered to be a whole. The configuration of a system is completely described by its state, which is a set of (usually time-depent) variables. 2. (15) Briefly explain these concepts: a. (3) Simulation by process interaction. Each entity lives in it s own process and interacts with other processes. b. (3) Central limit theorem. The average of a large number (N) of random variables from the same pdf or pmf follows approximately the normal distribution with the same mean and standard deviation scaled by 1/ N. c. (3) Monte Carlo simulation. The term Monte Carlo Method is very general. A Monte Carlo method is a stochastic technique, meaning that it is based on using random numbers and probability to investigate problems. Monte Carlo methods are employed in a wide variety of fields including economics, finance, physics, chemistry, engineering, and even the study of traffic flows. Each field using Monte Carlo

methods may apply them in different ways, but in essence they are using random numbers to examine some problem and approximate its outcome. As such Monte Carlo methods give us a way to model complex systems that are often extremely hard to investigate with other types of techniques. The term Monte Carlo was introduced by von Neumann and Ulam during World War II, as a code word for the secret work at Los Alamos; it was suggested by the gambling casinos at the city of Monte Carlo in Monaco. The Monte Carlo method was then applied to problems related to the atomic bomb. d. (3) Poisson process. Events are indepent and have constant probability to occur over every small (infinitesimal) time interval. Events have no memory. e. (3) A critical queuing system. A stable system is a system where the queue length does not grow over time. An unstable system is a system where the queue length grows over time. If we slowly increase a variable (say the arrival rate) of a stable system at some point it may change from stable to unstable. At the transition the system is said to be critical. The behavior AT the critical point can be many things. Indeed, the study of critical systems is a discipline in it s own. More general, a system is usually said to be critical when something in the system (called the order parameter changes discontinuously when we change a parameter continuously. In our case the order parameter is lim < QL(t) > t with < QL > the mean queue length. For a stable system it is a constant. If we increase the arrival rate all of a sudden if will jump to infinity. Another example of an order parameter is the resistance to deformation of water. If we decrease the temperature beyond the freezing point water turns into ice and the order parameter jumps from essentially zero to some very large value. 3. (8) Would you recomm to perform a simulation prior to implementing the ideas below? Briefly argue why or why not. a. A large supermarket considers firing 25% of its checkout cashiers to save money. Yes, so we can see if the queue s would be come intolerably large, or: No let s just fire them and if there s a problem we ll hire new ones. b. A pharmaceutical company considers testing a new drug which supposedly slows aging on humans. No, the human aging process is not understood well enough that we can simulate this. c. An architect has come up with a plan for a concert hall in the form of a pyramid. There is some concern this will affect the acoustics. We should simulate the sound in the space, hich involves known acoustical principles. (There is software available to do precisely this.) d. An airplane manufacturer thinks a jet in the shape of a W may have better performance than a V shaped jet and considers sping $100000000 on developing such a machine. Simulation is used extensively in airplane manufacturing. Simulation is a must here. cs405 Page 2 of 6

4. (30) People arrive at a self-service cafeteria at the rate of one every 30 ± 20 seconds. (This notation indicates a uniform distribution over the interval [10 50].) 40% go to the sandwich counter, where one worker makes a sandwich in 60 ± 30 seconds. The rest go to the main counter, where one server spoons the prepared meal onto a plate in 45 ± 30 seconds. All customers must pay a single cashier, which takes 25 ± 10 seconds. For all customers, eating takes 20 ± 10 minutes. After eating, 10% of the people go back for dessert, sping an additional 10 ± 2 minutes in the cafeteria. Construct an event scheduling simulation of this situation, appropriate for measuring the average time spent in the cafeteria per customer. The simulation will have to run for 24 hrs. Define the state space variables. Define the event set. Provide the rules for processing each event. Define the initial state and the initialization of the future event list. You don t have to explain the event scheduling algorithm itself. State = {Q S, Q M, Q C, s, m, c}, where Q S,Q M and Q C are queue lengths : 0..α, s, m and c are busy states (0 1) E = {A, F S, F M, F C, S},corresponding to arrival, finish S, finish M, finish C and stop. State(0) = {0, 0, 0, 0, 0, 0}, and EL(0) = {A(0), S(24)} R A : generate r uniform on [0,1] if(r<.4) if(s==1) qs ++; s=1; create Fs(t +60 ± 30)- >FEL if(m==1) qm ++; m=1; F M (t +45±30)- >FEL F A (t+30±20)->fel R FS if (qs>0) qs--; F S (t+60±30)->fel s=0; if (c==1) cs405 Page 3 of 6

qc++; F C (t+25±10)->fel c=1; R FM if(qm>0) qm--; F M (t+45±30)->fel m=1; qc++; F C (t+25±10)->fel c=1; R FC if(qc>0) qc--; F C (t+25±10)->fel c=0; compute D=20±10; r=rand; if(r<.1) D=D+10±2; //add this delay to all other service times 5. (10) a. (5) How can we generate random numbers on [ 1 1] with pdf P (x) = 3 2 x2 from a uniform random number generator on [0 1]? Generate r, then x = g(r) with g = F 1. F (x) = P (t) dt = x 1 3 2 t2 dt = 2 3 x3 + 1 2 = r x = (2r 1) 1 3 = g(r) cs405 Page 4 of 6

b. (5) Let r be random numbers uniform on [0 1]. What is the pdf P (x) of x = 1/r? Does it have the correct property of a pdf, namely P (x)dx = 1? P (y) = with g = 1, Q(x) = 1 for x [0, 1]. r { Q(g 1 ) d dy g 1 (y) = d dy g 1 (y) = 1 y 2 for y 1 0 y < 1 p(y) dy = 1 1 y 2 dy = 1 (1) 6. (12) Customers arrive at a store according to a Poisson process. The mean interarrival time is 2 minutes. a. (3) What is the probability that at least 2 customers arrive during a time interval of 4 minutes? P n (t) = (λt)n e λt n! with λ = 1 2. 1 P 0 (4) P 1 (4) = 1 e 1 2 4 2e 1 2 4 = 0.5940 b. (3) The first customer arrived after 1 minute. What is the probability that the second customer arrives less than 1 minute later? P = λe λt 1 p(t)dt = 1 1 e 1 2 t dt = e 1 2 t 1 0 = 1 e 1 2 = 0.3935 0 2 0 OR: 1 P 0 (1) = 1 e 1 2 =.3935. c. (3) The first customer arrived after 10 minutes. What is the probability that the second customer arrives less than 1 minute later? Same as b. d. (3) After the store has been open for 8 hours, the number of customers n are counted. What is the probability distribution for n? Give a formula. with λ = 1 2, T = 8 60. p n = (λt )n ) e λt n! 7. (10) A random variable x can take on discrete values (negative integers and 0) as well as continuous values (positive real numbers). It can be modeled by a pdf P (x) for the continuous values and a pmf p(x) for the discrete values. a. (5) Write down a condition that states that the chance of x taking on any value is 1. i=0 p(x) + 0 P (x)dx = 1 cs405 Page 5 of 6

b. (5) Write down a formula for the expectation value < x > of x.. < x >= x=0 xp(x) + 0 xp (x)dx cs405 Page 6 of 6