60 likes | 158 Views
WOOD 492 MODELLING FOR DECISION SUPPORT. Lecture 27 Simulation. Review. Simulated a single server queue with Next-event increment method State of the system at each time t N( t ) = number of customers in the queue at time t Random events in the simulation:
E N D
WOOD 492 MODELLING FOR DECISION SUPPORT Lecture 27 Simulation
Review • Simulated a single server queue with Next-event increment method • 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 • Next-event increment has two steps: • Advance time to the time of the next event • Update N(t) Example 16 Wood 492 - Saba Vahid
Example 17: drive-in restaurant simulation • A drive-in restaurant has one queue and two servers for bringing the food to the cars • The cars arrive every 1 to 4 minutes according to the probabilities in the table below. CDF (same as F(x)) values are given in the last column. • Cars wait for the first server who’s free or has been free the longest • The servers have different times for serving cars • Server 1: uniform distribution between 2 to 4 minutes • Server 2: uniform distribution between 3 to 5 minutes Wood 492 - Saba Vahid
Uniform distribution • Uniform distribution: all values have the same probability of occurring • For example: the probability of server 1 taking 3 minutes, or 4 minutes or 2.5 minutes to serve a car is all the same and is calculated as: a and b are min and max values of the random variable x (e.g. 2 and 4 for server 1) • The CDF values for this distribution is: So the probability of a service time smaller than 3 minutes is: (3-2)/(4-2)=50% • The inverse of CDF is calculated with this formula: Where p is the random number you draw and t is the corresponding service time Wood 492 - Saba Vahid
Simulating the drive-in system • Use Next-event increment method • Assume at t=0 there are 2 cars in line and both servers are busy • State of the system = N(t) = number of cars in the line • Potential events: • Arrival of cars (arrival) • Car served by server 1 (exit to 1) • Car served by server 2 (exit to 2) • System transition formula: • Arrival: N(t)=N(t-1)+1 • Exit to 1 or exit to 2 : N(t)=N(t-1)-1 • Simulation clock: moves to the next event time, decided by a random draw and inverse CDF transformation Example 17 Wood 492 - Saba Vahid
Final comments • Exam on November 19th, 9:00 am, same room as usual • Grades will be posted at my door about one week later • Check the course website for any potential updates • Quiz 5 answers posted online • Some extra simulation and network problems will be uploaded next week • Friday, 16th 10 to 12 office hours room 2026 Wood 492 - Saba Vahid