concurrent simulation: a tutorial christos g. cassandras dept. of manufacturing engineering boston...
TRANSCRIPT
CONCURRENT SIMULATION:A TUTORIAL
Christos G. Cassandras
Dept. of Manufacturing EngineeringBoston UniversityBoston, MA 02215
• Scope of Concurrent Simulation
• Modeling Foundations
• The Sample Path Constructability Problem
• The Time Warping Algorithm (TWA)
Christos G. Cassandras CODES Lab. - Boston University
OUTLINE:
SCOPE OFCONCURRENT SIMULATION
SIMULATOR
DesignParameters
DesignParameters
Operating Policies,Control Parameters
Operating Policies,Control Parameters
PerformanceMeasures
PerformanceMeasures
Christos G. Cassandras CODES Lab. - Boston University
CONVENTIONAL SIMULATION ANALYSIS
• Repeatedly change parameters/operating policies
• Test different conditions
• Answer multiple WHAT IF questions
SCOPE OFCONCURRENT SIMULATION
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
SIMULATOR
DesignParameters
DesignParameters
PerformanceMeasures
PerformanceMeasures
Operating Policies,Control Parameters
Operating Policies,Control Parameters
CONCURRENCYENGINE
WHAT IF…• Parameter p1 = a were replaced by p1 = b• Parameter p2 = c were replaced by p2 = d
WHAT IF…• Parameter p1 = a were replaced by p1 = b• Parameter p2 = c were replaced by p2 = d
PerformanceMeasuresunder allWHAT IFQuestions
PerformanceMeasuresunder allWHAT IFQuestions
ANSWERS TO MULTIPLE “WHAT IF”QUESTIONS AUTOMATICALLY PROVIDED
SCOPE OFCONCURRENT SIMULATION
TYPICAL OPTIMIZATION PROCESS FOR COMPLEX SYSTEMS: Repeated Trial and Error
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
SEARCH SPACE
SIMULATE SYSTEM
ESTIMATEPERFORMANCE
CHOOSE NEW POINT
SIMULATE SYSTEM
CHOOSE NEW POINT
ESTIMATEPERFORMANCE
etc…etc…etc
SIMULATE SYSTEM
SCOPE OFCONCURRENT SIMULATION
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
ESTIMATEPERFORMANCE
Estimate performance over many points from simulation at a single point
CONCURRENTSIMULATION
CHOOSE NEW POINT
SEARCH SPACE
SIMULATE SYSTEM
ESTIMATEPERFORMANCE
CONCURRENTSIMULATION
CHOOSE NEW POINT
RAPID
LEARNI
NG
TERMINOLOGY:IMPORTANT DISTINCTIONS1. BRUTE-FORCE SIMULATION:
sequentially simulate a system N times-- each time under a different setting
2. PARALLEL/DISTRIBUTED SIMULATION:
distribute simulation code over N processorsor a network of N workstations
3. CONCURRENT SIMULATION:
use data from simulation of one system toconcurrently simulate the system underN different settings
Christos G. Cassandras CODES Lab. - Boston University
1 processor N runs N input-output data
N processors 1 run 1 input-output data
1 processor 1 run N input-output data
TERMINOLOGY:IMPORTANT DISTINCTIONS
Christos G. Cassandras CODES Lab. - Boston University
1. CONCURRENT SIMULATION in SEQUENTIAL COMPUTER PROCESSING
• Sequential processing, N simulation threads unfolding in parallel• Main benefit: Sharing of data and some data structures
CONTINUED
2. CONCURRENT SIMULATION in PARALLEL COMPUTER PROCESSING
• One processor for each simulation thread
• Additional benefit: All state updates parallelized
BACKGROUND: PERTURBATION ANALYSIS
Christos G. Cassandras CODES Lab. - Boston University
“Brute Force” Sensitivity Estimation:
J DES
DES J ]
dJ
d
J J
est
( ) ( )
Finite Perturbation Analysis (FPA):
J
J ]DES
dJ
d
J J
est
( ) ( )
FPAFPA
Infinitesimal or Smoothed Perturbation Analysis(IPA, SPA):
J DES
IPA/SPAIPA/SPAdJ
d est
MODELING FOUNDATIONS
Christos G. Cassandras CODES Lab. - Boston University
DISCRETE EVENT SIMULATION:
The process of generating a sample path of a Stochastic Timed Automaton
AUTOMATON: (E, X, , f, x0)
: Event Set
X: State Space
(x) : Set of feasible or enabled events at
state x
f : State Transition Function (undefined for events )
x0 : Initial State,
f X E X: e x
x X0
e e1 2, , x x1 2, , f x e x, '
TIMED AUTOMATON
Christos G. Cassandras CODES Lab. - Boston University
Add a Clock Structure V to the Automaton: (E, X, , f, x0 , V)
where:
and vi is a Clock or Lifetime Sequence:
one for each event i
V v i i E :
vi i iv v 1 2, ,
v v1 2, , x x1 2, , f x e x, ' '
NEXT EVENT
Need an internal mechanism to determine
NEXT EVENT e’ and hence
NEXT STATE
Need an internal mechanism to determine
NEXT EVENT e’ and hence
NEXT STATE x f x e' , '
HOW THE TIMED AUTOMATON WORKS...
Christos G. Cassandras CODES Lab. - Boston University
CURRENT STATExX with feasible event set: (x)
CURRENT EVENTe that caused transition into x
CURRENT EVENT TIMEt associated with e
Associate a
CLOCK VALUE/RESIDUAL LIFETIME yi
with each feasible event i x
HOW THE TIMED AUTOMATON WORKS...
Christos G. Cassandras CODES Lab. - Boston University
NEXT/TRIGGERING EVENT e’ :
e y
i xi' arg min
NEXT EVENT TIME t’ :
t t y
y yi x
i
' *
min
where: *
CONTINUED
NEXT STATE x’ :
x f x e' , '
HOW THE TIMED AUTOMATON WORKS...
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
Detemine new CLOCK VALUESfor every event i x
yi
y
y y i x i x i e
v i x x e
otherwise
v i
i
i
ij
ij
* , ,
where: new lifetime for event
0
TIMED AUTOMATON - AN EXAMPLE
Christos G. Cassandras CODES Lab. - Boston University
QUEUE SERVER
CustomerArrivals
CustomerDepartures
E a d X , , , , , 012
x a d x
a
, , for all 0
0
f x ex e a
x e d x,
,
1
1 0
Given input:
v va a a d d dv v v v 1 2 1 2, , , , ,
TIMED AUTOMATON - AN EXAMPLE
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
t0
x0 = 0
a
e1 = a
x0 = 1
t1
ad
e2 = a
x0 = 2
t2
ad
A Typical Sample Path...
e3 = a
x0 = 3
t3
ad
x0 = 2
e4 = d
t4
STOCHASTICTIMED AUTOMATON
• Same idea with the Clock Structure consisting of Stochastic Processes
• Associate with each event i a Lifetime Distribution based on which vi is generated
Generalized Semi-Markov Process(GSMP)
• In a simulator, vi is generated through a pseudorandom number generator
Christos G. Cassandras CODES Lab. - Boston University
THEORETICALFOUNDATIONS
Christos G. Cassandras CODES Lab. - Boston University
THE CONSTRUCTABILITY PROBLEM:
Consider a Discrete Event System (DES) operating under parameter settings u um1 , ,
e tu
k k
1 1
1
, observed sample path under
• INPUT: = all event lifetimes u1 = a parameter setting
• OUTPUT:
u um2 , ,• PROBLEM:
Construct sample paths under all based only on
e tk k
1 1,The input The observed sample path
Observed state history
CONSTRUCTABILITY PROBLEM
Christos G. Cassandras CODES Lab. - Boston University
DESDESu1
e tk k1 1,
DESDESu2 e tk k
2 2,
DESDESum e tk
mkm,
OBSERVED
CONSTRUCTED
CONSTRUCTABILITY PROBLEM
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
• OBSERVABILITY:
A sample path is observable with respect to
if
e tkj
kj
,
e tk k, x xkj
k for all k = 0,1,...
INTERPRETATION: For every state xkj
visited in the constructed sample path, all feasible
events are also feasible in the corresponding
observed state xk
i xkj
Ref: Cassandras and Strickland, 1989Ref: Cassandras and Strickland, 1989
CONSTRUCTABILITY PROBLEM
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
AGE CLOCK
zi yi
t
Define the conditional cdf of an event clock giventhe event age:
H t z P y t zi i i,
• CONSTRUCTABILITY:
A sample path is constructable with respect to
if
e tkj
kj
,
e tk k,
AND
•
x xkj
k for all k = 0,1,...
H t z H t z i x kji kj j
i k kj
, , , , ,, , for all 0 1
CONSTRUCTABILITY PROBLEM
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
Two simple cases of constructability:
Theorem: If all event processes are Markovian
(generated by Poisson processes), then
OBSERVABILITY CONSTRUCTABILITY
NOTE: Observability is a simple-to-check structural condition
NOTE: Observability is a simple-to-check structural condition
Theorem:
CONSTRUCTABILITY
x x kkj
k for all 0 1, ,
CONSTRUCTABILITY:AN EXAMPLE
Christos G. Cassandras CODES Lab. - Boston University
A simple design/optimization problem
ADMISSIONCONTROL
da
Reject if Queue Length > K
PROBLEM: • How does the system behave under different choices of K? • What is the optimal K?
CONCURRENT SIMULATION APPROACH:• Choose any K
• Simulate (or observe actual system) under K
• Apply Concurrent Simulation to LEARN effect of all other feasible K
CONSTRUCTABILITY:AN EXAMPLE
NOMINALSYSTEM
K = 3
NOMINALSYSTEM
K = 3
a a a
d d d
a
PERTURBEDSYSTEM
K = 2
PERTURBEDSYSTEM
K = 2
aa a
d d
AUGMENTED SYSTEM: Check for OBSERVABILITY
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
a
d
a
d
a
a
a
d
d a
d
CONSTRUCTABILITY:AN EXAMPLE
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
a
a
d
d
a
a
d
d a
a
d
0 1 a a d,
OBSERVABILITY satisfied!
However, if roles of NOMINAL and PERTURBED are reversed, then OBSERVABILITY is not satisfied...
SOLVING THECONSTRUCTABILITY PROBLEM
Christos G. Cassandras CODES Lab. - Boston University
• Constructability is not easily satisfied, in general
• However, the CONSTRUCTABILITY PROBLEM can be solved at some cost
SOLUTION METHODOLOGIES:
• STANDARD CLOCK (SC) methodology for Markovian systems
• AUGMENTED SYSTEM ANALYSIS (ASA) for systems with at most one non-Markovian event
• The TIME WARPING ALGORITHM (TWA) for arbitrary systems
Ref: Vakili, 1991Ref: Vakili, 1991
Ref: Cassandras and Strickland, 1989Ref: Cassandras and Strickland, 1989
Ref: Cassandras and Panayiotou, 1996Ref: Cassandras and Panayiotou, 1996
CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS MAIN IDEA: MAXIMAL SAMPLE PATH COUPLING
• Observe event in a sample path under setting 0
• Save the lifetime of this event
• Wait until ALL sample paths constructed under2,…, M have used the lifetime at the right time
EXAMPLE: Queueing System with capacity K
Observed sample path: K = 2
Constructed sample path: K = 3
1
2
3
1
2
3
A D
Christos G. Cassandras CODES Lab. - Boston University
DA
CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
• OBSERVED event sequence under 0 after n events:
( ) : , ,n e j nj 1
• CONSTRUCTED event sequence under any after k events:
0
( ) : , , k e j kj 1
Define the SCORE of event i after n total events:
s ini
n number of occurrences of event after total events
CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
• Lifetime sequence of event i on OBSERVED sample path:
Vi i i inn v v s 1 , ,
• Lifetime sequence of event i on CONSTRUCTED sample path:
, , ,Vi i i ikk v v s k n 1
• A subsequence of Vi(n):
~, , ,Vi i i
ki i
nn k v s v s 1
LIFETIMES ALREADY OBSERVED,BUT NOT YET USEDIN CONSTRUCTED PATH
CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
• AVAILABLE Event Set:
A n k i i E s sin
ik, : ,
EVENTS ALREADY OBSERVED
IN n) WITH LIFETIMES YET UNUSED
IN CONSTRUCTED SAMPLE PATH
• MISSING Event Set:
M n k x x ek k k, 1
EVENTS NEEDEDTO CONTINUE CONSTRUCTION
EVENTS AVAILABLEFROM LAST STATE TRANSITION
NOTE: Constructed sample path is ACTIVE as long as MISSING Event Set is contained in AVAILABLE Event Set
CONCURRENT SIMULATION: STEP 1
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
When event en+1 is observed:
1. Store observed event lifetime:
~,
~,~
,V
V
Vi
i i in
n
i
n kn k v s i e
n k
1
1 1if
otherwise
2. Add event to AVAILABLE Event Set:
A n k A n k en 1 1, ,
3. No change to MISSING Event Set:
M n k M n k 1, ,
4. Check if constructed sample path is ACTIVE:
M n k A n k 1 1, ,
CONCURRENT SIMULATION: STEP 2
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
If constructed sample path is ACTIVE:
1. Discard “used up” observed event lifetime:
~,
~, ,
~,
VV
Vi
i i ik
i
n kn k v s i M n k
n k
1 1
1 1
1
if
otherwise
2. Delete from AVAILABLE Event Set:
A n k A n k i i M n k s sik
in 1 1 1 1 1 1, , , , :
3. Update MISSING Event Set:
M n k x x ek k k 1 1 1 1,
4. Check if constructed sample path is still ACTIVE:
M n k A n k 1 1 1 1, ,
TIME WARPING ALGORITHM (TWA)
Observe event en+1 and check ACTIVE condition:
M n k A n k 1 1, ,
If ACTIVE condition holds, then “Time Warp”:
• Construct desired state trajectory for events j = k, k+1,… as long as:
M n j A n j 1 1 1 1, ,
• When ACTIVE condition no longer satisfied, wait for next observed event and repeat
Observed sample path
Constructed sample path
n
k
Christos G. Cassandras CODES Lab. - Boston University
k+1
TWA PERFORMANCE:SPEEDUP FACTORS
Christos G. Cassandras CODES Lab. - Boston University
Simulation time for OBSERVEDsample path (N events)
TN0
Simulation time for OBSERVEDsample path (N events)+ TWA for CONSTRUCTEDsample path (K events)
TN K0
Simulation time for CONSTRUCTEDsample path (N events)
TN
ST N
KN
K
/
/SPEEDUP FACTOR:
NOTE:
• In conventional simulation, every event processed is discarded from the Event List
• In Concurrent Simulation, the event is saved and discarded only at the right time
TWA PERFORMANCE:SPEEDUP FACTORS
Christos G. Cassandras CODES Lab. - Boston University
CONTINUED
TYPICAL NUMERICAL RESULTS:• For simple event lifetime distributions: S ~ 2• For complex event lifetime distributions: S > 20
Ref: Cassandras and Panayiotou, 1996Ref: Cassandras and Panayiotou, 1996
The TWA is particularly efficient for the class of systems that satisfy the following REGULARITYcondition:
k k k
kk
x x
k
max , , ,
1
1 2 NUMBER OF NEW EVENTSTRIGGERED WHEN AN EVENTTAKES PLACE
REGULARITY: 1
NOTE: A surprisingly large class of systems satisfies the REGULARITY condition...
THE ENDTHE END
ACKNOWLEDGEMENTS:
NSF, AFOSR, ARPA, NRL, United Technologies,Rome Lab ( Al Sisti)
Copies of these slides can be obtained byrequest and will be made available on the web:
http://cad.bu.edu/cgc