IEOR 4404: Homework 6

Similar documents
h(x) = f(x)/g(x) = (1 + x)e (1/2)x.

IEOR 4703: Homework 2 Solutions

1 Poisson processes, and Compound (batch) Poisson processes

IEOR 6711, HMWK 5, Professor Sigman

1 Inverse Transform Method and some alternative algorithms

Q = (c) Assuming that Ricoh has been working continuously for 7 days, what is the probability that it will remain working at least 8 more days?

Stat 426 : Homework 1.

arxiv: v2 [math.pr] 24 Mar 2018

Section 7.3: Continuous RV Applications

Exact Simulation of the Stationary Distribution of M/G/c Queues

NEW FRONTIERS IN APPLIED PROBABILITY

Bernoulli Counting Process with p=0.1

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science

1.225J J (ESD 205) Transportation Flow Systems

CS418 Operating Systems

(b) What is the variance of the time until the second customer arrives, starting empty, assuming that we measure time in minutes?

EDRP lecture 7. Poisson process. Pawe J. Szab owski

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

EE126: Probability and Random Processes

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

The exponential distribution and the Poisson process

ISyE 6644 Fall 2016 Test #1 Solutions

Introduction to Queueing Theory with Applications to Air Transportation Systems

Variance reduction techniques

Poisson processes and their properties

Computer Networks More general queuing systems

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

Intro to Queueing Theory

Recap. Probability, stochastic processes, Markov chains. ELEC-C7210 Modeling and analysis of communication networks

Variance reduction techniques

Continuous-time Markov Chains

EE/CpE 345. Modeling and Simulation. Fall Class 5 September 30, 2002

RENEWAL PROCESSES AND POISSON PROCESSES

Simulation. Where real stuff starts

The story of the film so far... Mathematics for Informatics 4a. Continuous-time Markov processes. Counting processes

X i. X(n) = 1 n. (X i X(n)) 2. S(n) n

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

Poisson Processes. Stochastic Processes. Feb UC3M

Manual for SOA Exam MLC.

Queuing Theory. Using the Math. Management Science

Solutions to Homework Discrete Stochastic Processes MIT, Spring 2011

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science

IE 303 Discrete-Event Simulation

Stationary remaining service time conditional on queue length

Exponential Distribution and Poisson Process

NATCOR: Stochastic Modelling

2 Random Variable Generation

Hand Simulations. Christos Alexopoulos and Dave Goldsman 9/2/14. Georgia Institute of Technology, Atlanta, GA, USA 1 / 26

Part I Stochastic variables and Markov chains

Lecture 20: Reversible Processes and Queues

Simulation. Where real stuff starts

Introduction to Queueing Theory

Computer Systems Modelling

Stochastic process. X, a series of random variables indexed by t

Introduction to Queuing Networks Solutions to Problem Sheet 3

M/G/1 and M/G/1/K systems

Discrete-event simulations

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

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

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

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

ACM 116 Problem Set 4 Solutions

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 "

ISyE 3044 Fall 2017 Test #1a Solutions

IEOR 3106: Second Midterm Exam, Chapters 5-6, November 7, 2013

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

Optional Stopping Theorem Let X be a martingale and T be a stopping time such

Performance Modelling of Computer Systems

Qualifying Exam CS 661: System Simulation Summer 2013 Prof. Marvin K. Nakayama

1 Probability and Random Variables

EE126: Probability and Random Processes

Non Markovian Queues (contd.)

Chapter 5. Chapter 5 sections

UCSD ECE 153 Handout #20 Prof. Young-Han Kim Thursday, April 24, Solutions to Homework Set #3 (Prepared by TA Fatemeh Arbabjolfaei)

Fluid Models of Parallel Service Systems under FCFS

Renewal theory and its applications

Queueing Theory and Simulation. Introduction

1 IEOR 4701: Continuous-Time Markov Chains

Introduction to Queueing Theory

18.175: Lecture 14 Infinite divisibility and so forth

Simulation optimization via bootstrapped Kriging: Survey

Lecture 10: Semi-Markov Type Processes

Lecturer: Olga Galinina

6. Bernoulli Trials and the Poisson Process

1 Continuous-time chains, finite state space

Introduction to queuing theory

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

