+ All Categories
Home > Documents > Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1...

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1...

Date post: 19-Dec-2015
Category:
View: 249 times
Download: 17 times
Share this document with a friend
Popular Tags:
80
Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 1 of 51 Chapter 1 Basic Simulation Modeling
Transcript
Page 1: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 1 of 51

Chapter 1

Basic Simulation Modeling

Page 2: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 2 of 51

CONTENTS

1.1 The Nature of Simulation

1.2 Systems, Models, and Simulation

1.3 Discrete-Event Simulation

1.4 Simulation of a Single-Server Queueing System

1.5 Simulation of an Inventory System

1.6 Alternative Approaches to Modeling and Coding Simulations

1.7 Steps in a Sound Simulation Study

1.8 Other Types of Simulation

1.9 Advantages, Disadvantages, and Pitfalls of Simulation

Page 3: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 3 of 51

1.1 THE NATURE OF SIMULATION

• Simulation: Imitate the operations of a facility or process, usually via computer– What’s being simulated is the system

– To study system, often make assumptions/approximations, both logical and mathematical, about how it works

– These assumptions form a model of the system

– If model structure is simple enough, could use mathematical methods to get exact information on questions of interest — analytical solution

Page 4: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 4 of 51

1.1 The Nature of Simulation (cont’d.)

• But most complex systems require models that are also complex (to be valid)– Must be studied via simulation — evaluate model numerically and

collect data to estimate model characteristics

• Example: Manufacturing company considering extending its plant– Build it and see if it works out?

– Simulate current, expanded operations — could also investigate many other issues along the way, quickly and cheaply

Page 5: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 5 of 51

1.1 The Nature of Simulation (cont’d.)

• Some (not all) application areas– Designing and analyzing manufacturing systems– Evaluating military weapons systems or their logistics

requirements– Determining hardware requirements or protocols for

communications networks– Determining hardware and software requirements for a computer

system– Designing and operating transportation systems such as airports,

freeways, ports, and subways– Evaluating designs for service organizations such as call centers,

fast-food restaurants, hospitals, and post offices– Reengineering of business processes– Determining ordering policies for an inventory system– Analyzing financial or economic systems

Page 6: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 6 of 51

1.1 The Nature of Simulation (cont’d.)

• Use, popularity of simulation– Several conferences devoted to simulation, notably the Winter

Simulation Conference (www.wintersim.org)

• Surveys of use of OR/MS techniques (examples …)– Longitudinal study (1973-1988): Simulation consistently ranked

as one of the three most important techniques

– 1294 papers in Interfaces (1997): Simulation was second only to the broad category of “math programming”

Page 7: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 7 of 51

1.1 The Nature of Simulation (cont’d.)

• Impediments to acceptance, use of simulation– Models of large systems are usually very complex

But now have better modeling software … more general, flexible, but still (relatively) easy to use

– Can consume a lot of computer time But now have faster, bigger, cheaper hardware to allow for much better

studies than just a few years ago … this trend will continue However, simulation will also continue to push the envelope on computing

power in that we ask more and more of our simulation models

– Impression that simulation is “just programming” There’s a lot more to a simulation study than just “coding” a model in some

software and running it to get “the answer” Need careful design and analysis of simulation models – simulation

methodology

Page 8: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 8 of 51

1.2 SYSTEMS, MODELS, AND SIMULATION

• System: A collection of entities (people, parts, messages, machines, servers, …) that act and interact together toward some end (Schmidt and Taylor, 1970)– In practice, depends on objectives of study– Might limit the boundaries (physical and logical) of the system– Judgment call: level of detail (e.g., what is an entity?)– Usually assume a time element – dynamic system

• State of a system: Collection of variables and their values necessary to describe the system at that time– Might depend on desired objectives, output performance measures– Bank model: Could include number of busy tellers, time of arrival

of each customer, etc.

Page 9: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 9 of 51

1.2 Systems, Models, and Simulation (cont’d.)

• Types of systems– Discrete

State variables change instantaneously at separated points in time Bank model: State changes occur only when a customer arrives or departs

