Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Simulation
Output Analysis
Correlated outputs:
Consider time intervals:
If average queue length was long in Ti, starting conditions in Ti+1 will bias
that interval to longer than average queue length
Types of Simulations
with Respect to Output Analysis
Sonlanan veya Sonlanmayan (kararl hal) simulasyonlar
Measures of performance
Consider the estimation of a performance parameter, for
discrete (or for continuous), of a simulated system.
Discrete time data: [Y1, Y2, , Yn], with ordinary mean : (orn. bekleme
sureleri)
Continuous-time data:{Y(t), 0 t TE} with time-weighted mean : (orn.
bekleyen kisi sayisi)
i 1
stenen
Is unbiased if its expected value is , that is if: E ()
Is biased if: E ( )
1 TE
Point Estimator
Usually, system performance measures can be put into the
common framework of or
Performance measure that does not fit: quantile or percentile:
Quantile is the performance level that can be achieved with
probability
e.g.: Let Y be waiting time. If 0.85 quantile for Y is . Then
%85 of the customers will wait less than .
Pr{Y } p
Histograms can be used to estimate Quantiles for observed Y
Confidence-Interval Estimation
Confidence interval C.I.: A Measure of Error(gercek ortalamanin
hesaplanan aralikta olduguna %CI guveniyoruz)
Yi. average production time on the ith run
R
Average of R replication
Y.. Yi. / R
i 1
Y.. is an estimator for and is calculated
from our data
We cannot know for certain how far Y..is from but CI attempts to bound
that error. The more replications we make, the less error there is in
Y..
1 R
S
2
2
S
(
Y
Y
)
Y
t
i. ..
..
/ 2 , R 1
R 1 i 1
R
Y.. t / 2, R 1S 1
1
R
i 1
1 TE
0
T
E
Independent replications are used. Each run using a different random number
stream and independently chosen initial conditions.
Important to distinguish within-replication data from across-replication data.
Bir simulasyon runnda retim zamanlar Yi1, Yi2 (i inci tekrarn 1 ve 2 nolu
paralarnn retim zamanlar) tekrar-ii veridir.
Bir tekrardaki retim zamanlarnn ortalamas Yi. tekrarlar-aras veridir
Tekrarlar-aras veriler birbirinden bamszdrlar. Tekrar ici verilerin ortalamasi
alinarak bulundularsa, kendi aralarinda normal dagilima sahiptirler.
Tekrar-ii veriler birbirinden bamsz degildir (cogu zaman).
Y
)
i. ..
R 1 i 1
S
The confidence-interval half-width:
H t / 2, R 1
R
0
T Ei
The sample variance:
1
S
T Ei
2
i
Y (t ) Y
TEi
i.
dt
For the call center 4 replications are conducted. Estimated average waiting time in queue
for the log run
0.88
0.68
5.04
4.18
4.13
3.26
0.52
0.34
2
.
64
)
(
0
.
52
2
.
64
)
S2
2.282
4 1
S
H t0.025,4 1
3.62
4
%95CI 2.64 3.63 min
H t / 2, R 1
S2 rneklerin
varyans
P Y.. 1
z S
R /2 0
t / 2, R 1S 0
Y.. t / 2, R 1
S
R
1.96 2 * 0.00518
12.14
0.04 2
S
t
R / 2, R 1 0
, so R - R0 = 11 additional replications are needed.
For R = 15
After obtaining additional outputs, half-width should be checked.
Quantiles
A proportion or probability is treated as a special case of a mean.
When the number of independent replications Y1, , YR is large
enough that t/2,n-1 = z/2, the confidence interval for a probability p
is often written as:
p (1 p )
p z / 2
R 1
The sample proportion
Quantiles
The best way is to sort the outputs and use the (R*p)th smallest
value, i.e., find such that 100p% of the data in a histogram of Y
is to the left of .
Example: If we have R=10 replications and we want the p = 0.8 quantile,
first sort, then estimate by the (10)(0.8) = 8th smallest value (round if
necessary).
5.6 sorted data
7.1
8.8
8.9
9.5
9.7
10.1
12.2 point estimate
12.5
12.9
Quantiles
l and u.
l cuts off 100pl% of the histogram (the Rpl smallest value of the
sorted data.
u cuts off 100pu% of the histogram (the Rpu smallest value of the
sorted data
where p p z / 2
p (1 p )
R 1
pu p z / 2
p(1 p )
R 1
Quantiles
.8(1 .8)
0.78
1000 1
pu 0.8 1.96
.8(1 .8)
0.82
1000 1
Consider a single run of a simulation model to estimate a steadystate or long-run characteristics of the system.
The single run produces observations Y1, Y2, ... (generally the
samples of an autocorrelated time series).
Performance measure : (denklemde n in sonsuza gittiini
grnz)
n
1
Yi ,
n
n
i 1
1 TE
lim Y (t )dt ,
0
TE TE
lim
(with probability 1)
(with probability 1)
Steady-State Simulation
Initialization Bias
Intelligent initialization
Initialize the simulation in a state that is more representative of long-run conditions.
If the system exists, collect data on it and use these data to specify more nearly
typical initial conditions.
If the system can be simplified enough to make it mathematically solvable, e.g.
queueing models, solve the simplified model to find long-run expected or most
likely conditions, use that to initialize the simulation.
System has reached steady state: the probability distribution of the system state is
close to the steady-state probability distribution
Steady-State Simulation
Initialization Bias
Ensemble averages::
To identify trend in the data due to initialization bias
The average correspondingRbatch means across replications :
Y. j
1
Yrj
R r 1
R replications
Steady-State Simulation
Initialization Bias
j d 1
.j
Steady-State Simulation
Initialization Bias
Steady-State Simulation
Error Estimation
If {Y1, , Yn} are not statistically independent, then S2/n is a
biased estimator of the true variance.
Almost always the case when {Y1, , Yn} is a sequence of output
observations from within a single replication (autocorrelated sequence,
time-series).
Y i 1 Yi / n
n
Steady-State Simulation
Error Estimation
For a covariance stationary time series, {Y1, , Yn}:
Lag-k autocovariance is:
k cov(Y1 , Y1 k ) cov(Yi , Yi k )
k
2
If a time series is covariance stationary, then the variance of Y is:
Lag-k autocorrelation is:
2
V (Y )
n
2
1
n
k 1
n 1
where B
n / c 1
n 1
Steady-State Simulation
Error Estimation
Steady-State Simulation
Error Estimation
The expected value of the variance estimator is:
S2
BV (Y ),
E
n
where B
n / c 1
and V (Y ) is the variance of Y
n 1
Steady-State Simulation
Replication Method
Use to estimate point-estimator variability and to construct a
confidence interval.
Approach: make R replications, initializing and deleting from each
one the same way.
Important to do a thorough job of investigating the initialcondition bias:
Bias is not affected by the number of replications, instead, it is affected only
by deleting more data (i.e., increasing T0) or extending the length of each
run (i.e. increasing TE).
Steady-State Simulation
Replication Method
Each replication is regarded as a single sample for estimating
n
1
Yr . (n, d )
Yrj
For replication r:
n d j d 1
The overall point estimator:
1 R
Y.. (n, d ) Yr . (n, d )
R r 1
and
E[Y.. (n, d )] n ,d
Y
)
r. .. R 1
R 1 r 1
2
Yr. RY..
r 1
and
s.e.(Y.. )
S
R
Steady-State Simulation
Replication Method
Length of each replication (n) beyond deletion point (d):
(d nin en az 10 kat olmal):
(n - d) > 10d
Number of replications (R) should be as many as time permits,
up to about 25 replications.
For a fixed total sample size (n), as fewer data are deleted ( d):
C.I. shifts: greater bias
Standard error of Y.. (n, d ) decreases: decrease variance.
Reducing
bias
Trade off
Increasing
variance
Steady-State Simulation
Replication Method
Table 11.8 pp.416
Bu tablodan da goruldugu gibi sabit data sayisi (n) varken silinen data miktarininin
(d) azaltilmasi;
ortalamayi asagiya ceker (yanli olarak etkiler)
Hesaplanan ortalamanin standard hatasini yani S/sqrt(R) azaltir. Bunun sebebi
artan data sayisi ile birlikte varyansin azalmasidir.
Steady-State Simulation
Replication Method
M/G/1 queueing example:
Suppose R = 10, each of length TE = 15,000 minutes, starting at time 0 in
the empty and idle state, initialized for T0 = 2,000 minutes before data
collection begins.
Each batch means is the average number of customers in queue for a
1,000-minute interval.
The 1st two batch means are deleted (d = 2).
The point estimator and standard error are:
Y.. (15,2) 8.43
and
s.e.Y.. (15,2) 1.59
The 95% C.I. for long-run mean queue length is:
Y.. t / 2, R 1S / R Y.. t / 2, R 1S / R
8.43 2.26(1.59) LQ 8.42 2.26(1.59)
Steady-State Simulation
Sample Size
An alternative to increasing R is to increase total run length
T0+TE within each replication.
Approach:
Increase the run length from (T0+TE) to (R/R0)(T0+TE),
Delete the data from time 0 to time (R/R0)T0.
Steady-State Simulation
Sample Size
Example 11.17: Tablo 11.8 deki M/G/1 kuyruk orneginde R0=10 tekrar yapilmisti ve d=2
observasyonun silinmesiyle varyans tahmincisi S2=25.30 olmustu. Bizden ortalama kuyruk
uzunlugunu %90 guvenle +-2 musteri ile tahmin etmemiz isteniyor. Bu durumda kac tekrar
yapariz? Istenen adet tekrari bastan yapmak yerine ne onerirsiniz?
S
z
R /2 0
1.6452 (25.30)
22
t / 2, R 1S0
R 18 ?
t / 2, R 1S0
R 19 ?
19.15
no!!
9 adet daha sifir anindan baslayan tekrar yapmak yerine elimizdeki tekrarlarin son
dakikalarindan itibaren simulasyonlari uzatiriz. Elimizdeki tekrarlari (R/R0)(T0+TE)=(19/10)
(15000)=28500 dakikaya uzatiriz. Tum tekrarlarda ilk (R/R0)T0 = 1.9 * 2000 =3800 dakikayi
sileriz. Cikan verilerden 3800-28500 arasini kullaniriz.
Steady-State Simulation
Batch Means
A lot of simulation time is wasted by deleting d many data points from each
replication. Instead consider having one long simulation and deleting the
data for one period.
Using a single, long replication :
Problem: data are dependent so the usual estimator is biased.
Solution: batch means.
Batch means: divide the output data from 1 replication (after appropriate
deletion) into a few large batches and then treat the means of these batches
as if they were independent.
A continuous-time process, {Y(t), T0 <= t <= T0+TE}:
k batches of size m = TE/k, batch means :
1 jm
Yj
Y (t T0 )dt
(
j
1
)
m
m
jm
1
Yj
Yi d
m i ( j 1) m 1
Steady-State Simulation
Batch Means
Y1 , ..., Yd , Yd 1 , ..., Yd m , Yd m 1 , ..., Yd 2 m , ... , Yd ( k 1) m 1 , ..., Yd km
deleted
Y1
Yk
Y2
k
k
j 1
Y j Y
k 1
j 1
Y j2 kY 2
k (k 1)