You are on page 1of 61

On Uncertainty and Decision-Making

"Uncertainty is the most difficult thing about decision-making. In the face of uncertainty, some people react with paralysis, or they do exhaustive research to avoid making a decision. The best decision-making happens when the mental environment is focused. That fined-tuned focus doesnt leave room for fears and doubts to enter. Doubts knock at the door of our consciousness, but you don't have to have them in for tea and crumpets."
-- Timothy Gallwey, author of The Inner Game of Tennis and The Inner Game of Work.

Simulate
To assume falsely the appearance or signs of (anything), to feign, pretend, counterfeit, imitate

SIMULATION
The technique of imitating the behavior of some situation or system by means of analogous situation, model either to gain information more conveniently or to train personnel.

Oxford Dictionary

Why Simulation ?

Not possible to develop a mathematical model Observation of a system may be too expensive Operation & observation of a system may be too expensive Simulation may be the only method !

Simulation

Simulation is quantitative procedure which describes a process by developing a series of organized experiments to predict the behavior of the process over time A set of mathematical tool box comprising various probability functions, and decision rules that mimic the way a system behaves.

Another perspective..

Simulation is a numerical technique for conducting experiments through computer which involves certain types of mathematical and logical relationships necessary to describe the behavior and structure of a complex real world system over extended period of time.

Simulation: a descriptive technique that enables a decision maker to evaluate the behavior of a model under various conditions.

Simulation..

Simulation models complex situations Models are simple to use and understand Models can play what if experiments Extensive software packages available

Terminology

Model Event Sample Clock Random Stochastic or probabilistic

Probabilistic distribution Cumulative distribution Simulated clock Stopping rule

Some observations..

Dynamic simulation models track how the state of the system changes over time An event is said to occur when the state of the system changes Passage of time can be simulated by repeated advancement of the clock Random numbers are used to generate various stochastic events.

Steps in the Simulation Process


Define the problem/system Formulate the model Test the model Identify and collect the data Run the simulation Analyze the results Validate the simulation

Typical Issues Addressed Through Simulation

Need for and quantity of equipment /personnel Performance evaluation Evaluation of operational procedures

Typical Areas of application


Determination of safety stock Method of forecasting Determination of lot sizes Impact of Scheduling policies Assessment of overtime policies Evaluation of maintenance policies Investment decisions Launching of a new product

Methods for simulating time


Fixed time increment Next event increment

Generating random phenomena

Random number generators/tables

Monte Carlo Simulation


A model that mimics the behavior of a (random) system
Probabilistic Input (random number)

r1, r2, , rn
Controllable Input Model

Analysis

Outcome

Steps in Monte Carlo simulation..


Step 1: Select the measure of effectiveness(MOE) Step 2 : Identify the variables which influence the MOE. Step 3: Determine the proper cumulative probability distribution of each variable Step 4: Get a set of random numbers Step 5: Map this number into the variable of interest Step 6: Repeat this process for all variables Step 7: Compute MOE Step 8: Repeat Steps 4 to 7 if necessary

Example 1: Simulation of Toss of Coin

Use the following random numbers to simulate toss of a coin 0.538 0.312 0.167 0.198 0.227 0.673 0.493 0.821 0.187 0.964 What is the DECISION Rule ? How many Heads and Tails ? Is it a fair coin ?

Example 2: Simulating the Roll of a Die

We want the values 1, 2, 3, 4, 5 & 6 to occur randomly with equal probability of occurrence. Consider the following RNG: =INT(6*RAND())+1
If 6*RAND( ) falls in the interval: 0.0 to 0.999 1.0 to 1.999 2.0 to 2.999 3.0 to 3.999 4.0 to 4.999 5.0 to 5.999 INT(6*RAND( ))+1 returns the value: 1 2 3 4 5 6

Example 3: Millennium Computer Corporation (MCC)


MCC is a retail computer store facing fierce competition. Stock outs are occurring on a popular monitor. The current reorder point (ROP) is 28. The current order size is 50. Daily demand and order lead times vary randomly, viz.:
Units Demanded: 0 1 2 3 4 5 6 7 8 9 10 Probability: 0.01 0.02 0.04 0.06 0.09 0.14 0.18 0.22 0.16 0.06 0.02 Lead Time (days): 3 4 5 Probability: 0.2 0.6 0.2

MCCs owner wants to determine the ROP and order size that will provide a 98% service level while minimizing average inventory.

Example 4: Commuter Airlines