– Continuous State variables change continuously as a function of time Airplane flight: State variables like position, velocity change continuously

• Many systems are partly discrete, partly continuous

Page 10: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 10 of 51

• Ways to study a system

1.2 Systems, Models, and Simulation (cont’d.)

– Simulation is “method of last resort?” Maybe …

– But with simulation there’s no need (or less need) to “look where the light is”

Page 11: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 11 of 51

1.2 Systems, Models, and Simulation (cont’d.)

• Classification of simulation models– Static vs. dynamic

– Deterministic vs. stochastic

– Continuous vs. discrete

• Most operational models are dynamic, stochastic, and discrete – will be called discrete-event simulation models

Page 12: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 12 of 51

1.3 DISCRETE-EVENT SIMULATION

• Discrete-event simulation: Modeling of a system as it evolves over time by a representation where the state variables change instantaneously at separated points in time– More precisely, state can change at only a countable number of

points in time– These points in time are when events occur

• Event: Instantaneous occurrence that may change the state of the system– Sometimes get creative about what an “event” is … e.g., end of

simulation, make a decision about a system’s operation

• Can in principle be done by hand, but usually done on computer

Page 13: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 13 of 51

1.3 Discrete-Event Simulation (cont’d.)

• Example: Single-server queue– Estimate expected average delay in queue (line, not

service)– State variables

Status of server (idle, busy) – needed to decide what to do with an arrival

Current length of the queue – to know where to store an arrival that must wait in line

Time of arrival of each customer now in queue – needed to compute time in queue when service starts

– Events Arrival of a new customer Service completion (and departure) of a customer Maybe – end-simulation event (a “fake” event) – whether

this is an event depends on how simulation terminates (a modeling decision)

Page 14: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 14 of 51

1.3.1 Time-Advance Mechanisms

• Simulation clock: Variable that keeps the current value of (simulated) time in the model– Must decide on, be consistent about, time units– Usually no relation between simulated time and (real) time needed

to run a model on a computer

• Two approaches for time advance– Next-event time advance (usually used) … described in detail

below– Fixed-increment time advance (seldom used) … Described in

Appendix 1A Generally introduces some amount of modeling error in terms of when

events should occur vs. do occur Forces a tradeoff between model accuracy and computational efficiency

Page 15: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 15 of 51

1.3.1 Time-Advance Mechanisms (cont’d.)

• More on next-event time advance– Initialize simulation clock to 0

– Determine times of occurrence of future events – event list

– Clock advances to next (most imminent) event, which is executed Event execution may involve updating event list

– Continue until stopping rule is satisfied (must be explicitly stated)

– Clock “jumps” from one event time to the next, and doesn’t “exist” for times between successive events … periods of inactivity are ignored

Page 16: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 16 of 51

1.3.1 Time-Advance Mechanisms (cont’d.)

• Next-event time advance for the single-server queueti = time of arrival of ith customer (t0 = 0)

Ai = ti – ti-1 = interarrival time between (i-1)st and ith customers (usually assumed to be a random variable from some probability distribution)

Si = service-time requirement of ith customer (another random variable)

Di = delay in queue of ith customer

Ci = ti + Di + Si = time ith customer completes service and departs

ej = time of occurrence of the jth event (of any type), j = 1, 2, 3, …

– Possible trace of events (detailed narrative in text)

Page 17: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 17 of 51

1.3.2 Components and Organization of a Discrete-Event Simulation Model

• Each simulation model must be customized to target system• But there are several common components, general

organization– System state – variables to describe state– Simulation clock – current value of simulated time– Event list – times of future events (as needed)– Statistical counters – to accumulate quantities for output– Initialization routine – initialize model at time 0– Timing routine – determine next event time, type; advance clock– Event routines – carry out logic for each event type– Library routines – utility routines to generate random variates, etc.– Report generator – to summarize, report results at end– Main program – ties routines together, executes them in right order

Page 18: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 18 of 51

1.3.2 Components and Organization of a Discrete-Event Simulation Model (cont’d.)

Page 19: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 19 of 51

