IE 144 Lecture 1
Introduction to Simulation
Angelo C. Ani
Department of Industrial Engineering
UP Los Baños
Simulation
Brief Description
▪ Computer simulation copies the real system in a computer
to generate multiple artificial histories of the system.
▪ From the artificial history, an analyst may draw inferences
about the current system and changes made to the system
without disrupting the real one.
▪ Useful when the system is too complex to be modeled by
closed-form formulas. Most stochastic systems are
relatively complex to analyze, leaving no option but to
perform simulation as no formula may be used to generate
conclusions.
Simulation
Sample Simulation
Courtesy: dela Cruz, Godoy, Gonzales, Reyes
Simulation
Sample Simulation
Courtesy: Briones, Castaneda, Castillo, Macarandang
Simulation
Sample Simulation
Screen shot from an actual simulation model.
Courtesy: Manglicmot, Hernandez, Reyes, Tan
Simulation
Steps in Simulation
Simulation
Steps in Simulation – Example Problem
There are two types of transactions in the sequential
queueing system illustrated below – new applications and
renewal. What happens if one of the servers in the second
service facility is transferred to the first service facility?
Simulation
Steps in Simulation - Capture
Gathering Data
Simulation
Steps in Simulation - Capture
Input Analysis
Input Count Mean Std Dev
Inter-arrival Time – Renewal 38 3.74 3.65
Inter-arrival Time – New 62 3.81 3.91
First Transaction – Renewal 38 3.27 2.03
First Transaction – New 62 4.83 2.84
Second Transaction – Renewal 38 3.46 1.32
Second Transaction – New 62 3.52 1.57
Simulation
Steps in Simulation - Capture
Input Analysis
Inter-arrival Time
(in mins) =
= Enter Timecurrent –
Enter Timeprevious
Visually, it seems that
both types of
transaction have the
same distribution.
Simulation
Steps in Simulation - Capture
Input Analysis
Service Time (in mins)
= End – Start
Distributions of service
times in the first
transaction depends
on the type of
transaction.
Simulation
Steps in Simulation - Capture
Input Analysis
Service Time (in mins)
= End – Start
They are relatively of
the same distribution.
Simulation
Steps in Simulation - Imitate
Random Variate Generation
▪ Random variates are pseudo-random numbers that follow a
specified probability distribution.
▪ Simulation in spreadsheet, however, requires the analyst to
be familiar with random variate generation techniques.
▪ Simulation softwares usually have the built-in capability of
generating random variates.
Simulation
Steps in Simulation - Imitate
Random Variate Generation Spreadsheet Formula:
Discrete Probability: = if( rand() < 0.32, “new”, “renewal”)
Discrete (Integer) Uniform: = randbetween(1,5)
Continuous Uniform: = min + rand()*(max - min)
Normal Distribution: = norminv(rand(), mean, stddev)
Exponential Distribution: = -mean*ln(1-rand())
Simulation
Steps in Simulation – Run, Validate, Replicate
Running the Simulation Model
Simulation
Steps in Simulation – Run, Validate, Replicate
Validating the Model
▪ To ensure that the model is a good approximation of reality,
it is best to compare the result of the model and the
historical performance of the system.
▪ Since some of the data are directly used by the simulation
model, the validation data should be limited to the ones not
used as inputs in the model.
Simulation
Steps in Simulation – Run, Validate, Replicate
Validating the Model
Not Used as Validation Data
Two Servers
(Variable to be Controlled)
Possible Validation Data
Inter-Arrival Time Waiting Time
(Input to Simulation) Queuing (Performance Measure)
System
Service Time Average Queue Length
(Input to Simulation) (Performance Measure)
Simulation
Steps in Simulation – Run, Validate, Replicate
Replication
▪ Replicating requires the analyst to rerun the simulation a
number of times to ensure that the reported results are not
affected by the possible bias of the first run.
▪ When multiple replicates are made, other than the
estimated value of a metric is presented, the variation of
the said measure becomes available as well.
▪ If data gathering is advised to be conducted multiple times
to ensure reliability of data, simulation models are run
multiple times as well to see how robust results are.
Simulation
Steps in Simulation – Test and Evaluate
Output Analysis
Metrics 95% Confidence Interval
First Line: Lq (customers) 4.56 ± 0.61
First Line: Wq (mins) 16.23 ± 5.22
Second Line: Lq (customers) 1.28 ± 0.87
Second Line: Wq (mins) 5.91 ± 2.32
Simulation
Steps in Simulation – Test and Evaluate
Hypothesis Testing
Test:
Ho: Wq,before = Wq,after
H1: Wq,before > Wq,after
P-value: 0.000
Conclusion:
There is enough
evidence to conclude
that Wq is reduced
after the change.
Systems
Preliminaries
System Boundary
5 A
8 7
6 B
System
Environment
Systems
Preliminaries
5 A
8 7
6 B
Entities: objects of interest
Attributes: properties of an entity
States: properties of a system
Systems
Preliminaries
Queuing
5 A
Service
Transaction
8 7
6 B
Wait: action that occupies a duration of time
a. activity (unconditional wait): the duration of wait is specified
(deterministic, stochastic, conditional)
b. delay (conditional wait): the duration of wait is unspecified and
is dependent on other activities.
Systems
Preliminaries
5 A Start of Service
Customer
Arrival 8 7
6 B End of Service
Event: instantaneous (duration = 0) occurrence that may change the
system state.
a. Primary: completion of an activity, “independent” events
b. Conditional: completion of a delay, “dependent” and occurring
simultaneously with primary event(s).
Systems
Preliminaries
Discrete: Continuous:
relevant system states are relevant system states are
discrete. continuous.
Discrete Simulation: Continuous Simulation:
Using discrete events to model a The simulation model of
discrete system. continuous systems.