Professional Documents
Culture Documents
2 - Monte Carlo Simulation
2 - Monte Carlo Simulation
Dr. Hakeem–Ur–Rehman
IQTM-PU
1
Outlines
MC Simulation of a Project
2
Different Kinds of Simulation
System Model
The technique “Monte Carlo” derives its name from the city of Monte Carlo in the principality of
Monaco, France, famous for gambling and its casino.
Gambling is the game of probability and random sampling and so is the Monte Carlo Method.
Monte Carlo methods (or Monte Carlo experiments) are a broad class
of computational algorithms that rely on repeated random sampling to obtain numerical results.
(Based on random numbers)
To reflect the relative frequencies of the random variables, the random number mapping method is
used
Simulation-Optimization: Run simulation many times, each time with different parameters, to find
the best (optimal) values of parameters. 4
Monte Carlo Simulation…
5
Monte Carlo Simulation…
“Monte Carlo is a method of approximating things using samples”
Example–1: Using Monte Carlo Simulation to Estimate ‘’
7
Five Steps of Monte Carlo Simulation
The Monte Carlo method can be used with variables that are probabilistic.
8
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. Patients 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 (Minutes) Probability Doctor’s Service time (Minutes) Probability
5 0.5 4 0.3
10 0.3 8 0.5
15 0.2 12 0.2
Constant Random
Random Service time Service time
(Inter-arrival time) Nurse Doctor
Patients (One) (One)
arrive Waiting Area Waiting Area
Determine the average time a patient spends in the doctor’s office from the arrival till leaving using
simulation. 9
Monte Carlo Simulation:
Random Number Mapping Method
Simulation of a Queuing System:
1. What is the average inter-arrival time?
2. What is the arrival rate?
3. What is the average Doctor’s Service time?
4. What is the Doctor’s service rate?
5. What is the average time a patient spends in the doctor’s office from the arrival
till leaving?
6. How many number of patients in the doctor’s office at any given time?
10
Monte Carlo Simulation:
Random Number Mapping Method
Simulation of a Queuing System…
Time between
arrivals [min] Probability
What is the average inter-arrival time?
Avg. inter-arrival time =
5 0.5 Arrival Rate = = 1 / (Avg. inter-arrival time)
10 0.3 = 0.1176 cust. /min.
15 0.2 = 7.059 cust. / hour
What is the average time a patient spends in the doctor’s office from the arrival till leaving?
LITTLE’S LAW Inventory (I) = Flow Rate (R) * Flow Time (T)
Average Number of customers in the system = Arrival Rate X Average time in the System
Ali uses the following inventory policy: if at the end of the week inventory is R = 10 items or less and there is no
outstanding order, then order Q = 25 items. Holding cost $1 per unit per week. Order cost is $45 per order. Order
placed at the end of the week ‘n’ arrives at the beginning of a week ‘n+2’ (i.e. Lead time is 2 weeks). If Ali runs
out of units for which there is demand, they put them on backorder, i.e., the demand is satisfied once the next
order arrives. Backorder cost id $5 per unit per week.
Ali would like to determine the average weekly cost of inventory.
15
Monte Carlo Simulation:
Random Number Mapping Method
Simulation of an Inventory System …
Number of Mapping
Probability Demand per Mapping Order 'Q' when inventory is less than or equal to R and there
Customers (0-99) Probability
Customers (0-99) is no outstanding order.
0 0.1 0-9
Q = 25, R =10
1 0.3 10-39 1 0.1 0-9
Ordering Cost = $45 per order
2 0.25 40-64 2 0.15 10-24
Holding Cost = $1 per unit per week
3 0.2 65-84 3 0.4 25-64 Backorder Cost = $5 per unit per week
4 0.15 85-99 4 0.35 65-99
15
A B C D E
Days Prob. Days Prob. Days Prob. Days Prob. Days Prob.
4 0.4 8 0.4 2 0.5 4 0.8 2 0.5
8 0.4 10 0.2 4 0.5 9 0.2 10 0.5
11 0.2 12 0.4
17
Monte Carlo Simulation:
Random Number Mapping Method
Simulation of a Project…:
7
10
3
5
6
5 Mean duration of the Activity:
Critical Path: A B C F
Project Duration = 25 Days
All Paths:
A B C F (25 days)
A D C F (20 Days)
A D E F (23 Days)
18
Monte Carlo Simulation:
Random Number Mapping Method
Simulation of a Project…:
What is the Probability that project duration will exceed from 27 days? 4/10 = 40%
19
What is the Probability that path ‘ABCF’ is critical? ; ‘ADCF’ is critical? ; ‘ADEF’ is critical?
20