Here we provide another example of how simulation is used in queuing theory.
Students arrive at the head office of Universal Teacher Publications according to the following arrival and service time probability distributions:
Inter-arrival Time (Min.) |
Frequency | Service Time (Min.) |
Frequency |
---|---|---|---|
1 | 1 | 1 | 1 |
2 | 4 | 2 | 4 |
3 | 7 | 3 | 7 |
4 | 17 | 4 | 17 |
5 | 31 | 5 | 31 |
6 | 23 | 6 | 23 |
7 | 7 | 7 | 7 |
8 | 5 | 8 | 5 |
9 | 3 | 9 | 3 |
10 | 2 | 10 | 2 |
Using Monte Carlo Simulation, determine the following:
(a) The average waiting time before service
(b) The average time a student spends in the system
Solution.
From the given distribution of arrivals, the random numbers can be assigned to the arrival times as shown in table 1.
Table 1
Inter-arrival Time (Min.) |
Frequency | Probability | Cumulative Probability |
R.No. |
---|---|---|---|---|
1 | 1 | 0.01 | 0.01 | 0 |
2 | 4 | 0.04 | 0.05 | 1 - 4 |
3 | 7 | 0.07 | 0.12 | 5 - 11 |
4 | 17 | 0.17 | 0.29 | 12 - 28 |
5 | 31 | 0.31 | 0.60 | 29 - 59 |
6 | 23 | 0.23 | 0.83 | 60 - 82 |
7 | 7 | 0.07 | 0.90 | 83 - 89 |
8 | 5 | 0.05 | 0.95 | 90 - 94 |
9 | 3 | 0.03 | 0.98 | 95 - 97 |
10 | 2 | 0.02 | 1.00 | 97 - 99 |
Similarly, the random numbers can be assigned to the service times as shown in table 2.
Table 2
Service Time (Min.) |
Frequency | Probability | Cumulative Probability |
R.No. |
---|---|---|---|---|
1 | 1 | 0.01 | 0.01 | 0 |
2 | 4 | 0.04 | 0.05 | 1 - 4 |
3 | 7 | 0.07 | 0.12 | 5 - 11 |
4 | 17 | 0.17 | 0.29 | 12 - 28 |
5 | 31 | 0.31 | 0.60 | 29 - 59 |
6 | 23 | 0.23 | 0.83 | 60 - 82 |
7 | 7 | 0.07 | 0.90 | 83 - 89 |
8 | 5 | 0.05 | 0.95 | 90 - 94 |
9 | 3 | 0.03 | 0.98 | 95 - 97 |
10 | 2 | 0.02 | 1.00 | 97 - 99 |
The simulation worksheet as shown in table 3 is developed in the following way:
The first random number for inter-arrival time is 17, which corresponds to an inter-arrival time of 4 minutes. This implies that the first student arrives 4 minutes after the head office opens. Since the first student arrives at 10.04 a.m., therefore, the server has to wait for 4 minutes. The random number for service time is 90, which corresponds to a service time of 8 minutes. Thus, the first student leaves the system at 10.12 a.m. (10.04 + .08).
The next random number for inter-arrival time is 86, which corresponds to an inter-arrival time of 7 minutes. Since the second student arrives at 10.11 a.m., but the service can be started at 10.12 a.m. Therefore, he has to wait for 1 minute. Likewise, other values can be calculated.
Table 3
S.No. | R.No. | Inter-arrival time | Arrival Time |
Service starts |
R.No. | Service | Waiting Time | ||
---|---|---|---|---|---|---|---|---|---|
Time | Ends | Server | Student | ||||||
1 | 17 | 4 | 10.04 | 10.04 | 90 | 8 | 10.12 | 4 | - |
2 | 86 | 7 | 10.11 | 10.12 | 59 | 5 | 10.17 | - | 1 |
3 | 84 | 7 | 10.18 | 10.18 | 95 | 9 | 10.27 | 1 | - |
4 | 79 | 6 | 10.24 | 10.27 | 68 | 6 | 10.33 | - | 3 |
5 | 33 | 5 | 10.29 | 10.33 | 51 | 5 | 10.38 | - | 4 |
6 | 55 | 5 | 10.34 | 10.38 | 82 | 6 | 10.44 | - | 4 |
7 | 6 | 3 | 10.37 | 10.44 | 72 | 6 | 10.50 | - | 7 |
8 | 42 | 5 | 10.42 | 10.50 | 1 | 2 | 10.52 | - | 8 |
9 | 93 | 8 | 10.50 | 10.52 | 77 | 6 | 10.58 | - | 2 |
10 | 38 | 5 | 10.55 | 10.58 | 80 | 6 | 11.04 | - | 3 |
Total | 59 | 32 |
Average waiting time before service.
= 32/10 = 3.2 minutes.
Average service time.
= 59/10 = 5.9 minutes
Average time a student spends in the system.
5.9 + 3.2 = 9.1 minutes.