IEOR 6711: Stochastic Models I Fall 2012, Professor Whitt, Thursday, October 4 Renewal Theory: Renewal Reward Processes

ECE353: Probability and Random Processes. Lecture 18 - Stochastic Processes

IEOR 3106: Introduction to Operations Research: Stochastic Models. Professor Whitt. SOLUTIONS to Homework Assignment 2

Glossary availability cellular manufacturing closed queueing network coefficient of variation (CV) conditional probability CONWIP

GI/M/1 and GI/M/m queuing systems

EE 368. Weeks 3 (Notes)

2905 Queueing Theory and Simulation PART IV: SIMULATION

B. Maddah INDE 504 Discrete-Event Simulation. Output Analysis (1)

IEOR 6711: Stochastic Models I SOLUTIONS to the First Midterm Exam, October 7, 2008

Computer Simulation of Repairable Processes

E-Companion to Fully Sequential Procedures for Large-Scale Ranking-and-Selection Problems in Parallel Computing Environments

STAT2201. Analysis of Engineering & Scientific Data. Unit 3

BRANCHING PROCESSES AND THEIR APPLICATIONS: Lecture 15: Crump-Mode-Jagers processes and queueing systems with processor sharing

Transcription:

IEOR 4404: Homework 6. Consider the FIFO GI/GI/ queue as a model for a printer which prints one job at a time according to the distribution G(x) = P (S x) = e x, x 0 ( service time distribution ), and jobs arrive according to a renewal process with iid interarrival times {T n } distributed as A(x) = P (T x) =, x 0. Suppose further that in (+x) 3 addition, there are disasters that occur to the printer according to an indepent Poisson process at rate γ = 0.0 : when a disaster occurs, all jobs in the line (if any) are instantaneously removed (gone), while the job in service (if any) is re-started with a new indepent service time distributed as G. If the system is empty when the disaster occurs, then it has no effect at all on the system. Our objective is to only simulate a copy of L(t ), the total number of jobs in the system at time t > 0. The events are: e (arrival occurs), e 2 (service completion occurs; e.g. departure of a job from service), e 3 (disaster occurs). (a) Confirm that we can generate an interarrival time T via : Generate U, set T = U /3. SOLUTION: Solve y = (+x) 3 to obtain A (y) = ( y) /3 T = ( U) /3. We can replace U by U to get T = U /3.. This yields Confirm that we can generate a service time S via Generate U. Set S = (ln (U)) 2. SOLUTION: Solve y = e x to obtain G (y) = (ln( y)) 2. This yields S = (ln( U)) 2. Similarly we can replace U by U to get S = (ln(u)) 2. We already know that we can generate disaster interarrival times (we will denote by R) since they are exponential at rate γ: Generate U. Set R = γ ln (U). (b) Program up (Pseudo code is provided below) for t = 200, and use your code to generate 0, 000 copies of L(t ) so as to estimate E(l(t )). Redo with γ = 0.05. PSEUDO CODE INITIALIZE: n denotes L(t), t is time, t A time of next arrival, t D time of next service completion, t R time of next disaster. Set γ = 0.0. Generate T distributed as A and generate R distributed as exponential at rate γ n = 0, t A = T, t D =, t R = R. ARRIVAL IS NEXT (e )(min{t A, t D, t R } = t A and t A < t ): n = n +, t = t A. If n = 0, then place new arrival in service: Generate S distributed as G, set t D = t + S. Generate T distributed as A, set t A = t + T. SERVICE COMPLETION IS NEXT (e 2 )(min{t A, t D, t R } = t D and t D < t ): n = n, t = t D. If n, then place next job (in line) into service: Generate S distributed as G, set t D = t + S. Otherwise, if n = 0, then set t D =.

