CONCURRENT SIMULATION: A TUTORIAL Christos G. Cassandras Dept. of Manufacturing Engineering Boston University Boston, MA 02215 [email protected] OUTLINE: • Scope of Concurrent Simulation • Modeling Foundations • The Sample Path Constructability Problem • The Time Warping Algorithm (TWA) Christos G. Cassandras CODES Lab. - Boston University SCOPE OF CONCURRENT SIMULATION Design Parameters SIMULATOR Performance Measures Operating Policies, Control Parameters CONVENTIONAL SIMULATION ANALYSIS • Repeatedly change parameters/operating policies • Test different conditions • Answer multiple WHAT IF questions Christos G. Cassandras CODES Lab. - Boston University SCOPE OF CONCURRENT SIMULATION CONTINUED Design Parameters SIMULATOR Operating Policies, Control Parameters Performance Measures CONCURRENCY ENGINE WHAT IF… • Parameter p1 = a were replaced by p1 = b • Parameter p2 = c were replaced by p2 = d Performance Measures under all WHAT IF Questions ANSWERS TO MULTIPLE “WHAT IF” QUESTIONS AUTOMATICALLY PROVIDED Christos G. Cassandras CODES Lab. - Boston University SCOPE OF CONCURRENT SIMULATION CONTINUED TYPICAL OPTIMIZATION PROCESS FOR COMPLEX SYSTEMS: Repeated Trial and Error SIMULATE SYSTEM ESTIMATE PERFORMANCE CHOOSE NEW POINT SIMULATE SYSTEM ESTIMATE PERFORMANCE CHOOSE NEW POINT etc…etc…etc Christos G. Cassandras CODES Lab. - Boston University SCOPE OF CONCURRENT SIMULATION CONTINUED Estimate performance over many points from simulation at a single point SIMULATE SYSTEM CONCURRENT SIMULATION ESTIMATE PERFORMANCE CHOOSE NEW POINT SIMULATE SYSTEM CONCURRENT SIMULATION ESTIMATE PERFORMANCE CHOOSE NEW POINT Christos G. Cassandras CODES Lab. - Boston University TERMINOLOGY: IMPORTANT DISTINCTIONS 1. BRUTE-FORCE SIMULATION: sequentially simulate a system N times -- each time under a different setting 1 processor N runs N input-output data 2. PARALLEL/DISTRIBUTED SIMULATION: distribute simulation code over N processors or a network of N workstations N processors 1 run 1 input-output data 3. CONCURRENT SIMULATION: use data from simulation of one system to concurrently simulate the system under N different settings 1 processor Christos G. Cassandras 1 run N input-output data CODES Lab. - Boston University TERMINOLOGY: IMPORTANT DISTINCTIONS CONTINUED 1. CONCURRENT SIMULATION in SEQUENTIAL COMPUTER PROCESSING • Sequential processing, N simulation threads unfolding in parallel • Main benefit: Sharing of data and some data structures 2. CONCURRENT SIMULATION in PARALLEL COMPUTER PROCESSING • One processor for each simulation thread • Additional benefit: All state updates parallelized Christos G. Cassandras CODES Lab. - Boston University BACKGROUND: PERTURBATION ANALYSIS “Brute Force” Sensitivity Estimation: q DES q+Dq DES J q J q + Dq ] J( q + Dq ) J( q ) dJ Dq dq est Finite Perturbation Analysis (FPA): q q+Dq DES J q J q + Dq FPA ] J( q + Dq ) J( q ) dJ Dq dq est Infinitesimal or Smoothed Perturbation Analysis (IPA, SPA): q DES IPA/SPA Christos G. Cassandras J q dJ dq est CODES Lab. - Boston University MODELING FOUNDATIONS DISCRETE EVENT SIMULATION: The process of generating a sample path of a Stochastic Timed Automaton AUTOMATON: (E, X, G, f, x0) E : Event Set X : State Space G(x) : Set of feasible or enabled events at state x f:X E X f : State Transition Function (undefined for events e G x ) x0 : Initial State, x0 X e1 ,e2 , Christos G. Cassandras f x ,e x' x1 , x2 , CODES Lab. - Boston University TIMED AUTOMATON Add a Clock Structure V to the Automaton: (E, X, G, f, x0 , V) where: V vi : i E and vi is a Clock or Lifetime Sequence: vi vi1 , vi 2 , one for each event i v1 ,v2 , f x , e' x' x1 , x2 , NEXT EVENT Need an internal mechanism to determine NEXT EVENT e’ and hence NEXT STATE x' f x ,e' Christos G. Cassandras CODES Lab. - Boston University HOW THE TIMED AUTOMATON WORKS... CURRENT STATE xX with feasible event set: G(x) CURRENT EVENT e that caused transition into x CURRENT EVENT TIME t associated with e Associate a CLOCK VALUE/RESIDUAL LIFETIME yi with each feasible event i G x Christos G. Cassandras CODES Lab. - Boston University HOW THE TIMED AUTOMATON WORKS... CONTINUED NEXT/TRIGGERING EVENT e’ : e' arg min yi i G x NEXT EVENT TIME t’ : t' t + y * where: y* min yi i G x NEXT STATE x’ : x' f x ,e' Christos G. Cassandras CODES Lab. - Boston University HOW THE TIMED AUTOMATON WORKS... CONTINUED Detemine new CLOCK VALUES yi for every event i G x y y * i G x , i G x , i e i yi vij i G x G x e 0 otherwise where: vij new lifetime for event i Christos G. Cassandras CODES Lab. - Boston University TIMED AUTOMATON - AN EXAMPLE QUEUE SERVER Customer Arrivals Customer Departures E a ,d , X 0,1,2 , G x a ,d , G 0 a for all x 0 x + 1 e a f x ,e x 1 e d , x 0 Given input: va va1 ,va 2 ,, vd vd 1 ,vd 2 , Christos G. Cassandras CODES Lab. - Boston University TIMED AUTOMATON - AN EXAMPLE CONTINUED A Typical Sample Path... e1 = a x0 = 0 e2 = a x0 = 1 t0 t1 e3 = a x0 = 2 e4 = d x0 = 3 t2 t3 x0 = 2 t4 a a d a d a d Christos G. Cassandras CODES Lab. - Boston University STOCHASTIC TIMED 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 THEORETICAL FOUNDATIONS THE CONSTRUCTABILITY PROBLEM: Consider a Discrete Event System (DES) operating under parameter settings u1 , , um • INPUT: w = all event lifetimes u1 = a parameter setting • OUTPUT: observed sample path e ,t under u 1 1 k k 1 • PROBLEM: Construct sample paths under all based only on The input w 1 1 The observed sample path e k ,t k u2 ,,um Observed state history Christos G. Cassandras CODES Lab. - Boston University CONSTRUCTABILITY PROBLEM w u1 u2 um Christos G. Cassandras DES DES e1k ,t k1 DES ek2 ,t k2 ekm ,t km CODES Lab. - Boston University CONSTRUCTABILITY PROBLEM CONTINUED • OBSERVABILITY: j j A sample path ek ,t k is observable with respect to ek ,tk if G G x for all k = 0,1,... j xk k j INTERPRETATION: For every state x k visited in the constructed sample path, all feasible events i G are also feasible in the corresponding j xk observed state xk Ref: Cassandras and Strickland, 1989 Christos G. Cassandras CODES Lab. - Boston University CONSTRUCTABILITY PROBLEM CONTINUED Define the conditional cdf of an event clock given the event age: H t , zi P yi t zi AGE CLOCK zi yi t • CONSTRUCTABILITY: j j A sample path ek ,t k is constructable with respect to ek ,tk if G xk G xk for all k = 0,1,... j AND j • H j t , zi ,k H j t , zi ,k Christos G. Cassandras for all i G xk , k 0,1, j CODES Lab. - Boston University CONSTRUCTABILITY PROBLEM 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 Theorem: G xkj G xk for all k 0,1, CONSTRUCTABILITY Christos G. Cassandras CODES Lab. - Boston University CONSTRUCTABILITY: AN EXAMPLE A simple design/optimization problem a ADMISSION CONTROL d 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 Christos G. Cassandras CODES Lab. - Boston University CONSTRUCTABILITY: AN EXAMPLE a a a 1 0 d d a a 0 d PERTURBED SYSTEM K=2 a 2 1 d NOMINAL SYSTEM K=3 a 3 2 CONTINUED d AUGMENTED SYSTEM: Check for OBSERVABILITY d 00 10 a a d d 21 11 a a d Christos G. Cassandras 22 d a a 32 CODES Lab. - Boston University CONSTRUCTABILITY: AN EXAMPLE CONTINUED G 0 a G 1 a ,d d 00 10 a a d d 21 11 a a d 22 d a a 32 OBSERVABILITY satisfied! However, if roles of NOMINAL and PERTURBED are reversed, then OBSERVABILITY is not satisfied... Christos G. Cassandras CODES Lab. - Boston University SOLVING THE CONSTRUCTABILITY PROBLEM • 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 Ref: Vakili, 1991 • AUGMENTED SYSTEM ANALYSIS (ASA) for systems with at most one non-Markovian event Ref: Cassandras and Strickland, 1989 • The TIME WARPING ALGORITHM (TWA) for arbitrary systems Ref: Cassandras and Panayiotou, 1996 Christos G. Cassandras CODES Lab. - Boston University CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS MAIN IDEA: MAXIMAL SAMPLE PATH COUPLING • Observe event in a sample path under setting q0 • Save the lifetime of this event • Wait until ALL sample paths constructed under q2,…, qM have used the lifetime at the right time EXAMPLE: Queueing System with capacity K Observed sample path: K=2 3 2 A D 1 3 Constructed sample path: K=3 2 1 D Christos G. Cassandras A CODES Lab. - Boston University CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS CONTINUED • OBSERVED event sequence under q0 after n events: ( n ) e j : j 1, , n • CONSTRUCTED event sequence under any q q0 after k events: ( k ) e j : j 1, , k Define the SCORE of event i after n total events: sin number of occurrences of event i after n total events Christos G. Cassandras CODES Lab. - Boston University CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS CONTINUED • Lifetime sequence of event i on OBSERVED sample path: Vi n vi 1 , , vi sin • Lifetime sequence of event i on CONSTRUCTED sample path: , k v 1 , , v s k V i i i i k n • A subsequence of Vi(n): ~ Vi n , k vi sik + 1, , vi sin LIFETIMES ALREADY OBSERVED, BUT NOT YET USED IN CONSTRUCTED PATH Christos G. Cassandras CODES Lab. - Boston University CONCURRENT SIMULATION FOR ARBITRARY SYSTEMS CONTINUED • AVAILABLE Event Set: An, k i : i E , sin sik EVENTS ALREADY OBSERVED IN n) WITH LIFETIMES YET UNUSED IN CONSTRUCTED SAMPLE PATH • MISSING Event Set: M n, k G xk G xk 1 ek EVENTS NEEDED TO CONTINUE CONSTRUCTION EVENTS AVAILABLE FROM LAST STATE TRANSITION NOTE: Constructed sample path is ACTIVE as long as MISSING Event Set is contained in AVAILABLE Event Set Christos G. Cassandras CODES Lab. - Boston University CONCURRENT SIMULATION: STEP 1 CONTINUED When event en+1 is observed: 1. Store observed event lifetime: ~ Vi n , k + vi sin + 1 ~ Vi n + 1, k ~ V i n , k if i en+1 otherwise 2. Add event to AVAILABLE Event Set: An + 1, k An , k en+1 3. No change to MISSING Event Set: M n + 1, k M n, k 4. Check if constructed sample path is ACTIVE: M n + 1, k An + 1, k Christos G. Cassandras CODES Lab. - Boston University CONCURRENT SIMULATION: STEP 2 CONTINUED If constructed sample path is ACTIVE: 1. Discard “used up” observed event lifetime: ~ Vi n + 1, k vi sik ~ Vi n + 1, k + 1 ~ V i n + 1, k if i M n + 1, k otherwise 2. Delete from AVAILABLE Event Set: An + 1, k + 1 An + 1, k i : i M n + 1, k , sik +1 sin+1 3. Update MISSING Event Set: M n + 1, k + 1 G xk +1 G xk ek +1 4. Check if constructed sample path is still ACTIVE: M n + 1, k + 1 An + 1, k + 1 Christos G. Cassandras CODES Lab. - Boston University TIME WARPING ALGORITHM (TWA) Observe event en+1 and check ACTIVE condition: M n + 1, k An + 1, k If ACTIVE condition holds, then “Time Warp”: • Construct desired state trajectory for events j = k, k+1,… as long as: M n + 1, j + 1 An + 1, j + 1 • When ACTIVE condition no longer satisfied, wait for next observed event and repeat n Observed sample path k Constructed sample path Christos G. Cassandras k+1 ... CODES Lab. - Boston University TWA PERFORMANCE: SPEEDUP FACTORS TN0 Simulation time for OBSERVED sample path (N events) TN0 + K Simulation time for OBSERVED sample path (N events) + TWA for CONSTRUCTED sample path (K events) TN Simulation time for CONSTRUCTED sample path (N events) SPEEDUP FACTOR: TN / N S K / K 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 Christos G. Cassandras CODES Lab. - Boston University TWA PERFORMANCE: SPEEDUP FACTORS CONTINUED TYPICAL NUMERICAL RESULTS: • For simple event lifetime distributions: S ~ 2 • For complex event lifetime distributions: S > 20 Ref: Cassandras and Panayiotou, 1996 The TWA is particularly efficient for the class of systems that satisfy the following REGULARITY condition: k G xk G xk 1 NUMBER OF NEW EVENTS TRIGGERED WHEN AN EVENT TAKES PLACE max k , k 1,2 , k REGULARITY: 1 NOTE: A surprisingly large class of systems satisfies the REGULARITY condition... Christos G. Cassandras CODES Lab. - Boston University ACKNOWLEDGEMENTS: NSF, AFOSR, ARPA, NRL, United Technologies, Rome Lab ( Al Sisti) Copies of these slides can be obtained by request and will be made available on the w http://cad.bu.edu/cgc THE END
© Copyright 2026 Paperzz