+ All Categories
Home > Documents > AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or...

AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or...

Date post: 26-Aug-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
47
AN INTRODUCTION TO DISCRETE-EVENT SIMULATION Peter W. Glynn 1 Peter J. Haas 2 1 Dept. of Management Science and Engineering Stanford University 2 IBM Almaden Research Center San Jose, CA IMA Workshop, May 12, 2008
Transcript
Page 1: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

AN INTRODUCTION TODISCRETE-EVENT SIMULATION

Peter W. Glynn1 Peter J. Haas2

1Dept. of Management Science and EngineeringStanford University

2IBM Almaden Research CenterSan Jose, CA

IMA Workshop, May 12, 2008

Page 2: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

CAVEAT: WE ARE NOT BIOLOGISTS OR CHEMISTS!

Page 3: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Outline

I Overview of discrete-event simulationI Basic models for discrete-event stochastic systems

I Generalized semi-Markov processes (GSMPs)I Continuous-time Markov chains (CTMCs)I Stochastic Petri nets (SPNs)

I Some important techniques for simulationI Efficiency improvementI Sensitivity estimationI Parallel simulation

Glynn and Haas3 IMA Workshop, May 12, 2008

Page 4: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Part I

Overview

Glynn and Haas4 IMA Workshop, May 12, 2008

Page 5: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Discrete-Event Stochastic Systems

I Finite or countably infinite set of statesI System changes state when events occur

I Stochastic state changesI At strictly increasing random times

I Underlying stochastic process {X (t) : t ≥ 0 }I X (t) = state of system at time t (a random variable)

I Ex: Xi (t) = # molecules of ith species at time t

Glynn and Haas5 IMA Workshop, May 12, 2008

Page 6: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Simulation: A Tool for Studying DESS Characteristics

I Characteristics often of the form α = E [Y ]I Y = f

(X (t)

), e.g., Y = I (X (t) = x)

I Y = (1/t)∫ t

0f(X (u)

)du

I Y = min{ t > 0: X (t) ∈ A }

Glynn and Haas6 IMA Workshop, May 12, 2008

Page 7: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Characteristics

I Nonlinear functions of means: g(α1, α2, . . . , αk)I Apply Delta Method, jackknifing, bootstrapping, etc.

I Steady-state characteristicsI Time-average limits:

α = limt→∞

1

t

∫ t

0

f(X (u)

)du

I Steady-state means:

α = E [f (X )], where X (t)⇒ X

I Apply regenerative method, batch means, STS methods, etc.I Key issues of stability and validity

I For more details: buy us a beer

Glynn and Haas7 IMA Workshop, May 12, 2008

Page 8: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Part II

Models for Discrete-Event Systems

Glynn and Haas8 IMA Workshop, May 12, 2008

Page 9: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Generalized Semi-Markov Processes

I Classical model for discrete-event stochastic systemsI Building blocks

I S = set of states (finite or countably infinite)I E = set of events (finite)I E (s) = active events in state sI p(s ′; s, e∗) = state-transition probability

I One clock per event: records remaining time until occurrence

Glynn and Haas9 IMA Workshop, May 12, 2008

Page 10: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Clocks (Event Scheduling)

I Active events compete to trigger state transitionI The clock that runs down to 0 first is the “winner”I Can have simultaneous event occurrence: p(s ′; s,E∗)

I At a state transition se∗→ s ′: three kinds of events

I New events: Clock for e′ set according to F (x ; s ′, e′, s, e∗)I Old events: Clocks continue to run downI Cancelled events: Clock readings are discarded

I Clocks run down at state-dependent speeds r(s, e)

Glynn and Haas10 IMA Workshop, May 12, 2008

Page 11: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

The GSMP Process

I The continuous-time process: {X (t) : t ≥ 0 }I X (t) = the state at time tI A very complicated process

I Defined in terms of Markov chain { (Sn,Cn) : n ≥ 0 }I System observed after the nth state transitionI Sn = the stateI Cn = (Cn,1, . . . ,Cn,M) = the clock-reading vectorI Chain defined via GSMP building blocks

Glynn and Haas11 IMA Workshop, May 12, 2008

Page 12: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Definition of the GSMP

Glynn and Haas12 IMA Workshop, May 12, 2008

Page 13: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Generation of the GSSMC { (Sn, Cn) : n ≥ 0 }

1. [Initialization] Set n = 0. Generate state S0 and clockreadings C0,i for ei ∈ E (S0); set C0,i = −1 for ei 6∈ E (S0).