1.3.2 Components and Organization of a Discrete-Event Simulation Model (cont’d.)

• More on entities– Objects that compose a simulation model

– Usually include customers, parts, messages, etc. … may include resources like servers

– Characterized by data values called attributes

– For each entity resident in the model there’s a record (row) in a list, with the attributes being the columns

• Approaches to modeling– Event-scheduling – as described above, coded in general-purpose

language

– Process – focuses on entities and their “experience,” usually requires special-purpose simulation software

Page 20: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 20 of 51

1.4 SIMULATION OF A SINGLE-SERVER QUEUEING SYSTEM

• Will show how to simulate a specific version of the single-server queueing system

• Book contains code in FORTRAN and C … slides will focus only on C version

• Though simple, it contains many features found in all simulation models

Page 21: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 21 of 51

1.4.1 Problem Statement

• Recall single-server queueing model• Assume interarrival times are independent and

identically distributed (IID) random variables • Assume service times are IID, and are

independent of interarrival times• Queue discipline is FIFO• Start empty and idle at time 0• First customer arrives after an interarrival

time, not at time 0• Stopping rule: When nth customer has

completed delay in queue (i.e., enters service) … n will be specified as input

Page 22: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 22 of 51

1.4.1 Problem Statement (cont’d.)

• Quantities to be estimated– Expected average delay in queue (excluding service time) of the n

customers completing their delays Why “expected?”

– Expected average number of customers in queue (excluding any in service)

A continuous-time average Area under Q(t) = queue length at time t, divided by T(n) = time simulation

ends … see book for justification and details– Expected utilization (proportion of time busy) of the server

Another continuous-time average Area under B(t) = server-busy function (1 if busy, 0 if idle at time t), divided

by T(n) … justification and details in book– Many others are possible (maxima, minima, time or number in

system, proportions, quantiles, variances …)• Important: Discrete-time vs. continuous-time statistics

Page 23: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 23 of 51

1.4.2 Intuitive Explanation

• Given (for now) interarrival times (all times are in minutes):0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …

• Given service times:2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

• n = 6 delays in queue desired• “Hand” simulation:

– Display system, state variables, clock, event list, statistical counters … all after execution of each event

– Use above lists of interarrival, service times to “drive” simulation

– Stop when number of delays hits n = 6, compute output performance measures

Page 24: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 24 of 51

1.4.2 Intuitive Explanation (cont’d)

Status shown is after all changes have been made in each case …

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 25: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 25 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 26: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 26 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 27: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 27 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 28: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 28 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 29: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 29 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 30: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 30 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 31: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 31 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 32: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 32 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 33: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 33 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 34: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 34 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 35: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 35 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 36: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 36 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Page 37: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 37 of 51

1.4.2 Intuitive Explanation (cont’d)

Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, …Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

Final output performance measures:Average delay in queue = 5.7/6 = 0.95 min./cust.Time-average number in queue = 9.9/8.6 = 1.15 custs.Server utilization = 7.7/8.6 = 0.90 (dimensionless)

Page 38: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 38 of 51

1.4.3 Program Organization and Logic

• C program to do this model (FORTRAN as well is in book)– Event types: 1 for arrival, 2 for departure– Modularize for initialization, timing, events, library, report, main

• Changes from hand simulation:– Stopping rule: n = 1000 (rather than 6)– Interarrival and service times “drawn” from an exponential

distribution (mean = 1 for interarrivals, 0.5 for service times)

Density function

Cumulative distribution function

Page 39: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 39 of 51

1.4.3 Program Organization and Logic (cont’d.)

• How to “draw” (or generate) an observation (variate) from an exponential distribution?

• Proposal:– Assume a perfect random-number generator that generates IID

variates from a continuous uniform distribution on [0, 1] … denoted the U(0, 1) distribution … see Chap. 7

– Algorithm:1. Generate a random number U2. Return X = – ln U

– Proof that algorithm is correct:

Page 40: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 40 of 51

1.4.5 C Program;1.4.6 Simulation Output and Discussion

