17
1 Simulation Simulation Professor Ahmadi

1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

Embed Size (px)

Citation preview

Page 1: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

1 1 Slide

Slide

SimulationSimulation

Professor Ahmadi

Page 2: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

2 2 Slide

Slide

SimulationSimulationChapter OutlineChapter Outline

Computer SimulationComputer Simulation Simulation ModelingSimulation Modeling Random Variables and Pseudo-Random Random Variables and Pseudo-Random

NumbersNumbers Time Increments Time Increments Other Simulation IssuesOther Simulation Issues Validation and Statistical ConsiderationsValidation and Statistical Considerations

Page 3: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

3 3 Slide

Slide

Computer SimulationComputer Simulation

Computer simulationComputer simulation is one of the most is one of the most frequently employed management science frequently employed management science techniques. techniques.

It is typically used to model It is typically used to model random processesrandom processes that are too complex to be solved by analytical that are too complex to be solved by analytical methods.methods.

Page 4: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

4 4 Slide

Slide

Advantages of Computer SimulationAdvantages of Computer Simulation

Among the advantages of computer simulation is Among the advantages of computer simulation is the ability to gain insights into the model the ability to gain insights into the model solution which may be impossible to attain solution which may be impossible to attain through other techniques.through other techniques.

Also, once the simulation has been developed, it Also, once the simulation has been developed, it provides a convenient experimental laboratory provides a convenient experimental laboratory to perform "what if" and sensitivity analysis.to perform "what if" and sensitivity analysis.

Page 5: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

5 5 Slide

Slide

Disadvantages of Computer SimulationDisadvantages of Computer Simulation

A large amount of time may be required to A large amount of time may be required to develop the simulation.develop the simulation.

There is no guarantee that the solution obtained There is no guarantee that the solution obtained will actually be optimal. will actually be optimal.

Simulation is, in effect, a Simulation is, in effect, a trial and error methodtrial and error method of comparing different policy inputs. of comparing different policy inputs.

It does not determine if some input which was It does not determine if some input which was not considered could have provided a better not considered could have provided a better solution for the model.solution for the model.

Page 6: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

6 6 Slide

Slide

Simulation ModelingSimulation Modeling

One begins a computer simulation by One begins a computer simulation by developing a mathematical statement of the developing a mathematical statement of the problem.problem.

The model should be realistic yet solvable The model should be realistic yet solvable

within the speed and storage constraints of within the speed and storage constraints of the computer system being used. the computer system being used.

Input values for the model as well as Input values for the model as well as probability estimates for the random variables probability estimates for the random variables must then be determined.must then be determined.

Page 7: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

7 7 Slide

Slide

Random VariablesRandom Variables

Random variable values are utilized in the model Random variable values are utilized in the model through a technique known as through a technique known as Monte Carlo Monte Carlo simulationsimulation..

Each random variable is mapped to a set of Each random variable is mapped to a set of

numbers so that each time one number in that set numbers so that each time one number in that set is generated, the corresponding value of the is generated, the corresponding value of the random variable is given as an input to the model.random variable is given as an input to the model.

The mapping is done in such a way that the The mapping is done in such a way that the

likelihood that a particular number is chosen is the likelihood that a particular number is chosen is the same as the probability that the corresponding same as the probability that the corresponding value of the random variable occurs.value of the random variable occurs.

Page 8: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

8 8 Slide

Slide

Pseudo-Random NumbersPseudo-Random Numbers

Because a computer program generates random Because a computer program generates random numbers for the mapping according to some numbers for the mapping according to some formula, the numbers are not truly generated in formula, the numbers are not truly generated in a random fashion.a random fashion.

However, using standard statistical tests, the However, using standard statistical tests, the

numbers can be shown to appear to be drawn numbers can be shown to appear to be drawn from a random process.from a random process.

These numbers are called These numbers are called pseudo-random pseudo-random

numbersnumbers. .

Page 9: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

9 9 Slide

Slide

Static and Dynamic Simulation ModelsStatic and Dynamic Simulation Models

Static Simulation Models:Static Simulation Models: In these types of In these types of models, the simulation runs are independent models, the simulation runs are independent of each other. The state of the system at one of each other. The state of the system at one point in time does not affect the system at point in time does not affect the system at future points in time. For each time period a future points in time. For each time period a different set of data from the input sequence is different set of data from the input sequence is used to calculate the effects on the model.used to calculate the effects on the model.

Dynamic Simulation Models:Dynamic Simulation Models: In these types of In these types of models, the state of the system at one point models, the state of the system at one point in time in time doesdoes affect the future of the system. affect the future of the system.

Page 10: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

10 10 Slide

Slide

Model ValidationModel Validation

Models which do not accurately reflect real Models which do not accurately reflect real world behavior cannot be expected to world behavior cannot be expected to generate meaningful results. generate meaningful results.

Likewise, errors in programming can result in Likewise, errors in programming can result in nonsensical results. nonsensical results.