DISASTER IS NEXT (e 3 )(min{t A, t D, t R } = t R and t R < t ): t = t R. If n, then reset n =, and generate a new service time for the job in service: Generate S distributed as G, set t D = t + S. (If n = 0 do nothing.) Schedule next disaster time: generate R exponential at rate γ, set t R = t + R. NEXT EVENT > t (e.g., min{t A, t D, t R } > t ): Stop. Output n. SOLUTION: For γ = 0.0, E(L(t )) 28.8339; and for γ = 0.05, E(L(t )) 30.67. Sample codes in MATLAB as follows: T = 200; n = 0000; % sample size gamma = 0.0; % can change to 0.05 L = zeros(n,); for i = :n % initialization t = 0; n = 0; t_a = (rand)^(-/3)-; t_d = +Inf; t_r = -log(rand)/gamma; % event simulation while(min([t_a t_d t_r]) <= T) if(min([t_a t_d t_r])==t_a) % next event is an arrival n = n + ; t = t_a; if(n-==0) t_d = t + (log(rand))^2; t_a = t + (rand)^(-/3)-; if(min([t_a t_d t_r])==t_d) % next event is a service completion n = n - ; t = t_d; if(n>=) t_d = t + (log(rand))^2; t_d = +Inf; % next event is a disaster t = t_r; if(n>=) n = ; t_d = t + (log(rand))^2; t_r = t - log(rand)/gamma; 2

% return sample result L(i) = n; 2. Consider a non-stationary Poisson process {t n } with rate function: λ(t) = 2 + sin(2πt), t 0. Recall our thinning algorithm for simulating such a point process (Lecture Notes on non-stationary Poisson processes). (a) What is the smallest value of λ > 0 that we can use; e.g., that satisfies λ(t) λ, t 0? SOLUTION: The smallest value of λ = 3 since sin(2πt). (b) Program up the algorithm and give 5 outputs (e.g. 5 runs) for (t,..., t 5 ). For each run, also output how many Poisson rate λ arrivals were needed to obtain the (t,..., t 5 ). SOLUTION: Sample outputs are: Sample codes in MATLAB: output 2 3 4 5 num 8 25 9 9 24 t.840 0.4055 0.5649 0.0443 0.8863 t 2.2863 0.462.2339 0.275.603 t 3.4227.9635 2.5528 0.433 2.2302 t 4 2.030 2.9652 2.6266.0602 3.9655 t 5 2.427 3.077 2.8964.469 4.2439 t 6 2.2503 3.333 3.038.8784 4.2588 t 7 2.3644 3.3432 3.0374 2.053 5.2742 t 8 2.4524 3.9864 3.2597 2.0823 5.495 t 9 2.5003 4.340 3.4747 2.0 5.5628 t 0 3.39 5.323 4.979 2.78 6.078 t 3.889 5.3235 5.2786 2.950 6.2357 t 2 3.375 5.4634 5.4448 2.6972 6.424 t 3 4.224 6.6750 5.489 3.2652 7.243 t 4 4.8829 7.5957 5.5209 3.4547 7.2640 t 5 5.25 8.2997 6.9952 3.4762 7.4448 t = 0; lambda_star = 3; num = 0; % number of arrivals for PP(lambda*) n = 0; % number of arrivals for PP(lambda(t)) Arr = []; while(n < 5) t = t - log(rand)/lambda_star; 3

num = num + ; if(rand<=(2+sin(2*pi*t))/lambda_star) % accept the arrival n = n + ; Arr = [Arr, t]; (c) Let {N (t) : t 0} denote the counting process of the Poisson process at rate λ. Denote its arrival times by {s n }. Recall (Lecture Notes on the Poisson process) that conditional on the event N (t) = n, the vector of the n arrival times (s,..., s n ) has the same joint distribution as the n order statistics 0 < V () < V (n) < t of n iid unforms over (0, t), V,..., V n. Use this fact together with our thinning algorithm to give an algorithm for simulating our non-stationary Poisson process up to a desired time t. First write it up in Pseudo Code, then run it in MATLAB (or Python) giving output (N(t) and the arrival times (t,..., t N(t) )) for when t = 0. Do 5 runs. SOLUTION: PSEUDO CODE Enter t and λ. i. Generate N = N (t) distributed as Poisson with mean α = λ t. ii. If N = 0, then output There are no arrivals by time t and stop. iii. Otherwise (N (t) > 0): A. Generate N i.i.d. uniforms on (0, t), i.e. V,, V N. B. Sort the V i s in ascing order to get the order statistics V () < < V (N ) and set t i = V (i) for i N. C. Set N = 0 and Arr = []. D. For each i =,, N, generate U Unif(0, ). If U λ(t i )/λ, set N = N + and Arr = [Arr, t i ]. E. If N = 0, then output There are no arrivals by time t and stop. Otherwise (N ) output N and Arr. Sample codes in MATLAB: lambda_star = 3; t = 0; % generate N* ~ Poisson(lambda_star*t) N_star = 0; alpha = lambda_star*t; P = rand; while(p>=exp(-alpha)) N_star = N_star + ; P = P * rand; if(n_star==0) disp( There are no arrivals by time t ); V = sort(rand(n_star,)*t); N = 0; Arr = []; for i = :N_star 4