• Refer to pp. 30, 31, 42-48 in the book (Figures 1.8, 1.9, 1.19-1.27) and the file mm1.c– Figure 1.19 – external definitions (at top of file)– Figure 1.20 – function main– Figure 1.21 – function initialize– Figure 1.22 – function timing– Figure 1.23 – function arrive (flowchart: Figure 1.8)– Figure 1.24 – function depart (flowchart: Figure 1.9)– Figure 1.25 – function report– Figure 1.26 – function update_time_avg_stats– Figure 1.27 – function expon– Figure 1.28 – output report mm1.out

Are these “the” answers? Steady-state vs. terminating? What about time in queue vs. just time in system?

Page 41: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 41 of 51

1.4.7 Alternative Stopping Rules

• Stop simulation at (exactly) time 8 hours (= 480 minutes), rather than whenever n delays in queue are completed– Before, final value of simulation clock was a random variable– Now, number of delays completed will be a random variable

• Introduce an artificial “end-simulation” event (type 3)– Schedule it on initialization– Event routine is report generator– Be sure to update continuous-time statistics to end

• Changes in C code (everything else is the same)– Figure 1.33 – external definitions– Figure 1.34 – function main– Figure 1.35 – function initialize– Figure 1.36 – function report– Figure 1.37 – output report mm1alt.out

Page 42: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 42 of 51

1.4.8 Determining the Events and Variables

• For complex models, it might not be obvious what the events are

• Event-graph method (Schruben 1983, and subsequent papers) gives formal graph-theoretic method of analyzing event structure

• Can analyze what needs to be initialized, possibility of combining events to simplify model

• Software package (SIGMA) to build, execute a simulation model via event-graph representation

Page 43: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 43 of 51

1.5 SIMULATION OF AN INVENTORY SYSTEM;

1.5.1 Problem Statement• Single-product inventory• Decide how many items to have in inventory for the next

n = 120 months; initially (time 0) have 60 items on hand• Demands against inventory

– Occur with inter-demand time ~ exponential with mean 0.1 month

– Demand size = 1, 2, 3, 4 with resp. probabilities 1/6, 1/3, 1/3, 1/6

• Inventory review, reorder – stationary (s, S) policy … at beginning of each month, review inventory level = I– If I s, don’t order (s is an input constant); no ordering cost

– If I < s, order Z = S – I items (S is an input constant, order “up to” S); ordering cost = 32 + 3Z; delivery lag ~ U(0.5, 1) month

Page 44: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 44 of 51

1.5.1 Problem Statement (cont’d.)

• Demand in excess of current (physical) inventory is backlogged … so (accounting) inventory could be < 0

• Let I(t) be (accounting) inventory level at time t (+, 0, –)I+(t) = max {I(t), 0} = number of items physically on hand at time tI –(t) = max {–I(t), 0} = number of items in backlog at time t

• Holding cost: Incur $1 per item per month in (positive) inventoryTime-average (per month) holding cost =

• Shortage cost: Incur $5 per item per month in backlogTime-average (per month) backlog cost =

• Average total cost per month: Add ordering, holding, shortage costs per month– Try different (s, S) combinations to try to reduce total cost

Page 45: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 45 of 51

1.5.2 Program Organization and Logic

• State variables: Inventory level, amount of an outstanding order, time of the last (most recent) event

• Events:1. Arrival of an order from the supplier2. Demand for the product3. End of the simulation after n = 120 months4. Inventory evaluation (maybe ordering) at beginning of a month

• Random variates needed– Interdemand times: exponential, as in queueing model– Delivery lags ~ U(0.5, 1): 0.5 + (1 – 0.5)U, where U ~ U(0, 1)– Demand sizes: Split [0, 1] into subintervals of width 1/6, 1/3,

1/3, 1/6; generate U ~ U(0, 1); see which subinterval U falls in; return X = 1, 2, 3, or 4, respectively

Why the orderingof event types3 and 4?

Page 46: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 46 of 51

1.5.4 C Program;1.5.5 Simulation Output and Discussion