2. Determine holding time t∗(Sn,Cn) and trigger event e∗n .

3. Generate new state Sn+1 according to p( · ;Sn, e∗n).

4. Set clock-reading Cn+1,i for each new event ei according toF ( · ;Sn+1, ei ,Sn, e

∗n).

5. Set clock-reading Cn+1,i for each old event ei asCn+1,i = Cn,i − t∗(Sn,Cn)r(Sn, ei ).

6. Set clock-reading Cn+1,i equal to −1 for each cancelled eventei .

7. Set n← n + 1 and go to Step 2.

Can compute GSMP {X (t) : t ≥ 0 } from GSSMC

Glynn and Haas13 IMA Workshop, May 12, 2008

Page 14: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Implementation Considerations for Large-Scale GSMPs

I Use event lists (e.g., heaps) to determine e∗

I O(1) computation of e∗

I O(log m

)update time, where m = # of active events

Glynn and Haas14 IMA Workshop, May 12, 2008

Page 15: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Continuous-Time Markov Chains

I Time-homogeneous Markov property:

P{

X (t + h) = s ′ | X (t) = s,X (u) = x(u) for 0 ≤ u < t}

= P{

X (t + h) = s ′ | X (t) = s}

= ph(s, s′)

I CTMC specified by intensity matrix Q

Q(s, s ′) = limh↓0

ph(s, s′)

h, s 6= s ′

Q(s, s) = −∑s′ 6=s

Q(s, s ′)

I Define state intensity q(s) = −Q(s, s) =∑

s′ 6=s Q(s, s ′)

Glynn and Haas15 IMA Workshop, May 12, 2008

Page 16: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Simulating a CTMC (Gillespie Algorithm)

I Thm (path structure of a CTMC):I Sequence of visited states is a DTMCI Given states, holding times are indep. and exponential

1. [Initialization] Set n = 0. Generate state S0.

2. Generate holding time t∗(Sn) as Exponential(q(Sn)

).

3. Generate next state Sn+1 (6= Sn) according to Q(Sn, · )/q(Sn).

4. Set n← n + 1 and go to Step 2.

I A CTMC can be viewed as a GSMP with one exponentialclock!

Glynn and Haas16 IMA Workshop, May 12, 2008

Page 17: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

CTMCs and GSMPs

I Theorem: Let {X (t) : t ≥ 0 } be a GSMP such that

F (x ; s ′, e ′, s, e∗) ≡ 1− e−λ(e′)x for each e ′

Then {X (t) : t ≥ 0 } is a CTMC with intensity matrix

Q(s, s ′) =∑

e∈E(s)

λ(e)r(s, e)p(s ′; s, e), s ′ 6= s

I Under conditions of theorem, GSMP simulation algorithm cansimplify to CTMC algorithm!

I OR can simulate CTMC using one exponential clock per eventI GSMPs with unit exponential clocks and time-varying speeds

I Glasserman (1991, Ch. 6): hazard-rate constructionI Anderson (2007): application to chemical reaction systems

Glynn and Haas17 IMA Workshop, May 12, 2008

Page 18: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Stochastic Petri Nets

I D = finite set of places

I E = finite set of transitions (timed and immediate)

I marking = assignment of token counts to places

Glynn and Haas18 IMA Workshop, May 12, 2008

Page 19: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Stochastic Petri Nets

I D = finite set of places

I E = finite set of transitions (timed and immediate)

I marking = assignment of token counts to places

Glynn and Haas18 IMA Workshop, May 12, 2008

Page 20: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Stochastic Petri Nets

I D = finite set of places

I E = finite set of transitions (timed and immediate)

I marking = assignment of token counts to places

Glynn and Haas18 IMA Workshop, May 12, 2008

Page 21: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Stochastic Petri Nets

I D = finite set of places

I E = finite set of transitions (timed and immediate)

I marking = assignment of token counts to places

Glynn and Haas18 IMA Workshop, May 12, 2008

Page 22: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Stochastic Petri Nets

I D = finite set of places

I E = finite set of transitions (timed and immediate)

I marking = assignment of token counts to places

Glynn and Haas18 IMA Workshop, May 12, 2008

Page 23: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Stochastic Petri Nets

s = (2, 1, 1)

d1 d2

d3

I D = finite set of places

I E = finite set of transitions (timed and immediate)

I marking = assignment of token counts to places

Glynn and Haas18 IMA Workshop, May 12, 2008

