You are on page 1of 21

STAT 32562

Statistical
simulation
1
 A queuing system is described by its calling population, the nature of the arrivals,
the service mechanism, the system capacity and the queuing discipline.
 In a queuing system, customers arrive from time to time and join a queue or
waiting line, are eventually served and finally leave the system.

2
Eg:
Single
channel / server
queue

The calling population is infinite.


Arrivals for service occur one at a time in a random fashion.
service times according to a probability distribution does not change over time.
Units are served in the order of their arrival (FIFO).

3
Some important points-:

The overall effective arrival rate must be less than


the total service rate for any queue.
The state of the system refers to the number of
units and the status of the server.
The simulated clock is used to track the simulated
time.
Queuing systems simulation requires an event list
to determine what happens next.
Event list tracks future times for different types of
events.
Simulation table is customized for each problem
to calculate arrival and departure times.

Statistical models are used to develop the


simulation based on data or subjective estimates.
Randomness is used in simulation to mimic real-
life uncertainty.
4
Queue Status

Nonempty Empty

Server Busy Enter queue Enter queue


status
Idle Impossible Enter service

5
Example 1:
• Let’s consider a single channel queuing simulation.

• Here inter-arrival times and service times are generated from the distributions of these random

variables.

• Table l contains a set of five inter-arrival times, and these are used to compute the arrival times of six

customers at the queuing system.

• Table 2 contains service times for each customer.

6
Example 1 cont…
Table 1: Inter arrival and Clock Times Table 2: Service Times
Customer Inter arrival time Arrival time on clock Customer Service Time
1 2
1 - 0
2 1
2 2 2
3 3
3 4 6
4 2
4 1 7
5 1
5 2 9
6 4
6 6 15

1. Find the average waiting time for a customers.


2. Find the probability that a customer has to wait in the queue

7
Example 1 cont…
Event Type Customer Clock Time
Number
Arrival 1 0
Departure 1 2
Arrival 2 2
Departure 2 3
Table 3: Chronological Ordering of Events Arrival 3 6
Arrival 4 7
Departure 3 9
Arrival 5 9
Departure 4 11
Departure 5 12
Arrival 6 15
Departure 6 19

8
Example 1 cont…
Table 4: Summarizing Table Emphasizing Times

Customer Arrival time Time service Service Time Server Idle Waiting
number (Clock) begins Time Service Time Time
(Duration) Ends(Clock)
1 0 0 2 2 0 0
2 2 2 1 3 0 0
3 6 6 3 9 3 0
4 7 9 2 11 0 2
5 9 11 1 12 0 2
6 15 15 4 19 3 0

9
Example 1 cont…

Answers :

𝑇𝑜𝑡𝑎𝑙 𝑡𝑖𝑚𝑒 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 𝑤𝑎𝑖𝑡 𝑖𝑛 𝑞𝑢𝑒𝑢𝑒


1. Average waiting time for a customer =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠
4
= = 0.667 minutes
6

𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 𝑤ℎ𝑜 ℎ𝑎𝑠 𝑡𝑜 𝑤𝑎𝑖𝑡


2. Probability that a customer has to wait in the queue =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠
2
= = 0.333
6

10
Example 2:
A small grocery store has only one checkout counter. Customers arrive at this checkout counter at random times
that are from 1 to 8 minutes apart. Each possible value of inter-arrival time has the same probability of
occurrence, as shown in table 1. The service times vary from 1 to 6 minutes, with the probabilities shown in table
2. The problem is to analyze the system by simulating the arrival and service of 10 customers.

Then find
1. The average waiting time of a customer.
2. The probability that a customer has to wait in the queue.
3. The proportion of idle time of the server.

11
Example 2 cont…
Table 1: Distribution of Time between Arrivals Table 2: Service Times
Time Probability Cumulative Random
between Probability Digit Service Probability Cumulative Random
arrivals Assignment Time(Min) Probability Digit
(Min) Assignment
1 0.125 0.125 000-124 1 0.10 0.1 00-09
2 0.125 0.250 125-249 2 0.20 0.3 10-29
3 0.125 0.375 250-374 3 0.30 0.6 30-59
4 0.125 0.500 375-499
4 0.25 0.85 60-84
5 0.125 0.625 500-624
5 0.10 0.95 85-94
6 0.125 0.750 625-749
7 0.125 6 0.05 1.00 95-99
0.875 750-874
8 0.125 1.000 875-999

