Вы находитесь на странице: 1из 29

SIMULATION

Intro to Management Science


Introduction to Simulation

▪ In many spreadsheets, the value for one or more cells


representing independent variables is unknown or
uncertain.
▪ As a result, there is uncertainty about the value the
dependent variable will assume:
Y = f(X1, X2, …, Xk)
▪ Simulation can be used to analyze these types of models.
Random Variables & Risk
▪ A random variable is any variable whose value cannot be predicted or set
with certainty.
▪ Many “input cells” in spreadsheet models are actually random variables.
– the future cost of raw materials
– future interest rates
– future number of employees in a firm
– expected product demand
▪ Decisions made on the basis of uncertain information often involve risk.
▪ “Risk” implies the potential for loss.
Why Analyze Risk?
▪ Plugging in expected values for uncertain cells tells us nothing about
the variability of the performance measure we base decisions on.
▪ Suppose an $1,000 investment is expected to return $10,000 in two
years. Would you invest if...
– the outcomes could range from $9,000 to $11,000?
– the outcomes could range from -$30,000 to $50,000?
▪ Alternatives with the same expected value may involve different levels
of risk.
Methods of Risk Analysis

▪ Best-Case/Worst-Case Analysis
▪ What-if Analysis
▪ Simulation
Best-Case/Worst-Case Analysis
▪ Best case - plug in the most optimistic values for each of the
uncertain cells.
▪ Worst case - plug in the most pessimistic values for each of
the uncertain cells.
▪ This is easy to do but tells us nothing about the distribution of
possible outcomes within the best and worst-case limits.
Possible Performance Measure Distributions Within a Range

worst case best case worst case best case

worst case best case worst case best case


What-If Analysis

▪ Plug in different values for the uncertain cells and


see what happens.
▪ This is easy to do with spreadsheets.
▪ Problems:
– Values may be chosen in a biased way.
– Hundreds or thousands of scenarios may be required to
generate a representative distribution.
– Does not supply the tangible evidence (facts and
figures) needed to justify decisions to management.
Simulation

▪ Resembles automated what-if analysis.


▪ Values for uncertain cells are selected in an unbiased
manner.
▪ The computer generates hundreds (or thousands) of
scenarios.
▪ We analyze the results of these scenarios to better
understand the behavior of the performance measure.
▪ This allows us to make decisions using solid empirical
evidence.
Random Number Generation

▪ The RAND( ) function returns uniformly distributed random


numbers between 0.0 and 0.9999999.
▪ Suppose we want to simulate the act of tossing a fair coin.
▪ Let 1 represent “heads” and 2 represent “tails”.
▪ Consider the following:
=IF(RAND( )<0.5,1,2)
Simulating the Roll of a Dice
▪ We want the values 1, 2, 3, 4, 5 & 6 to occur randomly with equal
probability of occurrence.
▪ Consider the following:

If RAND( ) falls
in the interval: Return value:
0.0 to 0.16667 1
0.16667 to 0.3333 2
0.3333 to 0.5 3
0.5 to 0.66667 4
0.66667 to 0.83333 5
0.83333 to 1 6
Simulation Example

▪ A classical inventory problem concerns the purchase and sale of


newspapers. Each morning the newspaper vendor buys the same fixed
number of papers for $0.65 and sells them for $1.50 each. Newspapers not
sold at the end of the day are sold as scrap for $0.10 each. The newspapers
can be purchased in bundles of 10 by the newspaper seller. Demands from
day to day are independent of each other and the distribution of papers
demanded each day is given in Table. The problem is to determine the
number of newspapers the newspaper seller should purchase to maximize
his expected profit
Simulation Example (continued….)

𝐷𝑒𝑚𝑎𝑛𝑑 𝐷𝑒𝑚𝑎𝑛𝑑 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝐷𝑖𝑠𝑡𝑟𝑖𝑏𝑢𝑡𝑖𝑜𝑛


50 0.10
60 0.15
70 0.20
80 0.35
90 0.15
100 0.05

▪ To solve this problem we will simulate the demands for 15 days and
calculate profits from the sales of each day
Simulation Example (continued….)

▪ Variables/Parameters

