Modeling and Performance Analysis with Discrete-Event Simulation

Size: px
Start display at page:

Download "Modeling and Performance Analysis with Discrete-Event Simulation"

Transcription

1 Simulation Modeling and Performance Analysis with Discrete-Event Simulation

2 Chapter 2 Simulation Examples

3 Simulation using a Table Introducing simulation by manually simulating on a table Can be done via pen-and-paper or by using a spreadsheet : Repetition i 1 2 x i1 x i2 Inputs x ij x ip Response y i n Three steps 1. Determine the characteristics of each inputs to the simulation. 2. Construct a simulation table consisting of p inputs x ij, j=1,2,,p one response y i, i=1,2,,n 3. For each repetition i, generate a value for each of the p inputs x ij and j calculate the response y i. Next some simulation examples using tables. Chapter 2. Simulation Examples 3

4 Simulation of Queueing Systems A queueing system is described by Calling population Arrival rate Service mechanism System capacity Queueing eing discipline Calling population Waiting line Server Chapter 2. Simulation Examples 4

5 Simulation of Queueing Systems Single server queue Queueing system state Calling population is infinite System Arrival rate does not change Units are served according FIFO - Server Arrivals are defined by the - Clock distribution of the time between State of the system arrivals inter-arrival time Service times are according to distribution Arrival rate must be less than service rate stable system Otherwise waiting line will grow unbounded unstable system - Units (in queue or being served) - Number of units in the system - Status of server (idle, busy) Events - Arrival of a unit - Departure of a unit Calling population t i+1 t i Arrivals Waiting line Server Chapter 2. Simulation Examples 5

6 Simulation of Queueing Systems Arrival Event If server idle unit gets service, otherwise unit enters queue. Departure Event If queue is not empty begin servicing next unit, otherwise server will be idle. How do events occur? Events occur randomly Interarrival times {1,...,6} Service times {1,...,4} Chapter 2. Simulation Examples 6

7 Simulation of Queueing Systems Customer Interarrival Arrival Time Service Time on Clock Time The interarrival and service times are taken from distributions! Customer Number Arrival Time [Clock] Time Service Begins [Clock] Service Time [Duration] Time Service Ends [Clock] The simulation run is build by meshing clock, arrival and service times! Chapter 2. Simulation Examples 7

8 Simulation of Queueing Systems Chronological ordering of events Clock Time Customer Number Event Type Number of customers 0 1 Arrival Departure Arrival Departure Arrival 1 Number of customers in the system 7 4 Arrival Departure Arrival Departure Departure Arrival Departure 0 Chapter 2. Simulation Examples 8

9 Example 1: A Grocery Analysis of a small grocery store One checkout counter Customers arrive at random times from {1,2,,8} minutes Service times vary from {1,2,,6} minutes Consider the system for 100 customers Problems/Simplifications Sample size is too small to be able to draw reliable conclusions Initial condition is not considered Chapter 2. Simulation Examples 9 Interarrival Time Service Time Probability Cumulative Probability Probability Cumulative Probability

10 Example 1: A Grocery Customer Interarrival Time Arrival Time [Clock] Service Time Time Service Time Service Waiting Time in Time Customer Idle Time of Server [Minutes] [Minutes] Begins Ends Queue in System [Minutes] [Clock] [Clock] [Minutes] [Minutes] Total Chapter 2. Simulation Examples 10

11 Example 1: A Grocery Average waiting time Probability that a customer has to wait Porpotion of server idle time Average service time Average time between arrivals Waiting time in queue 174 w = = = 1.74 min Number of customers 100 Number of customer who wait 46 p( wait) = = = 0.46 Nunber of customers 100 Idle time of server 101 p( idle server) = = = 0.24 Simulation run time 418 Service time 317 s = = = 3.17 min Number of customers 100 ( ) = E s s= 0 s p( s) = L = 3.2 min Times between arrivals 415 λ = = = 4.19 min Number of arrivals Average waiting time of those who wait a + b 1+ 8 E( λ) = = = 4.5 min 2 2 w waited Waiting time in queue = Number of customers that wait 174 = = 3.22 min 54 Average time a customer spends in system t Time customers spend in system 491 = = = 4.91min Number of customers 100 t = w + s = = 4.91min Chapter 2. Simulation Examples 11

