Simulation
Simulation
IE 519
Contents
Input Modelling 3
Random Number Generation
Generating Random Variates
Output Analysis
134
Resampling Methods 205
Comparing Multiple Systems
Simulation Optimization
248
Metamodels
278
Variance Reduction 292
Case Study
350
IE 519
41
80
219
Input Modelling
IE 519
Input Modelling
You make custom Widgets
How do you model the input
process?
Is it deterministic?
Is it random?
Look at some data
IE 519
Orders
1/5/2004
1/12/2004
1/20/2004
1/29/2004
2/3/2004
2/15/2004
2/19/2004
2/25/2004
2/28/2004
3/6/2004
3/15/2004
3/27/2004
3/31/2004
4/10/2004
4/14/2004
4/17/2004
4/21/2004
4/22/2004
4/28/2004
5/2/2004
5/3/2004
5/24/2004
5/26/2004
6/4/2004
6/15/2004
Now what?
IE 519
Histogram
8
7
6
5
4
3
2
1
0
IE 519
Other Observations
Trend?
Seasonality
IE 519
IE 519
Assumptions
To fit a distribution, the data should
be drawn from IID observations
Could it be from more than one
distribution?
Statistical test
Is it independent?
Statistical test
IE 519
Activity I
Hypothesize families of
distributions
10
Activity II
Estimate the parameters
IE 519
11
Activity III
Determine quality of fit
Software
IE 519
12
Chi-Square Test
Formal comparison of a histogram and
the probability density/mass function
Divide the range of the fitted
distribution
intervals
[a0 , ainto
1 ), [ a1 , a2 ),..., [ ak 1 , ak )
Count the number of observations in
each interval
N j Number of X ' s in [a j 1 , a j )
IE 519
13
Chi-Square Test
Compute
the
expected
proportion
a
pj
f ( x)dx
p ( x )
a j 1
a j 1 xi a j
Test statistic is
k
j 1
np j
np j
14
Correlation plot
Scatter diagram
Nonparametric tests
IE 519
15
Correlation Plot
Calculate and plot the sample
correlation
j Correlation of observations j observations apart
H0 : j 0
IE 519
16
Scatter Diagram
Plot pairs
X i , X i 1
IE 519
17
X k1 , X k 2 ,..., X 1nk
Is the data drawn from the same process
(homogeneous) and can thus be combined?
Kruskal-Wallis test
IE 519
18
Kruskal-Wallis (K-W)
Statistic
Assign rank 1 to the smallest
observation, rank 2 to the second
k
smallest, etc
n ni
i 1
Calculate
R X ij Rank of X ij
ni
Ri R X ij
j 1
k
Ri2
12
T
3( n 1)
n(n 1) i 1 ni
IE 519
19
K-W Test
The null hypothesis is
H0: All the population distribution are identical
H1: At least one is larger than at least one other
We reject H0 at level if
2
k 1,1
In other words, the test statistic follows a chisquare distribution with k-1 degrees of freedom
IE 519
20
Absence of Data
We have assumed that we had data
to fit a distribution
Sometimes no data is available
Try to obtain minimum, maximum,
and mode and/or mean of the
distribution
Documentation
SMEs
IE 519
21
Triangular Distribution
IE 519
22
Symmetric Beta
Distributions
==2
==5
==3
==10
IE 519
23
IE 519
24
Beta Parameters
Mean
(b a )
a
Mode
1 b a
c a
2
Estimates
( a )(2c a b)
(c )(b a )
(b )
a
IE 519
25
Benefits of Fitting a
Parametric Distribution
We have focused mainly on the approach
where we fit a distribution to data
Benefits:
IE 519
26
27
Solutions
A customer places a monthly order.
IE 519
28
Examples of models
Univariate
Discrete
Continuous
Mixed
Binomial, etc.
Normal, gamma, beta, etc.
Empirical/Trace-driven
Multivariate
Discrete
Continuous
Mixed
Independent binomial
Multivariate normal
Bivariate-exponential
Time-independent
Cont.-state
Discrete-state
Stochastic Processes
Continuous-time
Cont.-state
IE 519
Time-series models
Poisson process (stationary?)
Markov process
29
30
Goodness-of-Fit Test
The distribution fitted is tested using
goodness-of-fit tests (GoF)
How good are those tests?
The null hypothesis is that the data
is drawn from the chosen
distribution with the estimated
parameters
Is it true?
IE 519
31
32
33
IE 519
34
Is Data Reality
Data is often
Distorted
Poorly communicated, mistranslated or recorded
Dated
Data is always old by definition
Deleted
Some of the data is often missing
Dependent
Often only summaries, or collected at certain times
Deceptive
This may all be on purpose!
IE 519
35
36
Alternative
Use empirical/trace-driven
simulation when there is sufficient
data
Treat other cases as if there is no
data, and use beta distribution
IE 519
37
Empirical Distribution
Observations
X 1 , X 2 ,..., X n
Empirical distribution function (CDF)
Number of X i x
FX ( x)
n
or we can order the observations X (1) X ( 2 ) ... X ( n ) and define
0
x X (i )
i 1
FX ( x)
n 1 (n 1) X ( i 1) X ( i )
1
x X (1)
X (i ) x X (i 1)
X (n) x
IE 519
38
IE 519
39
What to Do?
Old rule of thumb based on
number of data points available:
<20
: Not enough data to fit
21-50 : Fit, rule out poor choices
50-200 : Fit a distribution
>200 : Use empirical distribution
IE 519
40
Random Number
Generation
IE 519
41
Random-Number
Generation
Any simulation with random
components requires generating a
sequence of random numbers
E.g., we have talked about arrival times,
service times being drawn from a
particular distribution
We do this by first generating a random
number (uniform between [0,1]) and
then transforming it appropriately
IE 519
42
Three Alternatives
True random numbers
Throw a dice
Not possible to do with a computer
Pseudo-random numbers
Quasi-random numbers
43
Precision
44
Pseudo-Random Numbers
Want an iterative algorithm that
outputs numbers on a fixed interval
When we subject this sequence to a
number of statistical test, we cannot
distinguish it from a random
sequence
In reality, it is completely
deterministic
IE 519
45
Linear Congruential
Generators (LCG)
Introduced in the early 50s and still in
very wide use today
Recursive formula
Z i (aZ i 1 c) mod m
a multiplier
c increment
m modulus
Z 0 seed
46
Zi
Ui
m
What values can we take?
IE 519
47
Examples
Z i (11Z i 1 ) mod 16, Z 0 1
Z i (3Z i 1 ) mod 13, Z 0 1
Z i ( Z i 1 12) mod 16, Z 0 1
IE 519
48
Characteristics
All LCGs loop
The length of the cycle is the period
LCGs with period m have full period
This happens if and only if
IE 519
49
Types of LCGs
If c=0 then it is called
multiplicative LCG, otherwise
mixed LCG
Mixed and multiplicative LCG
behave rather differently
IE 519
50
Comments on Parameters
Mixed Generator
Want m to be large
A good choice is m = 2b, where b is the number of
bits
Obtain full period if c is odd and a-1 is divisible
by 4
Multiplicative LCGs
Simpler
Cannot have full period (first condition cannot
be satisfied)
Still an attractive option
IE 519
51
Performance Tests
Empirical tests
Use the RNG to generate some
numbers and then test the null
hypothesis
H0: The sequence is IID U(0,1)
IE 519
52
53
U 2 U d 1 , U d 2 ,..., U 2 d ,...
Similar to before
d
f j1 j2 jd
n
f j1 j2 jd d
k
j1 1 j2 1
jd 1
Number of U i ' s in the subinterval
k
n
2
IE 519
54
a r nb r
6
i 1 j 1
ij
nb j
55
1
E U U
4
12 E U U 3
E U iU i j E U i E U i j
i
i j
i j
IE 519
56
h 1 k 0
h (n 1) / j 1
13h 7
Var j
(h 1) 2
Test statistic
j
Aj
Var j
Approximately standard normal
IE 519
57
IE 519
58
Classic LCG16807
Multiplicative LCGs cannot have full period,
but they can get very close
Z i 16807 Z i 1 mod 231 1
Z
U i i 31
2 1
Has period of 231-2, that is, best possible
Dates back to 1969
Suggested in many simulation texts and was
(is) the standard for simulation software
Still in use in many software packages
IE 519
59
Java RNG
Mixed LCG with full period
Z i (25214903917 Z i 1 11) mod 2 48
27
2
Ui
Z 2i
Z 2i 1
2 22
2 21
253
Zi
2 48
IE 519
60
Zi
2 24
Excel
IE 519
61
I (1) I ( 2 ) I ( n )
Have k boxes, labeled with
S j I ( j 1) I ( j )
Define the spacing
ConsiderY j : S j 1 S j , j 1,..., n 2
IE 519
62
Performance: Collision
After 215 numbers, VB starts failing
After 217 numbers, Excel starts failing
After 219 numbers, LCG16807 starts failing
The Java RNG does OK up to at least 220
numbers
Note that this means that a clear pattern
is observed from the VB RNG with less
than 100,000 numbers generated!
IE 519
63
Performance: B-day
Spacing
After
After
After
After
64
Combined LCG
A better RNG is obtained as follows:
Z1,i (a1,1 Z1,i 1 a1, 2 Z1,i 2 ... a1,k Z1,i k ) mod m1
Z1,i (a2,1 Z 2,i 1 a2, 2 Z 2,i 2 ... a2,k Z 2,i k ) mod m2
Z1,i
Ui
m1
Z 2 ,i
m2
mod 1
65
66
Lattice Structure
For all LCGs, the numbers
generated fall in a fixed number of
planes
We want this to be as many planes
as possible and fill-up the space
This should be true in many
dimensions
IE 519
67
IE 519
68
LCG RANDU in 3
Dimensions
IE 519
69
Theoretical Tests
Based on analyzing the structure
of the numbers that can be
generated
Lattice test
Spectral test
IE 519
70
1 10 15 0 13 6 11 12 9 2 7 8 5 14 3 4 1
Seed = 15
Seed = 1
71
72
Z i (11Z i 1 ) mod 16
Analysis of RNG
1 10 15 0 13 6 11 12 9 2
0.06
0.63
0.94
0.00
0.81
0.38
0.69
0.75
0.56
0.13
3.5
3
2.5
2
1.5
1
0.5
0
[0,0.25)
[0.25,0.5)
[0.5,0.75)
IE 519
[0.75,1)
73
Do We Need Randomness?
For certain applications, definitely
For simulation, maybe not always
Quasi-random numbers
Say we want to estimate an
expected value
f u du
[ 0 ,1) s
IE 519
74
2
Var
n
n ( ) / N (0,1)
75
Quasi-Monte Carlo
Replace the random points with a set of
points that cover [0,1)s more uniformly
IE 519
76
Discussion
By using Quasi-random numbers,
we are able to achieve faster
convergence rate
When estimating an integral, real
randomness is not really an issue
What about discrete event
simulation?
IE 519
77
Discussion
Generating random numbers is
important to every simulation
project
IE 519
78
Discussion
Problems
79
Generating Random
Variates
IE 519
80
Generating Random
Variates
Say we have fitted an exponential
distribution to interarrival times of
customers
Every time we anticipate a new customer
arrival (place an arrival even on the
events list), we need to generate a
realization of of the arrival times
Know how to generate unit uniform
Can we use this to generate exponential?
(And other distributions)
IE 519
81
Indirect
Acceptance-rejection
IE 519
82
Inverse-Transform Method
IE 519
83
Formulation
Algorithm
1. Generate U ~ U (0,1)
1
2. Return X F (U )
Proof
P X x P F 1 (U ) x
P (U F ( x))
F ( x)
IE 519
84
Example: Weibull
IE 519
85
Example: Exponential
x0
x0
F ( x)
1 e x /
IE 519
86
Discrete Distributions
IE 519
87
Formulation
Algorithm
X can take values x1 , x2 ,...
1. Generate U ~ U (0,1)
2. Return X min I : U F xI
Proof: Need to show
P X xi p( xi )i
IE 519
88
Continuous, Discrete,
Mixed
Algorithm
1. Generate U ~ U (0,1)
2. Return X min x : F ( x) U
IE 519
89
Discussion: Disadvantages
Must evaluate the inverse of the
distribution function
IE 519
90
Discussion: Advantages
Facilitates variance reduction
X 1 F11 (U1 )
X 2 F21 (U 2 )
Can select
U1 , U 2 independent
U1 U 2
U1 1 U 2
Ease of generating truncated distributions
IE 519
91
Composition
F ( x) p j F j ( x),
Assume that
j 1
p
j 1
Algorithm
1.
2.
92
Convolution
Assume thatX Y1 Y2 ... Ym
(where the Ys are IID with CDF G)
Algorithm
1. Generate Y1 Y2 ... Ym IID each with CDF G
2. Return X Y1 Y2 ... Ym
IE 519
93
Acceptance-Rejection
Method
Specify a function that majorizes the
t ( x) f ( x), x
density
r ( x) t ( x)
1.
Generate Y with density r
Algorithm
2. Generate U independint of Y
3. If U f (Y ) t (Y ), return X Y .
Otherwise go back to Step 1.
IE 519
t ( x)dx
94
Example:
IE 519
95
IE 519
96
Simple Distributions
Uniform
X a (b a )U
Exponential
X ln U
m-Erlang
X
ln
m
U
i
i 1
IE 519
97
Gamma
Distribution function
F ( x)
x
1
x /
1 e
j!
j 0
0
x0
otherwise
No closed-form inverse
Note that ifX ~ gamma( ,1) then
X ~ gamma( , )
IE 519
98
Gamma(,1) Density
IE 519
99
Gamma(,1)
Gamma(1,1) is exponential(1)
0<<1: Acceptance-rejection with
x0
0
x 1
t ( x)
0 x 1
( )
x
e ( ) 1 x
100
Gamma(,1), 0<<1
The integral of majorizing function
x
e
x 1
0 t ( x)dx 0 ( ) dx 1 ( )dx
b
( ) ,
b (e ) / e
1
New density
x0
0 1
x
r ( x)
0 x 1
b
e x
1 x
IE 519
101
Gamma(,1), 0<<1
The distribution function is
x
x
R ( x) r ( y )dy b x
0
1 e
Invert
R 1 (u )
bu
0 x 1
1 x
1/
b(1 u )
ln
1
u
b
otherwise
IE 519
102
Gamma(,1), 0<<1
1.Generate U1~U(0,1) and let P=bU1. If P>1,
go to step 3. Otherwise go to step 2
2.Let Y=P1/, and generate U2~U(0,1). If U2eY,
return X=Y. Otherwise, go to step 1.
3.Let Y=-ln[(b-P)/], and generate U2~U(0,1).
If U2Y-1, return X=Y. Otherwise, go to step
1.
IE 519
103
Gamma(,1), 1<
Acceptance-rejection with
t x
2 1
c 4 e ( )
IE 519
104
Gamma(,1), 1<
Distribution function (loglogistics)
x
R( x)
x
Inverse1
u
R (u )
1 u
1/
IE 519
105
Normal
Distribution function does not have closed
form (so neither does the inverse)
Can use numerical methods for inversetransform
Note that
X ~ N (0,1)
X ~ N ( , )
106
Normal: Box-Muller
Algorithm
107
Polar Method
Algorithm
1. Generate independent U1 , U 2 ~ U (0,1).
Let Vi 2U i 1, W V12 V22
2. If W 1 go to step 1. Otherwise, let
Y (2 ln W ) / W
X 1 V1Y
X 2 V2Y
IE 519
108
Derived Distributions
Several distributions are derived
from the gamma and normal
Can take advantage of knowing
how to generate those two
distributions
IE 519
109
Beta
Density
x1 1 (1 x) 2 1
f ( x)
B 1 , 2
0
B 1 , 2 t
1
z1 1
(1 t )
z 2 1
0 x 1
otherwise
dt
110
IE 519
111
Beta Properties
Sufficient to consider beta on [0,1]
If X~beta(1,2) then 1-X~beta(2,1)
If 2=1 then
1 1
2 1
1 1
x (1 x)
x
f ( x)
1 x1 1
B 1 , 2
B 1 ,1
1
F ( x) x
If 1=1, 2=1 then X~U(0,1)
IE 519
112
Y1
~ beta 1 , 2
Y1 Y2
Thus, if we can generate two gamma
random variates, we can generate a beta
with arbitrary parameters
IE 519
113
Pearson Type VI
If Y1~Gamma(,) and
Y2~Gamma(,1), and Y1 and Y2 are
independent,
then
Y1
Y2
~ PT 6 1 , 2 ,
IE 519
114
Pearson Type V
IE 519
115
Pearson Type VI
IE 519
116
Normal Derived
Distributions
Lognormal
Y ~ N ,
~ LN ,
Chi-squared
Students t distribution
F distribution
IE 519
117
Log-Normal
IE 519
118
Empirical
Use inverse-transform method
Do not need to search through observations
because changes occur precisely at 0, 1/(n-1),
2/(n-1),
Algorithm
1. Generate U ~ U (0,1). Let P (n-1 )U ,
and let I P 1
2.Return X X ( I ) ( P I 1) X ( I 1) X ( I )
IE 519
119
Empirical Distribution
Function
IE 519
120
Discrete Distributions
Can always use the inverse-transform
method
May not be most efficient
Algorithm
1. Generate U ~ U (0,1).
j 0
j 0
p(j) U p(j)
IE 519
121
Alias Method
Another general method is the
alias method, which works for
every finite range discrete
distribution
IE 519
122
L0=1
L2=3
p( x)
0.2 x 2
0.3 x 3
1
123
Bernoulli
Mass function
1 p x 0
p( x) p
x 1
0
otherwise
Algorithm
1. Generate U ~ U (0,1)
2.If U p return X 1. Otherwise return X 0
IE 519
124
Binomial
Mass function
t x
p (1 p ) t x
p( x) x
0
x {0,1,..., t}
otherwise
125
Geometric
Mass function
x {0,1,..., t}
otherwise
p( x)
p (1 p ) x
Use inverse-transform
1. Generate U ~ U (0,1)
2. Return X ln(1 U )
ln(1 p )
IE 519
126
Negative Binomial
Mass function
s x 1 s
p (1 p ) x
p( x)
x
0
x {0,1,..., t}
otherwise
127
Poisson
e x
Mass function p ( x) x!
0
Algorithm
1. Let a e , b 1, i 0
x {0,1,..., t}
otherwise
128
Poisson Process
A stochastic process {N (t), t 0}
that counts the number of events up
until time t is a Poisson process if:
dt
IE 519
129
Generating a Poisson
Process
Stationary with rate >0
Time between events Ai=ti-ti-1 are
IID exponential
Algorithm
1. Generate U ~ U (0,1)
2. Return ti ti 1 1 ln U
IE 519
130
Nonstationary Case
Can we simply generalize?
(t)
ti
ti 1
IE 519
131
Thinning Algorithm
1. Set t=ti-1
2. Generate U1, U2 IID U(0,1)
3. Replace t by
1
t * ln U1 , where * max (t )
t
*
U
(
t
)
/
4. If 2
return ti = t. Otherwise,
go back to step 2.
IE 519
132
Summary
For any stochastic simulation it is
necessary to generate random
variates from either a theoretical
distribution or an empirical
distribution
General methods we covered
Inverse-transform
Acceptance-rejection
Alias method
IE 519
133
Output Analysis
IE 519
134
Output Analysis
Analyzing the output of the simulation is
a part that is often done incorrectly (by
analysts and commercial software)
We consider several issues
135
Simulation Output
The output from a single simulation run
is a stochastic process Y1, Y2,
Observations (n replications of length
m):
y y y
11
1i
1m
y21 y2i y2 m
136
Parameter Estimation
Want to estimate some parameter
based on these observations
Unbiased?
E ?
Consistant?
lim ?
t
IE 519
137
IE 519
138
IE 519
139
Types of Simulation
Terminating simulation
Steady-state parameters
IE 519
140
Terminating Simulation
Examples:
141
Non-Terminating
Simulation
Any system in continuous operation
(could have a break)
Interested in steady-state parameters
Initial conditions should be discarded
Sometimes no steady-state because the
system is cyclic
Then we are interested in steady-state
cycle parameters
IE 519
142
Terminating Simulation
Let Xj be a random variable defined on
the jth replication
Want to estimate the mean =E (Xj )
X (n) t n 1,1 / 2
S ( n)
n
Fixed-sample-size procedure
CI assumes Xjs are normally distributed
IE 519
143
Quality of Confidence
Interval
Number of failures
Depends on both the
underlying
distribution and the
number of
replications
Average delay (25 customers)
IE 519
144
P X
P X half length
IE 519
145
Replications Needed
To obtain absolute error of , the
number of replications needed is
approximately
2
S
( n)
*
na min i n : ti 1,1 / 2
i
IE 519
146
Relative Error
1 P
half length
P X X
P X X
P(1 ) X
P X (1 )
P X X
IE 519
147
Replications Needed
To obtain relative error of , the number
of replications needed is approximately
n min
*
r
S 2 ( n)
ti 1,1 / 2
i
i n:
1
X ( n)
IE 519
148
Sequential Procedure
2
S
( n)
Define '
, (n, ) ti 1,1 / 2
1
i
Algorithm
149
Other Measures
If we only use averages, the results
can often be misleading or wrong
What about the variance?
Alternative/additional measures
Proportions
Probabilities
Quantilies
IE 519
150
Example
Suppose we are interested in
customer delay X. We can estimate
The q-quantile xq
IE 519
151
Estimating Proportions
Define an indicator function
1 if X a
Ii
0 otherwise
Obtain a point estimate of the
proportion
1 n
n
i 1
IE 519
152
Estimating Probabilities
Want to estimate p=P(XB)
Have n replications X1,X2,,Xn
Define
S=number of observations that fall in
set B
S ~ binomial(n,p)
Unbiased estimate S
is
n
IE 519
153
Estimating Quantiles
Let X(1),X(2),,X(n) be the order statistics
corresponding to n simulation runs
A point estimator is then
X ( nq )
xq
X nq
if nq is an integer
otherwise
IE 519
154
Initial Conditions
In terminating simulation there is no
steady-state
Hence, the initial conditions are included
in the performance measure estimates
How should they be selected?
IE 519
155
Discussion
For terminating simulation we must use
replications (cannot increase length of simulation
run)
Point estimates of performance measures:
IE 519
156
Steady-State Behavior
Now were interested in parameters
related to the limit distribution
Fi ( y ) F ( y )
i
Fi ( y ) PYi y
F ( y ) P Y y
157
Estimating Mean
Suppose we want to estimate the
steady-state mean
lim E Yi
i
Problem:
E Y (m) , m
1
Y (m, l )
Yi
m l i l 1
IE 519
158
Replication/deletion
One long replication:
Batch-means
Autoregressive method
Spectrum analysis
Regenerative method
Standardized time series method
IE 519
159
160
Welchs Procedure
Y11
Y21
Y12
Y22
Y13
Y23
Y14 Y1,m 2
Y24 Y2,m 2
Y1,m 1
Y2,m 1
Y1,m
Y2,m
Yn1
Y1
Yn 2
Y2
Yn 3
Y3
Yn 4 Yn ,m 2
Y4
Ym 2
Yn ,m 1
Ym 1
Yn ,m
Ym
Ym 1 (1)
IE 519
161
Welchs Procedure
Key is to smooth out high-frequency
oscillations in the averages
Yi ( w)
w
1
Yi s , i w 1,..., m w
2w 1 s w
i 1
1
Yi s , i 1,2,..., w
2i 1 s ( i 1)
162
Example: Hourly
Throughput
163
Welchs Procedure
Much smoother and
easier to tell where it
has converged
Want to err on the side
of selecting it too large
IE 519
164
Replication/Deletion
Similar to terminating simulation
S 2 ( n' )
n'
1 m'
X ( n' )
Y ji
m'1 m ' l
m' l
Need n pilot runs to determine the warm-up
period l, and then throw away the first l
observations from the new n runs
IE 519
165
Discussion
Replication/deletion appoach
166
Covariance Stationary
Process
Classic statistical inference assumes independent
and identically distributed (IID) observations
Even after eliminating the initial transient this is
not true for most simulations because most
simulation output is auto-correlated
However, it is reasonable to assume that after the
initial transient the output will be covariance
stationary, that is,
k cov Yi , Yi k
is independent of i
IE 519
167
Notation:
Simulation output:
Mean:
Variance:
Covariance:
Y1 , Y2 ,..., Yn
v E Yj
2 Var Y j
k cov Yi , Yi k
Variance:
0 2
k
Correlation:
k
0
IE 519
Assume
covariance
stationary
168
Implications of
Autocorrelation
Y j and E
j 1
2
Y
j
n
n n 1 j 1
In fact,
E S ( n)
2
1 k n
1 2
n 1
k 1
n 1
IE 519
169
1 2 1 k
n
n
k 1
2
is
S2
2
E
IE 519
170
Independent Process
If the output process is independent
then
k cov Yi , Yi k
k
0
2
S
E
n
2
0, k 1
k
0 2
1 2 1 n k n n
k 1
n 1
1 2 1 k 1
n
k 1
2 2
n 1
n 1
IE 519
171
Autocorrelation in Process
If the process is positively correlated (usual):
k 0, k 1
0
2
n
S
E
n
2
0 2
k
1 2 1 n k n n
k 1
n 1
1 2 1 k 1
n
k 1
2 2
n 1
n 1
172
Batch-Means Estimators
Batch-means estimators are the most popular
alternative to replication/deletion
The idea here is to do one very long simulation
run and estimate the parameters from this run
Advantage is that the simulation only has to go
through the initial transient once
Assuming covariance-stationary output
IE 519
173
Classical Approach
Partition the run of n into k equalsize contiguous macro replications,
each composed of m=n/k micro
replications
k
1
Point estimator
j
k j 1
IE 519
174
CI Analysis
Assuming as before that Y1, Y2, is covariancestationary with E[Yi]=
v j
If the batch size is large enough, then the
estimates will be approximately uncorrelated
Suppose we can also choose k large enough so
that they are approximately normal
It follows that the batch estimates have the
same mean and variance
Hence we can treat them as approximately IID
normal and get the usual confidence interval
IE 519
175
Variants of Batch-Means
Y1 , Y2 , Y3 ,....., Ym 1 , Ym , Ym 1 ,...., Y2 m 1 , Y2 m , Y2 m 1 ,..., Yn
Batch 1
Batch 2
Batch 2
IE 519
176
Steady-State Batching
General variance estimator
2
SB
Var
nm
2
B
jB
2
j
B 1
IE 519
177
IE 519
178
MSE , E
Bias 2 , Var
179
cb 1
m 2n
1
cv 0
cb Bias constant
*
cv Variance constant
Center of gravity
IE 519
180
Regenerative Method
Similar to batch-means, the regenerative
method also tries to construct
independent replications from a single run
Assume that Y1, Y2, has a sequence of
random points 1 B1 < B2 < called
regeneration points, and the process from
Bj is independent of the process prior to Bj
The process between two successive
regeneration points is called a
regeneration cycle
IE 519
181
E[ N ]
Zj
B j 1 1
iB j
Z ( n' )
N ( n' )
n' Number of regeneration cycles
IE 519
182
Analysis
The estimator is not unbiased. However,
it is strongly consistent
(n' ) (w.p.1)
n '
V2 11 2 12 2 22
IE 519
183
Analysis
From the CLT
V ( n' )
2
V
n'
N (0,1)
Have estimates
11 (n' ) 12 (n' )
(n' )
12 (n' ) 22 (n' )
2
2
IE 519
184
Analysis
2
2
(
n
'
)
Hence
(n' )
N (0,1)
We get a CI
(n' )
z1 2 V2 (n' ) n'
N ( n' )
IE 519
185
Non-Independence
Non-overlapping batch-means and
regeneration methods try to create
independence between batches/cycles
An alternative is to use estimates of the
autocorrelation structure to estimate the
variance of the sample mean
(Again, estimating the mean is no
problem, just the variance)
Spectrum analysis and autoregressive
methods attempt to do this
IE 519
186
Spectral Variance
Estimator
Assume the process is covariance
stationary:
E Y , E Y Y (l )
j
j l
(l)
2 l
Since 2f (0) l (l,) an estimate of the
spectral density function at frequency 0 is
an estimate of the variance
IE 519
187
Spectral Variance
Estimator
Using standard results:
m 1
2 (n)
w (l )
l ( m 1)
Batch
size
(l )
1 n l
n (l ) Yr Y (n) Yr l Y (n)
n r 1
wn (0) 1
wn (l ) 1
Weights
IE 519
188
Parameters
For the batch sizem
m n0
n
l m 1
otherwise
IE 519
189
Autoregressive Method
Again assume covariance-stationary
output process, and also a pth-order
autoregressive model
b Y
p
j 0
i j
b0 1
{ i } uncorrelated random variables
with mean 0 and variance 2
IE 519
190
Convergence Result
Can be shown that
mVar Y (m)
m
p
j 0
bj
mb
191
IE 519
192
Discussion
Replication/deletion is certainly the most
popular in practice (easy to understand)
Batch-means is very effective. There are
practical algorithms and still a lot of research
Spectral methods are still a subject of active
research but probably not used much in
practice (very complicated)
Autoregressive methods appear not be
used/investigated much
Regeneration methods are theoretically
impeccable but practically useless!
IE 519
193
Comments on Variance
Estimates
We have spent considerable time looking at
alternative estimates of the variance
Why does it matter?
Simulation output is usually (always) autocorrelated, which makes it difficult to estimate
variance, and hence the CI may be incorrect
Most seriously, the precision of the estimate
may be less than predicted and hence
inference drawn from the model may not be
valid
IE 519
194
Implications of
Autocorrelation
Because simulation output is usually
autocorrelated we cannot simply use all of
the observations to estimate the mean
We need some way of obtaining no
correlation
IE 519
195
Sequential Procedures
None of the single run methods we have
discuss can assure any given precision
(which we need to make a decision)
Several sequential procedures exist that
allow us to do this
IE 519
196
Good Sequential
Procedures
Batch-means and relative error stopping
rule
WASSP (2005)
197
Estimating Probabilities
Know how to estimate means
How about probabilities p = P[YB] ?
1 if Y B
Note that
Z
0 otherwise
PY B P Z 1
1 P Z 1 0 P Z 0
E[ Z ]
198
Estimating Quantiles
Suppose we want to estimate the qquantile yq, that is, P[Y yq]=q
More complicated
Most estimates based on order
statistics
Biased estimates
Computationally expensive
Coverage low if sample size is too low
IE 519
199
Cyclic Parameters
No steady state distribution
With some cycle definition
Fi ( y ) P Yi y F ( y ) P Y y
C
200
Multiple Measures
In practice we are usually interested in
multiple measures simultaneously, so we have
several CIs
P 1 I1 1 1
P k I k 1 k
How does this effect our overall CI?
P s I s , s 1,..., k ?
IE 519
201
Bonferroni Inequality
No problem if independent
P s I s , s 1,..., k P s I s
s 1
P s I s , s 1,..., k 1 s
IE 519
s 1
202
Computational
Implications
Say we have 5 performance measures and
we want a 90% CI
Two alternatives:
203
Output Analysis:
Discussion
Terminating simulation
Replications defined by
terminating event
Can determine precision
Initial conditions
Multiple runs
Replication/deletion
Non-terminating simulation Issue with bias
Elimination of initial transient
IE 519
204
Resampling Methods
IE 519
205
Sources of Variance
We have learned how to estimate
variance and construct CI, predict
number of simulation runs needed, etc.
Where does the variance come from?
IE 519
206
Input Modelling
We have discussed input modeling and
output analysis separately
Recall main approaches for input
modeling:
207
Numerical Example
The underlying system is an M/M/1/10 queue
The simulation model is 1 station, capacity of
10, and empirical distribution for interarrival
and service times from 100 observations
Want to estimate the expected time in system
E[W]
Typical simulation experiment:
10 replications
Very long run of 5000 customers
Very long warm-up period of 1000 customers
CI constructed using t-distribution
Effect of Estimating
Distribution Parameters
True model
No resampling
Direct resampling
True model assumes that the true models for interarrival and
service distribution is known
No resampling is the traditional approach of empirical
distribution and then construct a sample mean based on 10
replications
Direct resampling obtains a new sample of 100 data points
IE 519
209
for each of the 10 replications
Remedies
Direct resampling
Bootstrap resampling
Uniformly randomized resampling
IE 519
210
Direct Resampling
For each replication (simulation
run) use a new sample to create an
empirical distribution function
Requires a lot more data
Alternatively what data is available
can be split among the replications
Can confidence intervals be
constructed?
IE 519
211
Bootstrap Resampling
Use the bootstrap to create a new
sample for a new empirical
distribution function for each
replication
Bootstrap: sampling with
replacement
No need for additional data and
may even be able to use less data
IE 519
212
Bootstrap Resampling
Algorithm
For each input quantity q modeled,
sample n values
from
the
observed
data
i
i
i
v
,
v
,...,
v
with replacement
q (1)
q ( 2)
q(n)
Construct an empirical distribution for
each q based on these samples
Do a simulation run based on these
input distributions (ith output)
Repeat
IE 519
213
Uniformly Randomized
Note that if F is the cdf of X then
F(X) is uniform on [0,1]
X [1] X [ 2] ... X [ n ]
F X [1] F X [ 2] ... F X [ n ]
F X [ k ] ~ beta (k , n k 1)
IE 519
214
Uniform Randomized
Bootstrap
For each input quantity q modeled,
xq (1) , xq ( 2data
) ,..., xq ( n )
order the observed
Generate a sample of n ordered values
i
i
i
uq (1) , uq ( 2 ) ,..., uq ( n )
from a uniform distribution
Set Fq( p ) xq ( j ) uqi ( j )
and construct an empirical distribution
for each q based on these samples
Do a simulation run based on these
input distributions (ith output)
Repeat
IE 519
215
Numerical Results
IE 519
216
Numerical Results
IE 519
217
Discussion
Uncertainty in the input modeling
can effect the precision of the output
For a given application you can
estimate this effect by selecting 3-5
random subsets of the data, and
performing the analysis on each
Bootstrap resampling can help fix
the problem
IE 519
218
Discussion
Bootstrap resampling is much more general, and
provides an answer to the question:
Assumptions:
Model validation
Ranking-and-selection, etc.
IE 519
219
Comparing Multiple
Systems
IE 519
220
Multiple Systems
We know something about how to
evaluate the output of a single
system
Simulation is rarely used to simply
evaluate one system
Comparison:
221
Types of Comparisons
Comparison of two systems
Comparison of multiple systems
Ranking-and-selection
Combinatorial optimization
IE 519
222
Ranking-and-selection
Indifference zone
The systems that is selected has performance that is
Optimization
IE 519
223
IE 519
224
X 21 , X 22,..., X 2 n2 2 E X 2i
1 2
IE 519
225
A Paired-t CI
If n1=n2=n we can construct a paired
CI
Z i X 1i X 2i
E Z i
1 n
Z ( n) Z i
n i 1
n
1
2
Z i Z ( n)
Z (n)
n( n 1) i 1
Z (n) t n 1,1
IE 519
Z (n)
226
Welch CI
Now do not require equal samples, but assume
that the two processes are independent
1 ni
X i (ni ) X ij
ni j 1
ni
1
X ij X i (ni )
Si2 (ni )
ni 1 j 1
X 1 (n1 ) X 2 (n2 ) t f ,1 2
n1
n2
S (n ) n S (n ) n
f
S (n ) n n 1 S (n ) n n
2
1
2
1
2
2
2
2
2
IE 519
227
Non-terminating simulation
Replication/deletion approach
Non-overlapping batch-means
IE 519
228
Comparing Multiple
Systems
IE 519
229
Comparison with a
Standard
Now assume that one of the systems is the
standard, e.g. an existing system
Construct a CI with with overall confidence
level 1- for 2-1, 3-1,, k-1.
Using Bonferroni inequality: Construct k-1
confidence intervals at level 1-k1
The individual CIs can be constructed using
any method as Bonferroni will always hold
IE 519
230
231
2
2
, X i (n) max X l (n) h
i max l X i (n) max X l (n) h
l i
l
i
l
i
n
n
IE 519
232
Ranking-and-Selection
Have some k systems, and IID
observations from each system:
i E X ij
i i ... i
1
233
Indifference Zone
Approach
We say that the selected system i* is the
correct selection (CS) if
i i
*
P (CS ) P i1 i* P *
234
Two-Stage Approach:
Stage I
Obtain n0 samplesn and calculate
1 0
(1)
X i (n0 ) X ij
n0 j 1
n0
1
2
2
X ij X i (n0 )
Si (n0 )
n0 1 j 1
h12 S i2 (n0 )
N i max n0 1,
2
IE 519
235
Two-Stage Approach:
Stage II
Obtain Ni-n0 more observations, and
calculate the second stage and overall
Ni
mean( 2 )
1
X i ( N i n0 )
X ij
N i n0 j n0 1
X i ( N i ) wi1 X i(1) (n0 ) wi 2 X i( 2 ) ( N i n0 )
n0
wi1
Ni
Ni
1 1
n0
wi 2 1 wi1
IE 519
N i n0 2
1
h S (n0 )
2
1
2
i
236
Comments: Assumptions
As usual: normal assumption
Do not need equal or known variances
(many statistical selection procedures
do)
Two-stage approach requires an estimate
of the variance (remember controlling
the precision)
The above approach assumes the least
favorable configuration
IE 519
237
Subset Selection
In most applications, many of the systems are
clearly inferior and can be eliminated quite
easily
Subset-selection:
I {1Find
,2,..k}a subset of systems
P ik I 1 P *
Guptas approach:
2
I l : X l (n) max X i (n) h
i l
n
IE 519
238
Proof
2
P ik I P X ik (n) max X i (n) h
i ik
n
2
P X ik (n) X i (n) h
, i ik
n
0
X ( n) X ( n)
i ik
i
ik
i
ik
P
h
, i ik
2n
2n
Approximat
select h
P Z i h, i 1,2,..., k 1 1
IE 519
239
P* 1
t t1 ( k 1),n0 1
n0 1 l 1
N i max
t 2 Sij2
n0 , max 2
j i
IE 519
240
j i
j i
max 0, X i max X j
IE 519
j i
241
Combined Procedure
Initialization: Calculate
X i(1) (n0 )
n0
1
2
S i2
X
X
(
n
)
ij i 0
n0 1 j 1
and
1/ 2
and
N i max n0 , hS i2 2
Obtain more samples from each system iI
Compute the overall sample means and select
the best system
IE 519
242
Sequential Procedure
2 n0 1
1 2
1 , h 2 2 n0 1
2 k 1
Compute
n0
1
2
Si2
X
X
(
n
)
X
(
n
)
ij lj i 0 l 0
n0 1 j 1
Screen
Set
h 2 Sil2
Wil (r ) max 0,
r
2
2r
243
P *
1 1
0 0
(
n
1
)
x y
Normal cdf
k 1
f
(
x
)
dx
n0 1
f n0 1 ( y )dy
f 2 density
244
Large Number of
Alternatives
Two-stage ranking-and-selection procedures
usually only efficient for up to about 20
alternatives
Always focus
(LFC)
on least-favorable-configuration
, i 1,2,..., k 1
i
IE 519
245
Other Approaches
Focused on comparing expected values
of performance to identify the best
Alternatives:
Bayesian procedures
IE 519
246
Bayesian Procedures
Posterior and prior
Take action to maximize/minimize the posterior
R&S: Given a fixed computing budget find the
allocation of simulation runs to systems that
minimizes some loss function
0 i
L01 (i, )
1 otherwise
Lo.c. (i, ) max j i
j
IE 519
247
Indifference-zone procedures
Most popular, easy to understand, use the LFC
assumption
IE 519
248
Simulation Optimization
IE 519
249
Larger Problems
Even with the best methods, R&S
can only be extended to perhaps
500 alternatives
Often faced with more when we
can set certain parameters for the
problem
Need simulation optimization
IE 519
250
What is Simulation
Optimization?
Optimization where the objective
function is evaluated using
simulation
Complex systems
251
Problem Setting
Components of any optimization
problem:
Decision variables ()
Objective function
n
f :R R
Constraints R n
IE 519
252
Simulation Evaluation
No closed form expression for the
n
functionf : R R
Estimated using the output of
stochastic discrete event
simulation:
X ( )
Typically, we
f (may
) E have
X ( ) .
IE 519
253
Types of Techniques
Decision Variables
Continuous
Discrete
Gradient-Based
Methods
Size of
Small
Ranking &
Selection
Large
Random
Search
IE 519
254
Continuous Decision
Variables
Most methods are gradient based
( k 1)
(k )
k f
(k )
Issues:
IE 519
255
Stochastic Approximation
Fundamental work by Robbins and Monro
(1951) & Kiefer and Wolfowitz (1952)
Asymptotic convergence can be assured
lim k 0
k
256
1
2
n
f i
i
(could also be two-sided)
IE 519
257
Improving Gradient
Estimation
Finite differences requires two
simulation runs for each estimate
May be numerically instable
Better: estimate gradient during
( ) as
the same simulation Xrun
Perturbation analysis
Likelihood ration or score method
IE 519
258
Other Methods
Stochastic approximation variants
have received most attention by
researchers
Other methods for continuous domains
include
259
Discrete Decision
Variables
Two types of feasible regions:
Feasible region small (have seen
this)
260
Statistical Selection
Selecting between a few alternatives
1 , 2 ,..., m
Can evaluate every point and compare
Must still account for simulation noise
We now know several methods:
Subset selection
Indifference zone ranking & selection
Multiple comparison procedures (MCP)
Decision theoretic methods
IE 519
261
262
IE 519
263
264
Metaheuristics
Random search methods that have
been found effective for
combinatorial optimization
For simulation optimization
Simulated annealing
Tabu search
Genetic algorithms
Nested partitions method
IE 519
265
Simulated Annealing
Falls within the random search framework
Novel acceptance criterion:
P Accept c
X c X (k )
Tk
X c X (k )
1,
otherwise
266
Temperature Parameter
Usually the temperature is decreased
as the search evolves
If it decreases sufficiently slowly then
asymptotic convergence is assured
For simulation optimization there are
indications that constant temperature
works as well or better
IE 519
267
Tabu Search
Can be fit into the random search framework
A unique feature is the restriction of the
neighborhood:
IE 519
268
Genetic Algorithms
Works with sets of solutions (populations)
rather than single solutions
Operates on the population
simultaneously:
Survival
Cross-over
Mutation
269
Partitioning
Random sampling
Local search improvements
270
NP Method
(k ) 1 (k ) 2 (k )
Superregion
3 (k ) \ (k )
Most Promising
Region
In k-th iteration
j=2 subregions
Subregion
1 (k )
s ( (k ))
Subregion
2 (k )
IE 519
271
Sampling
Sources of randomness:
272
Two-Stage Sampling
Use two-stage statistical selection methods to
determine the number of samples
Phase I:
Phase II:
IE 519
273
Convergence
Single-stage NP converges
asymptotically (useless?)
Two-stage NP converges to a solution
that is within an indifference zone of
optimum with a given probability
IE 519
274
Practical methods
275
Commercial Software
SimRunner (Promodel)
Genetic algorithms
AutoStat (AudoMod)
OPTIMIZ (Simul8)
Neural networks
276
Optimization in Practice
In academic work we have very specific
definitions:
Optimization = improvement
IE 519
277
Some examples:
278
Metamodels
IE 519
279
Response Surfaces
Obtaining a precise simulation estimate is
computationally expensive
We often want to do this for many
different parameter values (and even find
some optimal parameter values)
An alternative is to construct a response
surface of the output as a function of
these input parameters
This response surface is a model of the
simulation models, that is, a metamodel
IE 519
280
Metamodels
Simulation can be (simply) represented
as
y g
For as single output and additive
randomness, wey can
this as
g write
The metamodel, models g and
models
~
g f y
IE 519
281
Example
Instead of simulating an
exact contour construct
a metamodel using a few
values
IE 519
282
Regression
Most commonly, regression models have
been used for metamodels
f ( x) k pk ( x)
p1 (x) x1
p 2 ( x ) x2
p3 (x) x1 x2
283
X X
Key issues:
X ty
stream
284
IE 519
285
286
Response Surface
Optimization
IE 519
287
IE 519
288
Experimental Process
State your hypothesis
Plan an experiment
Run a simulation
Output analysis
289
DOE
Define the goals of the experiment
Identify and classify independent and
dependent variables (see example)
Choose a probability model
290
Example of Variables
Depende
nt
Independent
IE 519
291
Other Metamodels
Many other approaches can be taken to
metamodeling
Splines
Have been used widely in deterministic simulation
responses
IE 519
292
Variance Reduction
IE 519
293
Variance Reduction
As opposed to physical experiments, in simulation
we can control the source of randomness
May be able to take advantage to improve
precision
Output analysis
Ranking & selection
Experimental designs, etc.
Several methods:
Antithetic variates
Improving precision of a single system
IE 519
294
Common Random
Numbers
Most useful technique
Use the same stream of random
numbers for each system when
comparing
Motivation:
Z j X1 j X 2 j
1 n
Z ( n) Z j
n j 1
Var Z (n)
Var Z j
1j
2j
1j
, X2j
IE 519
295
Applicability
IE 519
296
Synchronization
We must match up random
numbers from the different systems
Careful synchronization of the
random number stream
297
IE 519
298
CRN
IE 519
299
Example: Correlation
Induced
IE 519
300
Example: System
Difference
IE 519
301
Experimental design
302
Discussion
Dramatic improvements can be
achieved with CRN (but can also be
harmful)
Recommendations:
IE 519
303
Antithetic Variates
We now turn to improving precision of a
simulation of a single system
Basic idea:
Pairs of runs
Large observations offset by small
observations
Use the average, which will have smaller
variance
304
Mathematical Motivation
Recall for covariance stationary process
Y1 , Y2 ,..., Yn
we have
2 2 n 1
l
Var Y
1 l
n n l 1
n
l CovYi , Yi l
305
Complementary Random
Numbers
X
4.98
3.02
0.09
7.19
1.70
3.40
2.78
1-U
0.63
0.45
0.02
0.76
0.29
IE 519
X
2.30
3.96
20.17
1.36
6.22
6.80
7.70
X
3.64
3.49
10.13
4.27
3.96
5.10
2.83
306
Example (cont.)
U
0.07
0.35
0.21
0.57
0.66
Avg.
S.Dev
X
13.39
5.26
7.86
2.81
2.08
6.28
4.58
1-U
0.93
0.65
0.79
0.43
0.34
X
0.36
2.15
1.16
4.23
5.39
2.66
2.11
X
6.87
3.70
4.51
3.52
3.74
4.47
1.40
Synchronization
Inverse-transform
IE 519
308
Formulation
1
X 2 j 1 F (U )
1
X 2 j F (1 U )
X 2 j 1 Y2 j 1
Simulation
X 2 j Y2 j
Yj
Y2 j 1 Y2 j
2
IE 519
309
Antithetic sampling
IE 519
310
Complimentary Processes
Imagine a queueing simulation with arrivals and
services
Large interarrival times will in general have the
same effect on performance measures as large
service times
Idea: Use the random numbers used for
generating interarrival times in the first run of a
pair to generate service time in the second run,
and vice versa
This could be extended to any situation where
you can argue similar complimentary
IE 519
311
312
Discussion
Basic idea is to induce negative
correlation to reduce variance
Success is model dependent
Must show that it works
313
Control Variates
We are again interested in improving the
precision of some output Y
YC
observed valued
of the output
E X
314
Estimator Properties
The controlled estimator is unbiased
E YC E Y a ( X )
E[Y ] a E[ X ] 0
The variance is
Var YC Var Y a( X )
So
315
Optimal a Given Y
0
Var [Y ] a 2 Var [ X ] 2a Cov ( X , Y )
a
2a Var [ X ] 2 Cov ( X , Y )
Cov ( X , Y )
a
Var [ X ]
*
2
Var [Y ] a Var [ X ] 2a Cov ( X , Y )
2Var [Y ] 0
IE 519
316
Optimal Variance
With the optimal value a*
Var Y Var [Y ] a
*
C
* 2
Var [ X ] 2a * Cov ( X , Y )
2
Cov ( X , Y )
Var [ X ]
Var [Y ]
Var [ X ]
Cov ( X , Y )
2
Cov ( X , Y )
Var [ X ]
Cov ( X , Y ) 2
2
Var [Y ]
1 XY
Var [Y ]
Var [ X ]
IE 519
317
Observations
By using the optimal value a*
Var YC 1 XY Var [Y ] 0
318
Estimating a*
Never know Cov[X,Y] and hence not a*
Need to estimate
C
*
XY ( n)
a (n) 2
S X ( n)
Y
n
j 1
Y (n) X j X (n) n
S X2 (n)
319
Service times
Positive correlation
Interarrival times
Negative correlation
IE 519
320
Shouldn' t be known!
Rep
13.84
0.92
3.18
0.95
2.26
0.88
2.76
0.89
4.33
0.93
1.35
0.81
1.82
0.84
3.01
0.92
1.68
0.85
10
3.60
0.88
Y (10) 3.78
4.13
C XY (10)
a (10) 2
35.00
S X (10)
*
321
YC Y a( X )
Y a( X
(1)
) a ( X
(1)
( 2)
( 2)
X X (1) X ( 2 )
Problems?
IE 519
322
YC Y a1 ( X (1) (1) ) a2 ( X ( 2 ) ( 2 ) )
Find the partial derivatives with respect
to both and solve for optimal values as
before
IE 519
323
In General
m
YC Y ai ( X ( i ) ( i ) )
i 1
2 ai cov Y , X ( i )
i 1
m
2 ai a j cov X ( i ) , X ( j )
i 1 j 1
IE 519
324
External
IE 519
325
Indirect Estimation
Primarily been used for queueing
simulations
Di Delay of ith customer
d E[ Di ]
Wi Total wait of ith customer
w E[Wi ]
Q(t ) Number of customers in queue at time t
L(t ) Number of customers in system at time t
IE 519
326
Direct Estimators
n
1
d (n) Di
n i 1
1 n
w (n) Wi
n i 1
1
Q ( n)
T ( n)
T (n)
L( n)
T ( n)
T (n)
Q(t )dt
0
L(t )dt
0
IE 519
327
Known Relationships
w (n) d (n) S (n)
1 n
S ( n) S i
n i 1
Si Service time of customer i
E S (n) E[ S ]
Can we take advantage of this?
IE 519
328
Indirect Estimator
Replace the average with the
known expectation
~ (n) d (n) E[ S ]
w
Avoid variation
For any G/G/1 queue it can be
shown that ~
var w(n) var w (n)
Is this trivial?
IE 519
329
Littles Law
A key result from queueing is Littles
L w
Law
~
~ (n) d (n) E[ S ]
L ( n) w
IE 519
330
Numerical Example
M/G/1 queue
Exponential
=.5 =.
7
15
11
=.
9
4
4-Erlang
22
17
Hyperexponential
Service Dist.
IE 519
331
Conditioning
Again replace an estimate with its exact
analytical value, hence removing a
source of variability
E X | Z z Analytically known
E X E E X | Z
var E X | Z var X E var X | Z var X
IE 519
332
Discussion
We need
333
Example: Time-Shared
Computer Model
IE 519
334
Conditioning
Estimating dT may be hard due to lack of data
Observe the number NT in tape queue every
time a job leaves the CPU
If this job were to go to the tape queue, its
expected delay would be
E DT E ST N T 12.50 NT
Z NT
335
Discussion
Both indirect estimation and
conditioning are extremely
application dependent
Require both good knowledge of
the system as well as some
background from the analyst
Can achieve good variance
reduction when used properly
IE 519
336
Variance Reduction
Discussion
Have discussed several methods
Control variates
Indirect estimation
Conditioning
More
application
specific
IE 519
337
Applicability &
Connections
Can we use VRT with any technique for
output analysis (e.g., batch-means)?
Can we use VRT (especially CRN) with
ranking-and-selection and multiple
comparison methods?
Can we design our simulation experiments
(DOE) to take advantage of VRT
(especially when building a metamodel)?
Can we use VRT with simulation
optimization techniques?
IE 519
338
339
X i ( n) X l i l
IE 519
340
Pair-Wise Differences
We can replace
ij
ij
341
Bonferroni Approach
We can break up the joint statement
using Bonferroni inequalities
k 1
k 1
i 1
1 P Ai
i 1
Ai X i (n) X k (n) i k
e.g.
342
Assumed Structure
E.g., Nelson-Matejcik modification of twostage ranking and selection assumes
sphericity
2
2 i
cov X ij , X lj
i l
il
il
IE 519
343
344
23 Factorial Design
IE 519
345
Assignment Rule
In an m-point experiment that admits orthogonal
blocking into two blocks of size m1 and m2, use a
common stream of random numbers for the first
block and the antithetic random numbers for the
second block
U 2 u 21 , u 22 ,..., u 2v
u11 , u12 ,..., u1v
u jv u jv ,1 , u jv , 2 ,...
u jv 1 u jv ,1 ,1 u jv , 2 ,...
IE 519
346
Blocking
IE 519
347
23 Factorial Design in 2
Blocks
IE 519
349
Discussion
Variance reduction techniques can be very
effective in improving the precision of
simulation experiments
Of course variance is only part of the equation,
and you should
bias and
also
E[ X ]consider
efficiency
2
2
MSE ( X ) E X
var[ X ] E X E[ X ]
2
1
Eff ( X )
MSE ( X ) C ( X )
C ( X ) Cost of computing X
IE 519
350
Case Study
IE 519
351
Manufacturing Simulations
Objective
Increased throughput
Reduce in-process inventory
Increase utilization
Improved on-time delivery
Validate a proposed design
Improved understanding of system
IE 519
352
IE 519
353
Performance Evaluation
Throughput
Response time
Bottlenecks
IE 519
354
Evaluate Operational
Procedures
Scheduling
Control strategies
Reliability
Quality control
IE 519
355
Sources of Randomness
Interarrival times between orders, parts,
or raw material
Processing, assembly, or inspection time
Times to failure
Times to repair
Loading/unloading times
Setup times
Rework
Product yield
IE 519
356
IE 519
357
Project Objective
Improve throughput in the line
Simulate the following options:
IE 519
358
Assembly Line
Verification
Test
HIM
Assembly
Functional Tests
Flashing
Packaging
Manual Station 1
Assemble heat
sinks and fans
Soldering
Manual Station 2
Install power module
onto power PCBA
Strapping
Hi-Pot Test
IE 519
359
Simulation Project
Define a conceptual model of the line
Gather data on processes
Validate the model
Implement model in Arena
Test model on known scenarios
Evaluate options
Recommend solutions
IE 519
360
IE 519
361
1
3
4
362
2
1
3
4
IE 519
363
Is it worthwhile to reconfigure?
IE 519
364
IE 519
365
Currently 48 pallets
Sometimes run out
IE 519
366
367
Options Considered
Current configuration
Pallets re-circulate rather than queue
Various queue logics at functional tests
Flash station in series, functional test in
parallel
Both flash and functional test stations in
parallel
Increased number of pallets in system
Eliminate conveyor
IE 519
368
IE 519
369
Throughput Comparison
Configuration
Throughput
(drives/day)
Current
265
Recirculation of pallets
Mixed series/parallel
No Conveyor
IE 519
370
Station 1
Station 2
0.67
0.94
0.81
Difference of 0.27
Station 3
Station 4
Third loop
Station 5
Station 6
0.45
0.81
Difference of 0.36
utilization
0.30
0.52
0.63
0.41
Difference of 0.22
IE 519
371
Improving Utilization
Backfilling will improve balance
between different loops (Option 2)
IE 519
372
Intermediate Options
Option 1: Queue one drive at second station
in each loop starting with furthest away
loop
Backfilling
Balance between no-queuing and current
method of queuing one drive at each station
IE 519
373
Utilization Comparison
Configuration
Functional Test
Utilization
Current
Recirculation of pallets
Comments on Utilization
Utilization of functional test
stations is currently uneven and
can be improved
Key ideas
Backfilling
Correct amount of queuing allowed
IE 519
375
Bottleneck Analysis
Utilization of various stations
Manual station 1
Manual station 2
Soldering
Hi-Pot
Strapping
Flashing
Functional test
80%
65%
79%
15%
37%
53% average
71% average
HIM
Verification
Packing
Bottlenecks*
Third highest
utilization
94%
31%
47%
57%
Bottleneck
*Statistically equivalent
IE 519
376
Bottleneck Identification
Functional Test Station 2 is the most
heavily loaded station on the line
On average, the functional test
stations are slightly less loaded than
Manual Station 1 and Soldering
Station, which should hence also be
considered bottlenecks
IE 519
377
Queue Length
Current
0.73 0.34
MAX=10 (21%)
Recirculation of pallets
0.17 0.04
MAX=1 (2%)
0.72 0.32
MAX=10 (21%)
0.20 0.10
MAX=8 (17%)
1.28 0.50
MAX=17 (35%)
0.79 0.27
MAX=11 (23%)
Mixed series/parallel
0.96 0.26
MAX=19 (40%)
1.14 0.33
MAX=14 (29%)
Increase to 60 pallets
1.34 0.55
MAX=16 (33%)
IE 519
378
Comments on Queue
Length
Functional test queue
IE 519
379
Recommendations
Throughput can be improved:
returns
Will not combine well with other improvements
IE 519
380
Further Improvements
Optimal logic of functional tests
depend on mix of drives, daily load,
etc.
Possibility of dynamically changed
logic?
Determine a relationship between
product mix parameters and best
logic
IE 519
381
Other Areas of
Improvement
Scheduling of drives
Suggestion
382
Will Scheduling
Improvements Help?
Simulation results
Mi
n
Ma
x
Most
common
Throughpu
t
Batching
27
14
279
Batching
22
10
265
No Batch
274
383
Discussion
Significant improvement can be obtain
through inexpensive changes
384