Next-Event Simulation

Similar documents
Section 5.2: Next Event Simulation Examples

Discrete-Event Simulation:

CHAPTER 5 NEXT-EVENT SIMULATION

Section 5.3: Event List Management

Discrete-Event Simulation: Multi-Stream Lehmer RNGs

CPSC 531: System Modeling and Simulation. Carey Williamson Department of Computer Science University of Calgary Fall 2017

Chapters 1, 2 & 3: A Brief Introduction. Barry L. Nelson Northwestern University July 2017

Queuing Systems. 1 Lecturer: Hawraa Sh. Modeling & Simulation- Lecture -4-21/10/2012

Precedence Graphs Revisited (Again)

B-Trees and External Memory

B-Trees and External Memory

Overview of the Simulation Process. CS1538: Introduction to Simulations

Dynamic Programming. Other Topics

CS301 - Data Structures Glossary By

Connection-Level Scheduling in Wireless Networks Using Only MAC-Layer Information

Discrete-event simulation

nalysis, Control, and Design of Stochastic Flow Systems Limited Storage

Discrete-Event Simulation: A First Course. Steve Park and Larry Leemis College of William and Mary

III Data Structures. Dynamic sets

Midterm Exam Amy Murphy 6 March 2002

Topic 4a Router Operation and Scheduling. Ch4: Network Layer: The Data Plane. Computer Networking: A Top Down Approach

1 P age DS & OOPS / UNIT II

Worst-case Ethernet Network Latency for Shaped Sources

Programming and Data Structures Prof. N.S. Narayanaswamy Department of Computer Science and Engineering Indian Institute of Technology, Madras

Scheduling Algorithms to Minimize Session Delays

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

A Study of the Performance Tradeoffs of a Tape Archive

Data Structure. IBPS SO (IT- Officer) Exam 2017

Advanced Algorithms and Data Structures

COMPUTER SIMULATION OF COMPLEX SYSTEMS USING AUTOMATA NETWORKS K. Ming Leung

Chapter 6: CPU Scheduling. Operating System Concepts 9 th Edition

SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM

2. The shared resource(s) in the dining philosophers problem is(are) a. forks. b. food. c. seats at a circular table.

6.852: Distributed Algorithms Fall, Class 21

Introduction to Queuing Systems

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

Performance Evaluation

6.1 Motivation. Fixed Priorities. 6.2 Context Switch. Real-time is about predictability, i.e. guarantees. Real-Time Systems

Implementing Scheduling Algorithms. Real-Time and Embedded Systems (M) Lecture 9

L5: Building Direct Link Networks III. Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806

Chapter 3 General Principles. Banks, Carson, Nelson & Nicol Discrete-Event System Simulation

Parallel Discrete Event Simulation

Simulation Studies of the Basic Packet Routing Problem

Module 7:Application of stochastic processes in queueing theory Lecture 29:Application of stochastic processes in Queueing Theory

Course Syllabus. Operating Systems

SFWR ENG 3S03: Software Testing

Scan Scheduling Specification and Analysis

Start of Lecture: February 10, Chapter 6: Scheduling

Figure 1: An example of a hypercube 1: Given that the source and destination addresses are n-bit vectors, consider the following simple choice of rout

Two states of the queue, either empty or containing some elements, can be judged by the following tests:

Real-time operating systems and scheduling

A STUDY OF THE PERFORMANCE TRADEOFFS OF A TRADE ARCHIVE

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN

Numerical approach estimate

OPERATING SYSTEMS. Systems with Multi-programming. CS 3502 Spring Chapter 4

COSC160: Data Structures Hashing Structures. Jeremy Bolton, PhD Assistant Teaching Professor

UNIT 4: QUEUEING MODELS

You ve already read basics of simulation now I will be taking up method of simulation, that is Random Number Generation

Markov Chains and Multiaccess Protocols: An. Introduction

Subject Name: System Modeling & Simulation. Prepared By : Ms. Pramela Devi( ASCP) Department : Computer Science & Engineering

Competitive Analysis of On-line Algorithms for On-demand Data Broadcast Scheduling

COS 226 Algorithms and Data Structures Fall Midterm

CHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science

Unavoidable Constraints and Collision Avoidance Techniques in Performance Evaluation of Asynchronous Transmission WDMA Protocols

Computer Science 4500 Operating Systems

Simulation Models for Manufacturing Systems

CS370 Operating Systems

Subject : Computer Science. Paper: Data Structures. Module: Priority Queue and Applications. Module No: CS/DS/14

Queues. CITS2200 Data Structures and Algorithms. Topic 5

Lecture 5: Performance Analysis I

1. Attempt any three of the following: 15

Verification Overview Testing Theory and Principles Testing in Practice. Verification. Miaoqing Huang University of Arkansas 1 / 80

CS 206 Introduction to Computer Science II

CS 3204 Operating Systems Programming Project #2 Job / CPU Scheduling Dr. Sallie Henry Spring 2001 Due on February 27, 2001.

Lecture 14: M/G/1 Queueing System with Priority

Queues. Lesson 4. CS 32: Data Structures Dept. of Computer Science

Simulative Evaluation of Internet Protocol Functions

Analytic Performance Models for Bounded Queueing Systems

CHAPTER 3 A TIME-DEPENDENT k-shortest PATH ALGORITHM FOR ATIS APPLICATIONS

CH ALGORITHM ANALYSIS CH6. STACKS, QUEUES, AND DEQUES

LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS

