DSC1007 Lecture 6 Simulation
DSC1007 Lecture 6Simulation
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.
SimulationinBusinessSimulation 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?
SimulationModeling
ProbabilisticSimulation
MonteCarlosimulationisatechniquethatallowspeopletoaccountforuncertainty inquantitativeanalysisanddecisionmaking.
SimulationModeling
WhousesMonteCarlosimulation?ManycompaniesuseMonteCarlosimulationasanimportantpartoftheirdecision‐makingprocess.
• GM, ProctorandGamble,Pfizer,Bristol‐MyersSquibb,andEliLilly:toestimateboththeaveragereturnandtheriskfactorofnewproducts.
• EliLilly : todeterminetheoptimalplantcapacityforeachdrug.
• ProctorandGamble: tomodelandoptimallyhedgeforexrisk.
• Sears :todeterminehowmanyunitsofeachproductlineshouldbeorderedfromsuppliers.
• Oilanddrugcompanies:tovalue"realoptions,"suchasthevalueofanoptiontoexpand,contract,orpostponeaproject.
Simulating a Random Variable
• The fundamental technique in simulation modeling is to simulate a random variable following certain probability distribution.
UniformRandomNumbers
Uniformrandomnumbersrefertoasequenceofnumbersthatareindependent andobeytheuniformdistributionU[0,1]
EXCELrandomnumbergenerator: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.
UniformDistributionU[a,b]
Q : HowtogenerateU[a,b]randomnumbers?
IfX U[0,1]
thenY =a +(ba)X U[a,b]
GeneratingU[0,1]randomnumbersiseasy– useRAND()
A:
GeneratingU[a,b]randomnumbers– usea +(ba)RAND()
OtherDistributions
GeneratingU[0,1]randomnumbers – RAND()
GeneratingU[a,b]randomnumbers – a +(ba)RAND()
Next:howtogeneraterandomnumbersthatobey– adiscrete probabilitydistribution
– acontinuous probabilitydistribution
Discrete Distribution
• Example: Let X be a random variable representing race of a randomly selected Singaporean.
X ProbabilityChinese 74.2%Malay 13.3%Indian 9.2%Others 3.3%
* Data from Department of Statistics, Singapore
RouletteWheel
Using RAND() to Generate X[0,1]uniformrandomnumber assigned X
0.00―0.742 Chinese0.742―0.875 Malay0.875―0.967 Indian0.967―1.00 Others
Trial RandomNumber X1 .6622 .9233 .3004 .8125 .999
Chinese
IndianChineseMalayOthers
andsoon...
GentleLentilCaseLOOKUPfunction– generatingvaluesofX
• Mostsimulationsoftwarepackages(e.g.,CrystalBall)cangeneraterandomnumbersfromdiscrete andavarietyofcontinuous distributions,suchastheNormal distribution,theuniform distribution,etc.
• Theuserneedtospecifythetypeofdistributionandtheparameters( and fortheNormal,a andb fortheuniform)
• However,itisworthwhiletopointouthowthecomputeraccomplishesthistask.
• WillfocusonusingEXCELformulatogeneraterandomnumbers
GeneratingRandomNumberswithagivenContinuous ProbabilityDistribution
GeneratingRandomNumberswithagivenContinuous ProbabilityDistribution
0.0
0.1
0.2
0.3
0.4
0.5
2.0 3.0 4.0 5.0 6.0 7.0 8.0
Series1
PDFf(y) oftheRandomVariable
Example
GeneratingRandomNumberswithagivenContinuous ProbabilityDistribution
0.0
0.2
0.4
0.6
0.8
1.0
2.0 3.0 4.0 5.0 6.0 7.0 8.0
Series1
CDF F(y) oftheRandomVariable
Example
StepstogenerateaRNthatfollowsagivenCDFF(y)
GeneratingRandomNumberswithagivenContinuous ProbabilityDistribution
1. Usearandomnumbergeneratortogenerateanumberu thatobeysauniform distributionbetween0.0and1.0.
2. Placethenumberu ontheverticalaxisofthegraphoftheCDFF(y)ofthegivendistribution.Thenfindthepointy onthehorizontalaxiswhoseCDFvalueF(y) isequaltou.
3. Thenumbery generatedthiswayhasthedesiredCDFF(y).
0.0
0.2
0.4
0.6
0.8
1.0
0 1 2 3 4 5 6 7 8 9 10
F(y)
Supposethe[0,1]uniformRNwegethappenstobeu =0.826
y = 6.851
StepstogenerateaRNthatfollowsagivenCDFF(y)
y
F(y) u = 0.826
F(y) =u
StepstogenerateaRNthatfollowsagivenCDFF(y)
1. Usearandomnumbergeneratortogenerateanumberu thatobeysauniform distributionbetween0.0and1.0.
2. Placethenumberu ontheverticalaxisofthegraphoftheCDFF(y)ofthegivendistribution.Thenfindthepointy onthehorizontalaxiswhoseCDFvalueF(y) isequaltou.
3. Thenumbery generatedthiswayhasthedesiredCDFF(y).
GeneratingRandomNumberswithagivenContinuous ProbabilityDistribution
Example: SupposewewanttogenerateRNsthatfollowtheNormaldistributionN(,)
y =NORMINV(u,,)F(y) =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 SenseWalton's bookstore - deterministic model
Cost dataUnit cost $7.50Unit price $10.00Unit refund $2.50
Uncertain quantityDemand (average shown) 200
Decision variableOrder quantity 200
Profit modelDemand Revenue Cost Refund Profit
200 $2,000.00 $1,500.00 $0.00 $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.
0
100
200
300
400
500
600
700
Frequency
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.