M2-MAIN-Discrete Event Simulation
M2-MAIN-Discrete Event Simulation
M2-MAIN-Discrete Event Simulation
MODULE 2
DISCRETE EVENT SIMULATION
SUBTOPIC 1
STATISTICAL CONCEPTS
FOR DES
• Demonstrate understanding of the several statistical concepts necessary for
developing and using discrete event simulation.
• Identify statistical methods associated with including randomness as part of a
system model.
• Identify methods associated with processing the simulation output to assess
system performance.
• Recall properties of sets and functions that are used to define a probability space.
• Investigate some of the input data modeling associated with including randomness
as part of a system model.
• Investigate some of the output data analysis associated with processing the
simulation output to assess system performance.
• Probability is a fundamental building block of
statistics.
• Statistics is the source of several very powerful
techniques used to:
❖ represent randomness
❖ generate the random variate streams that drive a
stochastic simulation
❖ interpret the output data obtained from
conducting a stochastic simulation experiment.
Set – collection of objects and usually denoted by capital letters.
Examples: S = { x, y, z } xS
A={}
Note:
• There are no repeated occurrences of an element in the definition of
a set.
• An object is either an element of a set or it is not.
Set Characteristics
1) A set is said to be countable if the elements of the set can be put in a one-to-
one correspondence with the positive integers,
2) A set is called finite if it is empty or if it has elements that can counted with the
counting process terminating. A set that is not finite is called infinite.
3) If every element of set A is also an element of set B, then A is said to be
contained in B and A is called a subset of B denoted as A B.
4) Two sets are said to be disjoint if they have no common elements.
5) The largest or all-encompassing set of elements under discussion in a given
situation is called the universal set denoted by U.
6) Two sets A and B are said to be equal, denoted A = B, if set A and set B
contained exactly the same elements.
Set Operations
1) The union of two sets A and B, denoted A B, is the set consisting of all
elements that are contained either in set A or in set B.
2) The intersection of two sets A and B, denoted A B, is the set consisting of all
elements that are contained in both sets A and B.
3) The difference of two sets A and B, denoted A – B, is the set consisting of the
elements contained in set A that are not contained in set B. It should be
observed that, in general, A – B B – A.
4) Let U be the universal set and let A be a subset of the universal set. The
complement of set A, denoted by AC, is the set U – A.
Example:
Let U = { 2, 4, 6, 8, 10, 12 }
A = { 2, 4, 10 }
B = { 4, 6, 8, 10 }
What is AC ? ________
Function
• A mathematical construct consisting of three components:
1) A set of elements called the domain set X.
2) A set of elements called the codomain set Y.
3) A rule of correspondence f that associates each element of
the domain set with exactly one element of the codomain set.
For m = 0, the function becomes y = f(x) = b. All points in the domain map to a single point in the
codomain. Range of function is the set {b}. Hence, function is neither one-to-one nor onto, and no
inverse function exists.
Probability Space
• Essential to developing a conceptual understanding of
problems involving probability.
• It is a mathematical construct consisting of three
components:
a) Sample space S
b) Sigma algebra of events A
c) Probability measure P
Random Experiment
• A well-defined experiment in which the experimental outcome
cannot be predicted before conducting the experiment.
Event (E)
• A subset of the sample space from a random experiment.
Sigma algebra of events (A)
• A set of events from a random experiment that satisfies the following
properties:
1) If E A, then EC A
2) If E1 A and E2 A, then E1 E2 A
3) If E1 A and E2 A, then E1 E2 A
4) SA
Sample space S = { B, C, D }
Sigma algebra of events A:
Probability measure P:
Random Variable
• A means of associating real numbers with experimental outcomes.
1. Uniform Distribution
• Often used when a random variable having equally likely values over a finite
range is needed.
• Denoted as UNIFORM (a, b)
where: a – minimum value of the random variable
b – maximum value of the random variable
a, b R and - < a < b <
• The probability density function for this distribution is
f(x)
Theoretical Distribution Functions Used Commonly in M&S
2. Triangular Distribution
• Used in situations in which the exact form of the distribution is not known, but approximate
values are known for the minimum, maximum and most likely values.
• Denoted as TRIANGULAR(a, m, b)
where: a – minimum value of the distribution f(x)
b – maximum value of distribution
m – mode or most likely value of the distribution
a, m, b R and - < a < m < b <
• The probability density function for this distribution is:
f(x)
Theoretical Distribution Functions Used Commonly in M&S
3. Exponential Distribution
• Used to model interarrival times for entities arriving at a system.
• Denoted as EXPONENTIAL(m)
where: m – the mean of the distribution
m R and 0 < m < − 𝑥
𝑒 ,𝑥 ≥ 0
• The probability density function for this distribution is: 𝑓 𝑥 = ൝
0 , 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
4. Normal Distribution
• Used to represent variability of quantities about some average value.
• This distribution also represents the distribution of a random variable formed as the sum of a
large number of other random variables, even when the other random variables are not
normally distributed.
• Denoted as NORMAL(m, )
where: m – the mean of the distribution
- standard deviation of the distribution
m, R, - < m < , and 0 < < . 1 1 𝑥−𝜇 2
• The probability density function for this distribution is 𝑓 𝑥 = 𝑒 2 𝜎 )
− (
𝜎 2𝜋
f(x)
Generation of Random Variates
Random Variates
• The independent samples selected from a random variable having a theoretical
distribution.
Random Variates
• The independent samples selected from a random variable having a theoretical distribution.
Note: The capability to quickly and efficiently generate random variates is an essential requirement
for all DES software systems.
Thus, to be useful in simulation, the constants in the LCG and the initial seed must be selected to
produce a very long cycle length.
Source: Olivar, A. (2015). Stochastic Simulation of Random Numbers Using Linear Congruential Method. Unpublished Thesis, AMA University
Source: Olivar, A. (2015). Stochastic Simulation of Random Numbers Using Linear Congruential Method. Unpublished Thesis, AMA University
Components in the development of a system model
1. Structural Modeling
• The entities, locations, resources and processes describing the structure and operation of
the system are defined.
• The result is a mathematical or logical representation (i.e., Queuing System Model)
2. Data Modeling
• Descriptive data required to execute the structural model are developed.
• Data include entity interarrival times, process service times, resource schedules and
failure rates, entity travel times and all of the other system data needed to describe the
operation of the system quantitatively.
• The data model is used to generate the many random variate streams that must be
supplied during the simulation of the system model.
Choice for generating the random variate stream required for
simulation
Disadvantage: It cannot generate outlying values that may actually occur but
are only infrequently observed.
Note: Generally used when a good fit to the sample data using a theoretical
distribution cannot be found.
Use of Theoretical Distribution
• A distribution function that is defined mathematically in terms of distribution
parameters.
• Parameters are often related to the position, scale or shape of the
theoretical distribution.
Examples:
a. Exponential Distribution
b. Normal Distribution
c. Triangular Distribution
Use of Theoretical Distribution
Advantages:
a. Smooths irregularities resulting from using a limited number of sample
values.
b. Use of this approach is computational efficient.
Steps:
a. A simple queuing system example is presented and used to illustrate why output data
analysis is necessary.
b. The confidence interval estimate of the mean is described.
c. Some of the more complex output data analysis situations are identified , and the
approaches for addressing these situations are briefly discussed.
Formative Assessment 2
Check Canvas for instructions
SUBTOPIC 2
DISCRETE EVENT SIMULATION
• Understand concepts on discrete event simulation.
• Discuss the construction and performance of a queuing
system model.
• Illustrate a simulation methodology by describing a
general DES framework and further illustrate the
mechanics of the simulation.
After the completion of the topics and laboratory activities, students can:
In Discrete Event Modeling, the movement of the train from Point A to Point B will be modelled by these two events:
Other Examples:
Other Examples:
In DES, we calculate the
solution for every change of
events. For example, in a
queuing system, we
calculate the system when
an entity arrives, or when
an entity leaves the system.
DES finds its applications
in simulating queuing of
people in a hospital,
queuing of cars in an
intersection, queuing of
products in manufacturing
line, etc.
1. Entity
• An object that can interact with
each other or competes with
each other for a resource.
Resource
Entity Entity
2. Attribute
• Variable (s) that pertains to an individual entity and is carried along with the
entity as it goes through the system.
NOTE:
Resource Utilization
- one of the outcomes of DES
Resource
5. Events
• Any change in the state of the system.
Examples:
Entity is created
Entity interacts/competes with another entity
Entity leaves the system
Discrete event simulation is generally carried out by a software designed in high level
programming languages such as Pascal, C++, or any specialized simulation
language.
Following are the five key features:
❑ Entities − These are the representation of real elements like the parts of machines.
❑ Relationships − It means to link entities together.
❑ Simulation Executive − It is responsible for controlling the advance time and
executing discrete events.
❑ Random Number Generator − It helps to simulate different data coming into the
simulation model.
❑ Results & Statistics − It validates the model and provides its performance
measures.
Time Graph Representation
❑ Time Slicing − It is the time defined by a model for each event until the absence
of any event.
❑ Next Event − It is the event defined by the model for the next event to be
executed instead of a time interval. It is more efficient than Time Slicing.
Common Terminology Associated with Discrete Event Simulation
• Report Generator. A tool that calculates and reports statistics that describe the
performance of the system.
1. Discrete Systems
• The state variables are updated instantaneously at specified times
(e.g., t1 , t2 , t3 … ).
Example:
A lunch queue and server utilization at a local fast - food restaurant
throughout the peak midday business hours.
2. Continuous Systems
• The state variables change continuously with the progression of time.
1. Fixed-increment Advance
• Uncommon in simulation software.
• Initializes at time zero and then advances at fixed time increments.
• Events such as an entity’s arrival to, or departure from, the system, as
generated by the probability distribution and recorded in the event list, may
fall between successive moments that demarcate the time interval.
• The updating of the state variables takes place not with the occurrence of an
event, but with the passing of a time increment moment.
• For the purpose of recording data and updating state variables, the event is
artificially forced in sync with the interval.
• The size of the time increment is subjective. The choice of increment has
implications for the performance measures of the system.
Approaches for Advancing the Simulation Clock
Basic Elements
1. Entities – Customers or objects
2. Servers – Persons or production stations that treat or interact
with the entity
3. Queues – Holding or waiting position of entities
1. Arrivals of Customers
• It defines the way customers enter into the system.
• Mostly the arrivals are random with random intervals between two adjacent
arrivals.
• The arrivals are described by a random distribution of intervals referred to as Arrival
Pattern.
2. Service Mechanism
• A customer who arrives and finds the server idle enters service immediately, and
the service time of the successive customers are independent and identically
distributed (IID) random variables that are independent of inter arrival times.
• A customer who arrives and finds the server busy joins the end of a single queue.
NOTE: IID means that the arrival times of the entities are independent, or
autonomous, of each other and that the probability distribution is identical, or alike,
for all entities.
3. Queuing Discipline
• It represents the way the queue is organized or it is the order in
which service is provided such as:
o FIFO – First in, First Out → also called FCFS
o FIFO – Last in, First Out → also called LCFS.
o Priority Queue → It maybe viewed as a number of queues for
various priorities
o SIRO → Serve in random order
• The order that either customers or objects are selected from a
queue to advance to receive service.
2. Simulation Model
- used for complex systems with multiple stations
Arrival time
• Independent, or autonomous, of each other and that the probability
distribution is identical for all entities
1. Arrival rate → How fast are customers will show up ?
2. Service rate → How fast will the server handle the customer ?
3. Number of servers → How many servers are needed to provide
service to the customers ?
4. Maximum queue length → Optional
5. Population size → Optional
1. Single Server, Single Phase → (McDonald’s, ATMs)
- Providing service to a single line
2. Single Server, Multi Phase → (Chipotle)
3. Multiple Server, Single Phase → (Chick-fil-A)
- Multiple servers serving a single line
4. Multiple Server, Multiple Phase → (Laundromat)
- Multiple servers serving a single line
Formulas to be used
1. Time since last arrival for (i + 1) customer = Arrival time of ith customer – Arrival time of (i – 1)th customer
2. Time customer wait in queue for ith customer = Arrival time of ith customer – Time service begin of ith customer
3. Time service ends of ith customer = Time service begin of ith customer (min) + Service Time of ith customer
4. Time customer spends in system = Time service ends of ith customer – Arrival time of ith customer
5. Idle time of server for ith customer = Time service begins of ith customer – Time service ends of (i – 1)th
customer