for (i=1; i<=100000; i++) { x = sqrt (y); // square root function cout << x+i << endl; }

An Approach to Task Attribute Assignment for Uniprocessor Systems

Distributed minimum spanning tree problem

Modeling and Simulation (An Introduction)

Lecture: Simulation. of Manufacturing Systems. Sivakumar AI. Simulation. SMA6304 M2 ---Factory Planning and scheduling. Simulation - A Predictive Tool

CSCI 4210 Operating Systems CSCI 6140 Computer Operating Systems Project 2 (document version 1.4) CPU Scheduling Algorithms

CMSC Introduction to Algorithms Spring 2012 Lecture 7

Read Chapter 4 of Kurose-Ross

Module 4: Stochastic Activity Networks

Spatial Outlier Detection

Final Examination: Topics and Sample Problems

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Thursday 1st June 2017 Time: 14:00-16:00

Resource Allocation Strategies for Multiple Job Classes

TOTAL CREDIT UNITS L T P/ S SW/F W. Course Title: Analysis & Design of Algorithm. Course Level: UG Course Code: CSE303 Credit Units: 5

Cantor s Diagonal Argument for Different Levels of Infinity

CSI33 Data Structures

Memory management, part 2: outline. Operating Systems, 2017, Danny Hendler and Amnon Meisels

Queuing Networks. Renato Lo Cigno. Simulation and Performance Evaluation Queuing Networks - Renato Lo Cigno 1

Transcription:

Next-Event Simulation Lawrence M. Leemis and Stephen K. Park, Discrete-Event Simulation - A First Course, Prentice Hall, 2006 Hui Chen Computer Science Virginia State University Petersburg, Virginia March 24, 2015 H. Chen (VSU) DES Examples March 24, 2015 1 / 45

Table of Contents 1 Next-Event Simulation 2 Examples Single-Server Service Node Simple Inventory System with Delivery Lag Multiple-Server Service Node 3 Event-List Management H. Chen (VSU) DES Examples March 24, 2015 2 / 45

Motivation Next-Event Simulation Making small modifications to our simple discrete-event simulations is non-trivial Add feedback to ssq2 Add delivery lag to sis2 Next-event simulation is a more general approach to discrete-event simulation, based on, System state Events Simulation clocks Event scheduling Event list H. Chen (VSU) DES Examples March 24, 2015 3 / 45

System State Next-Event Simulation The state of a system is a complete characterization of the system at an instance in time Conceptual model: abstract collection of variables and how they evolve over time Specification model: collection of mathematical variables together with logic and equations Computational model: collection of program variables systematically updated Example 5.1.1: state of ssq is the number of jobs in the node Example 5.1.2: state of sis is current inventory level and the amount of inventory on order (if any) H. Chen (VSU) DES Examples March 24, 2015 4 / 45

Events Next-Event Simulation An event is an occurrence that may change the state of the system Example 5.1.3: For ssq, events are arrivals or completion of a jobs An arrival will always increase the number of jobs in the node by 1 If there is no feedback, a completion of a job will always decrease the number of jobs in the node by 1 With feedback, a completion of a job may decrease the number of jobs in the node by 1 Example 5.1.4: For sis with delivery lag, events are demand instances, inventory reviews, and arrival of inventory replenishment orders A demand will decrease the inventory level by 1 An inventory review might lead to an increase in the amount of inventory on order The arrival of an order will increase the inventory level and decrease the amount of inventory on order. We can also define artificial events, e.g., Statistically sample the state of the system Schedule an event at a prescribed time H. Chen (VSU) DES Examples March 24, 2015 5 / 45

Simulation Clock Next-Event Simulation The simulation clock represents the current value of simulated time Previously introduced discrete-event simulation models lack definitive simulated time As a result, it is difficult to generalize or embellish models Example 5.1.5: It is hard to reason about ssq2 because there are effectively two simulation clocks Arrival times and completion times are not synchronized It is difficult to reason about the temporal order of events if arrivals are merged by feedback with completion of service. Example 5.1.6: In sis2, the only event is inventory review The simulation clock is integer-valued and we have to aggregate all demand and to do some calculus to derive equations for the time-averaged holding and shortage levels When there is a delivery lag that happens in a non-integer-valued time, the derivation of those equations is a significant task. (see Example 3.3.3 or In-Class Exercise 7-2) H. Chen (VSU) DES Examples March 24, 2015 6 / 45

Event Scheduling Next-Event Simulation It is necessary to use a time-advance mechanism to guarantee that events occur in the correct order Next-event time advance is typically used in discrete-event simulation To build a next-event simulation model: construct a set of state variables identify the event types construct a set of algorithms that define state changes for each event type The simulated system evolves in simulated time by executing the events in increasing order of their scheduled time of occurrence. Simulation clock is advanced discontinuously from event time to event time H. Chen (VSU) DES Examples March 24, 2015 7 / 45

Event List Next-Event Simulation The event list (or calendar is the data structure containing the time of next occurrence for each event type The event list is often, but not necessarily, represented as a priority queue sorted by the next scheduled time of occurrence of each event type More detailed discussion in the examples and a later discussion on event-list management. H. Chen (VSU) DES Examples March 24, 2015 8 / 45

Next-Event Simulation Next-Event Simulation Algorithm 5.1.1 1. Initialize. 1.1 set simulation clock (usually to zero) 1.2 set first time of occurrence for each event type 2. Process current event. 2.1 scan event list to determine most imminent event 2.2 advance simulation clock 2.3 update state 3. Schedule new events 3.1 The current event may spawn new events. The new events, if any, are placed in the event list 3.2 The algorithm returns to step 2 if not terminated as in step 4 4. Terminate Continue advancing the clock and handling events until termination condition is satisfied H. Chen (VSU) DES Examples March 24, 2015 9 / 45

Next-Event Simulation Next-Event Simulation The simulation clock runs asynchronously; inactive periods are ignored Simulation clock is advanced discontinuously from event time to event time Clearly, a computational advantage over fixed-increment time-advance mechanism H. Chen (VSU) DES Examples March 24, 2015 10 / 45

Examples Next-Event Simualtion by Examples Single-Server Service Node Model extension: immediate feedback Model extension: alternative queue disciplines Model extension: finite service node capacity Model extension: random sampling Simple inventory system with delivery lag and random demand Multi-server service node H. Chen (VSU) DES Examples March 24, 2015 11 / 45

Examples Single-Server Service Node Single-Server Service Node: Concept Model The state variable l(t) (the number of jobs at time t at the node) provides a complete characterization of the state of a ssq l(t) = 0 q(t) = 0 and x(t) = 0 l(t) > 0 q(t) = l(t) 1 and x(t) = 1 Two events cause this variable to change 1. An arrival causes l(t) to increase by 1 2. A completion of service causes l(t) to decrease by 1 H. Chen (VSU) DES Examples March 24, 2015 12 / 45

Examples Single-Server Service Node Single-Server Service Node: Specification Model The initial state l(0) can have any non-negative value, typically 0 The terminal state can be any non-negative value Assume at time τ arrival process stopped. Remaining jobs processed before termination Some mechanism must be used to denote an event impossible Only store possible events in event list Denote impossible events with event time of H. Chen (VSU) DES Examples March 24, 2015 13 / 45

Examples Single-Server Service Node Single-Server Service Node: Specification Model The simulation clock (current time) is t The terminal ( close the door ) time is τ The next scheduled arrival time is t a The next scheduled service completion time is t c The number in the node (state variable) is l Note the following, It is not necessary to generate and store all arrivals prior to the execution of the simulation. It only nees to schedule the 1st arrival in the intialization phase and then to schedule each subsequent arrival while processing the current arrival It inserts completion event in the event list. H. Chen (VSU) DES Examples March 24, 2015 14 / 45

Examples Single-Server Service Node Single-Server Service Node: Computational Model Algorithm 5.1.2 /* 1. Initialize */ l = 0; t = 0.0; t a = GetArrival(); /* initialize the event list */ t c = ; while ((t a < τ) or (l > 0)) { /* 4. Terminate or not */ /* process current event */ /* 2.1-2.2 scan the event list and advance simulation time */ t = min(t a,t c); if (t == t a) { /* process an arrival */ l ++; /* 3. schedule new arrival event */ t a = GetArrival(); if (t a > τ) t a = ; /* 3. schedule new service event */ if (l == 1) t c = t + GetService(); } else { /* process a completion */ l - -; /* 3. schedule new service event */ if (l > 0) t c = t + GetService(); else t c = ; } } H. Chen (VSU) DES Examples March 24, 2015 15 / 45

Program ssq3 Examples Single-Server Service Node In ssq3, long variable number represents l(t) and structure variable t represents time the event list t.arrival and t.completion, i.e., ta and t c from Algorithm 5.1.2; the simulation clock t.current, i.e., t from Algorithm 5.1.2; the next event time t.next, i.e., min(ta,t c ) from Algorithm 5.1.2 the last arrival time t.last Time-averaged statistics are gathered with the structure variable area t 0 t 0 t 0 l(s)ds evaluated as area.node q(s)ds evaluated as area.queue x(s)ds evaluated as area.service H. Chen (VSU) DES Examples March 24, 2015 16 / 45

Examples World Views and Synchronization Single-Server Service Node Programs ssq2 and ssq3 simulate exactly the same system The two have different world views ssq2: process-interaction world view, naturally produces job-averaged statistics ssq3: event-scheduling world view, naturally produces time-averaged statistics The event-scheduling world view is the discrete-event simulation world view of cohice for the rest of the discussion. The programs should produce exactly the same statistics Both requires requires rngs H. Chen (VSU) DES Examples March 24, 2015 17 / 45

Examples Single-Server Service Node Model Extension: Immediate Feedback It is simple to accomodate immediate feedback in the next-event simulation model. Immediate Feedback else { / process a completion of service / if (GetFeedback() == 0) { / this statement is new / index ++; number ; } } H. Chen (VSU) DES Examples March 24, 2015 18 / 45

In-Class Exericse L10-1 Examples Single-Server Service Node You are to extend the ssq3 program with immediate feedback. You may find ssq3 in Blackboard. The instructor also provides a solution to In-Class Exercise L7-2 (Examples 3.3.2 only) and the program is ssq2v2. Complete the following. 1. Extend ssq3 to accommodate immediate feedback as outlined in slide 18. 2. Adjust the parameters in the revised ssq3 to match those in ssq2v2. Compare the output from the revised ssq3 program to that of ssq2v2 by (a) graphing the result in a single figure and (b) computing and graphing the relative difference of the two outputs in a second figure. 3. Observe both ssq2v2 and the revised ssq3. Explain briefly the difference between the revision on ssq2 (to obtain ssq2v2) and that on ssq3 (to obtain the revised ssq3) 4. Submit the revised ssq3, the graphs, and your answer to bullet 3 above to Blackboard. H. Chen (VSU) DES Examples March 24, 2015 19 / 45

Examples Single-Server Service Node Model Extension: Alternate Queue Discipline arrival arrival arrival service service service head next next...... next tail. Program ssq3 can be modified to simulate any queue discipline. Need to add a dynamic-queue data structure. Example: singly linked list. Each list node contains the arrival time and service time for a job in the queue Use Enqueue each time an arrival event occurs and the server is busy. Dequeue each time a completion-of-service event occurs and the queue is not empty. Can be combined with with the immediate-feedback modification. The arrival field in the linked list would hold the time of feeback for those fedback jobs. H. Chen (VSU) DES Examples March 24, 2015 20 / 45

Examples Single-Server Service Node Model Extension: Finite Service Node Capacity Previously, assume the queue has infinite capacity. Program ssq3 can be modified to account for a finite capacity. Finite Service Node Capacity if (t. current == t. arrival ) { if (number < CAPACITY) { number++; if (number == 1) t. completion = t. current + GetService (); } else reject++; t. arrival = GetArrival (); if (t. arrival > STOP) { t. last = t. current ; t. arrival = INFINITY ; } } H. Chen (VSU) DES Examples March 24, 2015 21 / 45

In-Class Exericse L10-2 Examples Single-Server Service Node You are to extend the ssq3 program with finite capacity. You may find ssq3 in Blackboard. Complete the following. 1. Extend ssq3 to accommodate finite capacity as outlined in slide 21. 2. What consistency check have you performed? What are the results? 3. Graph utilization versus capacity 4. What is the maximum queue capacity needed if we do not want to reject any jobs? 5. Submit the revised ssq3, the graphs, and your answers to bullet 2 and 4 above to Blackboard. H. Chen (VSU) DES Examples March 24, 2015 22 / 45

Examples Model Extension: Random Sampling Single-Server Service Node The structure of ssq3 facilitates adding sampling Add a sampling event to the event list Sample deterministically, every δ time units Sample Randomly, every Exponential(δ) time units H. Chen (VSU) DES Examples March 24, 2015 23 / 45

Examples Simple Inventory System with Delivery Lag Simple Inventory System with Delivery Lag and Random Demand Two changes relative to sis2 Uniform(0, 1) lag between inventory review and order delivery More realistic demand model Demand instances for a single item occur at random Average rate is λ demand instances per time interval Time between demand instances is Exponential(1/λ) H. Chen (VSU) DES Examples March 24, 2015 24 / 45

Examples Demand Models: A Comparison Simple Inventory System with Delivery Lag sis2 used an aggregate demand for each time interval, generated as an Equilikely(10, 50) random variate Aggregate demand per time interval is random Within an interval, time between demand instances is constant Example: if aggregate demand is 25, inter-demand time is 0.04 Now using Exponential(1/λ) inter-demand times Demand is modeled as an arrival process Average demand per time interval is λ S.. l(t) s 0 o 2 o 5 δ 3 δ 6 t 0 1 2 3 4 5 6 H. Chen (VSU) DES Examples March 24, 2015 25 / 45

Examples Simple Inventory System with Delivery Lag Specification Model: States and Notation The simulation clock is t (real-valued) The terminal time is τ (integer-valued) Current inventory level is l(t) (integer-valued) Amount of inventory on order, if any, is o(t) (integer-valued). Necessary due to delivery lag l(t) and o(t) provide complete state description Initial state is assumed to be l(0) = S and o(0) = 0 Terminal state is assumed to be l(τ) = S and o(τ) = 0 Cost to bring l(t) to S at simulation end (with no lag) must be included in accumulated statistics H. Chen (VSU) DES Examples March 24, 2015 26 / 45

Examples Specification Model: Events Simple Inventory System with Delivery Lag Three types of events can change the system state A demand for an item at time t. l(t) decreases by 1. An inventory review at integer-valued time t If l(t) s, then o(t) = 0 If l(t) < s, then o(t) = Sl(t) An arrival of an inventory replenishment order at time t l(t) increases by o(t) o(t) becomes 0 H. Chen (VSU) DES Examples March 24, 2015 27 / 45

Examples Algorithm 5.2.1: Initialization Simple Inventory System with Delivery Lag Time variables used for event list: td : next scheduled inventory demand tr : next scheduled inventory review ta : next scheduled inventory arrival infty denotes impossible events Initialization Step of Algorithm 5.2.1 l = S; /* initialize inventory level */ o = 0; /* initialize amount on order */ t = 0.0; /* initialize simulation clock */ t d = GetDemand(); /* initialize event list */ t r = t + 1.0; /* initialize event list */ t a = ; /* initialize event list */ H. Chen (VSU) DES Examples March 24, 2015 28 / 45

Examples Algorithm 5.2.1: Main Loop Simple Inventory System with Delivery Lag Main Loop of Algorithm 5.2.1 while (t < τ) { t = min(t d, t r, t a); /* scan the event list */ if (t == t d ) { /* process an inventory demand */ l - -; t d = GetDemand(); } else if (t == t r ) { /* process an inventory review */ if (l < s) { o = S - l; end = GetLag(); t a = t + end; } t r += 1.0; } else { /* process an inventory arrival */ l += o; o = 0; t a = 1; } } H. Chen (VSU) DES Examples March 24, 2015 29 / 45

Program sis3 Examples Simple Inventory System with Delivery Lag Implements Algorithm 5.2.1 t.demand, t.review and t.arrive correspond to t d, t r, t a State variables inventory and order correspond to l(t) and o(t) sum.hold and sum.short accumulate the time-integrated holding and shortage integrals H. Chen (VSU) DES Examples March 24, 2015 30 / 45

Examples A Multi-Server Service Node Multiple-Server Service Node The single-server service node is extended to support multiple servers It is a natural generalization Multi-server service nodes have both practical and theoretical importance The event list size depends on the number of servers For large numbers of servers, the event list data structure becomes important Extensions of the multi-server node (immediate feedback, finite capacity, non-fifo) are left as exercises H. Chen (VSU) DES Examples March 24, 2015 31 / 45

Conceptual Model Examples Multiple-Server Service Node Definition 5.2.1: A multi-server service node consists of A single queue (if any) Two or more servers operating in parallel At any instant in time, Each server is either busy or idle The queue is either empty or not empty If one or more servers is idle, the queue must be empty If the queue is not empty, all servers must be busy. 1.. 2.. arrivals. queue... departures. c. servers H. Chen (VSU) DES Examples March 24, 2015 32 / 45

Conceptual Model Examples Multiple-Server Service Node When a job arrives If all servers are busy, the job enters the queue Else an idle server is selected and the job enters service When a job departs a server If the queue is empty, the server becomes idle Else a job is removed from the queue, served by server Servers process jobs independently H. Chen (VSU) DES Examples March 24, 2015 33 / 45

Server Selection Examples Multiple-Server Service Node Definition 5.2.2: The algorithm used to select an idle server is called the server selection rule Common selection rules Random selection: at random from the idle servers Selection in order: lowest-numbered idle server Cyclic selection: first available, starting after last selected (circular search may be required) Equity selection: use longest-idle or lowest-utilized Priority selection: choose the best idle server (modeler specifies how to dermine best) Random, cyclic, equity: designed to achieve equal utilizations If servers are statistically identical and independent, the selection rule has no effect on average performance of the service node The statistically identical assumption is useful for mathematicians; unnecessary for discrete-event simulation H. Chen (VSU) DES Examples March 24, 2015 34 / 45

Examples Multiple-Server Service Node Specification Model: States and Notation Servers in a multi-server service node are called service channels c is the number of servers (channels) The server index is s = 1,2,...,c l(t) denotes the number of jobs in the service node at time t l(t) c, all servers are busy and q(t) = l(t)c If l(t) < c, some servers are idle If servers are distinct, need to know which servers are idle For s = 1,2,...,c, define x s (t) : the number of jobs in service (0 or 1) at server s at time t The complete state description is l(t),x 1 (t),x 2 (t),...,x c (t) q(t) = l(t) c x s (t) s=1 H. Chen (VSU) DES Examples March 24, 2015 35 / 45

Examples Specification Model: Events Multiple-Server Service Node What types of events can change state variables l(t),x1(t),x2(t),...,x c (t)? An arrival at time t l(t) increases by 1 If l(t) c, an idle server s is selected, and xs (t) becomes 1 Else all servers are busy A completion of service by server s at time t l(t) decreases by 1 If l(t) c, a job is selected from the queue to enter service Else xs (t) becomes 0 There are c +1 event types H. Chen (VSU) DES Examples March 24, 2015 36 / 45

Examples Multiple-Server Service Node Specification Model: Additional Assumption The initial state is an empty node l(0) = 0 x1 (0) = x 2 (0) =... = x c (0) = 0 The first event must be an arrival The arrival process is turned off at time τ The node continues operation after time τ until empty The terminal state is an empty node The last event is a completion of service For simplicity, all servers are independent and statistically identical Equity selection is the server selection rule All of these assumptions can be relaxed H. Chen (VSU) DES Examples March 24, 2015 37 / 45

Examples Specification Model: Event List Multiple-Server Service Node 0 t x arrival 1 t x completion of service by server 1 2 t x completion of service by server 2 3 t x completion of service by server 3 4 t x completion of service by server 4 Can be organized as an array of c +1 event types Field t: scheduled time of next occurrence for the event Field x: current activity status of the event Superior alternative to using 1 to denote impossible events For 0th event type, x denotes if arrival process is on or off For other event types, x denotes if server is busy or idle For large c, consider alternate event-list structures (see later discussion) H. Chen (VSU) DES Examples March 24, 2015 38 / 45

Program msq Examples Multiple-Server Service Node Implements this next-event multi-server service node simulation model State variable l(t) is number State variables x 1 (t),x 2 (t),...,x c (t) are part of the event list Time-integrated statistic t 0 l(θ)dθ Array sum records for each server the sum of service times the number served Function NextEvent searches the event list to find the next event Function FindOne searches the event list to find the longest-idle server (because equity selection is used) H. Chen (VSU) DES Examples March 24, 2015 39 / 45

Event-List Management Event-List Management Some next-event simulations can have a great number of events on their event list simultaneously. An event list is the data structure that contains a list of events scheduled to occur in the future. The list is not necessarily sorted by the scheduled time of occurrence. Also called calendar, future events chain, sequencing set, future event set,... Event lists are also called future events, event notices, transactions, records,... Event-list management is important Many next-event simulation models spend more CPU time on managing the event list than on any other aspects of the simulations. H. Chen (VSU) DES Examples March 24, 2015 40 / 45

Event-List Management Event-List Management: 4 Categories 2 boolean classifications fixed maximum or variable maximum number of events on the event list devised for one specific model or for a general-purpose simulation language Based on the 2 boolean classifications, there are 4 categories of event-list management No. Number of Events Model 1 fixed maximum specific model 2 fixed maximum general-purpose 3 variable maximum specific model 4 variable maximum general-purpose H. Chen (VSU) DES Examples March 24, 2015 41 / 45

Event-List Management Event-List Management: Operations 2 critical operations Insertion (enqueue or scheduling) Deletion (dequeue) Additional operation Change Operation: change of an existing event Examine Operation: searches for an existing event Count: determine the number of events on the list H. Chen (VSU) DES Examples March 24, 2015 42 / 45

Event-List Management Event-List Management Criteria 3 criteria are used to assess the effectiveness oft he data structure and algorithms for an event-management scheme Speed Robustness Adaptability H. Chen (VSU) DES Examples March 24, 2015 43 / 45

Event-List Management Event-List Management by Example Consider the timesharing computer system model (Henriksen 1983) to discuss event-list management schemes. Simulation models for the timesharing computer system Concept, specification, and computational models Event-list management schemes Using array Using a single linked list Using multiple linked lists Using binary trees Using heaps Hybrid schemes H. Chen (VSU) DES Examples March 24, 2015 44 / 45

Summary Event-List Management A generic approach to discrete-event simulation: next-event simulation Examples of next-event simulations Event-list management by examples H. Chen (VSU) DES Examples March 24, 2015 45 / 45