Skip to main content
Modeling & Simulation(IS331)
Tutorial Session 11
Ayman S. Abdelaziz
MONTE CARLO SIMULATION
What is Monte Carlo ?
▪From the previous description we can define Monte Carlo
methods generally as an experimental mathematical tool
that is used to experiment with random numbers to solve or
estimate complex problems.
▪Monte Carlo simulation are usually associated with
problems with theoretical interests or optimizing certain
values with large amount of variables and restrictions
which is otherwise almost impossible to optimize.
▪Unlike discrete event simulation Monte Carlo simulation
are not concerned with the passage of time.
▪The interesting property of Monte Carlo simulation is
that, with the appropriate set up of the problem, it can
be used to solve (or estimate) both deterministic and
stochastic problems as will be explained in the following
examples.
Problem 1
Get the average daily demand for a small grocery store
selling a fresh bread according to the following table:
Note that:
the proportion of balls of a specific color corresponds
exactly to the probability of a specific level of daily
demand.
Solutions
To simulate the daily demand(5 days)
Draw one ball at a time, notice its color and then place it back
in the bowl. Then translate the outcomes into unique values of
demand.
Expected value of simulated demand
= 560/5 = 112 units / day
Analytical solution: Expected daily demand
=100(0.2) + 110(0.5) +120(0.3) = 111 units / day
Problem 2:
Use the one-digit Random Number (6, 3, 5, 0, 8) to generate random
observations for :
Throwing an unbiased coin,
Throwing a die,
The color of a traffic found by a randomly arriving car when it
is green
40% of the time, yellow 10% of the time, and red 50% of the
time.
Solution
To simulate a coin using one digit R.N.(0-9),
let 0 - 4 Represent a Head and
5 – 9 Represent a Tail;
so the solution will be:
(6, 3, 5, 0, 8) R. Observations (T, H, T, H, T)
Solutions
b) To simulate a die using number 0 – 9.
Let: 1 – 6 represents the faces of the die; then
0, 7, 8 and 9 are rejected. So the solution will be
(6, 3, 5, 0, 8) R. Observations (6, 3, 5, reject, reject)
c) Divide 0 – 9 into 3 classes according to the given probability:
Green 40% 0, 1, 2, 3
Yellow 10% 4
Red 50% 5, 6, 7, 8, 9
So (6, 3, 5, 0, 8) R. Observations (Red, Green, Red ,Green, Red)
Problem 3: News boy
A news boy buys paper for 15 P.T. each
and sells them for 25 P.T. each. Unsold
papers have no value in analyzing past
sells, it is found that three demand
distribution exist, depending on news
events in the papers. A good interesting
news day yield to many potential customer,
typical and poor days yield to less interest.
Historically 20% of days have been “good”,
50% “typical”, 30% “Poor”, The demand
distributions are summarized :
Simulate 10 days period and determine
main daily profit, max profit, min profit if
he decides to buy 80 papers each day. Use
the following R.N :-
09 65 69 66 57 64 84 24 92 22
49 50 61 01 45 48 48 45 52
35
Demand Types of new days
Good Typical Poor
40 0.05
50 0.20 0.03
60 0.41 0.07
70 0.26 0.28
80 0.08 0.30 0.02
90 0.25 0.15
100 0.07 0.28
110 0.24
120 0.12
130 0.09
140 0.06
150 0.04
Solutions
Solutions
1st Day:
RN 09 --> Good
RN 65 --> demand = 60
Profit = 60*25 – 80*15 = 300 P.T
2nd Day:
RN 69 --> Typical
RN 66 --> demand = 80
Profit = 80*25 – 80*15 = 800 P.T
3rd Day:
RN 57 --> Typical
RN 64 --> demand = 80
Profit = 80*25 – 80*15 = 800 P.T
4th Day:
RN 84 --> poor
RN 24 --> demand = 100
Profit = 80*25 – 80*15 = 800 P.T ; we calculate with
demand 80 NOT 100 as the newsboy buy only 80 news paper
each day.
Solutions
5th Day:
RN 92 --> poor
RN 22 --> demand = 100
Profit = 80*25 – 80*15 = 800
P.T
6th Day:
RN 49 --> Typical
RN 50 --> demand = 80
Profit = 80*25 – 80*15 = 800
P.T
7th Day:
RN 61 --> Typical
RN 01 --> demand = 50
Profit = 50*25 – 80*15 = 50 P.T
8th Day:
RN 45 --> Typical
RN 48 --> demand = 80
Profit = 80*25 – 80*15 = 800
P.T
9th Day:
RN 48 --> Typical
RN 45 --> demand = 80
Profit = 80*25 – 80*15 =
800 P.T
10th Day:
RN 52 --> Typical
RN 35 --> demand = 70
Profit = 70*25 – 80*15 =
550 P.T
MIN profit: in 7th day which
is 50 P.T
MAX profit: is 800 P.T
Main daily profit:
300+800+800+800+800+800+50+
800+800+550/10=650 PT
Problem 4: The owner of car renting company, pays a penalty for
each accident according to the following distribution:
The accidents occur with the probability of 30% (number of
accidents per day is up to 6). Number of accidents per day
has the following distribution:
Problem 4:
Simulate 12 days. Based on your simulation what is
the minimum money the owner must have to cover the
penalties occurred per day. Use the following R.N:
44 99 15 97 21 47 80 28 87 13 33 42 84
27 64 59 33 84 00 10 50 51 09 31 12 94
96 97 77
Solutions
The probability accidents occur is 30%  00 --> 29
The probability accidents don’t occur is 70%  30 --> 99
Solutions
1st Day:
RN: 92 --> NO ACCIDENT
2ND Day:
RN: 44 --> NO ACCIDENT
3RD Day:
RN: 99 --> NO ACCIDENT
4TH Day:
RN: 15 --> ACCIDENT
RN: 97 --> Number of accidents = 6 accidents.
 1th Accident:
