2. 2
Week 14
Simulation Using Excel
HW 12: Posted to Canvas
Quiz 5: Next week on Integer Programming and
Simulation
Next Week:
• Project Work
• Final Thoughts and Review
Note Exam 3: Cover all materials from Week 1
3. 3
Ways To Study A System*
*Simulation, Modeling & Analysis (3/e) by Law and Kelton, 2000, p. 4, Figure 1.1
4. 4
Motivating Example
A company manufactures and sells a particular
product.
How many units should they plan to produce this
month for sale next month?
Complicating factors:
• Next month’s demand is uncertain
•Normally distributed (μ = 50000, σ = 1000)
• Raw material costs are uncertain
•Per-unit raw material costs somewhere between
$22 and $25
5. 5
Decisions and Uncertainty
Most decisions are made in the face of uncertain/
random events
Said differently…
• If we could see into the future, the best course of
action would be easy to choose
• But because we can’t predict the future, we make our
best guess based on whatever partial information we
have about the future
Monte Carlo simulation is a tool to describe the
uncertainty in complex situations
7. 7
Simulation
University (or your workplace) simulates a fire
evacuation procedure
Company simulates how its digital photo paper
performs after years of exposure to light
A new amusement park uses software to simulate lines
before opening day
A meteorologist simulates a thunderstorm on computer
simulation - representation of the operation or features of one
process or system through the use of another
8. 8
Select best course
Examine results
Conduct simulation
Specify values
of variables
Construct model
Introduce variables
The
Process of
Simulation
Define problem
9. 9
Simulation Model
A simulation model is a computer model that imitates a
real-life situation.
Like other decision models, it has parameters (uncontroll-
able inputs), decision variables (controllable inputs), and
outputs (objective, consequences, etc.)
Simulation model incorporates uncertainty in one or more
parameters (uncontrollable inputs)
Simulation
Model
Parameters
Decision
Variables
Objective
Consequences
Determined by
decision-maker
Some of them are
random inputs
Probability and
statistics
Spreadsheet
10. 10
Monte Carlo Simulation
(MCS)
MCS simulates the uncertain inputs (and their
consequences) via repeated random sampling
Shows the effect of uncertain inputs in a statistical
setting
Imagine a situation having uncertain inputs with
known probability distributions…
Random sampling is using a computer to generate a
number from a given probability distribution
11. 11
Real Applications of Simulation
Many companies (Cummins Engine, Merck, Proctor &
Gamble, and United Airlines, to name only a few) have
used simulation to determine which of several possible
investment projects they should choose.
Simulation can help answer questions such as:
Which project is the riskiest?
What is the probability that an investment will yield at
least a 20% return?
What is the probability that the NPV of an investment
will be less than - $1 billion, which is a loss of more
than $1 billion?
12. 12
Advantage and Benefit of Simulation Models
It shows an entire distribution of results, not simply a
single bottom-line result.
Each different set of values for the uncertain inputs can
be considered a scenario. Simulation allows us to
generate many scenarios, each leading to an output
value. In the end, we see a whole distribution of the
output values.
Simulation models are useful for determining how
sensitive a system is to changes in operating conditions.
13. 13
Process for Developing and
Using a Simulation Model
Select the best input probability
distributions for uncontrolled variables
(e.g. demand, raw material cost, etc).
Build the simulation model.
Generate outputs from several values of
variables.
Select the “best” course of action.
14. 14
Selecting an Input Probability Distribution
There are several ways to chose an appropriate input
distribution.
Use a histogram with historical data.
Compare the assumptions of a distribution with the
input characteristics.
Use distribution fitting features in software to compare
potential distributions to actual data.
A good distribution will both fit the theoretical
assumptions of the variable and match the distribution of
values from that variable.
15. 15
Using Probability Distributions to model
uncertainty
Note: Generate random numbers between 0 and 1 using
Rand()
The following distributions are often used:
For Discrete Uniform Distribution: RANDBETWEEN(a, b)
For Continuous Uniform Distribution: a + (b-a)*RAND( )
For Normal Distribution: NORMINV( )
For Binomial Distribution: BINOMINV()
General formula: = *INV(RAND( ), parameter values), where
* is the name of the distribution
Example: =NORMINV(RAND( ), mean, standard
deviation)
LOOKUP and ROUND functions might come handy as well
16. 16
Building the Simulation Model
Create the spreadsheet model using decision variables,
random inputs, and formulas to create outputs of interest.
Use good spreadsheet design to make the model easy to
read and follow.
A table containing different candidate values for the
decision variables can be used to simultaneously
generate outputs from several decision variable values.
• Using only Excel, this can be done with a Data Table.
17. 17
Selecting the “Best” Decision
for the Decision Variable
After the simulation is run, the distribution
for the output variables from each set of
variable inputs can be compared and the
“best” selected.
Because random inputs change from
simulation to simulation, each run may
suggest a different value of the decision
variable as being the “best”.
18. 18
Predicting the Value of Company
An entrepreneur wants to predict the value of her
company after 3 years, when she hopes to retire. She is
going to bring company for an IPO, sell 1,000,000 shares
with which she hopes to make a bundle.
Her investment lawyer tells her that the distribution for
initial offers for sites of this nature is
Price (per share) Probability
0 (nobody buys) 30%
$1 25%
$2 15%
$3 10%
$4 10%
$5 10%
19. 19
Predicting the Value of Company
Each year there is a 30% probability that the company
will fold, and its stock value go to zero. Should it
survive a particular year, the change in value of the
stock is expected to be normally distributed with a
mean increases of $1.50 and standard deviation of $0.5.
Questions:
• Estimate the mean and maximum value of the stock,
based on 1,000 simulation trials.
• Find the probability that the company will fold.
20. 20
Ordering Calendars At Walton Bookstore
In August, Walton must decide how many of next year’s
nature calendars to order.
Each calendar costs $7.50 and sells for $10.
After February 1, all unsold calendars will be returned
to the publisher for a refund of $2.50/calendar.
Walton decided that the best-fit probability distribution
for demand is a normal distribution with mean of 175
and standard deviation of 50.
Walton wants to develop a simulation model to estimate the
expected profit and standard deviation if they order 130
calendars.
21. 21
Simulating Demand and Profit
For any fixed order quantity of calendars, profit is a
function of demand:
Profit = unit_price * MIN(demand, order_quantity)
- unit_cost * order_quantity
+ unit_refund * MAX(order_quantity - demand, 0)
Demand is uncertain, so profit is also uncertain.
Demand follows some probability distribution.
We can simulate demand by drawing samples from the
distribution.
Using the sample data of demand and the corresponding
profit data, we can simulate the profit.
22. 22
Key Formulas in the Simulation Model
Generate simulated demand (in C17):
=ROUND(NORM.INV(B17, $E$4, $E$5), 0)
Revenue (in D17):
=$B$5*MIN(C17, $B$9)
Ordering Cost (in E17):
=$B$4*$B$9
Refund (in F17):
=$B$6*MAX($B$9 – C17, 0)
23. 23
Key Formulas in the Simulation Model
Profit (in G17):
=D17 – E17 + F17
Estimated measures:
B12: =AVERAGE(G17:G1016)
B13: =STDEV(G17:G1016)
24. 24
Multiple Order Quantities
Now assume Walton can order 130, 140, 150, 160, 170, or
180 calendars. What is the expected profit for each of these
order quantities? Whichever order quantity has the highest
expected profit should be ordered. There are two
approaches:
• Manually enter the different order amounts into B9
and then copy the average profit in B12 to a table.
• Use a one-way data table to calculate all expected
profit amounts at once.
25. 25
One-Way Data Table
First, in G8 enter “=B12”. This will show the expected
profit amount value in the table for the
corresponding order quantity amount.
Highlight F8:G13.
Then, select the Data Tab -> What-If Analysis -> Data
Table.
Since the order quantity values are in a column, enter
B9 in the Column input cell.
Hit Enter.
Which order quantity has the highest expected value?
26. 26
Next Week
Quiz 5: Integer Programming and Simulation
Project Work
Final Thoughts and Review