𝑅 → 𝑅𝑒𝑡𝑎𝑖𝑙 𝑃𝑟𝑖𝑐𝑒 𝑝𝑒𝑟 𝑢𝑛𝑖𝑡 𝑜𝑓 𝑛𝑒𝑤𝑠𝑝𝑎𝑝𝑒𝑟

𝐶 → 𝐶𝑜𝑠𝑡 𝑝𝑒𝑟 𝑢𝑛𝑖𝑡 𝑜𝑓 𝑡ℎ𝑒 𝑛𝑒𝑤𝑠𝑝𝑎𝑝𝑒𝑟𝑠


𝑆 → 𝑆𝑎𝑙𝑣𝑎𝑔𝑒 𝑉𝑎𝑙𝑢𝑒 𝑝𝑒𝑟 𝑢𝑛𝑖𝑡 𝑜𝑓 𝑡ℎ𝑒 𝑛𝑒𝑤𝑠𝑝𝑎𝑝𝑒𝑟𝑠
𝐷 → 𝐷𝑎𝑖𝑙𝑦 𝐷𝑒𝑚𝑎𝑛𝑑

𝑄 → 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑛𝑒𝑠𝑝𝑎𝑝𝑒𝑟𝑠 𝑜𝑟𝑑𝑒𝑟𝑒𝑑 𝑏𝑦 𝑡ℎ𝑒 𝑛𝑒𝑤𝑠𝑝𝑎𝑝𝑒𝑟 𝑠𝑒𝑙𝑙𝑒𝑟


Simulation Example (continued….)

𝐷𝑎𝑖𝑙𝑦 𝑃𝑟𝑜𝑓𝑖𝑡 = 𝑅𝑒𝑣𝑒𝑛𝑢𝑒 𝑓𝑟𝑜𝑚 𝑠𝑎𝑙𝑒𝑠 + 𝑆𝑎𝑙𝑣𝑎𝑔𝑒 𝑓𝑟𝑜𝑚 𝑠𝑎𝑙𝑒 𝑜𝑓 𝑠𝑐𝑟𝑎𝑝


− 𝐶𝑜𝑠𝑡 𝑜𝑓 𝑛𝑒𝑤𝑠𝑝𝑎𝑝𝑒𝑟

𝑅𝑒𝑣𝑒𝑛𝑢𝑒 𝐹𝑟𝑜𝑚 𝑆𝑎𝑙𝑒𝑠 = min 𝐷, 𝑄 × 𝑅

𝑄 − 𝐷 × 𝑆, 𝑖𝑓 𝑄 ≥ 𝐷
𝑆𝑎𝑙𝑣𝑎𝑔𝑒 𝑓𝑟𝑜𝑚 𝑠𝑎𝑙𝑒 𝑜𝑓 𝑠𝑐𝑟𝑎𝑝 =
𝐸𝑙𝑠𝑒 0,

𝐶𝑜𝑠𝑡 𝑜𝑓 𝑛𝑒𝑤𝑠𝑝𝑎𝑝𝑒𝑟 = 𝑄 × 𝐶
Simulation Example (continued….)

▪ Inputs to the simulation model are the order quantity (decision variable
determined by the newspaper seller), the daily demand which is uncontrollable and
stochastic, and the cost and revenue factors which are set values and do not
change.

▪ Since it does not matter when the customers show up during the day, the problem
can be simulated through a static and stochastic model

▪ We first need to choose a value for the decision variable 𝑄 and then set up the
simulation where the demand is generated from the probability distribution in
Table
Random Digit Assignment For the Daily Demand
Of Newspaper

▪ Random Number Range for daily demand


𝐷𝑒𝑚𝑎𝑛𝑑 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝐶𝑢𝑚𝑢𝑙𝑎𝑡𝑖𝑣𝑒 𝑅𝑎𝑛𝑑𝑜𝑚 𝑁𝑢𝑚𝑏𝑒𝑟
𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑅𝑎𝑛𝑔𝑒
50 0.10 0.10 0.00 − 0.10
60 0.15 0.25 0.10 − 0.25
70 0.20 0.45 0.25 − 0.45
80 0.35 0.80 0.45 − 0.80
90 0.15 0.95 0.80 − 0.95
100 0.05 1.00 0.95 − 1.00
Confidence Interval

▪ Interval estimates can be calculated to determine how far off the calculated

