simul8

22
Notes on Monte Carlo Simulation University of Chicago Graduate School of Business Introduction to Computer Based Models Bus-36102-81 Mr. Schrage Spring 2003

Transcript of simul8

Page 1: simul8

Notes on Monte Carlo Simulation

University of ChicagoGraduate School of Business

Introduction to Computer Based Models Bus-36102-81Mr. Schrage Spring 2003

Page 2: simul8

(Monte Carlo) Simulation

  Basic Idea: Operation of a system, including random elements, can be described/modeled by a computer program.  Advantages: Can experiment with the simulator much cheaper than with the real system(usually). 

Can represent arbitrary detail.

  Disadvantages: 

Usually too complex to apply optimization such as LP.  

Can ask only “What If”, rather than “What’s Best”.

Page 3: simul8

Example Applications  Boulder 10K Race 

Telephone call centers 

Coal loading facility  Asian financial options  Exxon tanker fleet: Scheduling, sizing,  NYFD: Response policies, location, redeployment, staffing  Burger King restaurants: Multiple drive-up windows, no. of cashiers  IBM inventory simulator  GM Production lines  

American Airlines Reservation System 

Proposed computer design 

Military

Page 4: simul8

Useful Ideas/Avoiding Pitfalls

a) How to compare two policies the good way.   b) How to generate random variables the good way   c) When can a random variable be replaced by its expectation.  

Page 5: simul8

Types of Simulators

Transaction processing/trackers e.g., Extend, Witness  Replicators, e.g., @Risk, Crystal Ball  System Dynamics/Differential Equation e.g., Extend  Animation Can work with output log from any of above.   

Page 6: simul8

Quick Introduction to the Extend Simulation Program The Extend simulation program allows you to: run one replication of a many period Extend(nonspreadsheet) model. This is in contrast to the @RISK spreadsheet program that allows: run many replications of a single period spreadsheet model. Extend is a very powerful and general purpose simulation program. A slightly simplified description of its capabilities is that it allows to simulate a system in which various entities move through a series of processing steps or blocks, subject to various kinds of random influences. You build an Extend simulation by 1) selecting blocks or processes from a library of blocks, 2) specifying parameters for each block, e.g. the distribution and its mean and standard deviation, and 3) hooking up the blocks to specify how entities flow among blocks.

Page 7: simul8

VV 11 22Cust omer s

Cust omer s comei n f r ont door

FF

LL WWWai t i ng Li ne

DD

TT UU

Tel l er 1 Pl ot t er

DD

TT UU

Tel l er 2

DD

TT UU

Tel l er 3

##

( 4)( 4)Exi tExi t

Pl ot t er

Hel pHel p

countcount

Tel l er s

Leave bank

Bank Teller Simulation in Extend

Page 8: simul8

The first/customer block generates an arrival stream of customers according to some arrival process that you specify.

The "waiting line" block simply records how long each customer is in the waiting queue.

The teller blocks delay each customer for some random length of time. As with the first block, you can specify the distribution of this delay.

The final block simplyremoves completed customers from the system.

Extend cont.

Page 9: simul8

What kind of questions can you answer with a simulation such as this? Some examples are:

What's the benefit of adding more tellers? Is it worth the cost?

What's the effect of offering specialized service, for example, a "deposits only" teller?

What is the effect of reducing the service time, e.g., by increasing the wage rate so that the bank keeps more experienced tellers?

 

Page 10: simul8

Examining and Controlling an Extend Model  You can examine and the parameters that control a block by double clicking on the block. This opens up a dialog box in which you can change parameters, e.g., the mean of a distribution, or the type of the distribution, and see statistics from the most recent run.  Under the "Run" menu you can turn on "Show Animation" if you wish to see statistics reported at each block for the current state of the system, e.g., number in queue, etc. 

Page 11: simul8

More Information More information on Extend can be found at http://www.imaginethatinc.com/.

Another simulation software vendor is Pritsker and Associates, with information at: http://www.pritsker.com/. 

Page 12: simul8

Generating Random Numbers, Some Pointers

Prob{ Demand = 1] = .21

Prob{ Demand = 2} = .47

Prob{ Demand = 3} = .16

Prob{ Demand = 3} = .16

1

2

3

4

Page 13: simul8

Generating Random Numbers, Graphically

1.0

.84

.68

.21

0 1 2 3 4

CumulativeProbability

Random outcome

Page 14: simul8

Generating Continuous Random Variables

1.0

0

0 1 2 3 4

CumulativeProbability

Random outcome

Page 15: simul8

Generating a Normal deviate!?

Page 16: simul8
Page 17: simul8

Excel 97 uses inverse transform method for Normal,but...

Page 18: simul8

Using the Tools|Data Analysis|Random Number Generator

In Excel/Office 2002

Each column used a starting seed = 55.

Unif(10,20) Norm(15,3) Poisson(15) Binom(.75,20) Bernoulli(.5)10.06653 7.573612 14 14 1

12.764061 13.219347 15 17 116.325571 16.015903 13 17 014.638508 14.727789 12 13 115.829035 15.627981 8 13 019.509262 19.961707 12 15 014.794458 14.845367 16 14 110.719321 10.61534 9 14 110.330515 9.486825 18 13 116.148869 15.876239 18 16 019.303873 19.436051 16 15 019.315165 19.461549 13 16 011.942198 12.412647 13 16 117.810602 17.327336 14 12 018.75576 18.459459 19 16 0

Page 19: simul8

Quasi-Random Numbers

An important variance reduction method in Monte Carlo.

Available in @Risk and other simulators as an option.

Suppose I want to run 9 replications, one random variable per replication. How should I generate the 9 uniforms? (Make sure you get one in each interval, make “super-uniform”)

0 1

Page 20: simul8

Quasi-Random Numbers, continued

Suppose I want to run 9 replications, Need two random variables per replication. How should I generate the 9 pairs of uniforms?

0 1

1

0

Page 21: simul8

Applichem Case: How to best serve six international markets in the face of random demand, and random foreign exchange rates.

Design of experiment: 4096 scenarios(12 random variables each), 100 replications.

Method: Random Antithetic Stratified Weyl LH SLHMean: 1145.739 1145.427 1145.549 1145.274 1145.217 1145.288 Std Error: 2.834 1.348 1.717 2.609 0.815 0.663

Because we are maximizing profit, an optimizing simulation will have a slight optimistic bias. Why?

Numerical Examples

Page 22: simul8

Pricing a EurAsian option, i.e., Value = max(0, average_price_til_maturity – strike_price).

Design of experiment: 1024 scenarios(10 periods to maturity), 200 replications.

Method: Random Antithetic Stratified Weyl LH SLH Mean: 1.8972 1.8946 1.8896 1.8807 1.8902 1.8897 Std Error: 0.0811 0.0578 0.0554 0.1133 0.0373 0.0302

Numerical Examples, cont.