• Refer to pp. 64-66, 73-79 in the book (Figures 1.43-1.46, 1.57-1.67) and the file inv.c– Figure 1.57 – external definitions (at top of file)– Figure 1.58 – function main– Figure 1.59 – function initialize– Figure 1.60 – function order_arrival (flowchart: Figure 1.43)– Figure 1.61 – function demand (flowchart: Figure 1.44)– Figure 1.62 – function evaluate (flowchart: Figure 1.45)– Figure 1.63 – function report– Figure 1.64 – function update_time_avg_stats (flowchart:

Figure 1.46)– Figure 1.65 – function random_integer– Figure 1.66 – function uniform– Figure 1.67 – output report inv.out

Reaction of individual cost components to changes in s and S … overall? Uncertainty in output results (this was just one run)?

Page 47: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 47 of 51

1.6 ALTERNATIVE APPROACHES TO MODELING AND CODING SIMULATIONS

• Parallel and distributed simulation– Various kinds of parallel and distributed architectures

– Break up a simulation model in some way, run the different parts simultaneously on different parallel processors

– Different ways to break up model By support functions – random-number generation, variate generation,

event-list management, event routines, etc. Decompose the model itself; assign different parts of model to different

processors – message-passing to maintain synchronization, or forget synchronization and do “rollbacks” if necessary … “virtual time”

• Web-based simulation– Central simulation engine, submit “jobs” over the web

– Wide-scope parallel/distributed simulation

Page 48: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 48 of 51

1.7 STEPS IN A SOUND SIMULATION STUDY

Page 49: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 49 of 51

STEPS IN A SOUND SIMULATION STUDY

Now that we have looked in some detail at the inner workings of a discrete-event simulation. We need to step back and realize that model programming is just part of the overall effort to design or analyze a complex system by simulation. Attention must be paid to a variety of other concerns such as modeling system randomness, validation, statistical analysis of simulation output data and project management. Figure 1.46 shows the steps that will compose a typical, sound simulation study [see also Banks et al. (2005, pp. 14-18) and Law (2003)].

Page 50: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 50 of 51

The number beside the symbol representing each step refers to the more detailed description of that step below. Note that a simulation study is not a simple sequential process. As one proceeds with the study, it may be necessary to go back to a previous step.1. Formulate the problem and plan the

study.a. Problem of interest is stated by

manager. Problem may not be stated correctly or in quantitative terms.

An interactive process is often necessary

Page 51: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 51 of 51

1. Formulate problem and plan the study

2. Collect data and define a model

4. Construct a computer programme and verify

Assumptions document valid?

3.

5. Make pilot runs

ProgrammedModel valid?6.

7. Design experiments

8. Make production runs

9. Analyze output data

10. Document, present, and use results

Yes

Yes

No

No

FIGURE 1.46Steps in a simulation study

Page 52: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 52 of 51

b.One or more kickoff meetings for the study are conducted, with the project manager, the simulation analysts, and subject-matter experts (SMEs) in attendance. The following issues are discussed: Overall objectives of the study Specific questions to be answered by the

study (required to decide level of model detail)

Performance measures that will be used to evaluate the efficacy of different system configurations

Scope of the model System configurations to be modeled

(required to decide generality of simulation programme)

Time frame for the study and the required resources

Page 53: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 53 of 51

c. Select the software for the model (see Chap.3)

2.Collect data and define a model.

a.Collect information on the system layout and operating procedures.

No single person or document is sufficient. Some people may have inaccurate

information—make sure that true SMEs are identified.

Operating procedures may not be formalized.

b.Collect data (if possible) to specify model parameters and input probability distributions (see Chap. 6).

Page 54: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 54 of 51

c. Delineate the above information and data in an "assumptions document," which is the conceptual model (see Sec. 5.4.3).

d. Collect data (if possible) on the performance of the existing system (for validation purposes in Step 6).

e.Choosing the level of model detail (see Sec. 5.2), which is an art, should depend on the following: Project objectives Performance measures Data availability Credibility concerns Computer constraints Opinions of SMEs Time and money constraints

Page 55: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 55 of 51

