Professional Documents
Culture Documents
"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
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.
Define the problem/system Formulate the model Test the model Identify and collect the data Run the simulation Analyze the results Validate the simulation
Need for and quantity of equipment /personnel Performance evaluation Evaluation of operational procedures
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
r1, r2, , rn
Controllable Input Model
Analysis
Outcome
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
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 ?
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
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.
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
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
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
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
Normal
Need to know the mean and standard deviation Simulated = Random X Standard Mean + value number deviation
Uniform Distribution
F(x)
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 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...
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.
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.
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.
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.
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
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
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
C4 C4 C4
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
C4
Wait
Lost
0.00
0.00
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
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 ?
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
Modeling flexibility Ease of model development Fast execution speed Graphic capability Statistical capability Customer support
80583 70361 41047 26792 78466 03395 17635 09697 82447 31405
Pseudo-Random Numbers
Created using the RAND function in Excel Excel uses a pseudo-random number generator (pRNG) with a linear congruential algorithm:
Mathematical Algorithms
Choice of multiplicative, additive and modulus components can make a big difference to the randomness of the numbers generated
Seeding
Seeding
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
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
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