WOOD 492 MODELLING FOR DECISION SUPPORT Lecture 25 Simulation
Review Simulation: used to imitate the real system using computer software, helpful when system is too complex or has many stochastic elements Discrete event simulation: if the state of the system changes at random points in time as a result of various events Different probability distributions are used for different purposes Nov 5, 2012Wood Saba Vahid2
Distributions Various probability distributions are used for different random events Poisson : distribution of number of arrivals per unit of time Exponential : distribution of time between successive events (arrivals, serving customers,…) Uniform: for random number generation Normal : for some physical phenomenon's, normally used to represent the distributions of the means of observations from other distributions Binomial: coin flip … Nov 5, 2012Wood Saba Vahid3
Cumulative Distribution Function (CDF) Nov 5, 2012Wood Saba Vahid4 f(x) F(x) x x 1.0 t t Highlighted area: P(x<=t) P(x<=t)
Example 16 – A discrete event simulation Simulate a queuing system : –One server –Customers arrive according to a Poisson distribution (mean arrival rate λ = 3 per hour) –Service rate changes according to a Poisson distribution (mean service rate μ = 5 customers per hour) Nov 5, 2012Wood Saba Vahid5
Probability reminder Nov 5, 2012Wood Saba Vahid6
Example 16 – Queuing system State of the system at each time t – N(t) = number of customers in the queue at time t Random events in the simulation: –Arrival of customers (mean inter arrival times are 1/3 hour) –Serving the customers (mean service times are 1/5 hour) System transition formula: –Arrival: reset N(t) to N(t)+1 –Serve customer: reset N(t) to N(t)-1 How to change the simulation clock (2 ways) : 1.Fixed-time increment 2.Next-event increment Nov 5, 2012Wood Saba Vahid7
Fixed-time increment for Example 16 Nov 5, 2012Wood Saba Vahid8
Using random numbers to generate events To see if the events should occur or not, we use a random number generator to generate a uniform random number between [0,1] (e.g. in Excel there is a RAND() function that does this) If the random number is less than the calculated probability (in previous slide) we accept the event, if not we reject it. let’s assume we’ve generated a random number for the arrival of customers with Rand() function, random_A= Random_A < so we accept the arrival We must generate a new random number for each case, so let’s assume random_D= Random_D >= so we reject the departure N(1) = N(0)+ 1 (arrival) – 0 (departure) = 0+1=1 Nov 5, 2012Wood Saba Vahid9 Example 16