0% found this document useful (0 votes)
13 views133 pages

DES - Introduction

The document discusses discrete event simulation and provides an overview of the key concepts. It covers topics like what simulation is, when to use simulation, different types of models, components of a system, and areas where simulation is applied. The document is from a textbook and refers to other chapters for more details on various simulation concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views133 pages

DES - Introduction

The document discusses discrete event simulation and provides an overview of the key concepts. It covers topics like what simulation is, when to use simulation, different types of models, components of a system, and areas where simulation is applied. The document is from a textbook and refers to other chapters for more details on various simulation concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 133

Course: ISYE8023045 – Advanced System Simulation

and Modeling
Period : September / February 20XX

Discrete-Event Simulation:
Introduction
Session 6

D3776 – Fergyanto E. Gunawan 1


Reference

Banks Carson II and Nelson Nicol (2014), Discrete-Event System Simulation, Pearson,

Chapter 1: Introduction to Simulation


Chapter 2: Simulation Examples in a Spreadsheet
Chapter 3: General Principles
Chapter 5: Statistical Models in Simulation

2
Topic

• Introduction to DES simulation


• Simulation examples in a spreadsheet
• General principles
• Statistical models in simulation

3
Chapter 1
Introduction to Simulation

Banks, Carson, Nelson & Nicol


Discrete-Event System Simulation

4
Discrete-Event Simulation (DES) vs. Discrete-
Time Simulation
Discrete-event

Two major classes of simulations:


• Discrete-event simulation (DES)
• Discrete-time simulation (DTS)
The calculation or analysis needs to be
performed for every change of events in DES
and for every change of times in DTS.

Discrete-time
5
What is a Simulation?
 A simulation: imitation of the operation of a real-world
process or system over time:
 Involves generation of an artificial history of a system.
 Observes that history and draws inferences about system
characteristics.
 Can be used as:
 Analysis tool for predicting the effect of changes to existing
systems.
 Design tool to predict performance of new systems.
 Many real-world systems are very complex that cannot
be solved mathematically.
 Hence, numerical, computer-based simulation can be used to
imitate the system behavior.

6
When to use Simulation?
 Simulation can be used for the purposes of:
 Study and experiment with internal interactions of a complex
system.
 Observe the effect of system alterations on model behavior.
 Gain knowledge about the system through design of simulation
model.
 Use as a pedagogical device to reinforce analytic solution
methodologies, also to verify analytic solutions.
 Experiment with new designs or policies before implementation.
 Determine machine requirements through simulating different
capabilities.
 For training and learning.
 Show animation.
 Model complex system.
7
When Not to Use Simulation?
 Simulation should not be used when:
 Problem can be solved by common sense.
 Problem can be solved analytically.
 If it is easier to perform direct experiments.
 If the costs exceed the savings.
 If the resources or time to perform simulation studies are not
available.
 If no data, not even estimates, is available.
 If there is not enough time or personnel to verify/validate the
model.
 If managers have unreasonable expectations: overestimate the
power of simulation.
 If system behavior is too complex or cannot be defined.

8
Advantages and Disadvantages of Simulation

 Simulation is frequently used in problem solving.


 It mimics what happens in a real system.
 It is possible to develop a simulation model of a system without
dubious assumptions of mathematically solvable models.
 In contrast to optimization models, simulation models are “run”
rather than solved.
 Advantages:
 Explore new policies or procedures without disrupting ongoing
operations of the real system.
 Test new hardware or physical systems without committing to
acquisition.
 Test hypotheses about how or why certain phenomena occur.
 Study speed-up or slow-down of the phenomena under
investigation.

9
Advantages and Disadvantages of Simulation

 Advantages (cont.):
 Study interactions of variables, and their importance to system
performance.
 Perform bottleneck analysis.
 Understand how the system operates.
 Test “what if” questions.
 Disadvantages:
 Model building requires special training.
 Simulation results can be difficult to interpret.
 Simulation modeling and analysis can be time consuming and
expensive.
 Simulation is used in some cases when an analytical solution is
possible (or even preferable).

10
Areas of Application
 The applications of simulation are vast.
 The Winter Simulation Conference: an excellent way to
learn more about the latest in simulation applications and
theory.
 Some areas of applications:
 Manufacturing
 Construction engineering and project management.
 Military.
 Logistics, supply chain, and distribution.
 Transportation modes and traffic.
 Business process simulation.
 Healthcare.
 Computer and communication systems.

11
Areas of Application
 Some general trends:
 Risk analysis, e.g., pricing, insurance.
 Call-center analysis.
 Large-scale systems, e.g., internet backbone, wireless networks.
 Automated material handling systems as test beds for the
development and functional testing of control-system software.

12
Systems and System Environment
 A system is a group of objects joined together in some
regular interaction or interdependence to accomplish
some purpose.
 e.g., a production system: machines, component parts & workers
operate jointly along an assembly line to produce vehicle.
 Affected by changes occurring outside the system.
 System environment: “outside the system”, defining the
boundary between system and it environment is
important.

13
Components of a System
 An entity: an object of interest in the system, e.g., computing
jobs in queue.
 An attribute: a property of an entity, e.g., priority class, or
vector of resource requirements.
 An activity: represents a time period of a specified length, e.g.
job receiving service.
 The state of a system: collection of variables necessary to
describe the system at any time, relative to the objectives of
the study, e.g., the number of busy servers, the number of jobs
in queue.
 An event: an instantaneous occurrence that may change the
system state, can be endogenous or exogenous, e.g., a new
job arrival, or service time completion

14
Example System: Queuing at a Teller

Simulation Terms Actual

Entity A person
Attributes Person ID
Person age
Person saving
Events A person arrives in the queue
A person moves to the teller
A person leaves the teller
State The teller is busy
10 persons in queue

15
Discrete and Continuous Systems
 Discrete system: in which state variable(s) change only at a
discrete set of points in time.
 e.g., the number of jobs in queue changes when a new job arrives
or when service is completed for another
 Continuous system: in which state variable(s) change
continuously over time.
 e.g., the head of water behind a dam.

Discrete System Continuous System


16
Model of a System
 Studies of systems are often accomplished with a model
of a system.
 A model: a representation of a system for the purpose of
studying the system.
 A simplification of the system.
 Should be sufficiently detailed to permit valid conclusions to be
drawn about the real system.
 Should contain only the components that are relevant to the
study.

17
Types of Models
 Two types of models: mathematical or physical.
 Mathematical model: uses symbolic notation and
mathematical equations to represent a system.
 Simulation is a type of mathematical model.
 Simulation models:
 Static or dynamic.
 Deterministic or stochastic.
 Discrete or continuous.
 Our focus: discrete, dynamic, and stochastic models.

18
Discrete Event System Simulation
 This book is about discrete-event system simulation.
 Simulation models are analyzed by numerical methods
rather than by analytical methods.
 Analytical methods: deductive reasoning of mathematics to
“solve” the model.
 Numerical methods: computational procedures to “solve”
mathematical models.

19
Steps in a Simulation Study

Captured in this course

20
Steps in a Simulation Study
 Four phases:
 Problem formulation and 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.

21
Thank you for your attention

22
Chapter 2
Simulation Examples

Banks, Carson, Nelson & Nicol


Discrete-Event System Simulation

23
Purpose
 To present several examples of simulations that can be
performed by devising a simulation table either manually
or with a spreadsheet.
 To provide insight into the methodology of discrete-
system simulation and the descriptive statistics used for
predicting system performance.

24
Outline
 The simulations are carried out by following steps:
 Determine the input characteristics.
 Construct a simulation table.
 For each repetition i, generate a value for each input, evaluate
the function, and calculate the value of the response yi.
 Simulation examples are in queueing, inventory, reliability
and network analysis.

25
Simulation of Queueing Systems
 A queueing system is described by its calling population, nature of