RN: 21 --> Amount of money paid= 50 L.E
 2ND Accident:
RN: 47 --> Amount of money paid= 100 L.E
3rd Accident:
RN: 80 --> Amount of money paid= 150 L.E
4th Accident:
RN: 28 --> Amount of money paid = 50 L.E
5th Accident:
RN: 87 --> Amount of money paid = 200 L.E
6th Accident:
RN: 13 --> Amount of money paid= 50 L.E
Then the total paid in this day = 50 + 100 + 150 + 50 + 200 + 50
= 600 L.E
Solutins:
▪5th Day:
▪RN: 33 --> NO ACCIDENT
▪6TH Day:
▪RN: 42 --> NO ACCIDENT
▪7th Day:
▪RN: 84 --> NO ACCIDENT
▪8th Day:
▪RN: 27 --> ACCIDENT.
▪RN: 64 --> Number of accidents = 5 accidents.
▪1st Accident:
▪RN: 59 --> Amount of money paid = 100 L.E
▪2nd Accident:
▪RN: 33 --> Amount of money paid = 100 L.E
▪3rd Accident:
▪RN: 84 --> Amount of money paid = 150 L.E
▪4th Accident:
▪RN: 00 --> Amount of money paid = 50 L.E
▪5th Accident:
▪RN: 10 --> Amount of money paid = 50 L.E
▪Then the total paid in this day = 100 + 100 + 150 + 50 + 50 =
450 L.E
Solutins:
9TH Day:
RN: 50 --> NO ACCIDENT.
10TH Day:
RN: 51 --> NO ACCIDENT.
11TH Day:
RN: 09 --> ACCIDENT.
RN: 31 --> Number of accidents = 4 accidents
1st Accident:
RN: 12 --> Amount of money paid= 50 L.E
2nd Accident:
RN: 94 --> Amount of money paid= 200 L.E
3rd Accident:
RN: 96 --> Amount of money paid= 200 L.E
4th Accident:
RN: 97 --> Amount of money paid= 200 L.E
Then the total paid in this day = 50 + 200 + 200 + 200 = 650 L.E
12th Day:
RN: 77 --> NO ACCIDENT
Based on the above simulation :- The minimum money the
owner must have to cover the penalties occurred per day
(The maximum paid money in all days) = 650 L.E
References
▪ “Simulation modeling and analysis, Fourth edition”
Averill M. Law, McGraw-Hill.
How to find your course materials?
Via Facebook:
Join this group:
https://www.fb.com/groups/IS331.MUST
How to contact me?
▪Office hours
o TUE: 03:00 to 05:00 P.M
▪You can also contact me through:
o http://fb.com/ayman.shamel
Thanks!
ANY QUESTIONS?
You can find me at:
Ayman_shamel@hotmail.com
Fb.com/ayman.shamel