12 Example 1: A Grocery Interesting results for a Average of 50 Trials manager, but longer simulation run would increase the accuracy Histogram for the Average Customer Waiting Time Some interpretations Average waiting time is not high Server has not undue amount of idle time, it is well loaded ;-) Nearly half of the customers have to wait (46%) Occurrences (N No. of Trials) ,5 1 1,5 2 2,5 3 3,5 4 4,5 >4.5 Average customer waiting time [min] Chapter 2. Simulation Examples 12

13 Example 2: Call Center Problem Consider a Call Center where technical personnel take calls and provide service Two technical support people (2 server) exists Able more experienced, provides service faster Baker newbie, provides service slower Rule Able gets call if both people are idle Find out how well the current arrangement works Chapter 2. Simulation Examples 13

14 Example 2: Call Center Problem Interarrival distribution of calls for technical support Time between Arrivals [Minute] Probability Cumulative Probability Random-Digit Assignment Service time distribution of Able Service Time [Minute] Probability Cumulative Probability Random-Digit Assignment Service time distribution of Baker Service Time [Minute] Probability Cumulative Probability Random-Digit Assignment Chapter 2. Simulation Examples 14

15 Example 2: Call Center Problem Simulation proceeds as follows Step 1: For Caller k, generate an interarrival time A k. Add it to the previous arrival time T k-1 to get arrival time of Caller k as T k = T k-1 + A k Step 2: If Able is idle, Caller k begins service with Able at the current time T now Able s service completion time T fin,a is given by T fin,a = T now + T svc,a where T svc,a is the service time generated from Able s service time distribution. Caller k s waiting time is T wait = 0. Caller k s time in system, T sys, is given by T sys = T fin,a T k If Able is busy and Baker is idle, Caller begins with Baker. The remainder is in analogous. Step 3: If Able and Baker are both busy, then calculate the time at which the first one becomes available, as follows: T beg = min(t fin,a, T fin,b ) Caller k begins service at T beg. When service for Caller k begins, set T now = T beg. Compute T fin,a or T fin,b as in Step 2. Caller k s time in system is T sys = T fin,a T k or T sys = T fin,b -T k Chapter 2. Simulation Examples 15

16 Example 2: Call Center Problem Caller Interarrival Arrival When When Server Service Time Able s Baker s Caller Time in Nr. Time Time Able Baker Chosen Time Service Delay System Avail. Avail. Begins Service Compl. Time Service Compl. Time Able Able Able Able Baker Baker Total Chapter 2. Simulation Examples 16

17 Example 2: Call Center Problem One simulation trial of 100 Caller delay caller 62% of callers had no delay 12% of callers had a delay of 1-2 minutes 400 simulation trials of 100 caller 80.5% of callers had delay up to 1 minute 19.5% of callers had delay more than 1 minute Average caller delay Chapter 2. Simulation Examples 17

18 Example 3: Inventory System Important class of simulation problems: inventory systems Performance measure: Total cost (or total profit) Parameters N Review period length M Standard inventory level Q i Quantity of order i Chapter 2. Simulation Examples 18

19 Example 3: Inventory System Events in an (M, N) inventory system are Demand for items Review of the inventory Receipt of an order at the end of each review To avoid shortages, a buffer stock is needed Cost of stock Storage space Guards Chapter 2. Simulation Examples 19

20 Appendix: Random Digits Producing Random Numbers from Random Digits Select randomly a number, e.g. - One digit: Two digits: Three digits: Proceed in a systematic direction, e.g. - first down then right - first up then left Chapter 2. Simulation Examples 20

21 Summary This chapter introduced simulation concepts by means of examples Example simulations were performed on a table manually Use a spreadsheet for large experiments (Excel, OpenOffice) Input data is important Random variables can be used Output analysis important and difficult The used tables were of ad hoc, a more methodic approach is needed Chapter 2. Simulation Examples 21