Summary Mid Contents - 2023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Spring Semester, 2022 – 2023

Midterm Review
Lecture 1: Introduction to Simulation
Lecture 2: Simulation Examples
Lecture 3: General Principles of Simulation Modelling
Lecture 4: Review Statistics
Lecture 5: Random Numbers
Lecture 6: Random Variate
Review questions:
1. What is a Simulation?
2. When to and NOT to use Simulation?
3. What are advantages and disadvantages of Simulation?
4. What are some areas for applications of Simulation?
5. What are systems, system environment, and components of a system? Example?
6. Distinguish discrete and continuous systems! Example?
7. What are models and some model types of a system?
8. What are some methods to study systems?
9. What are steps in a simulation study?
What are some methods to study systems?

System

Experiment with real Experiment with


system system modeling

Physical Model Mathematical Model

Analytical Solutions Simulation Solutions


What are steps in a simulation study?
⚫ Four phases:
– Problem formulation, setting objective and overall
design (step 1 to 2).
– Modeling building and data collection (step 3 to 7)
– Running of the model (step 8 to 10).
– Implementation (step 11 to 12).
⚫ An iterative process.

verified ? Validation ?
Simulation of queueing system
Single-channel queue
2 sever queuing system ?

Simulation of queueing system


Single-channel queue
Simulation of queueing system
Single-channel queue

dong cuoi
Simulation of queueing system
• Single-channel queue
• Simulation of a two-server queuing system

Simulation of inventory system


Other examples of simulation 5 input , 5 output cho moi system
Major concepts in simulation
• System
• Model
• System state
• Entity definition
example
different
• Attribute
• List
• Event
• Event notice
• Event list
• Activity
• Delay,
• Clock
World view s for developing a model

Event-scheduling w orld view Process-interaction w orld view


▪ Allow us to control everything; ▪ Focus on the processes that
have complete flexibility; know the entities undergo
state of everything anytime
▪ Analogous to flowcharting
▪ Easily to be coded up in any
programming language or with
▪ Employed when using a process-
oriented simulation language or a
macros in a spreadsheet
simulation software (e.g., ARENA)
▪ Become very complicated for
large models with lots of different
▪ Most discrete-event simulation are
executed in the event orientation
kinds of events, entities and
even though we cannot see it.
resources
Hypothesis testing
For population mean (large sample)

x − 0
zt =
s n

 z 2 − z ( z )

zt  z 2 or zt  − z 2 zt  − z ( zt  z )
Hypothesis testing
For population mean (small sample), s unknown, population is normally distributed

x − 0
tt =
s n

 t n−1,  2
− t n−1,  (t n−1,  )

t t  t n−1,  2 or t t  −t n−1,  2 t t  −t n−1,  ( t t  t n−1,  )


Hypothesis testing
For population proportion
Hypothesis testing
For population variance, population is normally distributed
Confidence interval
Properties of RNs what is Rn?
RN co tac dung gi trong simulation
• Uniformity RN vs RV

• Independence
Generation of pseudo-random numbers
• Linear Congruential Method
• Combined Linear Congruential Method
• Random-Number Streams
Test for RNs
Test for uniformity (Frequency test)
Kolmogorov-Smirnov test
Arrange R(i) from
smallest to largest
Step 1:

D+ = max {i/N – R(i)}


Neu i/N - R am => bo trong
Step 2:

D- = max {R(i) - (i-1)/N}


Step 3: D = max(D+, D-) = 0.26
Step 4: For  = 0.05,
D = 0.565 > D

Hence, H0 is not rejected.


Kolmogorov vs chi-square

Test for RNs


Test for uniformity (Frequency test)
Chi-square test (N>=50)

⚫ Chi-square test uses the sample statistic:

n is the # of classes Ei is the expected


# in the ith class

Oi is the observed
# in the ith class

– Approximately the chi-square distribution with n-1 degrees of freedom (where the
critical values are tabulated in Table A.6)
– For the uniform distribution, Ei, the expected number in each class is:
n: so luong interval
n co the tu chon nhung nen la <= N/5

⚫ Valid only for large samples, e.g., N >= 50


Test for RNs
Test for independence (Test for autocorrelation)

⚫ Testing the autocorrelation between every l numbers (l is as known as. the lag), starting
with the ith number
– The autocorrelation ril between numbers: Ri, Ri+l, Ri+2l, Ri+(M+1)l
– M is the largest integer such that i + (M + 1 )l  N

⚫ Hypothesis:

⚫ If the values are uncorrelated:


– For large values of M, the distribution of the estimator of ril, denoted is
approximately normal.
Test for RNs
Test for independence (Test for autocorrelation)

rˆ il
⚫ Test statistics is: Z0 =
ˆ rˆil

– Z0 is distributed normally with mean = 0 and variance = 1, and:

⚫ If ril > 0, the subsequence has positive autocorrelation


– High random numbers tend to be followed by high ones, and vice versa.
⚫ If ril < 0, the subsequence has negative autocorrelation
– Low random numbers tend to be followed by high ones, and vice versa.
Inverse-transform technique

𝑋 = 𝐹 −1 (𝑅)
Continuous distribution: exponential distribution, uniform distribution, triangular
distribution, empirical continuous distribution, etc.
Discrete distribution: discrete uniform distribution, geometric distribution, etc.
Inverse-transform technique: 𝑿 = 𝑭−𝟏 (𝑹)
Ex ponential distribution
Pdf: Cdf:

Solve the equation F(X) = R for X in terms of R.


Inverse-transform technique: 𝑿 = 𝑭−𝟏 (𝑹)
Uniform distribution

Pdf: Cdf:

Solve the equation F(X) = R for X in terms of R.


a,b = Lb, UB
c= most likely

Inverse-transform technique: 𝑿 = 𝑭−𝟏 (𝑹)


Triangular distribution
Consider a random variable X that has pdf: The cdf is then given by:

Solve the equation F(X) = R for X in terms of R.

tu chon Ri de generate
Inverse-transform technique: 𝑿 = 𝑭−𝟏 (𝑹)
Weibull distribution

Pdf: Cdf:

Solve the equation F(X) = R for X in terms of R.


Inverse-transform technique: 𝑿 = 𝑭−𝟏 (𝑹)
Empirical discrete distribution

Pdf: Cdf:

F(x) = cummulative p(x)

Solve the equation F(X) = R for X in terms of R.


Acceptance-rejection technique
Suppose that an analyst needed to devise a method for generating random variates,
X, uniformly distributed between 1/4 and 1. One way to proceed would be to follow
these steps:
Step 1. Generate a random number R. tu random tren Casio
Step 2a. If R ≥ 1/4, accept X = R, then go to Step 3.
Step 2b. If R < 1/4, reject R, and return to Step 1.
Step 3. If another uniform random variate on [1/4, 1] is needed, repeat the
procedure beginning at Step 1. If not, stop
Acceptance-rejection technique
Poisson Distribution

Step 1. Set n = 0, P = 1.
Step 2. Generate a random number Rn+1 and replace P by P · Rn+1.
Step 3. If P < 𝑒 −𝛼 , then accept N = n. Otherwise, reject the current n, increase n by one,
and return to step 2.
Acceptance-rejection technique
Poisson Distribution
Special properties
Some random-variate generation methods are based on features of a particular
family of probability distributions. For example:
• Direct transformation for normal and lognormal distributions
• Convolution method
• Beta distribution from gamma distribution

You might also like