Validation is generally done by having an Validation is generally done by having an expert review the model and the computer expert review the model and the computer code for errors.code for errors.

If possible, the simulation should be run using If possible, the simulation should be run using actual past data. actual past data.

Predictions from the simulation model should Predictions from the simulation model should be compared with historical results.be compared with historical results.

Page 11: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

11 11 Slide

Slide

Experimental DesignExperimental Design

Experimental designExperimental design is an important consideration is an important consideration in the simulation process. in the simulation process.

Issues such as the length of time of the simulation Issues such as the length of time of the simulation and the treatment of initial data outputs from the and the treatment of initial data outputs from the model must be addressed prior to collecting and model must be addressed prior to collecting and analyzing output data. analyzing output data.

Normally one is interested in results for the Normally one is interested in results for the steady steady state state (long run) operation of the system being (long run) operation of the system being modeled.modeled.

The initial data inputs to the simulation generally The initial data inputs to the simulation generally represent a represent a start-up periodstart-up period for the process and it for the process and it may be important that the data outputs for this may be important that the data outputs for this start-up period be neglected for predicting this long start-up period be neglected for predicting this long run behavior.run behavior.

Page 12: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

12 12 Slide

Slide

Experimental DesignExperimental Design

For each policy under consideration by the For each policy under consideration by the decision maker, the simulation is run by decision maker, the simulation is run by considering a long sequence of input data values considering a long sequence of input data values (given by a pseudo-random number generator). (given by a pseudo-random number generator).

Whenever possible, different policies should be Whenever possible, different policies should be

compared by using the same sequence of input compared by using the same sequence of input data.data.

Page 13: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

13 13 Slide

Slide

Example: Probabilistic, Inc.Example: Probabilistic, Inc.

The price change of shares of Probabilistic, Inc. The price change of shares of Probabilistic, Inc. has been observed over the past 50 trades. The has been observed over the past 50 trades. The frequency distribution is as follows:frequency distribution is as follows:

Price ChangePrice Change Number of TradesNumber of Trades

-3/8 -3/8 4 4

-1/4 -1/4 2 2

-1/8 -1/8 8 8

0 200 20

+1/8 +1/8 10 10

+1/4 +1/4 3 3

+3/8 +3/8 2 2

+1/2 +1/2 1 1

Page 14: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

14 14 Slide

Slide

Example: Probabilistic, Inc.Example: Probabilistic, Inc.

Relative Frequency Distribution andRelative Frequency Distribution and

Random Number MappingRandom Number Mapping

Price ChangePrice Change Relative FrequencyRelative Frequency Random NumbersRandom Numbers

-3/8 -3/8 .08 .08 00 and under 07 00 and under 07

-1/4 -1/4 .04 .04 08 and under 11 08 and under 11

-1/8 -1/8 .16 .16 12 and under 27 12 and under 27

0 0 .40 .40 28 and under 67 28 and under 67

+1/8 +1/8 .20 .20 68 and under 87 68 and under 87

+1/4 +1/4 .06 .06 88 and under 93 88 and under 93

+3/8 +3/8 .04 .04 94 and under 97 94 and under 97

+1/2 +1/2 .02 .02 98 and under 99 98 and under 99

TOTAL = 1.00TOTAL = 1.00

Page 15: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

15 15 Slide

Slide

Example: Probabilistic, Inc.Example: Probabilistic, Inc.

If the current price per share of If the current price per share of Probabilistic is 23, use random numbers to Probabilistic is 23, use random numbers to simulate the price per share over the next 10 simulate the price per share over the next 10 trades. trades.

For random numbers, use the following:For random numbers, use the following:

21, 84, 07, 30, 94, 57, 57, 19, 84, 8421, 84, 07, 30, 94, 57, 57, 19, 84, 84

Page 16: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

16 16 Slide

Slide

Example: Probabilistic, Inc.Example: Probabilistic, Inc.

Simulation WorksheetSimulation Worksheet Trade Random Price StockTrade Random Price Stock NumberNumber NumberNumber ChangeChange PricePrice

1 21 -1/8 22 1 21 -1/8 22 7/87/8

2 84 +1/8 232 84 +1/8 23 3 07 -3/8 22 3 07 -3/8 22 5/85/8

4 30 0 22 4 30 0 22 5/85/8

5 94 +3/8 235 94 +3/8 23 6 57 0 236 57 0 23 7 57 0 237 57 0 23 8 19 -1/8 22 8 19 -1/8 22 7/87/8

9 84 +1/8 239 84 +1/8 23 10 84 +1/8 10 84 +1/8 23 23 1/81/8

Page 17: 1 1 Slide Simulation Professor Ahmadi. 2 2 Slide Simulation Chapter Outline n Computer Simulation n Simulation Modeling n Random Variables and Pseudo-Random

17 17 Slide

Slide

Example: Coin TossExample: Coin Toss

Use Excel to generate 200 random numbers and Use Excel to generate 200 random numbers and simulate a coin toss.simulate a coin toss.