Simulation Modeling
Simulation
Tosimulate is to try to duplicate the
characteristics of a real system
We will study mathematical simulation models
of real systems to help make business decisions
Imitate real-world situation mathematically.
Study its properties and operating characteristics.
Draw conclusions and make action decisions based
on results of simulation.
Simulationis one of the most widely used
decision modeling techniques
The Process of Simulation
Advantages of Simulation
1. Flexibility
2. Can handle large and complex systems
3. Can answer “what-if” questions
4. Does not interfere with the real system
5. Allows study of interaction among
variables
6. “Time compression” is possible
7. Handles complications that other methods
can’t
Disadvantages of Simulation
1. Can be expensive and time consuming
2. Does not generate optimal solutions
3. Managers must choose solutions they
want to try (“what-if” scenarios)
4. Each model is unique
Monte Carlo Simulation
Can be used with variables that are
probabilistic (exhibit chance, random,
stochastic behaviour)
Experimentation based on chance elements
through random sampling.
Steps:
1. Determine the probability distribution for each
random variable
2. Use random numbers to generate random values
3. Repeat for some number of replications
Random Variables (RV’s)
There are many random variables in real life where
there is uncertainty, such as:
Product demand
Lead time for orders to arrive
Time between equipment breakdown
Service time
Times between arrivals at a service facility.
Times to complete project activities.
Number of employees absent from work each day
Step 1: Determine the Probability
Distribution for Each RV
There are many different probability
distributions (e.g. general discrete, normal,
Poisson, uniform, exponential, binomial,
triangular, beta, gamma, weibull, etc.)
Usually use historical data to determine
which distribution “fits” best
Step 2: Use Random Numbers
to Generate Random Values
Random numbers are where all values are
equally likely
Rolling a single die generates random numbers
between 1 and 6
Using two-digit random numbers (00 to 99) the
probability of each is 1/100 or 0.01
Random numbers can come from a computer, a
table, a roulette wheel, etc.
Random Number Mapping
First calculate cumulative distribution: F(x)
Next make random number assignments (called
random number mapping).
This is an assignment of a range of random numbers
to each value of the random variable.
Each range must be mutually exclusive (no overlap)
All ranges must be collectively exhaustive
Each range is as wide as the probability value
Random numbers go from 0.0 – 0.9 (10) or from
0.00 – 0.99 (100) or 0.000 – 0.999 (1,000) or from
0.0000 – 0.9999 (10,000), etc. They do not reach 1
Random Number Mapping
Then if we are simulating manually
1. We must be given random numbers
2. We cannot do replications
In Excel (we can do replications)
1. We use Excel’s built in generator to get the random
number
2. We use a Lookup Table along with the VLookup
function to replicate general discrete RVs
3. Choose appropriate column headings and link
together
Using Random Numbers
to Simulate Demand
Once we have done random number mapping, this is
what we have achieved:
Each value of the random variable is mapped (associated
with) to a specific range of the random numbers.
These ranges are mutually exclusive and collectively
exhaustive. That is, each value has a unique range and all
possible values are covered
Simulation is an INVERSE transformation. That is,
given a probability, we find the value of the random
variable. The probability is the random number.
Step 3: Replication of the Simulation
When we simulate in Excel, we can replicate the
simulation
Repeatedly draw a random number and
determine the demand for a particular month
A simulation must be replicated (or repeated)
many times to cover the full range of variability
and obtain meaningful results
Determine The Headings
Simulating the random variable (s) is easy.
The challenge is to get the various headings
and link them together in logical order.
One approach to determine the headings is to
begin with the ultimate objective in mind, and
work backwards until you disaggregate the
objective into independent units (variables)
Sunrise Bakery Example
Sunrise Bakery has decided to bake 20 loaves of its
famous sourdough bread at the beginning of the day.
Monthly demand for bread follows a general discrete
probability distribution
Each loaf costs Sunrise $1.50 and can be sold for $3.
Sunrise sells any unsold loaves for $0.75 the next day.
Sunrise Bakery Example
Simulate 25 days of sales to find the average daily
profit.
Use a one-way data table to replicate this average daily
profit 1,000 times.
Sunrise Bakery would like to investigate the profitability
of baking 5, 10, 15, 20, 25, or 30 loaves at the start of
the day. Use a two-way data table with 1,000
replications to recommend a quantity to bake.
Graph the average daily profit versus baking level from
this new result. Use bar chart.
Sunrise Bakery Example
• Create the cumulative distribution: F(x)
• Assign the Random Number Mapping (Ranges)
25 Random Number for Sunrise Bakery
Manual Simulation
0.34 0.11 0.72
0.41 0.81 0.75
0.77 0.51 0.26
0.92 0.36 0.81
0.12 0.96 0.55
0.87 0.03 0.50
0.50 0.82 0.96
0.14 0.74 0.87
0.80
25 Random Number for Sunrise Bakery
Manual Simulation
• Use these 25 random numbers to simulate 25 days of
operations.
• Each random number is used to represent the demand
that randomly occurs that day.
• What are the headings for the simulation?
First suppose we generate demand, then we must determine
How many items will be sold
Are there any left over?
Today (full price) Sales Revenue and Next Day Revenue
Cost and Profit
Average Profit
Simulation Software Packages
• General purpose languages
(Visual Basic, C++, Fortran, etc.)
• Special purpose languages and programs
(GPSS, Simscript, Microsaint, BuildSim, etc.)
• Spreadsheet models
Generating Random Values in Excel
• To generate random numbers between 0
and 1, use: = RAND()
• Using this with various formulas allows
generating RV’s from a variety of
distributions, including normal, uniform,
exponential, and general discrete
The Spreadsheet
Step 3 - Repeat Process for
Series of Trials
It is very risky to draw any hard and fast conclusion
regarding simulation model from only few simulation
trials. Like making inference from small samples
It is likely that one will get different values for average
from short simulation of few days.
Run simulation model for several thousand trials in
order to gather meaningful results.
Data Table is very handy to replicate the simulation
Sunrise Bakery Example M12 = I 39
One-way data table with
1,000 rows
Make M12 = I39
Select rectangle
Select Data | Table
No row input cell
Column input cell = any Simulation was
blank cell. (L11 chosen) replicated
OK without
Most of the rows are changing any
hidden input. Random
Find average of the numbers actually
1,000 changed
Sunrise Bakery Replications (2)
Here we are examining what is the BEST
quantity to bake
Always select Tools | Options | Calculation | Automatic
Except Tables
Two-way data table with 1,000 rows
M12:R12 contain different quantities to try and bake
Make M12 = I39
Select the rectangle then Data | Table
Row input cell = B8 (cell with original baked quantity)
Column input cell = any blank cell. L10 chosen
OK
Most of the rows are hidden
Find statistics of the 1,000 rows for each decision level
25 (for now) gives highest expected profit
Sunrise Bakery Example
Chart of Expected Profit per Quantity
Bar chart shows the results of this simulation
Press F9 and the results may change
The Uncertainty of Sampling
The replications of our model represent a sample from
the (infinite) population of all possible replications.
Suppose we repeated the simulation and obtained a
new sample of the same size.
Q: Would the statistical results be the same?
A: No!
As the sample size (# of replications) increases, the
sample statistics converge to the true population
values.
We can also construct confidence intervals for a
number of statistics...
Sample Statistics
At the end of the data table simulation, we always
collect summary statistics. These include, mean
(average), minimum, maximum, standard deviation and
confidence intervals.
•For example. For data in cells N13:N1012
Average N1013 = AVERAGE(N13:N1012)
Standard Deviation: N1014 = STDEV(N13:N1012)
Minimum N1015 = MIN(N13:N1012)
Maximum N1016 = MAX(N13:N1012)
For confidence interval discussion see next slide
Constructing a Confidence Interval
for the True Population Mean
s
95% Lower Confidence Limit = x -1.96
n
s
95% Upper Confidence Limit = x 1.96
n
Where (n is the number of rows in data table):
x the sample mean
s = the sample standard deviation
n = the sample size (and n 30)
Note that as n increases, the width of
the confidence interval decreases.
Simulating Random Variables
• In Probability we studied discrete and continuous
random variables. The Discrete are
General discrete; Binomial; Poisson; Geometric;
Multinomial; Hypergeometric
• The Continuous Random Variables are:
Uniform*; Exponential and Normal.
*The Uniform can be both discrete and continuous
• There are other continuous like
Triangular; Beta; Gamma; Erlang; Lognormal