You are on page 1of 9

Monte Carlo Simulation

Service Time
Consider service time distribution shown here (Minutes)
Probability

1 0.4
To obtain a random service time, we need to map an appropriate number of 2 0.35
intergers from 0 to 99 to each service time, according to the probability. 3 0.2
4 0.05
Assume that we have random integers ' Uniformly distributed' in range '0 - 99'

Service Time
Obtained using Excel formula (Minutes)
Probability Mapping
1 0.4 0 - 39
TRUNC(100*RAND()) 2 0.35 40 -74
RANDBETWEEN(0,99) 3 0.2 75 - 94
4 0.05 95 - 99
Monte Carlo Simulation:
Random Number Mapping Method

Simulation of a Queuing System: A doctor's office has one nurse and one doctor. Patients arrive
randomly. Each patient first goes through a check-up with the nurse and then proceeds for a full
check-up by the doctor. Patient may have to wait before being served by the nurse as well as before
being served by the doctor. Service priority is first-in first-out (FIFO). The service time of the nurse
is always 7 minutes, but the service time of the doctor is random. The distributions of the time
between arrivals and the service time of the doctor are given below:

Time Between Arrivals Doctor's Service Time


Probability Probability
(Minutes) (Minutes)
5 0.5 4 0.3
10 0.3 8 0.5
15 0.2 12 0.2

Customer Service Random Service


Time Time
Random (Inter-arrival
Time)
Nurse (One) Doctor (One)
Patients arrive
Waiting Area Waiting Area

Determine the average time a patient spends in the doctor's office from the arrival till leaving using
simulation
Monte Carlo Simulation:
Random Number Mapping Method
Simulation of a Queuing System:

Time Between Arrivals


(Minutes)
Probability What is the average inter-arrival time? E(X) = å XP(X)
5 0.5 Avg. Inter-arrival time = 1/g = 0.5(5) + 0.3(10) + 0.2(15) = 8.5 min
10 0.3 Arival Rate = g = 1 / (avg. inter-arrival time)
15 0.2 = 0.1176 cust. / min
= 7.059 cust. / hour

Doctor's Service Time


(Minutes)
Probability Doctor's Service Time:
4 0.3 What is the average Service time? E(X) = å XP(X)
8 0.5 Avg. Service time = 1/m = 0.3(4) + 0.5(8) + 0.2(12) = 7.6 min
12 0.2 Service Rate = m = 1 / (avg. Avg. Service time)
= 0.1316 cust. / min
= 7.895 cust. / hour

Nurse's Service Time:


Avg. Service time = 1/m = 7 min

Service Rate = m = 1 / 7 = 0.1429 cust. / min. = 8.57 cust. / hour


Monte Carlo Simulation:
Random Number Mapping Method
Simulation of a Queuing System:

Time Between Arrivals Mapping Doctor's Service Time Mapping


Probability Probability
(Minutes) (0 - 99) (Minutes) (0 - 99)
5 0.5 0 - 49 4 0.3 0 - 29
10 0.3 50 - 79 8 0.5 30 - 79
15 0.2 80 - 99 12 0.2 80 - 99

What is the average time a patient spends in the doctor's office from the arrival till leaving?

Nurse Doctor
Inter-
Arrival Arival Time Waiting Random Service Waiting Time in
Customer Random Number Start Service Time Finish Start Finish
Time (Cumulative) Time Number Time Time System
(Minutes)
1 48 5 5 5 7 12 0 12 5 4 16 0 11
2 42 5 10 12 7 19 2 19 53 8 27 0 17
3 74 10 20 20 7 27 0 27 55 8 35 0 15
4 51 10 30 30 7 37 0 37 57 8 45 0 15
5 52 10 40 40 7 47 0 47 80 12 59 0 19

Agerage time in the System" = (11+17+15+15+19)/5 = 15.4 Min.


Nurse
Random Inter-Arrival Arival Time Service
Customer Start Finish
Number Time (Minutes) (Cumulative) Time

1 98 15 15 15 7 22
2 35 5 20 22 7 29
3 48 5 25 29 7 36
4 99 15 40 40 7 47
5 40 5 45 47 7 54
6 25 5 50 54 7 61
7 72 10 60 61 7 68
8 48 5 65 68 7 75
9 71 10 75 75 7 82
10 68 10 85 85 7 92
11 69 10 95 95 7 102
12 64 10 105 105 7 112
13 91 15 120 120 7 127
14 13 5 125 127 7 134
15 93 15 140 140 7 147
16 5 5 145 147 7 154
17 52 10 155 155 7 162
18 71 10 165 165 7 172
19 90 15 180 180 7 187
20 11 5 185 187 7 194
rse Doctor
Waiting Random Service Waiting Time in
Start Finish
Time Number Time Time System

0 22 47 8 30 0 15
2 30 9 4 34 1 14
4 36 91 12 48 0 23
0 48 64 8 56 1 16
2 56 71 8 64 2 19
4 64 93 12 76 3 26
1 76 99 12 88 8 28
3 88 39 8 96 13 31
0 96 73 8 104 14 29
0 104 64 8 112 12 27
0 112 24 4 116 10 21
0 116 65 8 124 4 19
0 127 61 8 135 0 15
2 135 46 8 143 1 18
0 147 39 8 155 0 15
2 155 59 8 163 1 18
0 163 73 8 171 1 16
0 172 39 8 180 0 15
0 187 66 8 195 0 15
2 195 44 8 203 1 18
Average time in System = 19.9
Average Customer in system (per hour) = 2.34
Time between arivals [min] Probability Mapping (0-99)
5 0.5 0-49
10 0.3 50-79
15 0.2 80-99
Expected time between arrivals [min] = 8.5 =SUMPRODUCT(R5:R7,Q5:Q7)
Arrival rate [customers/min] = 0.1176 =1/8.5
Arrival rate [customer/hour] = 7.059 =0.1176*60

Doctor's service time [min] Probability Mapping (0-99)


4 0.3 0-29
8 0.5 30-79
12 0.2 80-99
Expected service time [min] = 7.6 =SUMPRODUCT(Q16:Q18,R16:R18)
Service rate [customers/min] = 0.1316 =1/7.6
Service rate [customer/hour] = 7.895 =0.1316*60
,R16:R18)
Average time
Experiment in system
[Min.]
1 16.05
2 17.55
3 22.25
4 15.25
5 23.45
6 17.85
7 23.10
8 16.25
9 19.80
10 22.85

n 10
mean 19.44
stdev 3.240

95% confidence interval


Lower Value 17.432
Upper Value 21.448

You might also like