profit average may be from the true profit mean

▪ This is done through confidence interval estimation

▪ A confidence interval is a range which we can have a certain level of

confidence that the true mean falls within


Confidence Interval (continued….)

Assuming that the average profit and standard deviation calculated are
independent and normally distributed the following equation can be used to
calculate the half width of a confidence interval for a given level of confidence

𝑡𝑛−1,𝛼 2 𝑆
√𝑛
𝑛 → 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑟𝑒𝑝𝑙𝑖𝑐𝑎𝑡𝑖𝑜𝑛
𝑠 → 𝑆𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝐷𝑒𝑣𝑖𝑎𝑡𝑖𝑜𝑛
𝛼 → 𝑃𝑟𝑜𝑏𝑎𝑏𝑖𝑙𝑖𝑡𝑦 𝑓𝑎𝑙𝑙 𝑜𝑢𝑡𝑠𝑖𝑑𝑒 𝑡ℎ𝑒 𝑐𝑜𝑛𝑓𝑖𝑑𝑒𝑛𝑐𝑒 𝐼𝑛𝑡𝑒𝑟𝑣𝑎𝑙
𝑡𝑛−1,𝛼 2→𝑉𝑎𝑙𝑢𝑒 𝑓𝑟𝑜𝑚 𝑇 𝑡𝑎𝑏𝑙𝑒
Simulation For Purchase Of 80 Newspaper

𝐷𝑎𝑦 𝑅𝑎𝑛𝑑𝑜𝑚 𝐷𝑒𝑚𝑎𝑛𝑑 𝑅𝑒𝑣𝑒𝑛𝑢𝑒 𝑆𝑎𝑙𝑣𝑎𝑔𝑒 𝐷𝑎𝑖𝑙𝑦 𝐿𝑜𝑠𝑡


𝑁𝑢𝑚𝑏𝑒𝑟 𝑓𝑟𝑜𝑚 𝑠𝑎𝑙𝑒𝑠 𝑓𝑟𝑜𝑚 𝑠𝑎𝑙𝑒 𝑃𝑟𝑜𝑓𝑖𝑡 𝑝𝑟𝑜𝑓𝑖𝑡
𝑓𝑜𝑟 𝑜𝑓 𝑠𝑐𝑟𝑎𝑝 𝑓𝑟𝑜𝑚
𝐷𝑒𝑚𝑎𝑛𝑑 𝑒𝑥𝑐𝑒𝑠𝑠
𝑑𝑒𝑚𝑎𝑛𝑑
1 0.149 60 90 2 40 −
2 0.447 70 105 1 54 −
3 0.931 90 135 − 83 8.5
4 0.407 70 105 1 54 −
5 0.140 60 90 2 40 −
6 0.313 70 105 1 54 −
7 0.563 80 120 0 68 −
8 0.424 70 105 1 54 −
Simulation For Purchase Of 80 Newspaper
(continued….)

𝐷𝑎𝑦 𝑅𝑎𝑛𝑑𝑜𝑚 𝐷𝑒𝑚𝑎𝑛𝑑 𝑅𝑒𝑣𝑒𝑛𝑢𝑒 𝑆𝑎𝑙𝑣𝑎𝑔𝑒 𝐷𝑎𝑖𝑙𝑦 𝐿𝑜𝑠𝑡


𝑁𝑢𝑚𝑏𝑒𝑟 𝑓𝑟𝑜𝑚 𝑠𝑎𝑙𝑒𝑠 𝑓𝑟𝑜𝑚 𝑠𝑎𝑙𝑒 𝑃𝑟𝑜𝑓𝑖𝑡 𝑝𝑟𝑜𝑓𝑖𝑡
𝑓𝑜𝑟 𝑜𝑓 𝑠𝑐𝑟𝑎𝑝 𝑓𝑟𝑜𝑚
𝐷𝑒𝑚𝑎𝑛𝑑 𝑒𝑥𝑐𝑒𝑠𝑠
𝑑𝑒𝑚𝑎𝑛𝑑
9 0.763 80 120 0 68 −
10 0.264 70 105 1 54 −
11 0.300 70 105 1 54 −
12 0.185 60 90 2 40 −
13 0.368 70 105 1 54 −
14 0.546 80 120 0 68 −
15 0.518 80 120 0 68 −
𝐴𝑣𝑒𝑟𝑎𝑔𝑒 $56.87
Example: Hungry Dawg Restaurants
▪ Hungry Dawg is a growing restaurant chain with a self-insured
employee health plan.
▪ Covered employees contribute $125 per month to the plan, Hungry
Dawg pays the rest.
▪ The number of covered employees changes from month to month.
▪ The number of covered employees was 18,533 last month and this is
expected to increase by 2% per month.
▪ The average claim per employee was $250 last month and is
expected to increase at a rate of 1% per month.
▪ What would be the total company cost over 12 months?
Questions About the Model