g. Start with a “simple” model and embellish it as needed. Modeling each aspect of the system will seldom be required to make effective decisions, and might result in excessive model execution time, in missed deadlines, or in obscuring important system factors.

h. Interact with the manager (and other key project personnel) on a regular basis (see Sec. 5.4.2).

f. There need not be a one-to-one correspondence between each element of the model and the corresponding element of the system.

Page 56: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 56 of 51

3. Is the assumptions model valid?

a. Perform a structured walk-through of the assumptions document before an audience of managers, analysts, and SMEs (see Sec. 5.4.3). This will Help ensure that the model's assumptions

are correct and complete Promotes interaction among the project

members. Promote ownership of the model. Take place before programming begins, to

avoid significant reprogramming later

Page 57: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 57 of 51

4.Construct a computer program and verify.a.Program the model in a programming

language (e.g., C or C++) or in simulation software (e.g., Arena, Extend, Flexsim and ProModel). Benefits of using a programming language are that one is often known, they offer greater program control, they have a low purchase cost, and they may result in a smaller model execution time. The use of simulation software (see Chap. 3), on the other hand, reduces programming time and results in a lower project cost.

Page 58: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 58 of 51

b. Verify (debug) the simulation computer program (see Sec. 5.3).

5. Make pilot runs.a. Make pilot runs for validation purposes in

Step 6.6. Is the programmed model valid?

a. If there is an existing system, then compare model and system (from Step 2) performance measures for the existing system (see Sec. 5,4.5).

b. Regardless of whether there is an existing system, the simulation analysts and SMEs should review the model results for correctness.

Page 59: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 59 of 51

c. Use sensitivity analyses (see Sec. 5.4.4) to determine what model factors have a significant impact on performance measures and, thus, have to be modeled carefully.

7. Design experiments.a.Specify the following for each system

configuration of interest:

Length of each simulation run Length of the warmup period, if one is

appropriate Number of independent simulation runs

using different random numbers (see Chap. 7)—facilitates construction of confidence intervals

Page 60: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 60 of 51

8. Make production runs.a.Production runs are made for use in Step

9.9. Analyze output data.

a.Two major objectives in analyzing output data are: Determining the absolute performance of

certain system configurations (see Chap. 9)

Comparing alternative system configurations in a relative sense (see Chap. 10 and Sec. 11.2)10. Document, present, and use results.

a. Document assumptions (See Step 2), computer program, and study's results for use in the current and future projects.

Page 61: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 61 of 51

b. Present study's results. Use animation (see Chap. 3) to

communicate model to managers and other people who are not familiar with all of the model details.

Discuss model building and validation process to promote credibility.c. Results are used in decision-making

process if they are both valid and credible.

Page 62: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 62 of 51

1.8 OTHER TYPES OF SIMULATION

• Continuous simulation– Typically, solve sets of differential equations numerically over

time

– May involve stochastic elements

– Some specialized software available; some discrete-event simulation software will do continuous simulation as well

• Combined discrete-continuous simulation– Continuous variables described by differential equations

– Discrete events can occur that affect the continuously-changing variables

– Some discrete-event simulation software will do combined discrete-continuous simulation as well

Page 63: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 63 of 51

1.8 Other Types of Simulation (cont’d.)

• Monte Carlo simulation– No time element (usually)– Wide variety of mathematical problems– Example: Evaluate a “difficult” integral

Let X ~ U(a, b), and let Y = (b – a) g(X) Then

Algorithm: Generate X ~ U(a, b), let Y = (b – a) g(X); repeat; average the Y’s … this average will be an unbiased estimator of I

Page 64: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 64 of 51

1.9 ADVANTAGES, DISADVANTAGES, AND PITFALLS OF SIMULATION

• Advantages– Simulation allows great flexibility in modeling complex systems,

so simulation models can be highly valid– Easy to compare alternatives– Control experimental conditions– Can study system with a very long time frame

• Disadvantages– Stochastic simulations produce only estimates – with noise– Simulation models can be expensive to develop– Simulations usually produce large volumes of output – need to

summarize, statistically analyze appropriately• Pitfalls