arrivals, service mechanism, system capacity and the queueing
discipline (details in Chapter 6.)
 In a single-channel queue:
 The calling population is infinite.
 Arrivals for service occur one at a time in a random fashion, once they
join the waiting line, they are eventually served.
 Arrivals and services are defined by the distribution of the time
between arrivals and service times.
 Key concepts:
 The system state is the number of units in the system and the status of
the server (busy or idle).
 An event is a set of circumstances that causes an instantaneous change
in the system state, e.g., arrival and departure events.
 The simulation clock is used to track simulated time.

26
Simulation of Queueing Systems
 Event list: to help determine what happens next.
 Tracks the future times at which different types of events occur.
(this chapter simplifies the simulation by tracking each unit
explicitly.)
 Events usually occur at random times.
 The randomness needed to imitate real life is made possible
through the use of random numbers, they can be generated
using:
 Random digits tables: form random numbers by selecting the
proper number of digits and placing a decimal point to the left of
the value selected, e.g., Table A.1 in book.
 Simulation packages and spreadsheets.
 Details in chapter 7.

27
Simulation of Queueing Systems
 Single-channel queue illustration:
 Assume that the times between arrivals were generated by rolling
a die 5 times and recording the up face. Input generated:
Customer Interarrival Time Arrival Time on Clock
1 - 0
2 2 2
3 4 6
4 1 7
5 2 9
6 6 15

 The 1st customer is assumed to arrive at clock time 0. 2nd customer


arrives two time units later (at clock time 2), and so on.
 Assume the only possible service times are 1,2,3 and 4 time units
and they are are equally likely to occur. Input generated:
Customer Service Time Customer Service Time
1 2 4 2
2 1 5 1
3 3 6 4

28
Simulation of Queueing Systems
 Resulting simulation table emphasizing clock times:
Customer Arrival Time Time Service Service Time Time Service
Number (clock) Begins (Clock) (Duration) Ends (clock)
1 0 0 2 2
2 2 2 1 3
3 6 6 3 9
4 7 9 2 11
5 9 11 1 12
6 15 15 4 19
 Another presentation method, by chronological ordering of events:
Event Type Customer Number Clock Time
Arrival 1 0
Departure 1 2
Arrival 2 2
Departure 2 3
Arrival 3 4
Arrival 4 7
Departure 2 8
Arrival 5 8
Departure 4 11
Departure 5 12
Arrival 6 15
Departure 6 19
29
Simulation of Queueing Systems
 Grocery store example: with only one checkout counter.
 Customers arrive at random times from 1 to 8 minutes apart, with
equal probability of occurrence:
Time between Cumulative Random Digit
Arrivals (minutes) Probability Probability Assignment
1 0.125 0.125 001-125
2 0.125 0.250 126-250
3 0.125 0.375 251-375
4 0.125 0.500 376-500
5 0.125 0.625 501-625
6 0.125 0.750 626-750
7 0.125 0.875 751-875
8 0.125 1.000 876-000

 The service times vary from 1 to 6 minutes, with probabilities:


Time between Cumulative Random Digit
Arrivals (minutes) Probability Probability Assignment
1 0.10 0.100 001-100
2 0.20 0.300 101-300
3 0.30 0.600 301-600
4 0.25 0.850 601-850
5 0.10 0.950 851-950
6 0.05 1.000 951-000 30
Grocery Store Example
[Simulation of Queueing Systems]
 To analyze the system by simulating arrival and service of 100
customers.
 Chosen for illustration purpose, in actuality, 100 customers is too small a
sample size to draw any reliable conclusions.
 Initial conditions are overlooked to keep calculations simple.
 A set of uniformly distributed random numbers is needed to generate
the arrivals at the checkout counter:
 Should be uniformly distributed between 0 and 1.
 Successive random numbers are independent.
 With tabular simulations, random digits can be converted to random
numbers.
 List 99 random numbers to generate the times between arrivals.
 Good practice to start at a random position in the random digit table and
