Академический Документы
Профессиональный Документы
Культура Документы
601
Decision Models
Simulation
Summer 2013
Simulation BU.520.601 1
Simulation
Simulation Simulation
Simulation Process
Process
Many definitions.
It is the process of studying the
behavior of a real system using a
computer-based model that
replicates the behavior of that
system.
Used in situations involving
probabilistic elements (e.g.
random arrivals, service times
and process yields)
Used in situations where the
complexity or the size of the
problem makes it difficult to use
optimizing models.
Useful in both service or
manufacturing systems.
Simulation BU.520.601 2
Simulation
Simulation characteristics
characteristics
In a simulation model we have transactions (customers, cars, ..)
and events (arrivals, receiving service, departure,..).
When probability distributions are associated with events, we
use a method called random deviate generation to get
numbers from the probability distribution to simulate events.
Timing of event may or may not be important in a simulation.
For simulation of a warehouse operation, if inventory is charged
on items at the end of the month, we do not need to know precise
timing of withdrawal of items. We only need to know how many
items were withdrawn during the month.
For simulation of toll booths, we need timings of two types of
events when each car arrives and how long it takes to pay.
Simulation BU.520.601 3
Simulation characteristics..cont
Simulation is not an optimization tool, rather we try to
establish values of performance measures to arrive at better
decision making. Here is an example.
Suppose we would like improve customer satisfaction at a bank
drive-in facility. We study arrival patterns, service times etc., and
simulate the operation with one drive-in window, with two and
may be with three drive-in windows.
Obviously three windows will be most satisfactory from the customer
point of view. But then we take into account the cost (initial and
operating) and other factors to make the final decision.
Simulation BU.520.601 4
Ex. 11 Simulate the tossing of a coin.
Ex.
Model construction: No simulation clock is involved
Each transaction will be the toss of a coin. We will generate 500
transactions (an arbitrary decision).
We will assume that the coin is fair. The random variable X
takes two values (0, 1 for T and H) with equal probabilities.
Simulation BU.520.601 5
Ex. 1.. Excel: Simulate the tossing of a coin.
Ex. 1..
Simulation BU.520.601 6
Generating
Generating random
random deviates
deviates (variates)
(variates)
For every probability distribution, as the variable X goes the
minimum value to the maximum value, the cumulative probability
increases from 0 to 1.
Random number generators produce numbers between 0 to 1
(uniform distribution). Thus for any value of a random number,
there is one matching point on the cumulative distribution of X.
We match the value and generate X.
RAND() generates a random number (say RN, 0 RN < 1).
function automatically.
Discrete
Discrete uniform
uniform distribution
distribution
For the discrete uniform
distribution , when X varies
between integers A and B, Excel
has a special function
= RANDBETWEEN(A, B). A A+1 B-
1 B X
Simulation BU.520.601 7
Empirical
Empirical distribution
distribution We need cumulative probabilities.
1. F(X
0 )
Suppose we pick RN = 0.632.
0.632
Simulation BU.520.601 8
F(X) 0.3 0.7 0.9 1.0
Using
Using LOOKUP
LOOKUP Demand: X 300 400 500 600
Pr(X) 0.3 0.4 0.2 0.1
What is the value
of X if RN = 0.632?
Suppose we use
HLOOKUP to find
1. F(X
demand corresponding
0 )
to F(X) = 0.632
0.632 We need to use the
function without exact
match.
300 400 500 But since 0.3 < 0.632 <
0. 600
0.7, Excel will match the
0 X value
To avoid this, we need to replace equal
F(X) withto 300.variable
some
G(X), in which F(X) values are shifted to the right.
Simulation BU.520.601 9
Ex.
Ex. 22 Ships arrive in the night at Arrival distribution
a facility with two docks. X 0 1 2 3 4 5
If a dock is available in the morning, Pr(X) 0.30 0.30 0.20 0.10 0.05 0.05
it is assigned to a waiting ship for the whole day and the ship leaves
in the evening. If a dock cannot be assigned, there is a fee of $10,000
per day per ship. Simulate the operation and estimate the
annual fee.
Model construction: We will start with a flow chart
Population
Dock 1
Arrival Queue Departure
Dock 2
Our model is simpler because both docks take 1 day to process.
Simulation BU.520.601 10
Ex. 2.. Dock simulation
Ex. 2..
Population
Simulation BU.520.601 11
Ex. 2 Excel: Dock simulation
Ex. 2
Simulation generated
Simulation BU.520.601 12
Ex. 2. Excel: Dock simulation
Ex. 2.
200
No of days 150
100
50
0
0 1 2 3 4 5 6 7 >7
No of ships
Simulation BU.520.601 13
Ex. 2.. Excel: Dock simulation
Ex. 2..
Arrivals are generated
with HLOOKUP.
Simulation BU.520.601 14
Random
Random Deviates:
Deviates: Continuous
Continuous distributions
distributions
Suppose X has continuous probability
distribution (range 100 to 500) and we
1. can find the cumulative distribution F(X).
0 F(X Every F(X) varies between 0 and 1.
0.5 )
2
0. 100 26 X
0 500
4 We can use random numbers (RN) to
generate X values because RN also
vary between 0 and 1 and there is a
one to one correspondence.
Simulation BU.520.601 15
Random
Random Deviates
Deviates Triangular distribution
Uniform distribution
A X B C
Triangular:
A X B
Let p = (B - A) / (C A)
Uniform: =IF(RAND() p, X, Y) where
= A + RAND()*(B A) X = A + SQRT(RAND() * (C A) * (B A)),
Y = C - SQRT((1-RAND()) * (C A) * (C
B))
Normal distribution = NORMINV(RAND(),Mean, Std. dev.)
Log-Normal = LOGINV(RAND(),Mean, Std. dev.)
Exponential distribution = (-Mean)*LN(RAND())
Simulation BU.520.601 16
Ex. 33 Retirement Planning
Ex.
You are 30 years old, and would like to invest
3000 dollars at the end of each year from
now till you reach 60.
Assume interest paid to be N(12, 2) meaning
normally distributed with mean = 12% and
std. dev. = 2%; interest is paid at the end of
year.
You would like to estimate probability of
reaching the target of one million dollars at
the age 60.
Age Investment value
You would like to know chances of achieving
30 if you
the target X30increase
= 3000 the annual amount
invested.
31 X31 = 3000 + X30 +
interest on X30
Simulation 32 X32 = 3000
BU.520.601 + X
31 + 17
Ex.
Ex. 3..
3..
=B12*(1+NORMINV(RAND(), Mean_R,STDV_R))
+ Annual_contr
Simulation BU.520.601 18
Ex. 3 Retirement Planning sensitivity analysis
Ex. 3
Effect of changing contribution on the probability of
achieving the desired outcome.
Simulation BU.520.601 19
Ex.
Ex. 44 An IPO is to be launched Opening Stock Price
with the opening price X 10 11 12 13 14 15
expected to be from the Pr(X) 0.10 0.20 0.30 0.20 0.10 0.10
distribution shown.
For the next five years, the stock price is expected to increase by an
amount given by a lognormal distribution with mean of 1.5% and
standard deviation of 0.5% provided the company does not fail. The
probability of failure is 40%, 30%, 20%, 20% and 10% during the next
five years.
Simulation BU.520.601 20
Ex.
Ex. 4..
4.. IPO Launching
Simulation BU.520.601 21
IPO Launching Ex.
Ex. 4
4
How
?Count failures
through Y1, then
Y2 Y1, etc.
Fail in Year 4:
=IF(K3="Y","Y",IF(RAND()<F$15,"Y","N"))
22
Simulation BU.520.601
Ex.
Ex. 4.
4. IPO Launching
23
Simulation BU.520.601
Time
Time Based
Based Event
Event Oriented
Oriented Simulation
Simulation
We will consider the following:
Transactions (customers) enter the system in a single line and are
processed at a single facility (server) on a FIFO basis also called
First Come First Served (FCFS).
Population
Simulation BU.520.601 24
A
A simple
simple example
example
Population
SS=1 SS=0
SS?
Q Queue
SS = 0 Server Status:
Idle
Tr. Transaction
Simulation BU.520.601 28
Example
Example 5..
5.. Single server system simulation 4 cases
Simulation BU.520.601 29
Example
Example 5
5 Single server system simulation
When the simulation starts at time zero, the system is empty. Value of
a performance measure such as server utilization keeps on changing
as time progresses.
After some time, when the process
reaches a steady state, value of the
performance measure comes close to the Expected
Parameter value
expected value of that measure.
In all four cases since average time
between arrivals is 6 minutes and the Parameter
average service time (when the server is value
busy) is 5 minutes. The server utilization
will stabilize at about 83% (=100*75/90). 0 t Time
Simulation BU.520.601 30
Example Arrival Service time
Example 5A
5A
Uniform (discrete) 1 to Fixed ( 5
11 min minutes)
Simulation BU.520.601 31
Example Arrival Service time
Example 5A..
5A..
Uniform (discrete) 1 to Fixed ( 5
11 min minutes)
Simulation BU.520.601 32
Example 5B Arrival
Example 5B Service time
Poisson: 10 / Exponential: 5 min
hour
Simulation BU.520.601 33
Example 5D.. Arrival
Example 5D.. Service time
Poisson: 10 / Exponential: 5 min
hour
The graph here shows that it is not easy to determine when steady
state may be reached (how many observations to chop off), nor do
we know how many total observations to collect in a simulation
run or how many time to replicate.
Simulation BU.520.601 34
Example
Example 5:
5: Comparison
Comparison
A B
Simulation BU.520.601 35
Simulation:
Simulation: general
general comments
comments
Simulation BU.520.601 38