– Failure to identify objectives clearly up front– In appropriate level of detail (both ways)– Inadequate design and analysis of simulation experiments– Inadequate education, training

Page 65: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 65 of 51

APPENDIX 1B A PRIMER ON QUEUEING SYSTEMS

A queueing system consists of one or more servers that provide service of some kind to arriving customers. Customers who arrive to find all servers busy (generally) join one or more queues (or lines) in front of the servers, hence the name "queueing" system.

Historically, a large proportion of all discrete-event simulation studies have in volved the modeling of a real-world queueing system, or at least some component of the system being simulated was a queueing system.

Page 66: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 66 of 51

Thus, we believe that it is im portant for the student of simulation to have at least a basic understanding of the components of a queueing system, standard notation for queueing systems, and measures of performance that are often used to indicate the quality of service being provided by a queueing system. Some examples of real-world queueing systems that have often been simulated are given in Table 1.4. For additional information on queueing systems in general, see Gross and Harris (1998). Bertsekas and Gallager (1992) is recommended for those interested in queueing models of communications networks. Finally, Shanthikumar and Buzacott (1993) discuss stochastic models of manufacturing systems.

Page 67: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 67 of 51

System Servers Customers

Bank Tellers Customers

Hospital Doctors, nurses, beds Patients

Computer System Central processing unit, input/output devices

Jobs

Manufacturing System Machines, workers Parts

Airport Runways, gates, security check-in-stations

Airplanes, travelers

Communications network

Nodes, links Messages, Packets

TABLE 1.4Examples of queueing system

Page 68: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 68 of 51

1B.1 COMPONENTS OF A QUEUEING SYSTEM

A queueing system is characterized by three components: arrival process, service mechanism, and queue discipline. Specifying the arrival process for a queueing sys tem consists of describing how customers arrive to the system. Let Ai be the inter arrival time between the arrivals of the (i — l)st and ith customers (see Sec. 1.3). If A1, A2,... are assumed to be IID random variables, we shall denote the mean (or ex pected) inter arrival time by E(A) and call λ == 1 /E(A) the arrival rate of customers.

Page 69: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 69 of 51

The service mechanism for a queueing system is articulated by specifying the number of servers (denoted by s), whether each server has its own queue or there is one queue feeding all servers, and the probability distribution of customers' service times. Let 5; be the service time of the ith arriving customer. If S1, S2. . .are IID random variables, we shall denote the mean service time of a customer by E(S) and call w = 1/E(S) the service rate of a server.The queue discipline of a queueing system refers to the rule that a server uses to choose the next customer from the queue (if any) when the server completes the service of the current customer.

Page 70: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 70 of 51

Commonly used queue disciplines includeFIFO: Customers are served in a first-in, first-out manner. LIFO: Customers are served in a last-in, first-out manner (see Prob. 2.17). Priority: Customers are served in order of their importance (see Prob. 2.22) or on the basis of their service requirements (see Probs. 1.24, 2.20, and 2.21).1B.2 NOTATION FOR QUEUEING SYSTEMSCertain queueing systems occur so often in practice that standard notations have been developed for them. In particular, consider the queueing system shown in Fig. 1.71, which has the following characteristics:

Page 71: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 71 of 51

1. s servers in parallel and one FIFO queue feeding all servers

2. A1 A2 ... are IID random variables.

3. S1, S2, ….. are IID random variables.4. The Ai’s and Si’s are independent.

Page 72: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 72 of 51

We call such a system a GI/G/s queue, where GI (general independent) refers to the ' distribution of the Ai's and G (general) refers to the distribution of the Si’s. If spe cific distributions are given for the Ai’s and the Si’s (as is always the case for simu lation), symbols denoting these distributions are used in place of GI and G. The symbol M is used for the exponential distribution because of the Markovian, i.e., memory less, property of the exponential distribution (see Prob. 4.26), the symbol EK for a k-Erlang distribution (if X is a k-Erlang random variable, then , where the V/s are IID exponential random variables), and D-for deterministic (or constant) times. Thus, a single-server queueing system with exponential inter arrival times and service times and a FIFO queue discipline is called an M/M/l queue.