CA Flight flies between a small regional airport and a major hub. The plane has 19 seats & several are often vacant. Tickets cost Rs 1500 per seat. There is a 0.10 probability of a sold seat being vacant. If CA overbooks, it must pay an average of Rs 3250 for any passengers that get bumped. Demand for seats is random, as follows:
Demand Probability 14 15 16 17 18 19 20 21 22 23 24 25 .03 .05 .07 .09 .11 .15 .18 .14 .08 .05 .03 .02

What is the optimal number of seats to sell?

Example 5 ABC Stationers Ltd (ASL)


Demand/week 0 1 2 3 Probability 0.2 0.4 0.3 0.1 Lead Time(week) 2 3 4 Probability 0.3 0.4 0.3 Ordering cost: Rs 50; Holding cost Rs 2/wk/1000, Shortage cost : Rs 10/1000
POLICY : Whenever Inventory Level <=2000 Place an order equal to difference between current inventory & 4000 units

Example 5: Contd.

Demand/wk Probability Cum Prob 0.2 Random No <0.2 LT Probability Cum Prob Random No

0 0.2 0.6

1 0.4 0.9

2 0.3

3 0.1 1.0 0.9-1 4 0.3 1.0 0.7-1.0

0.2-0.6 0.6-0.9 2 0.3 0.3 <0.3 3 0.4 0.7 0.3-0.7

Analysis of cost
Average Inventory : 15000/20= 750 units/wk Avg cost/wk = Ordering cost + Inventory Holding cost + Shortage cost = 50 x5/20+2x750/1000+10x13/20 =Rs 20.50 /wk

Monte Carlo method: Probabilistic simulation technique used when a process has a random component

Monte Carlo Simulation


Identify a probability distribution Setup intervals of random numbers to match probability distribution Obtain the random numbers Interpret the results

Simulation Steps

Problem formulation Model building Data acquisition Model translation Verification & validation Experiment planning & execution Analysis Implementation & documentation

Example 6

Example 6 (Contd..)

Simulating Distributions

Poisson

Mean of distribution is required

Normal

Need to know the mean and standard deviation Simulated = Random X Standard Mean + value number deviation

Uniform Distribution
F(x)

Simulated = a + (b - a)(Random number as a percentage) value

Exponential Distribution
F(t)

P ( t T ) =. RN

Advantages of Simulation

Solves problems that are difficult or impossible to solve mathematically Allows experimentation without risk to actual system Compresses time to show long-term effects Serves as training tool for decision makers

Limitations of Simulation

Does not produce optimum solution Model development may be difficult Computer run time may be substantial Monte Carlo simulation only applicable to random systems

The Uncertainty of Sampling