▪ Will the number of covered employees really increase by


exactly 2% each month?
▪ Will the average health claim per employee really increase by
exactly 1% each month?
▪ What is the likelihood of the total costs computed
Simulation
▪ To properly assess the risk inherent in the model we need to use
simulation.
▪ 4 step process:
1) Identify the uncertain cells in the model.
2) Implement appropriate RNGs for each uncertain cell.
3) Replicate the model n times, and record the value of the bottom-line
performance measure.
4) Analyze the sample values collected on the performance measure.
Simulation in Excel

▪ Different options
– Within the spreadsheet using Rand() and other functions (limited)
– Embed code in the macro
– Add-ons
▪ Crystal Ball, Simtools, @Risk etc.
What is @RISK?

▪ @RISK is a spreadsheet add-in that simplifies spreadsheet


simulation.
▪ It provides:
– functions for generating random numbers
– commands for running simulations
– graphical & statistical summaries of simulation data
▪ For more info see:http://www.palisade.com
Some of the RNGs Available In @RISK
Distribution RNG Function
Binomial RiskBinomial(n,p)
Custom RiskDiscrete({x1,x2,… },{p1,p2…})
Poisson RiskPoisson(λ)
Continuous Uniform RiskUniform(min,max)
Chi Square RiskChisq(λ)
Exponential RiskExponential(λ)
Normal RiskNormal(μ,σ,min,max)
Triangular RiskTriang(min, most likely, max)
Examples of Discrete Probability Distributions
RiskBinomial(10,0.2) RiskBinomial(10,0.05) RiskBinomial(10,0.08)
0.40 0.40 0.40

0.30 0.30 0.30


0.20 0.20 0.20
0.10 0.10 0.10
0.00 0.00 0.00
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

RiskDiscrete({20,21,22,23},{.15,.35,.45,.05}) INT(RiskUniform(20,24))
0.50 0.50
0.40 0.40
0.30 0.30
0.20 0.20
0.10 0.10
0.00 0.00
20 21 22 23 20 21 22 23

RiskPoisson(0.9) RiskPoisson(2) RiskPoisson(8)


0.40 0.40 0.40
0.30 0.30 0.30
0.20 0.20 0.20
0.10 0.10 0.10
0.00 0.00 0.00
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 2 4 6 8 10 12 14 16 18 20
Examples of Continuous Probability Distributions
RiskNormal(20,1.5) RiskNormal(20,3) RiskNormal(20,3,15,23)
0.30 0.30 0.30
0.25 0.25 0.25
0.20 0.20 0.20
0.15 0.15 0.15
0.10 0.10 0.10
0.05 0.05 0.05
0.00 0.00 0.00
12 14 16 18 20 22 24 26 28 12 14 16 18 20 22 24 26 28 11 13 15 17 19 21 23 25 27 29

RiskChisq(2) RiskChisq(5) RiskExponential(5)


0.50 0.50 0.50
0.40 0.40 0.40
0.30 0.30 0.30
0.20 0.20 0.20
0.10 0.10 0.10
0.00 0.00 0.00
0 2 4 6 8 10 12 0 2 4 6 8 10 12 14 16 18 0 2 4 6 8 10

RiskTriang(3,4,8) RiskTriang(3,7,8) RiskUniform(40,60)


0.50 0.50 0.15
0.40 0.40
0.30 0.30 0.10
0.20 0.20
0.05
0.10 0.10
0.00 0.00 0.00
2.5 3.5 4.5 5.5 6.5 7.5 8.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 30.0 40.0 50.0 60.0 70.0

Вам также может понравиться