k

i iYX1

Page 73: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 73 of 51

For any GI/G/s queue, we shall call the quantity p = λ / (sw) the utilization factor of the queueing system (sw is the service rate of the system when all servers are busy). It is a measure of how heavily the resources of a queueing system are utilized.

1B.3 MEASURES OF PERFORMANCE FOR QUEUEING SYSTEMS

There are many possible measures of performance for queueing systems. We now describe four such measures that are usually used in the mathematical study of queueing systems. The reader should not infer from our choices that these measures are necessarily the most relevant or important in practice (see Chap. 9 for further discussion). As a matter of fact, for some real-world systems these measures may not even be well defined; i.e., they may not exist.

Page 74: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 74 of 51

Let

Di = delay in queue of ith customer Wi = Di + Si= waiting time in system of ith customerQ(t) = number of customers in queue at time tL(t) = number of customers in system at time t [Q(t) plus number of customers being served at time t]Then the measures

n

Dd

n

ii

n

1lim w.p.1

n

Ww

n

ii

n

1limand w.p.1

(if they exist) are called the steady-state average delay and the steady-state average waiting time. Similarly, the measures

Page 75: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 75 of 51

T

dttQQ

T

T

0)(

lim

T

dttLL

T

T

0)(

limand w.p.1

w.p.1

(if they exist) are called the steady-state time-average number in queue and the steady-state time-average number in system. Here and throughout this book, the qualifier "w.p. 1" (with probability 1) is given for mathematical correctness and has little practical significance. For example, suppose that (w.p. 1) for some queueing system. This means that if one performs a very large (an infinite) number of experiments, then in virtually every experiment con verges to the finite quantity d. Note that p < 1 is a necessary condition for d, w, Q, and L to exist for a GI/G/s queue.

Page 76: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 76 of 51

Among the most general and useful results for queueing systems are the con servation equations

Q=λd and L = λw

These equations hold for every queueing system for which d and w exist [see Stidham (1974)]. (Section 11.5 gives a simulation application of these relationships.) Another equation of considerable practical value is given by

w = d + E(S)

(See Sec. 1.4.6 and also Sec. 11.5 for further discussion).

Page 77: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 77 of 51

It should be mentioned that the measures of performance discussed above can be analytically computed for M/M/s queues (s 1), M/G/1 queues for any distrib ution G, and for certain other queueing systems. In general, the inter-arrival-time distribution, the service-time distribution, or both must be exponential (or a variant of exponential, such as k-Erlang) for analytic solutions to be possible [see Gross and Harris (1998)].

Page 78: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 78 of 51

For example, in the case of an M/M/1 queue, it can be shown analytically that the steady-state average number in system is given by

L = p/(1 - p)

Page 79: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 79 of 51

which we plot as a function of p in Fig. 1.72. Note that L is clearly not a linear func tion of p, and for p > 0.8 the plot of L increases exponentially. Although the for mula for L is specifically for the M/M/1 queue, the nonlinear behavior seen in Fig. 1.72 is indicative of queueing systems in general.

Another interesting (and instructive) example of an analytical solution is the steady-state average delay in queue for an M/G/1 queue, given by

)(12

)( 2

SE

SESVard

Page 80: Simulation Modeling and Analysis – Chapter 1 – Basic Simulation ModelingSlide 1 of 51 Chapter 1 Basic Simulation Modeling.

Simulation Modeling and Analysis – Chapter 1 – Basic Simulation Modeling Slide 80 of 51

where Var(S) denotes the variance of the service-time distribution [see, for exam ple, Ross (1997, p. 444) for a derivation of this formula]. Thus, we can see that if E(S) is large, then congestion (here measured by d) will be larger; this is certainly to be expected. The formula also brings out the perhaps less obvious fact that con gestion also increases if the variability of the service-time distribution is large, even if the mean service time stays the same. Intuitively, this is because a highly variable service-time random variable will have a greater chance of taking on a large value (since it must be positive), which means that the (single) server will be tied up for a long time, causing the queue to build up.


Recommended