Uploaded by barryallenpewpew

7-Simulation

advertisement
DSC1007 Lecture 7
Simulation
War Simulation
Graf Helmuth von Moltke
• Regarded as the grandfather of
modern military simulation.
• Although not the inventor of
Kriegspiel, he was greatly
impressed by it as a young
officer
• As Chief of Staff of the Prussian
Army promoted its use as a
training aid.
• Kriegspiel is sometimes credited
with the Prussian victory in the
Franco-Prussian War.
What is Simulation?
• A simulation model is a computer model that
imitates a real-life situation.
• The fundamental advantage of a simulation
model is that it provides an entire distribution of
results, not simply a single bottom-line result.
• Each different set of values for the uncertain
quantities can be considered a scenario.
– Simulation models allow the company to generate many
scenarios, each leading to a particular outcome.
Introduction Continued
• Simulation models are also useful for
determining how sensitive a system is to
changes in operating conditions.
• Another benefit of a computer simulation is that
it enables managers to answer what-if question
without actually changing (or building) a physical
system.
• Simulations are used in a variety of business
settings.
Simulation in Business
Simulation models are widely used in many management settings:
•Modeling of manufacturing operations
•Modeling of service operations where queues form
•Modeling of investment alternatives
•Analyzing and pricing of sophisticated financial instruments
Aircraft Boarding Strategy
How to board all passengers in the shortest possible time?
Simulation Modeling
Probabilistic Simulation
Monte Carlo simulation is a technique that allows people to
account for uncertainty in quantitative analysis and decision
making.
Simulation Modeling
Who uses Monte Carlo simulation?
Many companies use Monte Carlo simulation as an important part of their
decision-making process.
•
GM, Proctor and Gamble, Pfizer, Bristol-Myers Squibb, and Eli Lilly :
to estimate both the average return and the risk factor of new products.
•
Eli Lilly : to determine the optimal plant capacity for each drug.
•
Proctor and Gamble : to model and optimally hedge forex risk.
•
Sears : to determine how many units of each product line should be
ordered from suppliers.
•
Oil and drug companies : to value "real options," such as the value of
an option to expand, contract, or postpone a project.
Simulating a Random Variable
• The fundamental technique in simulation
modeling is to simulate a random variable
following certain probability distribution.
Uniform Random Numbers
Uniform random numbers refer to a sequence of numbers that
are independent and obey the uniform distribution U [0,1]
EXCEL random number generator :
RAND()
Properties of RAND():
•Uniform property: All numbers between 0 and 1 have the same
chance of occurring.
•Independence property: Different random numbers are
probabilistically independent. A number generated previously has no
effect on the values of the following random numbers.
Uniform Distribution U[a,b]
Generating U[0,1] random numbers is easy – use RAND()
Q : How to generate U[a,b] random numbers ?
A : If X  U[0,1]
then Y = a + (ba)X  U[a,b]
Generating U[a,b] random numbers – use a + (ba) RAND()
Other Distributions
Generating U[0,1] random numbers –
RAND()
Generating U[a,b] random numbers – a + (ba) RAND()
Next :
how to generate random numbers that obey
–
a discrete probability distribution
–
a continuous probability distribution
Discrete Distribution
• Example: Let X be a random variable representing race
of a randomly selected Singaporean.
X
Probability
Chinese
74.2%
Malay
13.3%
Indian
9.2%
Others
3.3%
* Data from Department of Statistics, Singapore
Roulette Wheel
Using RAND() to Generate X
[0, 1] uniform random number
assigned X
0.00 ― 0.742
Chinese
0.742―0.875
Malay
0.875 ― 0.967
Indian
0.967 ― 1.00
Others
Trial
1
2
3
4
5
Random Number
.662
.923
.300
.812
.999
and so on . . .
X
Chinese
Indian
Chinese
Malay
Others
LOOKUP function
– generating
Gentle
Lentilvalues
Caseof X
Generating Random Numbers with a
given Continuous Probability Distribution
•
Most simulation software packages (e.g., Crystal Ball) can generate
random numbers from discrete and a variety of continuous distributions,
such as the Normal distribution, the uniform distribution, etc.
•
The user need to specify the type of distribution and the parameters
( and  for the Normal, a and b for the uniform)
•
However, it is worthwhile to point out how the computer accomplishes
this task.
•
Will focus on using EXCEL formula to generate random numbers
Generating Random Numbers with a
given Continuous Probability Distribution
PDF f(y) of the Random Variable
0.5
Example
0.4
0.3
Series1
0.2
0.1
0.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
Generating Random Numbers with a
given Continuous Probability Distribution
CDF F(y) of the Random Variable
1.0
Example
0.8
0.6
Series1
0.4
0.2
0.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
Generating Random Numbers with a
given Continuous Probability Distribution
Steps to generate a RN that follows a given CDF F(y)
1.
Use a random number generator to generate a number u that
obeys a uniform distribution between 0.0 and 1.0.
2.
Place the number u on the vertical axis of the graph of the CDF F(y)
of the given distribution. Then find the point y on the horizontal
axis whose CDF value F(y) is equal to u.
3.
The number y generated this way has the desired CDF F(y).
Steps to generate a RN that follows a given CDF F(y)
Suppose the [0, 1] uniform RN we get happens to be u = 0.826
1.0
F(y)
0.8
u = 0.826
0.6
F(y)
0.4
F(y) = u
0.2
y = 6.851
0.0
0
1
2
3
4
5
6
7
8
9
y
10
Generating Random Numbers with a
given Continuous Probability Distribution
Steps to generate a RN that follows a given CDF F(y)
1.
Use a random number generator to generate a number u that
obeys a uniform distribution between 0.0 and 1.0.
2.
Place the number u on the vertical axis of the graph of the CDF F(y)
of the given distribution. Then find the point y on the horizontal
axis whose CDF value F(y) is equal to u.
3.
The number y generated this way has the desired CDF F(y).
Example :
Suppose we want to generate RNs that follow the Normal
distribution N(, )
F(y) = u
y = NORMINV (u, , )
Case – Ordering Calendars at Walton
Bookstore
• In August, Walton Bookstore must decide how many of
next year’s nature calendars to order.
• Each calendar costs the bookstore $7.50 and sells for
$10. After January 1, all unsold calendars will be
returned to the publisher for a refund of $2.50 per
calendar.
• Walton believes that the number of calendars it can sell
by January 1 follows some probability distribution with
mean 200.
• How many calendars should Walton order in order to
maximize the expected profit?
Decision by Common Sense
Walton's bookstore - deterministic model
Cost data
Unit cost
Unit price
Unit refund
$7.50
$10.00
$2.50
Uncertain quantity
Demand (average
shown)
200
Decision variable
Order quantity
200
Profit model
Demand Revenue
200 $2,000.00
Cost
$1,500.00
Refund
$0.00
Profit
$500.00
Is it correct?
Simulation Model
Simulation with Excel
Histogram
• Step 1. Initiate “Analysis ToolPak” in Excel.
Histogram
• Step 2. Define bins in Excel worksheet.
Histogram
• Step 3. Launch Analysis ToolPak and select “Histogram”.
Histogram
• Step 4. Define inputs to create the histogram.
Histogram
• Step 5. Create histogram chart with the result.
Frequency
700
600
500
400
300
200
100
0
Frequency
Find Optimal Order with “Goal-Seek”
Configure “Goal-Seek”
What-if with “Data Table”
Step 1. Build a list of possible order quantities
What-if with “Data Table”
Step 2. Add formula of “Expected Profit” to the top of the table
What-if with “Data Table”
Step 3. Highlight the table and choose “Data Table” button
What-if with “Data Table”
Step 4. Specify B13 as the cell to be replaced by the list of options.
Result
Press F9 if the result doesn’t show.
Simulation with @Risk
Task
• Please try to do the problem by yourself
for the cases where demand follows
different probability distributions.
Download