Download simulation

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Law of large numbers wikipedia , lookup

Transcript
Simulation is the process of studying
the behavior of a real system by using a
model that replicates the system under
different scenarios.
A simulation model is constructed by
identifying the mathematical
expressions and logical relationships
that describe how the system operates.
Advantages of Computer
Simulation


It offers the ability to gain insights into
the model solution which may be
impossible to attain through other
techniques.
It provides a convenient experimental
laboratory to perform "what if" and risk
analysis.
Disadvantages of Computer
Simulation


A large amount of time may be required to
develop the simulation model.
Simulation is, in effect, a trial and error
method of comparing different policy inputs.
It does not determine if some input which
was not considered could have provided a
better solution for the model.
Building a Simulation Model
1.
2.
3.
4.
5.
Identify the decision variables, random variables and
objective in the problem.
Model the logic of the problem:
 Flowchart
 Formulas to describe relationships
 Probability distributions for random variables
 Program code
Validate the model
Experimental Design
Perform simulation runs and analyze output results
Random Variables



Random variable values are utilized in the model
through a technique known as Monte Carlo
simulation.
Each random variable is mapped to a set of numbers
N so that each time one number in N is generated,
the corresponding value of the random variable is
given as an input to the model.
The mapping is done in such a way that the long run
percentage of time that a particular number is
simulated in the model occurs according to the
probability of that value for the random variable.
Excel’s Random Number Generator (RNG)


=rand()
Randomly simulates a value between 0 and
1 in the cell where the function is entered


In PC’s press [F9] to recalculate the function
manually
Function value is recalculated whenever a
number or formula is entered in another cell
unless Calculation Options in Formula ribbon is
set to Manual
Continuous Distributions


The values generated for a random
variable are specified from a set of
uninterrupted values over a range; an
infinite number of values is possible
For example, the interest rate next year
could be modeled as a continuous
random variable between 0% to 8%.
Common Continuous Distributions


Normal Distribution: A symmetrical bell
shaped curve that is centered around a
specified mean μ with a spread described
by the standard deviation σ
Uniform Distribution: A rectangular
curve where it is assumed that all values
between a specified minimum and a
specified maximum are equally likely to
occur
Modeling Continuous Distributions

In Excel, for the Normal distribution:


=norminv(random #, μ, σ)
Values will be simulated from a
symmetrical bell-shaped curve where the
most likely value is μ and 64% of the
values have a chance of lying within 1 σ (in
either direction) of μ
Discrete Distributions


The values generated for a random variable
must be from a finite distinct set of individual
values.
For example, the number of passengers who
may try to buy airline tickets is a discrete
random variable that is limited to positive
integer values in a certain range.
=Randbetween(a,b) function



Simulates an integer value between a
and b
Assumes that every number between a
and b is equally likely to occur in the
system
Maps numbers generated between 0
and 1 using rand() function to the
interval (a,b)
Modeling Discrete Distributions

In Excel, when every random variable
value is not equally likely and there are
limited choices, use the Vlookup
function:


=vlookup(value to look up in column 1,
table to look in, column to report result
from)
See Vlookup function Excel snippit in
MyLMUConnect.
Modeling Discrete Distributions

In Excel, when every random variable
value is not equally likely and there are
many choices, use a continuous
distribution with the Int function:


=Int(norminv(random #, μ, σ)
Replace the continuous distribution with
appropriate shape for likelihood as
appropriate.
Model Validation




Models based on assumptions which do not
accurately reflect real world behavior cannot be
expected to generate meaningful results.
Errors in programming can result in nonsensical
results.
Validation is generally done by having an expert
review the model and the computer code for errors.
If possible, the simulation should be run using actual
past data. Predictions from the simulation model
should be compared with historical results.
Experimental Design



Policies under consideration for
implementation in the real system must be
identified.
For each policy under consideration by the
decision maker, the simulation requires
performing many runs.
Whenever possible, different policies should
be compared by using the same sequence of
random numbers.
“Trials”, “Runs” and “Iterations”


Every time a set of input values are
simulated, output results should be collected.
The outputs associated with a trial represent
one snapshot of what could occur in the real
system and under what conditions
Many trials (e.g. runs, iterations) should be
performed so that a distribution describing
the key outputs can be created and the mean
outcomes and risk can be viewed
Excel Simulation Add-ins



Risk Solver
Crystal Ball
@Risk


Provides built-in functions for probability
distributions
Performs simulation trials, captures outputs
and summarizes results with histograms
and statistics