if(rand <= (2+sin(2*pi*V(i)))/lambda_star) N = N + ; Arr = [Arr; V(i)]; if(n==0) disp( There are no arrivals by time t ); disp(n); disp(arr); Sample outputs: Output : N = 8 and the arrival times are (0.3855, 0.8849,.72,.3903, 2.3704, 3.473, 4.3690, 5.4458, 5.7752, 6.263, 6.3305, 6.833, 7.665, 7.3969, 7.474, 7.5947, 8.2946, 9.440). Output 2: N = 20 and the arrival times are (0.30, 0.3982, 0.9532,.0288,.726, 3.078, 3.5870, 3.657, 4.579, 4.285, 4.2467, 4.6206, 4.9936, 6.026, 6.2642, 6.3874, 8.9637, 9.96, 9.4675, 9.832). Output 3: N = 6 and the arrival times are (0.2537, 2.892, 2.4024, 2.859, 2.8903, 2.9438, 3.306, 3.5394, 5.774, 5.760, 6.3072, 7.6334, 8.863, 9.953, 9.3488, 9.499). Output 4: N = 9 and the arrival times are (2.46, 2.307, 3.0496, 3.9, 3.688, 4.2279, 4.2932, 4.96, 5.0660, 5.3448, 5.5036, 6.279, 6.669, 6.7527, 6.8097, 7.3650, 7.4793, 8.9675, 9.823). Output 5: N = 22 and the arrival times are (0.039, 0.2233, 0.2467,.0264,.238, 2.4254, 3.592, 3.6202, 3.7806, 4.096, 4.235, 4.5998, 5.5783, 6.4489, 7.24, 7.235, 7.883, 8.5068, 8.8728, 9.2080, 9.539, 9.949). 3. Electoral College (EC) Vote numbers used in 202, and which will be used in 206 and 2020: In 200, the USA Census was taken and thus the 5 EC numbers slightly changed (but still total to 538). (The Census will be taken again in 2020 at which time new numbers yet again will be determined and used in 2024, and 2028.) Here are the numbers (Alphabetical order by State, including DC= District of Columbia= Washington D.C.): https://www.archives.gov/federal-register/electoral-college/allocation.html Let n i denote the number for state i, i 52. We know that 5 n i = 538. i= (RECALL LECTURE NOTES 7 FROM OUR COURSE WEBSITE.) By Generating 5 iid Bernoulli (/2) rvs, B,..., B 5, you are to simulate a copy of 5 C = n i I{B i = }. i= C represents the outcome for an election (total EC vote) in which each state is equally likely to go to candidate A versus Candidate B (and indepently among states). If C = 269, then it is a tie. 5

Now generate n = million iid copies (sequentially) of C, C,..., C n and use them to estimate the probability of a tie P T : P T ˆP T = n n I{C i = 269}, i= the proportion of runs that led to a tie. Finally, use the above ˆP T to estimate the number of ways there can be a tie, N T, using the fact that P T = N T 2 5, hence N T = 2 5 P T : N T 2 5 ˆPT. SOLUTION: Numerical results ˆP T = 0.0075 and ˆN T =.689 0 3. Sample codes in MATLAB as follows: % input EC numbers n = [9,3,,6,55,9,7,3,3,29,6,4,4,20,,6,6,8,8,4,0,,6,... 0,6,0,3,5,6,4,4,5,29,5,3,8,7,7,20,4,9,3,,38,6,3,3,2,5,0,3]; N = 0^6; % sample size C = zeros(n,); for i = :N B = rand(,5)<=/2; C(i) = sum(n.*b); P_T = mean(c==269) N_T = 2^5*P_T 6