12
Example 2 cont…
Inter arrival time Service time
Customer Random Digit Time between Customer Random Digit Service Time
Number arrivals Number
1 - - 1 84 4
2 913 8 2 09
10 1
3 727 6 3 74 4
4 15 1 4 53 3
5 948 8 5 17 2
6 309 3 6 79 4
7 412 4 7 42 3
8 102 1 8 61 4
9 545 5 9 32 3
10 300 3 10 98 6

13
Example 2 cont…
Summarizing Table Emphasizing Times
Customer Inter Arrival time Service Time Waiting Time service Time Idle time of
Number arrival (Clock time) time service time end (Clock spent in server
time begins time) system
(Clock time)
1 - 0 4 0 0 4 4 0
2 8 8 1 8 0 9 1 4
3 6 14 4 14 0 18 4 5
4 1 15 3 18 3 21 6 0
5 8 23 2 23 0 25 2 2
6 3 26 4 26 0 30 4 1
7 4 30 3 30 0 33 3 0
8 1 31 4 33 2 37 6 0
9 5 36 3 37 1 40 4 0
10 3 39 6 40 1 46 7 0
14
Example 2 cont…
Answers:
𝑇𝑜𝑡𝑎𝑙 𝑡𝑖𝑚𝑒 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 𝑤𝑎𝑖𝑡 𝑖𝑛 𝑞𝑢𝑒𝑢𝑒
1. Average waiting time for a customer =
𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠
7
= = 0.7 minutes
10

𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠 𝑤ℎ𝑜 𝑤𝑎𝑖𝑡


2. Probability that a customer has to wait in the queue = 𝑇𝑜𝑡𝑎𝑙 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑐𝑢𝑠𝑡𝑜𝑚𝑒𝑟𝑠
4
= 10
= 0.4

𝑇𝑜𝑡𝑎𝑙 𝑖𝑑𝑙𝑒 𝑡𝑖𝑚𝑒


3. Proportion of idle time of the server = 𝑇𝑜𝑡𝑎𝑙 𝑡𝑖𝑚𝑒 𝑠𝑝𝑒𝑛𝑑 𝑖𝑛 𝑡ℎ𝑒 𝑠𝑦𝑠𝑡𝑒𝑚
12
= = 0.260 minutes
46

15
more than one service channels
Example 3:
.

Consider a computer technical support center where personnel take calls and provide service. The time
between calls ranges from 1 to 4 minutes, with distribution as shown in Table1. There are two technical
support perons-: Able and Baker. Able is more experienced and can provide service faster than Baker.
The distributions of their service times are shown in Tables 2 and Table 3. Problem is to find out how
well the current arrangement is working.

16
Example 3 cont…

Table 1- Inter-Arrival Distribution of calls for Technical Support

Time Between Probability Cumulative Random Digit


Arrivals Probability Assignment
(Minutes)
1 0.25 0.25 00-24
2 0.40 0.65 25-64
3 0.20 0.85 65-84
4 0.15 1.00 85-99

17
Example 3 cont…

Table 2- Service Distribution of Able Table 3- Service Distribution of Baker

Service Probability Cumulative Random Service Probability Cumulativ Random


Time Probability Digit Time (Min) e Digit
(Min) Assignment Probability Assignment
2 0.30 0.30 00-29 3 0.35 0.35 00-34
3 0.28 0.58 30-57 4 0.25 0.60 35-59
4 0.25 0.83 58-82 5 0.20 0.80 60-79
5 0.17 1.00 83-99 6 0.20 1.00 80-99

18
Summarizing Table Emphasizing Times
Custome Random Time Arrival Random Able Baker Time in
r digits between time digits queue
number for arrivals (Clock for Time Service Time Time Service Time
arrivals time) service service time service service time service
begins ends begins ends

1 - - 0 95 0 5 5 0
2 26 2 2 21 2 3 5 0
3 98 4 6 51 6 3 9 0
4 90 4 10 92 10 5 15 0
5 26 2 12 89 12 6 18 0
6 42 2 14 38 15 3 18 1
7 74 3 17 13 18 2 20 1
8 80 3 20 61 20 4 24 0
9 68 3 23 50 23 4 27 0
10 22 1 24 49 24 3 27 0

19
Example 3 cont…

 Assumptions that can be made under the problem :


 Service times and inter arrival times are discrete.
 Able gets the call if both technical support people are idle.

 What can you say about the current system? :


 Over the 62-minute period Able was busy 92.6% of the time.
 Baker was busy only 48.1% of the time. The seniority rule keeps Baker less busy (and gives Able
more tips).
 Two of the 10 arrivals (about 20%) had to wait. The average waiting time for all customers was
only about 0.20 minute (12 seconds), which is very small.
 Those two who did have to wait only waited an average of 1 minutes, which is quite low.

20
21

You might also like