Simulation-2
Simulation-2
Simulation-2
Simulation
Customers
x Server
x x x x
In this figure, customers are served by a single server, and while one
customer is being served, others wait in a queue. If we obtain the waiting
times for each of these customers, denoted as W1 , W2 , ..., Wn , can we infer
something about the original system? How can we validate the model and
determine whether it truly replicates the behavior of the actual system?
We get the waiting time of customers and obtain the mean waiting time as
n
1X
W̄ = Wi , i ∈ {1, 2, . . . , n}
n i=1
We run the model for multiple replications and obtain the value of W̄ . This
is because we want W̄ to be the unbiased estimator of waiting times. If
we obtain the mean from just the first replication, W̄ won’t be an unbiased
estimator, since the Wi would not be independent and identically distributed
(I.I.D.), and Wi s would be correlated.
1
n1
1 X
W̄1 = W1j , j ∈ {1, 2, . . . , n1 }
n1 j=1
n2
1 X
W̄2 = W2j , j ∈ {1, 2, . . . , n2 }
n2 j=1
..
.
nm
¯ 1 X
Wm = Wmj , j ∈ {1, 2, . . . , nm }
nm j=1
To determine the average waiting time we take the mean of average replica-
tion times across replications.
m
1 X
W̄ = W̄i
m i=1
[W̄1 , W̄2 , W̄3 , . . . , W¯m ] provides confidence interval to check if the original
waiting time of system lies within this. Before analysing the output from
this single server queue we must verify and validate our model.
0.1.1 Verification
Verification is the process of ensuring that the model has been implemented
correctly. This involves walking someone through the code, adding comments
for clarity, and testing with different inputs to confirm that the model behaves
as expected and is free from errors.It also includes checking that the logic
and algorithms align with the model’s specifications.
0.1.2 Validation
Validation is the process of assessing how closely the model resembles the
true system. It involves comparing the model’s output to real system to
evaluate its accuracy and consistency. The goal is to ensure the model reliably
represents the system.
2
0.2 Types of Simulation
The type of simulation depends on the nature of the system being modeled.
It could be a non-terminating simulation, which models systems that oper-
ate continuously over time, such as an airport. Alternatively, it could be a
terminating simulation, which models systems with a defined start and end
time, such as the operation of a bank.
Statistic
t0 Time
Do all systems have a queue length ? In terms of queue length, the
system is in a steady state when the average queue length remains constant
over time. This means that the rate at which customers or tasks arrive
and are processed is balanced in the long run, and the queue does not grow
indefinitely. A system is in steady state when ρ = µλ , is greater than 1, i.e.,
the service rate µ is smaller than the arrival rate λ. In unsteady state the
queue keeps on increasing always and servers are always busy. If we observer
this pattern in our model ,it implies that it is transient.
3
State Parameter and Steady State Cycle Parameter.
σ2
X̄ ∼ N µ, .
n
X
Xi ∼ N (nµ, nσ 2 )
2
Further if X1 , X2 , . . . , Xn belong to N (µ, σ ), then the sample mean X̄
2
belongs to N µ, σn for any value of n.
(n − 1)S 2
∼ χ2n−1
σ2
Here, the sample variance follows a chi-squared distribution with n−1 degrees
of freedom.
For T Statistic
X̄ − µ
√ ∼ tn−1 for X1 , X2 , . . . , Xn ∼ N (µ, σ 2 )
Sn−1 / n
4
The confidence interval for the population mean µ is given by:
Sn−1 Sn−1
X̄ − t α2 ,n−1 × √ ≤ µ ≤ X̄ + t α2 ,n−1 × √
n n
where X1 , X2 , . . . , Xn ∼ N (µ, σ 2 )
where Yij represents the observations in replication i for the j-th obser-
vation.
The values for each replication mean are:
Ȳ¯ = 20.4
2
The sample variance Sn−1 is calculated as:
5
2 (26.67 − 20.4)2 + (13.33 − 20.4)2 + (15 − 20.4)2 + (26.67 − 20.4)2
Sn−1 = = 52.6
3
q √
2
Sn−1 = Sn−1 = 52.6 = 7.3
The confidence interval for µ is calculated as:
7.3
µ ∈ 20.4 ± 3.18 × √
4
This gives:
µ ∈ [8.89, 31.93]
Y5 ∈ [5.55, 46.35]
if negative or infeasible limits are obtained then they should be truncated
depending upon the random variable .