proceed in a systematic direction (never re-use the same stream of digits
in a given problem.

31
Grocery Store Example
[Simulation of Queueing Systems]
 Generated time-between-arrivals:
Customer Random Digits Interarrival Times (minutes)
1 - -
2 64 1
3 112 1
4 678 6
5 289 3
6 871 7
… … …
100 538 4
 Using the same methodology, service times are generated:

Customer Random Digits Service Times (minutes)


1 842 4
2 181 2
3 873 5
4 815 4
5 006 1
6 916 5
É É É
100 266 2

32
Grocery Store Example
[Simulation of Queueing Systems]
 For manual simulation, Simulation tables are designed for the
problem at hand, with columns added to answer questions
posed: 2 customer was in the
system for 5 minutes.
nd

Time Waiting Time Time


Arrival Service Service Time in Service customer Idle time
Interarrival Time Time Begins Queue Ends spends in of server
Customer Time (min) (clock) (min) (clock) (min) (clock) system (min) (min)
1 0 4 0 0 4 4
2 1 1 2 4 3 6 5 0
3 1 2 5 5 4 11 9 0
4 6 8 4 11 3 15 7 0
5 3 11 1 15 4 16 5 0
6 7 18 5 18 0 23 5 2
… … … … … … … … …
100 5 415 2 416 1 418 3
Totals 415 317 174 491 0

Service could not Service ends at time 16, but


begin until time 4 the 6th customer did not
(server was busy until arrival until time 18. Hence,
that time) server was idle for 2 minutes 33
Grocery Store Example
[Simulation of Queueing Systems]
 Tentative inferences:
 About half of the customers have to wait, however, the average waiting
time is not excessive.
 The server does not have an undue amount of idle time.

 Longer simulation would increase the accuracy of findings.


 Note: The entire table can be generated using the Excel spreadsheet
for Example 2.1 at www.bcnn.net
34
Grocery Store Example
[Simulation of Queueing Systems]
 Key findings from the simulation table:
Average waiting total time wait in queue (min) 174
   1.74 min
time (min) total number of customers 100
numbers of customers who wait 46
Probability(wait)    0.46
total number of customers 100
Probability of total idle time of server (min) 101
   0.24
idle server total run time of simulation (min) 418
Hence : Probability of busy server  1 - 0.24  0.76
Average service total service time (min) 317
   3.17 min
time (min) total number of customers 100
Check : Expected service time
 1(0.1)  2(0.2)  3(0.3  4(0.25)  5(0.1)  6(0.05)
 3.2 min
Average interarrival sum of all interarrival times (min) 415
   4.19 min
Times (min) number of arrivals  1 99
Check : Expected interarrival time  (1  8) / 2  3.2 min 35
Able-Baker Call Center Example
[Simulation of Queueing Systems]

 A computer technical support center with two personnel


taking calls and provide service.
 Two support staff: Able and Baker (multiple support channel).
 A simplifying rule: Able gets the call if both staff are idle.
 Goal: to find how well the current arrangement works.
 Random variable:
 Arrival time between calls

 Service times (different distributions for Able and Baker).

 A simulation of the first 100 callers are made


 More callers would yield more reliable results, 100 is chosen for

purposes of illustration.

36
Able-Baker Call Center Example
[Simulation of Queueing Systems]

 The steps of simulation are implemented in a spreadsheet


available on the website (www.bcnn.net).
 In the first spreadsheet, we found the result from the trial:

 62% of the callers had no delay


 12% had a delay of one or two minutes.

37
Able-Baker Call Center Example
[Simulation of Queueing Systems]
 In the second spreadsheet, we run an experiment with 400 trials
(each consisting of the simulation of 100 callers) and found the
following:

 19% of the average delays are longer than two minutes.


 Only 2.75% are longer than 3 minutes.

38
Simulation of Inventory Systems
 A simple inventory system, an (M, N) inventory system:

 Periodic review of length, N, at which time the inventory level is


checked.
 An order is made to bring the inventory up to the level M.
 At the end of the ith review period, an order quantity, Qi, is placed.
 Demand is shown to be uniform over time. However, in general,
demands are not usually known with certainty.
39
Simulation of Inventory Systems
 A simple inventory system (cont.):
 Total cost (or profit) of an inventory system is the performance
measure.
 Carrying stock in inventory has associated cost.
 Purchase/replenishment has order cost.
 Not fulfilling order has shortage cost.

40
Simulation of Inventory Systems
 The News Dealer’s Example: A classical inventory problem
concerns the purchase and sale of newspapers.
 News stand buys papers for 33 cents each and sells them for 50
cents each.
 Newspaper not sold at the end of the day are sold as scrap for 5
cents each.
 Newspaper can be purchased in bundles of 10 (can only buy 10,
20,… 50, 60…)
 Random Variables:
 Types of newsdays.
 Demand.

Profits = (revenue from sales) – (cost of newspaper)


– (lost profit form excess demand)
+ (salvage from sale of scrap papers)
41
News Dealer’s Example
[Simulation of Inventory Systems]
 Three types of newsdays: “good”; “fair”; “poor”; with
probabilities of 0.35, 0.45 and 0.20, respectively.
Type of Newsday Probability Cumulative Probability Random digit Assignment
Good 0.35 0.35 01-35
Fair 0.45 0.80 36-80
Poor 0.20 1.00 81-00

 Demand and the random digit assignment is as follow:


Cumulative Distribution Random Digit Assignment
Demand Good Fair Poor Good Fair Poor
40 0.03 0.10 0.44 01-03 01-10 01-44
50 0.08 0.28 0.66 04-08 11-28 45-66
60 0.23 0.68 0.82 09-23 29-68 67-82
70 0.43 0.88 0.94 24-43 69-88 83-94
80 0.78 0.96 1.00 44-78 89-96 95-00
90 0.93 1.00 1.00 79-93 97-00
100 1.00 1.00 1.00 94-00
42
News Dealer’s Example
[Simulation of Inventory Systems]
 Simulate the demands for papers over 20-day time period to
determine the total profit under a certain policy, e.g. purchase
70 newspaper
 The policy is changed to other values and the simulation is
repeated until the best value is found.

43
News Dealer’s Example
[Simulation of Inventory Systems]
 From the manual solution
 The simulation table for the decision to purchase 70 newspapers
is:

Random Lost Profit


Digits for Random from Salvage
Type of Type of Digits for Revenue Excess from Sale
Day Newsday Newsday Demand Demand from Sales demand of Scrap Daily Profit
1 58 Fair 93 80 $35.00 $1.70 - $10.20
2 17 Good 63 80 $35.00 $1.70 - $10.20
3 21 Good 31 70 $35.00 - - $11.90
4 45 Fair 19 50 $25.00 - $1.00 $2.90
5 43 Fair 91 80 $35.00 $1.70 $10.20
… … … … … … … … …
19 18 Good 44 80 $35.00 $1.70 - $10.20
20 98 Poor 13 40 $20.00 - $1.50 -$1.60
Total $600.00 $17.00 $10.00 $131.90

44
News Dealer’s Example
[Simulation of Inventory Systems]
 From Excel: running the simulation for 400 trials (each for 20
days)

 Average total profit = $137.61.


 Only 45 of the 400 results in a total profit of more than $160.

45
News Dealer’s Example
[Simulation of Inventory Systems]
 The manual solution had a profit of $131.00, not far from the
average over 400 days, $137.61.
 But the result for a one-day simulation could have been the
minimum value or the maximum value.
 Hence, it is useful to conduct many trials.
 On the “One Trial” sheet in Excel spreadsheet of Example 2.3.
 Observe the results by clicking the button ‘Generate New Trail.’
 Notice that the results vary quite a bit in the profit frequency graph
and in the total profit.

46
Order-Up-To Level Inventory Example
[Simulation of Inventory Systems]

 A company sells refrigerators with an inventory system


that:
 Review the inventory situation after a fixed number of days (say
N) and order up to a level (say M).
Order quantity = (Order-up-to level) - (Ending inventory)
+ (Shortage quantity)
 Random variables:
 Number of refrigerators ordered each day.
 Lead time: the number of days after the order is placed with the
supplier before its arrival.
 See Excel solution for Example 2.4 for details.

47
Other Examples of Simulation
 Reliability problem:
 A machine with different failure types of which repairman is called
to install or repair the part.
 Possible random variables: time to failure, time to service.
 Possible decision variables: decide strategy of repair verses
replace, number of repairman to hire.
 Random normal numbers:
 e.g. a bomber problem – where the point of impact is normally
distributed around the aim point.
 Possible decision variables: number of bombs to drop for a certain
level of damage.

48
Other Examples of Simulation
 Lead-time demand:
 Lead time is the random variable: the time from placement of an
order until the order is received.
 Other possible random variable: demand.
 Possible decision variables: how much and how often to order.
 Project simulation:
 A project can be represented as a network of activities: some
activities must be carried out sequentially, others can be done in
parallel.
 Possible random variables: times to complete the activities.
 Possible decision variables: sequencing of activities, number of
workers to hire.

49
Summary
 Introduced simulation concepts by means of examples,
illustrated general areas of application, and motivated the
remaining chapters.
 Ad-hoc simulation tables were used:
 Events in tables were generated by using uniformly distributed
random numbers, and resulting responses were analyzed.
 Ac-hoc simulation table may fail due to system complexities.
More systematic methodology, e.g., event scheduling approach,
is described in Chapter 3.
 Key takeaways:
 A simulation is a statistical experiment and results have variation.
 As the number of replications increases, there is an increased
opportunity for greater variation.

50
Chapter 3
General Principles

Banks, Carson, Nelson & Nicol


Discrete-Event System Simulation

51
Purpose
 Develops a common framework for the modeling of
complex systems.
 Covers the basic blocks for all discrete-event simulation
models.
 Introduces and explains the fundamental concepts and
methodologies underlying all discrete-event simulation
packages.
 These concepts and methodologies are not tied to any particular
simulation package.

52
Outline
 Deals exclusively with dynamic, stochastic systems.
 Discrete-event models are appropriate for those systems
for which changes in system state occur only at discrete
points in time.
 Covers general principles and concepts:
 Event scheduling/time advance algorithm.
 The three prevalent world views.
 Introduces some of the notions of list processing.

53
Concepts in Discrete-Event Simulation
 System: a collection of entities that interact together over time,
e.g., people and machines.
 Model: an abstract representation of a system.
 System state: a collection of variables that contain all the info
necessary to describe the system at any time.
 Entity: any object or component in the system, e.g., a server, a
customer, a machine.
 Attributes: the properties of a given entity.

54
Concepts in Discrete-Event Simulation
 Lists: a collection of associated entities, ordered in some
logical fashion, a.k.a, sets, queues and chains.
 Event: an instantaneous occurrence that changes the state of
a system, e.g., an arrival of a new customer.
 Event list: a list of event notices for future events, ordered by
time of occurrence, a.k.a. the future event list (FEL)
 Activity: a duration of time of specified length which is known
when it begins , e.g., a service time.
 Clock: a variable representing simulated time.

Note: different simulation packages use different terminology for


the same or similar concepts.

55
Concepts in Discrete-Event Simulation
 An activity typically represents a service time, an interarrival
time, or any processing time whose duration has been
characterized/defined by the modeler.
 An activity’s duration may be specified:
 Deterministic
 Statistical
 A function depending on system variables and/or entity attributes.
 Duration is not affected by the occurrence of other events, hence,
activity is also called an unconditional wait.
 Completion of an activity is an event, often called a primary
event.
 For example
 If the current simulated time is CLOCK = 100 minutes, and an
inspection time of exactly 5 minutes is just beginning, then an event
notice is created that specified the type of event and the event time
(100+5 = 105 min).

56
Concepts in Discrete-Event Simulation
 A delay’s duration is determined by system conditions (not
specified by the modeler ahead of time.)
 Also called a conditional wait.
 For example, a customer’s delay in a waiting line may be
dependent on the number and duration of service of other
customers ahead in line and, whether a server has a failure
during the delay.
 Dynamic: Function of time and constantly changing over time.
 System state, entity attributes, the number of active entities, the
contents of sets, and the activities and delays currently in
progress are all function of time.

57
Concepts in Discrete-Event Simulation
 Example: Able-Baker Call Center System. A discrete-event model
has the following components:
 System state:
 The number of callers waiting to be served at time t
 Indicator that Able is idle or busy at time t
 Indicator that Baker is idle or busy at time t
 Entities: neither the caller nor the servers need to be explicitly
represented, except in terms of the state variables, unless certain caller
averages are desired.
 Events:
 Arrival
 Service completion by Able
 Service completion by Baker
 Activities:
 Interarrival time.
 Service time by Able
 Service time by Baker
 Delay: a caller’s wait in queue until Able or Baker becomes free.

58
Concepts in Discrete-Event Simulation
 The definition of the model components provides a static
description of the model.
 A description of the dynamic relationships and
interactions between the components is also needed.
 e.g., how does each event affect system state? What events
mark the beginning or end of each activity? What is the system
state at time 0?
 A discrete-event simulation is:
 The modeling over time of a system all of whose state changes
occur at discrete points in time.
 Proceeds by producing a sequence of system snapshots.

59
Event Scheduling/Time Advance Algorithm
 The mechanism for advancing simulation time and
guaranteeing that all events occur in correct chronological
order.
 At any given time t, the future event list (FEL) contains all
previously scheduled future events and their associated event
times (t1,t2, …)
 FEL is ordered by event time, and the event time satisfy:
t £ t1 £ t2 £ t3 £ … £ tn where t is the value of
CLOCK

Update Remove event from


system Advance FEL and execute
clock to ti+1
snapshot ti event, i = i +1

Repeat

60
Event Scheduling/Time Advance Algorithm
 Example: figure 3.2 (cannot find it in the figure files…)

61
List Processing [Event Scheduling]

 The management of a list.


 The major list processing operations performed on a FEL are:
 Removal of the imminent event
 Addition of a new event to the list
 Occasionally removal of some event (cancellation of an event).
 Efficiency of search within the list depends on the logical
organization of the list and how the search is conducted.
 When an event with event time t* is generated, its correct
position on the FEL can be found via:
 A top-down search, or
 A bottom-up search.

62
Future Events [Event Scheduling]

 An exogenous event is a happening “outside the system”


that impinges on the system, e.g., arrival and service
completion in a queueing system.
 Arrival event:
 An exogenous event is a happening “outside the system” that
impinges on the system.
 For example, an arrival to a queueing system, at time 0, the 1st
arrival event is generated and is scheduled on the FEL. When
the clock eventually is advanced to the time of this first arrival, a
second arrival event is generated.
 The end of an interarrival interval is an example of a primary
event (primary event is managed by placing an event notice on
the FEL.)

63
Future Events [Event Scheduling]

 Service completion event:


 Conditional event
 Triggered only on the condition that a customer is present and a
server is free.
 A service time is an example of an activity.
 Alternate generation of runtimes and downtimes for a machine
subject to breakdowns.
 Stopping event, E:
 At time 0, schedule a stop simulation event at a specified future
time TE.
 Run length TE is determined by the simulation itself. Generally,
TE is the time of occurrence of some specified event E.

64
World Views
 The most prevalent world views are:
 Event-scheduling world view (variable time advance.)
 Process-interaction world view (variable time advance.)
 Activity-scanning world view (fixed time increment.)

 Event-scheduling approach
 Concentrates on events and their effect on system state
 Summarized in the previous slides; manual simulation will be
discussed next.

65
World Views
 Process-interaction approach
 Concentrates on the processes: a process is a time-sequenced
list of events, activities and delays that define the life cycle of one
entity as it moves through a system.
 Usually, many processes are active simultaneously in a model,
and the interaction among processes could be quite complex.
 A popular approach because it has intuitive appeal and ease of
simulation package implementation.
 An example of a “customer process”:

66
World Views
 Activity-scanning approach:
 Concentrates on activities of a model and those conditions that
allow an activity to begin.
 At each clock advance, the conditions for each activity are
checked, and if the conditions are true, then the corresponding
activities begins.
 Simple in concept but slow runtime on computers.
 The modified approach is called the three-phase approach.
 Events are considered to be activities of duration zero time units.
 Activities are divided into 2 categories:
 B-type: activities that are bound to occur, e.g. primary events.
 C-type: activities or events that are conditional upon certain conditions
being true
 Simulation proceeds with repeated execution of the 3 phases: from
removal of events, then execute B-type events, and then execute C-
type events.
67
World Views
 Commercial Use:
 Process-interaction approach has been adopted by simulation
packages most popular in the U.S.
 Activity-scanning packages are popular in the UK and Europe.

68
Manual Simulation Using Event Scheduling
 Grocery Store Example: Single-channel queue. Reconsider the
single checkout counter problem.
 The system consists of those customers in the waiting plus the one (if
any) checking out.
 For this example, a stopping time of 60 minutes is set.
 Model components:
 System state: LQ(t) – # of customers in line at time t, LS(t) - # being served at
time t.
 Entities: the server and customers are not explicitly modeled, except in terms
of the state variables.
 Events: arrival (A), departure (D), stopping event (E).
 Event notices (event type, event time):
 (A, t), representing an arrival event to occur at future time t;
 (D, t), representing a customer departure at future time t;
 (E, 60), representing the simulation stop event at future time 60.
 Activities: interarrival time and service time.
 Delay: customer time spent in waiting line.
69
Grocery Store Example [Manual Simulation]

 FEL will always contain two


or three event notices.
 Event logic – execution of
arrival event.

70
Grocery Store Example [Manual Simulation]

 Event logic – execution of departure event.

71
Grocery Store Example [Manual Simulation]

 Initial conditions are the 1st customer arrives at time 0 and begin service.
 Only two statistics: server utilization (B) & maximum queue lengths (MQ).
 Simulation table:
Arrival at time 8

Departure at time 4
Terminating event
at time 60
System State Cumulative Statistics
Clock LQ(t) LS(t) Future Event List Comment B MQ
First A occurs: (a* = 8),
0 0 1 (D, 4), (A, 8), (E, 60) schedule next A; (s*=4) 0 0
Schedule first D
4 0 0 (A, 8), (E, 60) First D occurs: (D, 4) 4 0

Second A occurs: (A, 8);


8 0 1 (D, 9), (A, 14), (E, 60) (a* = 6) Schedule next A; 4 0
(s* = 1) Schedule next D

9 0 0 (A, 14) (E, 60) Second D occurs: (D, 9) 5 0


Third A occurs: (A, 14);
14 0 1 (A, 15) (D, 18) (E, 60) 5 0
(s* = 4) Schdeule next D
Fourth A occurs: (A, 15)
15 1 1 (D, 18), (A, 23), (E, 60) 6 1
(Customer delayed)
Third D occurs: (D, 18);
18 0 1 (D, 21) (A, 23) (E, 60) 9 1
(s* = 3) schedule next D 72
Manual Simulation
 When an event-scheduling algorithm is computerized, only one
snapshot (the current one or partially updated one) is kept in
computer memory.
 A new snapshot can be derived only from the previous snapshot,
newly generated random variables, and the event logic.
 The current snapshot must contain all information necessary to
continue the simulation.

73
Grocery Store Example [Manual Simulation]

 Suppose the simulation analyst desires to estimate mean


response time and mean proportion of customers who spend 5
or more minutes in the system.
 It is necessary to expand the previous model to represent the
individual customers explicitly.
 Customer entity with arrival time as an attribute will be added to the list
of model components,
 Customer entities will be stored in a list to be called
“CHECKOUTLINE” as: C1, C2, C3, …,
 Three new cumulative statistics will be collected.
 S, the sum of customer response times for all customers who have
departed by the current time.
 F, the total number of customers who spend 4 or more minutes at the
checkout counter.
 ND the total number of departures up to the current simulation time.
74
Grocery Store Example [Manual Simulation]

(D, t, C )i –the departure of


Simulation Table: customer C iat future time t

(C ,i t) –customer C i (A, t, C )i –the arrival of


who arrived at time t customer C iat future time t
System State Cumulative Statistics
Clock LQ(t) LS(t) List "CHECKOUT LINE" Future Event List S ND F
0 0 1 (C1, 0) (D, 4, C1), (A, 8, C2), (E, 60) 0 0 0
4 0 0 (A, 8, C2), (E, 60) 4 1 1
8 0 1 (C2, 8) (D, 9, C2), (A, 14, C3), (E, 60) 4 1 1
9 0 0 (A, 14, C3) (E, 60) 5 2 1
14 0 1 (C3, 14) (A, 15, C4) (D, 18, C3) (E, 60) 5 2 1
15 1 1 (C3, 14) (C4, 15) (D, 18, C3), (A, 23, C5), (E, 60) 5 2 1
18 0 1 (C4, 15) (D, 21, C4) (A, 23, C5) (E, 60) 9 3 2

At time 18, when the departure event (D, 18, C3) is being executed, the
response time for customer C3 is computed by:

Response time = CLOCK TIME – attribute “time of arrival”


= 18 – 14
= 4 minutes
The S is incremented by 4 minutes, and F and ND by one customer.
75
Dump-Truck Example [Manual Simulation]

 Six dump trucks are used to haul coal from the entrance of a
small mine to the railroad.
 Each truck is loaded by one of two loaders.
 After loading, the truck immediately moves to the scale to be
weighed.
 The loaders and the scale have a FCFS waiting line (or queue) for
trucks.
 After being weighed, a truck begins a travel time (during which the
truck unloads) and returns to the loader queue.

76
Dump-Truck Example [Manual Simulation]

 The distributions of loading time, weighing time and travel time


are: Cumulative Random Digit
Loading Time Probability Probability Assignment
5 0.3 0.3 1-3
10 0.5 0.8 4-8
15 0.2 1 9-0

Weighing Cumulative Random Digit


Time Probability Probability Assignment
12 0.7 0.7 1-7
16 0.3 1 8-0

Cumulative Random Digit


Travel Time Probability Probability Assignment
40 0.4 0.4 1-4
60 0.3 0.7 5-7
80 0.2 0.9 8-9
100 0.1 1 0
77
Dump-Truck Example [Manual Simulation]

 Purpose: to estimate the loader and scale utilizations (% of time busy.)


 The model has the following components:
 System State [ LQ(t), L(t), WQ(t), Q(t)], where
 LQ(t) = number of trucks in loader queue
 L(t) = number of trucks (0, 1, or 2) being loaded
 WQ(t) = number of trucks in weigh queue
 W(t) = number of trucks (0 or 1) being weighed
 Event notices:
 (ALQ, t, DTi), dump truck i arrives at loader queue (ALQ) at time t
 (EL, t, DTi), dump truck i ends loading (EL) at time t
 (EW, t, DTi), dump truck i ends weighing (EQ) at time t
 Entities: The six dump trucks (DT1, …, DT6)
 Lists:
 Loader queue, all trucks waiting to begin loading, ordered in FCFS basis.
 Weigh queue, all trucks waiting to be weighed, ordered on a FCFS basis.
 Activities: Loading time, weighing time, and travel time.
 Delay: Delay at loader queue, and delay at scale

78
Dump-Truck Example [Manual Simulation]

 When an end-loading (EL) event occurs, say for truck j at


time t, other events are triggered:
 If the scale is idle [W(t) = 0], truck j begins weighing and an end-
weighing event (EW) is scheduled on the FEL. Otherwise, truck j
joins the weigh queue.
 If there is another truck waiting for a loader, it will be removed from
the loader queue and begin loading by the scheduling of an end-
loading event (EL) on the FEL.
 Both this logic for the occurrence of the end-loading event and the
appropriate logic for the other two events should be incorporated
into an event diagram.

79
Dump-Truck Example [Manual Simulation]
Truck 3 joins the weigh Truck 4 begins to load,
queue (because the scale is schedule an EL event for
 Simulation Table: occupied.) future time 10

System State Loader Weigh Cumulative Statistics


At time 0, Clock t Future Event List BL BS
LQ(t) L(t) WQ(t) W(t) Queue Queue
5 trucks at 0 3 2 0 1 DT4 (EL, 5, DT3) 0 0
the DT5 (EL, 10, DT2)
loaders DT6 (EW, 12, DT1)
5 2 2 1 1 DT5 DT3 (EL, 10, DT2) 10 5
and 1 is at
DT6 (EL, 5+5, DT4)
the scale (EW, 12, DT1)
10 1 2 2 1 DT6 DT3 (EL, 10, DT4) 20 10
DT2 (EW, 12, DT1)
The (EL, 10+10, DT5)
imminent 10 0 2 3 1 DT3 (EW, 12, DT1) 20 10
event is an DT2 (EL, 20, DT5)
DT4 (EL, 10+15, DT6)
EL event with
12 0 2 2 1 DT2 (EL, 20, DT5) 24 12
time 5, hence DT4 (EW, 12+12, DT3)
clock is (EL, 25, DT6)
advanced to (ALQ, 12+60, DT1)
time t=5 20 0 1 3 1 DT2 (EW, 24, DT5) 40 20
DT4 (EL, 25, DT6)
DT5 (ALQ, 72, DT1)
24 0 1 2 1 DT4 (EL, 25, DT6) 44 24
DT5 (EW, 24+12, DT2)
(ALQ, 72, DT1)
(ALQ, 24+100, DT3)
25 0 0 3 1 DT4 (EW, 36, DT2) 45 25
DT5 (ALQ, 72, DT1)
DT6 (ALQ, 124, DT3)
36 0 0 2 1 DT5 (EW, 36+16, DT4) 45 36
DT6 (ALQ, 72, DT1)
(ALQ, 36+40, DT2) 80
(ALQ, 124, DT3)
Dump-Truck Example [Manual Simulation]

 Two cumulative statistics are maintained:


 BL = total busy time of both loaders from time 0 to time t
 BS = total busy time of the scale from time 0 to time t
 From the simulation table, we know that:
 Both loaders are busy from time 0 to time 20, so BL = 40 at time = 20.
 From time 20 to time 24, only one loader is busy, thus BL increases by
only 4 minutes over the time interval [20, 24].
 From time 25 to time 36, both loaders are idle (L(25) = 0), so BL does
not change.

81
Dump-Truck Example [Manual Simulation]

 Under the activity-scanning approach, the conditions for


beginning each activity are:
Activity Condition
Load time Truck is at front of loader queue, and at
least one loader is idle.
Weighing time Truck is at front of weigh queue, and weigh
scale is idle.
Travel time Truck has just completed a weighing.

82
Dump-Truck Example [Manual Simulation]

 Using process-interaction approach, we view the model


from the viewpoint of one dumper truck and its “life cycle.”
 Considering a life cycle as beginning at the loader queue, we can
picture a dump-truck process as:

83
Lists: Basic Properties and Operations
 Lists are a set of ordered or ranked records.
 In simulation, each record represents one entity or one event
notice.
 They have top or head (1st item) and bottom or tail.
 Ways to traverse the list (to find the 2nd, 3rd, etc. items on the list)
are necessary.
 An entity identifier and its attributes are fields in the entity
record.
 Each record on a list has a field that holds a “next pointer” that
points to the next record on the list.

84
Lists: Basic Properties and Operations
 The main operations on a list are:
 Removing a record from the top of the list
 Removing a record from any location on the list
 Adding an entity record to the top or bottom of the list
 Adding a record at an arbitrary position in the list, specified by the ranking
rule.
 In the event-scheduling approach, when time is advanced and
the imminent event is due to be executed:
 First, the removal operation takes place.
 If an arbitrary event is being canceled, or an entity is removed from a list
based on some of its attributes to being an activity, then the second
removal operation is performed
 If a queue has the ranking rule earliest due date first, then, upon arrival at
the queue, an entity must be added to the list determined by the due-date
ranking rule.

85
Lists: Basic Properties and Operations
 For simulation on a computer:
 All records are stored in arrays: arrays hold successive records in
contiguous locations in computer memory, referenced by array index.
 All entities and event notices are represented by structure (as in C) or
classes (as in Java) allocated from RAM memory as needed, and tracked
by pointers to a record or structure.

86
Using Arrays [List Processing]

 The array method of list storage is typical of FORTRAN.


 Most modern simulation packages do not use arrays for list
storage, but rather use dynamically allocated records.
 Advantages of arrays:
 Any specified record (say the ith record) can be retrieved quickly
without searching, merely by referencing R(i)
 Disadvantages of arrays:
 The list is rearranged when items are added to the middle of a list.
 Have a fixed size which is determined at compile time.

87
Using Arrays [List Processing]

 Two basic methods for keeping track of record ranking in a list:


 Method 1: Store the 1st record in R(1), 2nd in R(2), …, and list in
R(tailptr).
 Extremely inefficient.
 For example, adding a record in position 41 in a list of 100 items, it
requires that the last 60 records be physically moved down one array
position to make space for the new record.
 Method 2: Use head pointer.
 A variable that points to the record at the top of the list, denoted as
headptr.
 For example, if the record in position R(11) were the record at the top
of the list, then headptr would have the value 11.

88
Dump-Truck Example [List Processing]

 Recall the dump-truck problem: At clock time 10, there is waiting line
of 3 dump trucks occurred at the weigh queue, specifically, DT3, DT2
and DT4 (in this order.)
 Suppose the model is tracking one attribute of each dump truck: its
arrival time at the weigh queue, updated each time it arrives.
 Suppose that the entities are stored in records in an array
dimensioned from 1 to 6, one record for each dump truck.
 Each entity is represented by a record with 3 fields:
 The first is an entity identifier,
 The second is the arrival time at the weigh queue,
 The last is pointer field to “point to” the next record.
[ DTi, arrival time at weigh queue, next index]

89
Dump-Truck Example [List Processing]

 At time 0, the records would be initialized as follows:


R(1) = [DT1, 0.0, 0], R(2) = [DT2, 0.0, 0], R(3) = [DT3, 0.0, 0]
R(4) = [DT4, 0.0, 0], R(5) = [DT5, 0.0, 0], R(6) = [DT6, 0.0, 0]

 At clock time 10, the list of entities in the weigh queue would be defined by:
headptr = 3
R(1) = [DT1, 0.0, 0], R(2) = [DT2, 10.0, 4], R(3) = [DT3, 5.0, 2]
R(4) = [DT4, 10.0, 0], R(5) = [DT5, 0.0, 0], R(6) = [DT6, 0.0, 0]

 To traverse the list, start with the head pointer, go to that record, retrieve that
record’s next point, and proceed. To create the list in its logical order, for
example:
headptr = 3,
R(3) = [DT3, 5.0, 2], R(2) = [DT2, 10.0, 4], R(4) = [DT4, 10.0, 0]
 The zero entry for next point in R(4), as well as tailptr = 4, indicates that DT4 is at
the end of the list.

90
Dump-Truck Example [List Processing]

 At clock time 12, dump truck DT3 begins weighing and thus leaves the
weigh queue.
 To remove the DT3 entity record form the top of the list, update the head
pointer by setting it equal to the next pointer value of the record at the top
of the list:
headptr = R(headptr, next)

 In this example, we get: headptr = R(3, next) = 2. Hence, dump truck DT2
in R(2) is now at the top of the list.

91
Using Dynamic Allocation and Linked Lists
[List Processing]
 Used in procedural languages, such as C++ and Java, and in
most simulation languages.
 Entity records are dynamically created when an entity is
created.
 Event notice records are dynamically created whenever an
event is scheduled on the future event list.
 Basic mechanics:
 The languages maintain a linked list of free chunks of computer
memory and allocate a chunk of desired size upon request to
running programs.
 When an entity exits from the simulated system, and also after an
event occurs and the event notice is no longer needed, the
corresponding records are free.

92
Using Dynamic Allocation and Linked Lists
[List Processing]
 A record is referenced by a pointer instead of by an array index.
 A pointer to a record can be thought of as the physical or logical
address in computer memory of the record.
 If the 3rd item on the list is needed, we need to traverse the list,
counting items until we reach the record.
 Notation for records:
 Entities: [ID, attributes, next pointer]
 Event notices: [event type, event time, other data, next pointer]
 List types:
 Singly-linked lists: one-way linkage from the head of the list to its
tail.
 Doubly-linked lists: records have two pointer fields, one for the
next record and one for the previous record.

93
Dump-Truck Example [List Processing]

 Event notices in the dump truck problem are expanded to include a


pointer to the next event notice on the future event list, and can be
represented by:
[event type, event time, DTi, nextptr]
 Keep in mind that the records may be stored anywhere in computer
memory.

 For example, [EL,10, DT3, nextptr]


 At future event list at clock time 10, the future event list as a linked list:

94
Summary
 Introduced the major concepts and building blocks in
simulation:
 Entities and attributes.
 Events and activities.
 Three major world views:
 Event-scheduling.
 Process interaction.
 Activity scanning.
 Basic notions of list processing are introduced to gain
understanding of this important underlying methodologies.

95
Chapter 5
Statistical Models in
Simulation

Banks, Carson, Nelson & Nicol


Discrete-Event System Simulation

96
Purpose & Overview
 The world the model-builder sees is probabilistic rather
than deterministic.
 Some statistical model might well describe the variations.

 An appropriate model can be developed by sampling the


phenomenon of interest:
 Select a known distribution through educated guesses
 Make estimate of the parameter(s)
 Test for goodness of fit

 In this chapter:
 Review several important probability distributions
 Present some typical application of these models

97
Review of Terminology and Concepts
 In this section, we will review the following
concepts:
 Discreterandom variables
 Continuous random variables
 Cumulative distribution function
 Expectation

98
Discrete Random Variables [Probability Review]

 X is a discrete random variable if the number of possible


values of X is finite, or countably infinite.
 Example: Consider jobs arriving at a job shop.
 Let X be the number of jobs arriving each week at a job shop.
 Rx = possible values of X (range space of X) = {0,1,2,…}
 p(xi) = probability the random variable is xi = P(X = xi)
 p(xi), i = 1,2, … must satisfy:
1. p ( xi )  0, for all i



2. i 1
p ( xi )  1

 The collection of pairs [xi, p(xi)], i = 1,2,…, is called the probability


distribution of X, and p(xi) is called the probability mass function
(pmf) of X.

99
Continuous Random Variables [Probability Review]

 X is a continuous random variable if its range space Rx is an interval


or a collection of intervals.
 The probability that X lies in the interval [a,b] is given by:
b
P(a  X  b)   f ( x)dx
a

 f(x), denoted as the probability density function (pdf) of X, satisfies:


1. f ( x)  0 , for all x in R X
2.  f ( x)dx  1
RX

3. f ( x)  0, if x is not in RX
 Properties
x0
1. P( X  x0 )  0, because x0
f ( x) dx  0
2. P(a  X  b)  P(a  X  b)  P (a  X  b)  P (a  X  b)
100
Continuous Random Variables [Probability Review]

 Example: Life of an inspection device is given by X, a


continuous random variable with pdf:

1 x/ 2
 e , x0
f ( x)   2
0, otherwise

 X has an exponential distribution with mean 2 years


 Probability that the device’s life is between 2 and 3 years is:
1 3 x/ 2
P (2  x  3)   e dx  0.14
2 2

101
Cumulative Distribution Function [Probability Review]

 Cumulative Distribution Function (cdf) is denoted by F(x),


where F(x) = P(X ≤ x)
 If X is discrete, then F ( x)   p ( xi )
all
xi  x
 If X is continuous, then x
F ( x)   f (t )dt

 Properties
1. F is nondecreasing function. If a  b, then F ( a)  F (b)
2. lim x  F ( x)  1
3. lim x  F ( x)  0

 All probability questions about X can be answered in terms of the


cdf, e.g.:
P (a  X  b)  F (b)  F (a ), for all a  b

102
Cumulative Distribution Function [Probability Review]

 Example: An inspection device has cdf:


1 x t / 2
F ( x)   e dt  1  e  x / 2
2 0

 The probability that the device lasts for less than 2 years:
P (0  X  2)  F (2)  F (0)  F (2)  1  e 1  0.632

 The probability that it lasts between 2 and 3 years:

P (2  X  3)  F (3)  F (2)  (1  e  ( 3 / 2 ) )  (1  e 1 )  0.145

103
Expectation [Probability Review]

 The expected value of X is denoted by E(X)


 If X is discrete E ( x)   xi p ( xi )
all i
 If X is continuous 
E ( x)   xf ( x)dx


 a.k.a the mean, m, or the 1st moment of X


 A measure of the central tendency
 The variance of X is denoted by V(X) or var(X) or s2
 Definition: V(X) = E[(X – E[X]2]
 Also, V(X) = E(X2) – [E(X)]2
 A measure of the spread or variation of the possible values of X around
the mean
 The standard deviation of X is denoted by s
 Definition: Square root of V(X)
 Expressed in the same units as the mean

104
Expectations [Probability Review]

 Example: The mean of life of the previous inspection device


is: 
1  x/2  x / 2 
E ( X )   xe dx   xe   e  x / 2dx  2
2 0 0 0

 To compute variance of X, we first compute E(X2):



1  2 x/2  x / 2 
E ( X )   x e dx   x e
2 2   e  x / 2 dx  8
2 0 0
0

 Hence, the variance and standard deviation of the device’s life


are:
V ( X )  8  22  4
  V (X )  2
105
Useful Statistical Models
 In this section, statistical models appropriate to
some application areas are presented. The
areas include:
 Queueing systems
 Inventory and supply-chain systems
 Reliability and maintainability
 Limited data

106
Queueing Systems [Useful Models]

 In a queueing system, interarrival and service-time


patterns can be probablistic (for more queueing examples, see
Chapter 2).
 Sample statistical models for interarrival or service time
distribution:
 Exponential distribution: if service times are completely random
 Normal distribution: fairly constant but with some random
variability (either positive or negative)
 Truncated normal distribution: similar to normal distribution but
with restricted value.
 Gamma and Weibull distribution: more general than exponential
(involving location of the modes of pdf’s and the shapes of tails.)

107
Inventory and supply chain [Useful Models]

 In realistic inventory and supply-chain systems, there are


at least three random variables:
 The number of units demanded per order or per time period
 The time between demands
 The lead time
 Sample statistical models for lead time distribution:
 Gamma
 Sample statistical models for demand distribution:
 Poisson: simple and extensively tabulated.
 Negative binomial distribution: longer tail than Poisson (more
large demands).
 Geometric: special case of negative binomial given at least one
demand has occurred.

108
Reliability and maintainability [Useful Models]

 Time to failure (TTF)


 Exponential: failures are random
 Gamma: for standby redundancy where each
component has an exponential TTF
 Weibull: failure is due to the most serious of a large
number of defects in a system of components
 Normal: failures are due to wear

109
Other areas [Useful Models]

 For cases with limited data, some useful


distributions are:
 Uniform, triangular and beta
 Other distribution: Bernoulli, binomial and
hyperexponential.

110
Discrete Distributions
 Discrete random variables are used to describe
random phenomena in which only integer values
can occur.
 In this section, we will learn about:
 Bernoullitrials and Bernoulli distribution
 Binomial distribution
 Geometric and negative binomial distribution
 Poisson distribution

111
Bernoulli Trials and Bernoulli Distribution
[Discrete Dist’n]
 Bernoulli Trials:
 Consider an experiment consisting of n trials, each can be a
success or a failure.
 Let Xj = 1 if the jth experiment is a success
 and Xj = 0 if the jth experiment is a failure
 The Bernoulli distribution (one trial):
 p, x j  1, j  1,2,..., n

p j ( x j )  p ( x j )  1  p  q, x j  0 ,j  1,2 ,...,n
0, otherwise

 where E(Xj) = p and V(Xj) = p (1 – p) = p q
 Bernoulli process:
 The n Bernoulli trials where trails are independent:
p(x1,x2,…, xn) = p1(x1) p2(x2) … pn(xn)

112
Binomial Distribution [Discrete Dist’n]

 The number of successes in n Bernoulli trials, X, has a


binomial distribution.
 n  x n  x
  p q , x  0,1,2,..., n
p ( x)   x 
0, otherwise

The number of outcomes having


Probability that there are
the required number of successes
x successes and (n-x) failures
and failures

 The mean, E(x) = p + p + … + p = n*p


 The variance, V(X) = pq + pq + … + pq = n*pq

113
Geometric & Negative
Binomial Distribution [Discrete Dist’n]

 Geometric distribution
 The number of Bernoulli trials, X, to achieve the 1st success:
q x 1 p, x  0,1, 2,..., n
p( x)  
0, otherwise
 E(X) = 1/p, and V(X) = q/p2

 Negative binomial distribution


 The number of Bernoulli trials, X, until the kth success
 If X is a negative binomial distribution with parameters p and k,
then:
 x  1 x  k k
  q p , x  k , k  1, k  2,...
p ( x)   k  1
0, otherwise

 E(X) = k/p, and V(X) = kq/p2

114
Poisson Distribution [Discrete Dist’n]

 Poisson distribution describes many random processes


quite well and is mathematically quite simple.
 where a > 0, pdf and cdf are:
 e   x x
e   i

p ( x)   x! , x  0,1,... F ( x)  
i 0 i!
0, otherwise
 E(X) = a = V(X)

115
Poisson Distribution [Discrete Dist’n]

 Example: A computer repair person is “beeped” each


time there is a call for service. The number of beeps per
hour ~ Poisson(a = 2 per hour).

 The probability of three beeps in the next hour:


p(3) = e–223/3! = 0.18
also, p(3) = F(3) – F(2) = 0.857 – 0.677 = 0.18

 The probability of two or more beeps in a 1-hour period:


p(2 or more) = 1 – p(0) – p(1)
= 1 – F(1)
= 0.594

116
Continuous Distributions
 Continuous random variables can be used to
describe random phenomena in which the
variable can take on any value in some interval.
 In this section, the distributions studied are:
 Uniform
 Exponential
 Normal
 Weibull
 Lognormal

117
Uniform Distribution [Continuous Dist’n]

 A random variable X is uniformly distributed on the


interval (a,b), denoted U(a,b), if its pdf and cdf are:
0, xa
 1 xa
 , a xb 
f ( x)   b  a F ( x)   , a xb
b  a
0, otherwise 
1, xb

 Properties
 P(x1 < X < x2) is proportional to the length of the interval:
F(x2) – F(x1) = (x2 – x1)/(b – a)
 E(X) = (a+b)/2 V(X) = (b – a)2/12
 U(0,1) provides the means to generate random numbers,
from which random variates can be generated.

118
Exponential Distribution [Continuous Dist’n]

 A random variable X is exponentially distributed with


parameter l > 0 if its pdf and cdf are:
e  x , x  0 0, x0
f ( x)   F ( x )   x  t
 0  e dt  1  e , x  0
x
0, elsewhere

 E(X) = 1/l V(X) = 1/l2

 Used to model interarrival times when arrivals are

completely random, and to model service times that are

highly variable

 For several different exponential pdf’s (see figure), the value

of intercept on the vertical axis is l, and all pdf’s eventually

intersect.

119
Exponential Distribution [Continuous Dist’n]

 Memoryless property
 For all s and t greater or equal to 0:
P(X > s + t | X > s) = P(X > t)

 Example: A lamp ~ exp(l = 1/3 per hour), hence, on


average, 1 failure per 3 hours.
 The probability that the lamp lasts longer than its mean life is:
P(X > 3) = 1-(1-e-3/3) = e-1 = 0.368
 The probability that the lamp lasts between 2 to 3 hours is:
P(2 <= X <= 3) = F(3) – F(2) = 0.145
 The probability that it lasts for another hour given it is
operating for 2.5 hours:
P(X > 3.5 | X > 2.5) = P(X > 1) = e-1/3 = 0.717

120
Normal Distribution [Continuous Dist’n]

 A random variable X is normally distributed if it has the


pdf:  2

1 1 x 
f ( x)  exp     ,   x  
 2 2
    

    
 Mean:
Variance:   0
2

 Denoted as X ~ N(m,s2)
 Special properties:
 lim x f ( x)  0, and lim x f ( x)  0.
 f(m – x) = f((m + x); the pdf is symmetric about m.
 The maximum value of the pdf occurs at x = m; the mean and
mode are equal.

121
Normal Distribution [Continuous Dist’n]

 Evaluating the distribution:


 Use numerical methods (no closed form)
 Independent of m and s, using the standard normal distribution:
Z ~ N(0,1)
 Transformation of variables: let Z = (X – m) / s,
F ( x)  P  X  x 
 x 
 PZ  
  
( x ) / 1  z2 / 2
 e dz

2
( x ) /
  ( z )dz


1 t 2 / 2
 
z
 x
 where ( z )   e dt

2 122
Normal Distribution [Continuous Dist’n]

 Example: The time required to load an oceangoing


vessel, X, is distributed as N(12,4)
 The probability that the vessel is loaded in less than 10 hours:
 10  12 
F (10)      (1)  0.1587
 2 
 Using the symmetry property, F(1) is the complement of F (-1)

123
Weibull Distribution [Continuous Dist’n]

 A random variable X has a Weibull distribution if its pdf has the form:
   x    1   x    

f ( x)     
exp    , x  
    
0, otherwise

 3 parameters:
 Location parameter: u, (    )
 Scale parameter: b , (b > 0)
 Shape parameter. a, (> 0)
 Example: u = 0 and a = 1:

When b = 1,

X ~ exp(l = 1/a)

124
Lognormal Distribution [Continuous Dist’n]

 A random variable X has a lognormal distribution if its pdf


has the form:
 1   ln x  μ  2  m=1, s2=0.5,1,2.
 exp   , x  0
f ( x)   2πσx  2 σ 2


0, otherwise
2
 Mean E(X) = em+s /2
2 2
 Variance V(X) = e2m+s (es - 1)

 Relationship with normal distribution


 When Y ~ N(m, s2), then X = eY ~ lognormal(m, s2)
 Parameters m and s2 are not the mean and variance of the
lognormal

125
Poisson Distribution
 Definition: N(t) is a counting function that represents
the number of events occurred in [0,t].
 A counting process {N(t), t ≥ 0} is a Poisson process
with mean rate l if:
 Arrivals occur one at a time
 {N(t), t ≥ 0} has stationary increments
 {N(t), t ≥ 0} has independent increments
 Properties
e  t ( t ) n
P[ N (t )  n]  , for t  0 and n  0,1,2,...
n!
 Equal mean and variance: E[N(t)] = V[N(t)] = lt
 Stationary increment: The number of arrivals between time s
and time t > s is also Poisson-distributed with mean l(t – s)

126
Interarrival Times [Poisson Dist’n]

 Consider the interarrival times of a Possion process (A1, A2, …),


where Ai is the elapsed time between arrival i and arrival i+1

 The 1st arrival occurs after time t iff there are no arrivals in the interval
[0,t], hence:
P{A1 > t} = P{N(t) = 0} = e-lt
P{A1 ≤ t} = 1 – e-lt [cdf of exp(l)]
 Interarrival times, A1, A2, …, are exponentially distributed and
independent with mean 1/l

Arrival counts ~ Interarrival time ~ Exp(1/l)

Poisson(l)

Stationary & Independent Memoryless

127
Splitting and Pooling [Poisson Dist’n]

 Splitting:
 Suppose each event of a Poisson process can be classified as
Type I, with probability p and Type II, with probability 1-p.
 N(t) = N1(t) + N2(t), where N1(t) and N2(t) are both Poisson
processes with rates l p and l (1-p)
lp N1(t) ~ Poi[lp]

l
N(t) ~ Poi(l)

N2(t) ~ Poi[l(1-p)]
l(1-p)

 Pooling:
 Suppose two Poisson processes are pooled together
 N1(t) + N2(t) = N(t), where N(t) is a Poisson processes with
rates l1 + l2 l
N1(t) ~ Poi[l ]
1 1 l +l
1 2
N(t) ~ Poi(l + l )
1 2

N2(t) ~ Poi[l ] l
2 2
128
Nonstationary Poisson
Process (NSPP) [Poisson Dist’n]

 Poisson Process without the stationary increments, characterized by


l(t), the arrival rate at time t.
 The expected number of arrivals by time t, L(t):
t
Λ(t)   λ(s)ds
0

 Relating stationary Poisson process n(t) with rate l=1 and NSPP N(t)
with rate l(t):
 Let arrival times of a stationary process with rate l = 1 be t1, t2, …,
and arrival times of a NSPP with rate l(t) be T1, T2, …, we know:
ti = L(Ti)
Ti = L-1(ti)

129
Nonstationary Poisson
Process (NSPP) [Poisson Dist’n]
 Example: Suppose arrivals to a Post Office have rates 2 per minute
from 8 am until 12 pm, and then 0.5 per minute until 4 pm.
 Let t = 0 correspond to 8 am, NSPP N(t) has rate function:
2, 0t 4
 (t )  
0.5, 4  t  8
Expected number of arrivals by time t:
2t , 0t4

 (t )   4 t t
 0 2 ds  4 0.5ds 
2
 6, 4  t  8

 Hence, the probability distribution of the number of arrivals between


11 am and 2 pm.
P[N(6) – N(3) = k] = P[N(L(6)) – N(L(3)) = k]
= P[N(9) – N(6) = k]
= e(9-6)(9-6)k/k!
= e3(3)k/k!

130
Empirical Distributions [Poisson Dist’n]

 A distribution whose parameters are the observed values


in a sample of data.
 May be used when it is impossible or unnecessary to establish that
a random variable has any particular parametric distribution.
 Advantage: no assumption beyond the observed values in the
sample.
 Disadvantage: sample might not cover the entire range of possible
values.

131
Summary
 The world that the simulation analyst sees is probabilistic,
not deterministic.
 In this chapter:
 Reviewed several important probability distributions.
 Showed applications of the probability distributions in a simulation
context.
 Important task in simulation modeling is the collection and
analysis of input data, e.g., hypothesize a distributional
form for the input data. Reader should know:
 Difference between discrete, continuous, and empirical
distributions.
 Poisson process and its properties.

132
Thank You

133

You might also like