Page 24: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Transition Firing

I The marking changes when an enabled transition fires

I Removes 1 token per place from random subset of input places

I Deposits 1 token per place in random subset of output places

Glynn and Haas19 IMA Workshop, May 12, 2008

Page 25: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Transition Firing

I The marking changes when an enabled transition fires

I Removes 1 token per place from random subset of input places

I Deposits 1 token per place in random subset of output places

Glynn and Haas19 IMA Workshop, May 12, 2008

Page 26: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Transition Firing

I The marking changes when an enabled transition fires

I Removes 1 token per place from random subset of input places

I Deposits 1 token per place in random subset of output places

Glynn and Haas19 IMA Workshop, May 12, 2008

Page 27: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Transition Firing

I The marking changes when an enabled transition fires

I Removes 1 token per place from random subset of input places

I Deposits 1 token per place in random subset of output places

Glynn and Haas19 IMA Workshop, May 12, 2008

Page 28: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Transition Firing

I The marking changes when an enabled transition fires

I Removes 1 token per place from random subset of input places

I Deposits 1 token per place in random subset of output places

Glynn and Haas19 IMA Workshop, May 12, 2008

Page 29: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Transition Firing

I The marking changes when an enabled transition fires

I Removes 1 token per place from random subset of input places

I Deposits 1 token per place in random subset of output places

Glynn and Haas19 IMA Workshop, May 12, 2008

Page 30: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Transition Firing

p(s ′; s, e∗)

I The marking changes when an enabled transition fires

I Removes 1 token per place from random subset of input places

I Deposits 1 token per place in random subset of output places

Glynn and Haas19 IMA Workshop, May 12, 2008

Page 31: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

SPNs and GSMPs

I SPN marking = GSMP state

I SPN transition firing = GSMP event occurrenceI Differences

I SPN has specific form of stateI SPN has restrictions on allowable state transitionsI SPN has immediate transitions

I SPN and GSMP have same modeling power

Glynn and Haas20 IMA Workshop, May 12, 2008

Page 32: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Bottom-Up and Top-Down Modeling

Glynn and Haas21 IMA Workshop, May 12, 2008

Page 33: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Bottom-Up and Top-Down Modeling

Glynn and Haas21 IMA Workshop, May 12, 2008

Page 34: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Bottom-Up and Top-Down Modeling

Glynn and Haas21 IMA Workshop, May 12, 2008

Page 35: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Bottom-Up and Top-Down Modeling

Glynn and Haas21 IMA Workshop, May 12, 2008

Page 36: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Bottom-Up and Top-Down Modeling

Glynn and Haas21 IMA Workshop, May 12, 2008

Page 37: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Bottom-Up and Top-Down Modeling

Glynn and Haas21 IMA Workshop, May 12, 2008

Page 38: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 39: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Concurrency:

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 40: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Concurrency: Synchronization:

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 41: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Concurrency: Synchronization:Synchronization:

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 42: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Concurrency: Synchronization:Synchronization:

Precedence:

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 43: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Concurrency: Synchronization:Synchronization:

Precedence:Precedence:

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 44: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Concurrency: Synchronization:Synchronization:

Precedence:Precedence:Precedence:

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 45: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Other Modeling Features

Concurrency: Synchronization:Synchronization:

Precedence:Precedence:Precedence: Priority:

Glynn and Haas22 IMA Workshop, May 12, 2008

Page 46: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

Implementation Advantages for Large-Scale SPNs

I Updating the state is often simpler in an SPN than a GSMPI Efficient techniques for event scheduling [Chiola91]

I Encode transitions potentially affected by firing of ei

I Parallel simulation of subnetsI E.g., Adaptive Time Warp [Ferscha & Richter PNPM97]I Guardedly optimisticI Slows down local firings based on history of rollbacks

Glynn and Haas23 IMA Workshop, May 12, 2008

Page 47: AN INTRODUCTION TO DISCRETE-EVENT SIMULATION · Discrete-Event Stochastic Systems I Finite or countably infinite set of states I System changes state when events occur I Stochastic

For Further Details:

I Asmussen and Glynn: Stochastic Simulation: Algorithms andAnalysis, Springer, 2007

I MS-level lecture notes:http://eeclass.stanford.edu/msande223/

I Haas: Stochastic Petri Nets: Modelling, Stability, Simulation,Springer, 2002

Glynn and Haas24 IMA Workshop, May 12, 2008


Recommended