The replications of our model represent a sample from the (infinite) population of all possible replications. Suppose we repeated the simulation and obtained a new sample of the same size. Q: Would the statistical results be the same? A: No! As the sample size (# of replications) increases, the sample statistics converge to the true population values. We can also construct confidence intervals for a number of statistics...

Constructing a Confidence Interval for the True Population Mean s


95% Lower Confidence Limit = y-1.96 n
s n 95% Upper Confidence Limit = y + 1.96

where:

y = the sample mean s = the sample standard deviation n = the sample size (and n 30)
Note that as n increases, the width of the confidence interval decreases.

Constructing a Confidence Interval for the True Population Proportion


95% Lower Confidence Limit = p-1.96
95% Upper Confidence Limit = p + 1.96

p (1 p ) n

p (1 p ) n

where:
p = the proportion of the sample that is less than some value Y p n = the sample size (and n 30)

Note again that as n increases, the width of the confidence interval decreases.

Additional Uses of Simulation

Simulation is used to describe the behavior, distribution and/or characteristics of some bottom-line performance measure when values of one or more input variables are uncertain. Often, some input variables are under the decision makers control. We can use simulation to assist in finding the values of the controllable variables that cause the system to operate optimally. The following examples illustrate this process.

Random Number Seeds

RNGs can be seeded with an initial value that causes the same series of random numbers to generated repeatedly. This is very useful when searching for the optimal value of a controllable parameter in a simulation model (e.g., # of seats to sell). By using the same seed, the same exact scenarios can be used when evaluating different values for the controllable parameter. Differences in the simulation results then solely reflect the differences in the controllable parameter not random variation in the scenarios used.

Queuing Simulation: Arrival & Service


We have 2 things to simulate: -Arrival of customers (20 per hr) -Service of customers (between 1 and 7mins) Since 20 customers arrive every 60 mins, then the inter-arrival time is 3mins, this can be modelled as: inter-arrival time = -3ln(1-R) and service time = 1 + 6R Let 5p.m. be time 0 ( i.e. the start of the simulation )

Event List
R.N. Event End serve C1 Arr C2 Time 1.10 2.00 0.00 Done Time

State
Queue Pump C1

Statistics
Wait Lost

Queuing 1 - continued
Event List
R.N. Event End serve C1
9042 8863 0745 3847 0509 1069 8327 2237 Arr C2 Arr C3 End serve C2 Arr C4 End serve C3 Arr C5 Arr C6 Arr C7 End serve C4

State
Time 1.10
9.04 2.00 8.32 9.27 12.35 9.43 9.77 15.13 14.69

Statistics
Wait Lost

Done Time Queue Pump

Working: -3 ln(1 -.9042) = 7.04 1 + 6(.8863) = 6.32 -3 ln(1 - .0745) = 0.23 1 + 6(.3847) = 3.31

0.00
8.32 1.1

C1 -C4 C4 C4

2.00
9.27 9.77 12.35 9.43

9.04

C2

C3 C3 C3 C3 C4

0.00

0.00
C5 C6

3.08

Queuing 1 Final simulation tables


R.N.
9042 8863 745 3847 509 1069 8327 2237 7064 4512 92 4725 8027 4553 6593 579 6190 9285 1139

Event
End serve C1 Arr C2 Arr C3 End serve C2 Arr C4 End serve C3 Arr C5 Arr C6 Arr C7 End serve C4 Arr C8 End serve C7 Arr C9 End serve C8 Arr C10 End serve C9 Arr C11 End serve C10 Arr C12 End serve C11 Arr C13

Time
1.1 2 9.04 8.32 9.27 12.35 9.43 9.77 15.13 14.69 18.81 18.84 18.84 22.68 23.71 26.41 26.94 27.76 29.83 34.33 30.19

Done

State Time
0 1.1 2 8.32 9.04 9.27 9.43 9.77 12.35 14.69 15.13 18.81 18.84 18.84 22.68 23.71 26.41 26.94 27.76 29.83

Statistics Event list Queue Pump Wait Lost


C1 C2 C3 C3 C3 C3 C4 C7 C7 C8 C8 C9 C9 C10 C10 C11 C11 0 0 C5 C6 3.08 0 0.03 3.84 2.7 0.82

C4 C4 C4

C8 C9 C10 C11 C12

Queuing 1 - Statistics
A) Based on the Simulation: Mean waiting time = ( 0.00 + 0.00 + 3.08 + 0.00 + 0.03 + 3.84 + 2.70 + 0.82 ) / 8 = 1.31 Average number of customers lost per hour = 4 B) Main limitation, simulation is run only once for a short time Overcome this limitation by, either having a longer simulation running time or have several runs with different random numbers

Queuing -2
NB: Same as before, except that now a queue is formed only if two customers are already being served R.N. Event End serv1 C1 Arr C2 9042 8863 0745 Arr C3 End serve C2 Arr C4 Tables below are excepts from question1
R.N.
9042 8863 745 3847

Event
End serve C1 Arr C2 Arr C3 End serve C2 Arr C4 End serve C3

Time
1.1 2 9.04 8.32 9.27 12.35

Done

State Statistics Event list Time Queue Pump Wait Lost


0 1.1 2 8.32 9.04 9.27 C1 C2 C3 C3 0 0

Time Done 1.1 2.0 9.04 8.32 9.27

C4

Time Queue Pump 1 Pump 2 0.00 1.10 2.00 8.32 9.04 C1 C2 C3 -

Wait

Lost

0.00

0.00

Queuing -2 - Final simulation tables


R.N.
9042 8863 745 3847 509 2237 1069 8327 4512 7064 4725 92 4553 8027 579 6593 9285 6190 4648 1139

Event
End serve C1 Arr C2 Arr C3 End serve C2 Arr C4 End serve C3 Arr C5 End serve C4 Arr C6 Arr C7 End serve C5 Arr C8 End serve C7 Arr C9 End serve C8 Arr C10 End serve C9 Arr C11 End serve C10 Arr C12 End serve C11 Arr C13

Time Done
1.1 2 9.04 8.32 9.27 12.35 9.43 11.61 9.77 15.13 15.32 18.81 18.97 18.84 22.54 23.71 20.31 26.94 30.28 29.83 30.72 30.19

State Time
0 1.1 2 8.32 9.04 9.27 9.43 9.77 11.61 12.35 15.13 15.32 18.81 18.84 18.97 20.31 22.54 23.71 26.94 29.83

Statistics Event list Queue Pump 1 Pump 2 Wait Lost


C1 C2 C3 C3 C3 C3 C3 C7 C7 C7 C7 C9 C10 C10 C10 C4 C4 C4 C5 C5 C5 C8 C8 C8 C8 C11 C11 0 0 0 C6 2.18 0 0 0.13

C5 C5

C9

0 0

C12

Queuing -2 - Statistics
Based on the Simulation: Mean waiting time = ( 0.00 + 0.00 + 0.00 + 2.18 + 0.00 + 0.00 + 0.13 + 0.00 + 0.00 ) / 9 = 2.31 /9 = 0.26 Average no. customers lost per hour = 2

What If Analysis

What If the Shortage cost is increased by 10 % ? What if the replenishment policy is changed? What if the demand pattern is changed? What if the lead time pattern is changed ?

Which simulation language/package to use ?


Complexity of the simulation variety of simulations that are likely to be done in future modeling & programming skills of the user

Commercial Software
SimFactory ProModel Witness Xcell Siman Simulation Language GPSS

Desirable features of a simulator


Modeling flexibility Ease of model development Fast execution speed Graphic capability Statistical capability Customer support

TABLE OF RANDOM NUMBERS


39634 62349 74088 65564 16379 19713 39153 69459 17986 24537 14595 35050 40469 27478 44526 67331 93365 54526 22356 93208 30734 71571 83722 79712 25775 65178 07763 82928 31131 30196 64628 89126 91254 24090 25752 03091 39411 73146 06089 15630 42831 95113 43511 42082 15140 34733 68076 18292 69486 80468

80583 70361 41047 26792 78466 03395 17635 09697 82447 31405

Is this a Random Sequence?

653589793238462643383279 502884197169399375105820 974944592307816406286208 998628034825342117067982 148086513282306647093844 609550582231725359408128 481117450284102701938521 1055596

Is this a Random Sequence?

314159265358979323846264 338327950288419716939937 510582097494459230781640 628620899862803482534211 706798214808651328230664 709384460955058223172535 940812848111745028410270 1938521

Generating Random Numbers

How would you do it (without a computer)? Is this a good way?

What might cause your method to be nonrandom?

Truly Random Numbers

Truly random numbers can be obtained from physical devices:


Radioactive emissions Thermal noise from a resistor Electronic noise

Computers can capture events and convert them into numbers

Pseudo-Random Numbers

Pseudo-random numbers are obtained from mathematical algorithms, e.g.:

Linear congruential generators

Commonly used in computer-based random number generators

Numbers Ticking Across Title

Created using the RAND function in Excel Excel uses a pseudo-random number generator (pRNG) with a linear congruential algorithm:

Eventually the pattern will repeat

Mathematical Algorithms

Linear congruential algorithms are the least sophisticated of RNGs

Choice of multiplicative, additive and modulus components can make a big difference to the randomness of the numbers generated

Any mathematical approach is not random

Seeding

Left alone, the pRNG will eventually repeat

We can think of a very long list of numbers that are produced

The randomness of a pRNG can be improved with seeding

Seeding

Starting point for algorithm


What number in the list the algorithm starts with Frequently defined by length of time computer has been operating before first request for a random number is made

Periodically, the pRNG can be stopped, and restarted using a new seed

Random number generator

LCG (linear congruential generators)

produces a pseudorandom sequence of numbers x1, x2, x3 according to the linear recurrence xn = axn1 + b mod m; n 1;
a, b,and m are parameters which characterize the generator x0 is the (secret) seed. given a partial output sequence, the remainder of the sequence can be reconstructed even if the parameters a, b,and m are unknown.

Unix Random

Statistical Test

Why

impossible to give a mathematical proof that a generator is indeed a random bit generator, the tests help detect certain kinds of weaknesses the generator may have. This is accomplished by taking a sample output sequence of the generator and subjecting it to various statistical tests.

Statistical Test

the term accepted should be replaced by not rejected Basic Tests


Frequency Test: # of 0 and 1 Serial Test: # of 00, 01, 10, 11 Run Test: comparing with expected run length Autocorrelation test: correlations between s and shifted version

Sources of Error

Model error

Model is abstraction of reality Caused by fact simulation is an experiment Usually a lesser problem than model error but should not be ignored Should be measured and controlled

Simulation error

Simulation Error

Small samples lead to large errors Even 1000 trials usually not sufficient for great accuracy Get closer to right answer as number of trials increases Mean Standard Error (MSE) measures precision

A 95% confidence interval for true mean extends to 1.96 MSEs on either side of the sample average

You might also like