Skip to content

Contents

1 Introduction

A simulation is the imitation of the operation of a real-world process or system over time. Whether done by hand or on a computer, simulation involves the generation of an artificial history of a system and the observation of that artificial history to draw inferences concerning the operating characteristics of the real system.

The behavior of a system as it evolves over time is studied by developing a simulation model. This model usually takes the form of a set of assumptions concerning the operation of the system. These assumptions are expressed in mathematical, logical, and symbolic relationships between the entities, or objects of interest, of the system. Once developed and validated, a model can be used to investigate a wide variety of “what if” questions about the real-world system. Potential changes to the system can first be simulated, in order to predict their impact on system performance. Simulation can also be used to study systems in the design stage, before such systems are built. Thus, simulation modeling can be used both as an analysis tool for predicting the effect of changes to existing systems and as a design tool to predict the performance of new systems under varying sets of circumstances.

In some instances, a model can be developed which is simple enough to be “solved” by mathematical methods. Such solutions might be found by the use of differential calculus, probability theory, algebraic methods, or other mathematical techniques. The solution usually consists of one or more numerical parameters, which are called measures of performance of the system. However, many real-world systems are so complex that models of these systems are virtually impossible to solve mathematically. In these instances, numerical, computer-based simulation can be used to imitate the behavior of the system over time. From the simulation, data are collected as if a real system were being observed. This simulation-generated data is used to estimate the measures of performance of the system.

This chapter initially discusses when to use simulation, its advantages and disadvantages, and actual areas of its application. Then the concepts of system and model are explored. Finally, an outline is given of the steps in building and using a simulation model of a system.

1 When Simulation Is the Appropriate Tool

The availability of special-purpose simulation languages, of massive computing capabilities at a decreasing cost per operation, and of advances in simulation methodologies have made simulation one of the most widely used and accepted tools in operations research and systems analysis. Circumstances under which simulation is the appropriate tool to use have been discussed by many authors, from Naylor et al. [1966] to Shannon [1998]. Simulation can be used for the following purposes:

  1. Simulation enables the study of, and experimentation with, the internal interactions of a complex system or of a subsystem within a complex system.
  2. Informational, organizational, and environmental changes can be simulated, and the effect of these alterations on the model’s behavior can be observed.
  3. The knowledge gained during the designing of a simulation model could be of great value toward suggesting improvement in the system under investigation.
  4. Changing simulation inputs and observing the resulting outputs can produce valuable insights about which variables are the most important and how variables interact.
  5. Simulation can be used as a pedagogical device to reinforce analytic solution methodologies.
  6. Simulation can be used to experiment with new designs or policies before implementation, so as to prepare for what might happen.
  7. Simulation can be used to verify analytic solutions.
  8. Simulating different capabilities for a machine can help determine its requirements.
  9. Simulation models designed for training make learning possible, without the cost and disruption of on-the-job instruction.
  10. Animation can show a system in simulated operation so that the plan can be visualized.
  11. A modern system (factory, wafer fabrication plant, service organization, etc.) is so complex that its internal interactions can be treated only through simulation.

2 When Simulation Is Not Appropriate

This section is based on an article by Banks and Gibson [1997], which gives ten rules for evaluating when simulation is not appropriate. The first rule indicates that simulation should not be used when the problem can be solved by common sense. An example is given of an automobile tag facility serving customers who arrive randomly at an average rate of 100/hour and are served at a mean rate of 12/hour. To determine the minimum number of servers needed, simulation is not necessary. Just compute 100/12 = 8.33, which indicates that nine or more servers are needed.

The second rule says that simulation should not be used if the problem can be solved analytically. For example, under certain conditions, the average waiting time in the example above can be found using the tools available at www.bcnn.net.

The next rule says that simulation should not be used if it is less expensive to perform direct experiments. The example of a fast-food drive-in restaurant is given, where it was less expensive to stage a person taking orders using a hand-held terminal and voice communication to determine the effect of adding another order station on customer waiting time.

The fourth rule says not to use simulation if the costs exceed the savings. There are many steps in completing a simulation, as will be discussed in Section 12, and these must be done thoroughly. If a simulation study costs $20,000 and the savings might be $10,000, simulation would not be appropriate.

Rules five and six indicate that simulation should not be performed if the resources or time are not available. If the simulation is estimated to cost $20,000 and there is only $10,000 available, the suggestion is not to venture into a simulation study. Similarly, if a decision is needed in two weeks and a simulation would take a month, the simulation study is not advised.

Simulation takes data, sometimes lots of data. If no data is available, not even estimates, simulation is not advised. The next rule concerns the ability to verify and validate the model. If there is not enough time or if the personnel are not available, simulation is not appropriate.

If managers have unreasonable expectations, if they ask for too much too soon, or if the power of simulation is overestimated, simulation might not be appropriate.

Last, if system behavior is too complex or cannot be defined, simulation is not appropriate. Human behavior is sometimes extremely complex to model.

3 Advantages and Disadvantages of Simulation

Simulation is intuitively appealing to a client because it mimics what happens in a real system or what is perceived for a system that is in the design stage. The output data from a simulation should directly correspond to the outputs that could be recorded from the real system. Additionally, it is possible to develop a simulation model of a system without dubious assumptions (such as the same statistical distribution for every random variable) of mathematically solvable models. For these and other reasons, simulation is frequently the technique of choice in problem solving.

In contrast to optimization models, simulation models are “run” rather than solved. Given a particular set of input and model characteristics, the model is run and the simulated behavior is observed. This process of changing inputs and model characteristics results in a set of scenarios that are evaluated. A good solution, either in the analysis of an existing system or in the design of a new system, is then recommended for implementation.

Simulation has many advantages, but some disadvantages. These are listed by Pegden, Shannon, and Sadowski [1995]. Some advantages are these:

  1. New policies, operating procedures, decision rules, information flows, organizational procedures, and so on can be explored without disrupting ongoing operations of the real system.
  2. New hardware designs, physical layouts, transportation systems, and so on can be tested without committing resources for their acquisition.
  3. Hypotheses about how or why certain phenomena occur can be tested for feasibility.
  4. Time can be compressed or expanded to allow for a speed-up or slow-down of the phenomena under investigation.
  5. Insight can be obtained about the interaction of variables.
  6. Insight can be obtained about the importance of variables to the performance of the system.
  7. Bottleneck analysis can be performed to discover where work in process, information, materials, and so on are being delayed excessively.
  8. A simulation study can help in understanding how the system operates rather than how individuals think the system operates.
  9. “What if” questions can be answered. This is particularly useful in the design of new systems.

Some disadvantages are these:

  1. Model building requires special training. It is an art that is learned over time and through experience. Furthermore, if two models are constructed by different competent individuals, they might have similarities, but it is highly unlikely that they will be the same.
  2. Simulation results can be difficult to interpret. Most simulation outputs are essentially random variables (they are usually based on random inputs), so it can be hard to distinguish whether an observation is the result of system interrelationships or of randomness.
  3. Simulation modeling and analysis can be time consuming and expensive. Skimping on resources for modeling and analysis could result in a simulation model or analysis that is not sufficient to the task.
  4. Simulation is used in some cases when an analytical solution is possible, or even preferable, as was discussed in Section 2. This might be particularly true in the simulation of some waiting lines where closed-form queueing models are available.

In defense of simulation, these four disadvantages, respectively, can be offset as follows:

  1. Vendors of simulation software have been actively developing packages that contain models that need only input data for their operation. Such models have the generic tag “simulator” or “template.”
  2. Many simulation software vendors have developed output-analysis capabilities within their packages for performing very thorough analyses.
  3. Simulation can be performed faster today than yesterday and will be even faster tomorrow, because of advances in hardware that permit rapid running of scenarios and because of advances in many simulation packages. For example, some simulation software contains constructs for modeling material handling that uses such transporters as fork-lift trucks, conveyors, and automated guided vehicles.
  4. Closed-form models are not able to analyze most of the complex systems that are encountered in practice. During the many years of consulting practice by two of the authors, not one problem was encountered that could have been solved by a closed-form solution.

4 Areas of Application

The applications of simulation are vast. The Winter Simulation Conference (WSC) is an excellent way to learn more about the latest in simulation applications and theory. There are also numerous tutorials at both the beginning and advanced levels. WSC is sponsored by six technical societies and the National Institute of Standards and Technology (NIST). The technical societies are the American Statistical Association (ASA), the Association for Computing Machinery/Special Interest Group on Simulation (ACM/SIGSIM), the Institute of Electrical and Electronics Engineers: Systems, Man and Cybernetics Society (IEEE/SMCS), the Institute of Industrial Engineers (IIE), the Institute for Operations Research and the Management Sciences: Simulation Society (INFORMS-SIM), and the Society for Modeling and Simulation International (SCS). Information about the upcoming WSC can be obtained from www.wintersim.org. WSC programs with full papers are available from www.informs-cs.org/wscpapers.html. Some presentations, by area, from a recent WSC are listed next:

Manufacturing Applications

  • Methodology for Selecting the Most Suitable Bottleneck Detection Method
  • Automating the Development of Shipyard Manufacturing Models
  • Emulation in Manufacturing Engineering Processes
  • Optimized Maintenance Design for Manufacturing Performance Improvement
  • Productivity Management in an Automotive-Parts Industry
  • Manufacturing Line Designs in Japanese Automobile Manufacturing Plants

Wafer Fabrication

  • A Paradigm Shift in Assigning Lots to Tools
  • Scheduling a Multi-Chip Package Assembly Line with Reentrant Processes
  • Execution Level Capacity Allocation Decisions for Assembly—Test Facilities
  • Managing WIP and Cycle Time with the Help of Loop Control

Business Processing

  • A New Policy for the Service Request Assignment Problem
  • Process Execution Monitoring and Adjustment Schemes
  • In-Store Merchandizing of Retail Stores
  • Sales Forecasting for Retail Small Stores

Construction Engineering and Project Management

  • Scheduling of Limited Bar-Benders over Multiple Building Sites
  • Constructing Repetitive Projects
  • Traffic Operations for Improved Planning of Road Construction Projects
  • Template for Modeling Tunnel Shaft Construction
  • Decision Support Tool for Planning Tunnel Construction

Logistics, Transportation, and Distribution

  • Operating Policies for a Barge Transportation System
  • Dispensing Plan for Emergency Medical Supplies in the Event of Bioterrorism
  • Analysis of a Complex Mail Transportation Network
  • Improving the Performance of Container Terminals
  • Yard Crane Dispatching Based on Real Time Data
  • Unit Loading Device Inventory in Airline Operations
  • Inventory Systems with Forecast Based Policy Updating
  • Dock Allocation in a Food Distribution Center

Military Applications

  • Multinational Intra-Theatre Logistics Distribution
  • Examining Future Sustainability of Canadian Forces Operations
  • Feasibility Study for Replacing the MK19 Automatic Grenade Launching System
  • Training Joint Forces for Asymmetric Operations
  • Multi-Objective Unmanned Aerial Vehicle Mission Planning
  • Development of Operational Requirements Driven Federations

Health Care

  • Interventions to Reduce Appointment Lead-Time and Patient No-Show Rate
  • Supporting Smart Thinking to Improve Hospital Performance
  • Verification of Lean Improvement for Emergency Room Process
  • Reducing Emergency Department Overcrowding
  • Inventory Modeling of Perishable Pharmaceuticals
  • Implementation of an Outpatient Procedure Center
  • Infectious Disease Control Policy
  • Balancing Operating Room and Post-Anesthesia Resources
  • Cost Effectiveness of Colorectal Cancer Screening Tests

Additional Applications

  • Managing Workforce Resource Actions with Multiple Feedback Control
  • Analyzing the Impact of Hole-Size on Putting in Golf
  • Application of Particle Filters in Wildfire Spread Simulation
  • Predator-Prey Relationship in a Closed Habitat
  • Intensive Piglet Production Systems
  • Real-Time Delay Estimation in Call Centers
  • Pandemic Influenza Preparedness Plans for a Public University

For an article on the future of simulation appearing in the ICS Newsletter (Banks, 2008), sixteen simulationists, including well-known experts in the field, provided their response to the following question: “What remarkable results will we observe in simulation software in the long term, say, after three years?” The responses that are shown below appeared in the referenced article:

  • After new fundamental ideas and methodologies such as agent-based modeling have been adopted by the software vendors (which is going to happen within a few years), progress in simulation modeling will be driven by gains in computing power. For example, at a certain point we will be able to simulate the detailed operation of very large supply chains and manufacturing facilities.
  • Simulation modeling will be more of an “assembly” activity than a “build-from-scratch” activity. Intelligent, parameterized components will be used to piece together models rather than defining lots of detailed logic.
  • Progress will be made in solving hard problems. To provide tools for really hard problems, simulation software developers will have to go back to the drawing board and seriously reconsider the fundamental question: “Who provides the power, and who provides the vision?” Getting this mix right is essential to further progress. When a software developer tries to provide both power and vision, end users are saddled with the developer’s paradigms. This works well for easy problems, but poorly for hard problems. For all truly hard problems, users know more about the problems than software developers do. The obvious solution is for developers to provide well-thought-out collections of true primitives, along with ways of combining and packaging these primitives.
  • Simulation software will be integrated more closely with control software.
  • Modelers will have a single model that is shared across applications within the organization.
  • Simulation applications will not be restricted to design applications but will also be used to make day-to-day operational decisions within an organization.
  • Simulation modeling on powerful servers will be accessed with web-based interfaces.
  • Better and easier modeling of human activities (e.g. embedding agent-based models into discrete-event models) will be available.
  • More collaborative simulation project development can be expected.
  • Interface standards and incorporation of web services allowing simulation software to not only work with each other as an integrated federation, but also standardize and simplify the way other applications interface with simulation software will be adopted.
  • Analytical solving techniques (such as linear programming) will be integrated with simulation capabilities.
  • The “remarkable” results will be derived from advances in other areas of computing technology and software engineering. But nothing will surpass the object-oriented paradigm that was ushered into mainstream software development by SIMULA 67, emanating from the simulation software community.

5 Some Recent Applications of Simulation

In this section, we present some recent applications of simulation. These have appeared in the literature indicated so you can find these cases and learn more details about them.

Case 1

  • TITLE: “The Turkish Army Uses Simulation to Model and Optimize Its Fuel-Supply System”
  • AUTHOR(S): I. Sabuncuoglu, A. Hatip
  • REPORTED: November–December 2005 in Interfaces
  • CHALLENGE: Analysis of the Turkish army’s fuel-supply system.
  • TECHNIQUE(S): (1) Measured performance of the existing and proposed systems under various scenarios, (2) developed a simulation optimization model based on a genetic algorithm to optimize system performance, (3) conducted extensive simulation experiments.
  • SAVINGS: Millions of US$.

Case 2

  • TITLE: “PLATO Helps Athens Win Gold: Olympic Games Knowledge Modeling for Organizational Change and Resource Management”
  • AUTHOR(S): D.A. Beis, P. Poucopoulos, Y. Pyrgiotis, K.G. Zografos
  • REPORTED: January–February 2006 in Interfaces
  • CHALLENGE: Develop a systematic process for planning and designing venue operations. Develop a rich library of models that is directly transferable to future Olympic organizing committees and other sports-oriented events.
  • TECHNIQUE(S): Knowledge modeling and resource-management techniques and tools based on simulation and other decision analysis methodologies.
  • SAVINGS: Over US$69.7 million.

Case 3

  • TITLE: “Schlumberger Uses Simulation in Bidding and Executing Land Seismic Surveys”
  • AUTHOR(S): P.W. Mullarkey, G. Butler, S. Gavirneni, D.J. Morrice
  • REPORTED: March–April 2007 in Interfaces
  • CHALLENGE: Quickly and accurately measure the cost of seismic surveys.
  • TECHNIQUE(S): Developed a simulation tool to evaluate the impact of crew sizes, survey area, geographical region, and weather conditions on survey costs and durations.
  • SAVINGS: US1.5toUS1.5 to US3.0 million annually.

Case 4

  • TITLE: “Operations Research Helps Reshape Operations Strategy at Standard Register Company”
  • AUTHOR(S): S.L. Ahire, M.F. Gorman, D. Dwiggins, O. Mudry
  • REPORTED: November–December 2007 in Interfaces
  • CHALLENGE: Minimize the total costs to offer competitive pricing in the highly competitive traditional print market.
  • TECHNIQUE(S): (1) Regression to estimate costs and time attributes, (2) optimization modeling to determine the order-routing strategy, (3) simulation modeling of the production-distribution network.
  • SAVINGS: Over US$10 million annually.

Case 5

  • TITLE: “Simulation Implements Demand-Driven Workforce Scheduler for Service Industry”
  • AUTHOR(S): M. Zottolo, O.M. Ulgen, E. Williams
  • REPORTED: Proceedings of the 2007 Winter Simulation Conference, eds. S.G. Henderson, B. Biller, M.-H. Hsieh, J. Shortle, J.D. Tew, and R.R. Barton.
  • CONDUCTED BY: PMC (www.pmcorp.com)
  • CLIENT: Major US appliance company.
  • CHALLENGE: As a result of a time-consuming, manual, and inefficient scheduling process the client was experiencing over- and underscheduling of workgroups, inconsistent service levels being provided, and overwhelmed site managers.
  • TECHNIQUE(S): (1) Built simulation model to schedule different workgroups according to changes in customer demand during the day and servicing times, (2) determined work standards, (3) developed interface for input data as well as storing and publishing of schedules, (4) implemented and trained employees on the use of the scheduling tool.
  • SAVINGS: Estimated at US$80 million for client’s US facilities.

Case 6

  • TITLE: “Simulation Improves End-of-Line Sortation and Material Handling Pickup Scheduling at Appliance Manufacturer”
  • AUTHOR(S): N. Kale, M. Zottolo, O.M. Ulgen, E. Williams
  • CONDUCTED BY: PMC (www.pmcorp.com)
  • CLIENT: Major US car rental company. (as printed in the original)
  • REPORTED: Proceedings of the 2007 Winter Simulation Conference, eds. S.G. Henderson, B. Biller, M.-H. Hsieh, J. Shortle, J.D. Tew, and R.R. Barton.
  • CHALLENGE: To determine the most efficient method to distribute several types of finished appliances (SKUs) into a 12-lane sortation system in order to minimize the material handling and the number of forklifts required to pick them. This sortation task and its associated material-handling tasks were of a complexity meriting discrete-event simulation analysis due to volatile product mix, the large number of SKUs, and high overhead costs.
  • TECHNIQUE(S): Built simulation model and performed experimentation with respect to (1) assignment of different SKUs to the different lanes, (2) picking strategy and quantity, (3) SKU batch sizes.
  • SAVINGS: Estimated US$100,000 annually for a US$50,000 one-time capital investment.

6 Systems and System Environment

To model a system, it is necessary to understand the concept of a system and the system boundary. A system is defined as a group of objects that are joined together in some regular interaction or interdependence toward the accomplishment of some purpose. An example is a production system manufacturing automobiles. The machines, component parts, and workers operate jointly along an assembly line to produce a high-quality vehicle.

A system is often affected by changes occurring outside the system. Such changes are said to occur in the system environment [Gordon, 1978]. In modeling systems, it is necessary to decide on the boundary between the system and its environment. This decision may depend on the purpose of the study.

In the case of the factory system, for example, the factors controlling the arrival of orders may be considered to be outside the influence of the factory and therefore part of the environment. However, if the effect of supply on demand is to be considered, there will be a relationship between factory output and arrival of orders, and this relationship must be considered an activity of the system. Similarly, in the case of a bank system, there could be a limit on the maximum interest rate that can be paid. For the study of a single bank, this would be regarded as a constraint imposed by the environment. In a study of the effects of monetary laws on the banking industry, however, the setting of the limit would be an activity of the system [Gordon, 1978].

7 Components of a System

In order to understand and analyze a system, a number of terms need to be defined. An entity is an object of interest in the system. An attribute is a property of an entity. An activity represents a time period of specified length. If a bank is being studied, customers might be one of the entities, the balance in their checking accounts might be an attribute, and making deposits might be an activity.

The collection of entities that compose a system for one study might only be a subset of the overall system for another study [Law, 2007]. For example, if the aforementioned bank is being studied to determine the number of tellers needed to provide for paying and receiving, the system can be defined as that portion of the bank consisting of the regular tellers and the customers waiting in line. If the purpose of the study is expanded to determine the number of special tellers needed (to prepare cashier’s checks, to conduct commercial transactions, etc.), the definition of the system must be expanded.

The state of a system is defined to be that collection of variables necessary to describe the system at any time, relative to the objectives of the study. In the study of a bank, possible state variables are the number of busy tellers, the number of customers waiting in line or being served, and the arrival time of the next customer. An event is defined as an instantaneous occurrence that might change the state of the system. The term endogenous is used to describe activities and events occurring within a system, and the term exogenous is used to describe activities and events in the environment that affect the system. In the bank study, the arrival of a customer is an exogenous event, and the completion of service of a customer is an endogenous event.

Table 1 lists examples of entities, attributes, activities, events, and state variables for several systems. Only a partial listing of the system components is shown. A complete list cannot be developed unless the purpose of the study is known. Depending on the purpose, various aspects of the system will be of interest, and then the listing of components can be completed.

Table 1 Examples of Systems and Their Components

SystemEntitiesAttributesActivitiesEventsState Variables
BankingCustomersChecking-account balanceMaking depositsArrival; departureNumber of busy tellers; number of customers waiting
Rapid railRidersOrigin; destinationTravelingArrival at station; arrival at destinationNumber of riders waiting at each station; number of riders in transit
ProductionMachinesSpeed; capacity; breakdown rateWelding; stampingBreakdownStatus of machines (busy, idle, or down)
CommunicationsMessagesLength; destinationTransmittingArrival at destinationNumber waiting to be transmitted
InventoryWarehouseCapacityWithdrawingDemandLevels of inventory; backlogged demands
Table 1 as printed in the original book

8 Discrete and Continuous Systems

Systems can be categorized as discrete or continuous. “Few systems in practice are wholly discrete or continuous, but since one type of change predominates for most systems, it will usually be possible to classify a system as being either discrete or continuous” [Law, 2007]. A discrete system is one in which the state variable(s) change only at a discrete set of points in time. The bank is an example of a discrete system: The state variable, the number of customers in the bank, changes only when a customer arrives or when the service provided a customer is completed. Figure 1 shows how the number of customers changes only at discrete points in time.

Figure 1 Discrete-system state variable

Figure 1 Discrete-system state variable.

A continuous system is one in which the state variable(s) change continuously over time. An example is the head of water behind a dam. During and for some time after a rain storm, water flows into the lake behind the dam. Water is drawn from the dam for flood control and to make electricity. Evaporation also decreases the water level. Figure 2 shows how the state variable head of water behind the dam changes for this continuous system.

Figure 2 Continuous-system state variable

Figure 2 Continuous-system state variable.

9 Model of a System

Sometimes it is of interest to study a system to understand the relationships between its components or to predict how the system will operate under a new policy. To study the system, it is sometimes possible to experiment with the system itself. However, this is not always an option. A new system might not yet exist; it could be in only hypothetical form or at the design stage. Even if the system exists, it might be impractical to experiment with it. In the case of a bank, reducing the number of tellers to study the effect on the length of waiting lines might infuriate the customers so greatly that they will move their accounts to a competitor. Consequently, studies of systems are often accomplished with a model of a system.

We had a consulting job for the simulation of a redesigned port in Western Australia. At US$300 million for a loading/unloading berth, it is not advisable to invest that amount only to find that the berth is inadequate for the task.

A model is defined as a representation of a system for the purpose of studying that system. For most studies, it is only necessary to consider those aspects of the system that affect the problem under investigation. These aspects are represented in a model of the system; the model, by definition, is a simplification of the system. On the other hand, the model should be sufficiently detailed to permit valid conclusions to be drawn about the real system. Different models of the same system could be required as the purpose of investigation changes.

Just as the components of a system include entities, attributes, and activities, so too models are represented. However, the model contains only those components that are relevant to the study.

10 Types of Models

Models can be classified as being mathematical or physical. A mathematical model uses symbolic notation and mathematical equations to represent a system. A simulation model is a particular type of mathematical model of a system. A physical model is a larger or smaller version of an object such as the enlargement of an atom or a scaled-down version of the solar system.

Simulation models may be further classified as being static or dynamic, deterministic or stochastic, and discrete or continuous. A static simulation model, sometimes called a Monte Carlo simulation, represents a system at a particular point in time. Dynamic simulation models represent systems as they change over time. The simulation of a bank from 9:00 A.M. to 4:00 P.M. is an example of a dynamic simulation.

Simulation models that contain no random variables are classified as deterministic. Deterministic models have a known set of inputs, that will result in a unique set of outputs. Deterministic arrivals would occur at a dentist’s office if all patients arrived at their scheduled appointment times. A stochastic simulation model has one or more random variables as inputs. Random inputs lead to random outputs. Since the outputs are random, they can be considered only as estimates of the true characteristics of a model. The simulation of a bank would usually involve random interarrival times and random service times. Thus, in a stochastic simulation, the output measures—the average number of people waiting, the average waiting time of a customer—must be treated as statistical estimates of the true characteristics of the system.

Discrete and continuous systems were defined in Section 7. Discrete and continuous models are defined in an analogous manner. However, a discrete simulation model is not always used to model a discrete system, nor is a continuous simulation model always used to model a continuous system. Tanks and pipes might be modeled discretely, even though we know that fluid flow is continuous. In addition, simulation models may be mixed, both discrete and continuous. The choice of whether to use a discrete or continuous (or both discrete and continuous) simulation model is a function of the characteristics of the system and the objective of the study. Thus, a communication channel could be modeled discretely if the characteristics and movement of each message were deemed important. Conversely, if the flow of messages in aggregate over the channel were of importance, modeling the system via continuous simulation could be more appropriate. The models emphasized in this text are dynamic, stochastic, and discrete.

11 Discrete-Event System Simulation

This is a text about discrete-event system simulation. Discrete-event system simulation is the modeling of systems in which the state variable changes only at a discrete set of points in time. The simulation models are analyzed by numerical rather than analytical methods. Analytical methods employ the deductive reasoning of mathematics to “solve” the model. For example, differential calculus can be used to compute the minimum-cost policy for some inventory models. Numerical methods employ computational procedures to “solve” mathematical models. In the case of simulation models, which employ numerical methods, models are “run” rather than solved—that is, an artificial history of the system is generated from the model assumptions, and observations are collected to be analyzed and to estimate the true system performance measures. Real-world simulation models are rather large, and the amount of data stored and manipulated is vast, so such runs are usually conducted with the aid of a computer.

In summary, this text is about discrete-event system simulation in which the models of interest are analyzed numerically, usually with the aid of a computer.

12 Steps in a Simulation Study

Figure 3 shows a set of steps to guide a model builder in a thorough and sound simulation study. Similar figures and discussion of steps can be found in other sources [Shannon, 1975; Gordon, 1978; Law, 2007]. The number beside each symbol in Figure 3 refers to the more detailed discussion in the text. The steps in a simulation study are as follows:

Figure 3 Steps in a simulation study

Figure 3 Steps in a simulation study.

1. Problem formulation

Every study should begin with a statement of the problem. If the statement is provided by the policymakers or those that have the problem, the analyst must ensure that the problem being described is clearly understood. If a problem statement is being developed by the analyst, it is important that the policymakers understand and agree with the formulation. Although not shown in Figure 3, there are occasions where the problem must be reformulated as the study progresses. In many instances, policymakers and analysts are aware that there is a problem long before the nature of the problem is known.

2. Setting of objectives and overall project plan

The objectives indicate the questions to be answered by simulation. At this point, a determination should be made concerning whether simulation is the appropriate methodology for the problem as formulated and the objectives as stated. Assuming that it is decided that simulation is appropriate, the overall project plan should include a statement of the alternative systems to be considered and of a method for evaluating the effectiveness of these alternatives. It should also include the plans for the study in terms of the number of people involved, the cost of the study, and the number of days required to accomplish each phase of the work, along with the results expected at the end of each stage.

3. Model conceptualization

The construction of a model of a system is probably as much art as science. Pritsker [1998] provides a lengthy discussion of this step. “Although it is not possible to provide a set of instructions that will lead to building successful and appropriate models in every instance, there are some general guidelines that can be followed” [Morris, 1967]. The art of modeling is enhanced by an ability to abstract the essential features of a problem, to select and modify basic assumptions that characterize the system, and then to enrich and elaborate the model until a useful approximation results. Thus, it is best to start with a simple model and build toward greater complexity. However, the model complexity need not exceed that required to accomplish the purposes for which the model is intended. Violation of this principle will only add to model-building and computer expenses. It is not necessary to have a one-to-one mapping between the model and the real system. Only the essence of the real system is needed.

It is advisable to involve the model user in model conceptualization. Involving the model user will both enhance the quality of the resulting model and increase the confidence of the model user in the application of the model. (However, only experience with real systems—versus textbook problems—can “teach” the art of model building.)

4. Data collection

There is a constant interplay between the construction of the model and the collection of the needed input data [Shannon, 1975]. As the complexity of the model changes, the required data elements can also change. Also, since data collection takes such a large portion of the total time required to perform a simulation, it is necessary to begin as early as possible, usually together with the early stages of model building.

The objectives of the study dictate, in a large way, the kind of data to be collected. In the study of a bank, for example, if the desire is to learn about the length of waiting lines as the number of tellers changes, the types of data needed would be the distributions of interarrival times (at different times of the day), the service-time distributions for the tellers, and historic distributions on the lengths of waiting lines under varying conditions. This last type of data will be used to validate the simulation model. (See an excellent discussion by Henderson [2003].)

5. Model translation

Most real-world systems result in models that require a great deal of information storage and computation, so the model must be entered into a computer-recognizable format. We use the term program even though it is possible, in many instances, to accomplish the desired result with little or no actual coding. The modeler must decide whether to program the model in a simulation language, such as GPSS/H™, or to use special-purpose simulation software. For manufacturing and material handling, there exists such software as AnyLogic®, Arena®, AutoMod™, Enterprise Dynamics®, Extend™, Flexsim, ProModel®, and SIMUL8®. Simulation languages are powerful and flexible. However, if the problem is amenable to solution with the simulation software, the model development time is greatly reduced. Furthermore, most simulation software packages have added features that enhance their flexibility, although the amount of flexibility varies greatly.

6. Verified?

Verification pertains to the computer program that has been prepared for the simulation model. Is the computer program performing properly? With complex models, it is difficult, if not impossible, to translate a model successfully in its entirety without a good deal of debugging; if the input parameters and logical structure of the model are correctly represented in the computer, verification has been completed. For the most part, common sense is used in completing this step. (Sargent [2007] discusses this topic.)

7. Validated?

Validation usually is achieved through the calibration of the model, an iterative process of comparing the model against actual system behavior and using the discrepancies between the two, and the insights gained, to improve the model. This process is repeated until model accuracy is judged acceptable. In the previously mentioned example of a bank, data was collected concerning the length of waiting lines under current conditions. Does the simulation model replicate this system measure? This is one means of validation. (Sargent [2007] discusses this topic.)

8. Experimental design

The alternatives that are to be simulated must be determined. Often, the decision concerning which alternatives to simulate will be a function of runs that have been completed and analyzed. For each system design that is simulated, decisions need to be made concerning the length of the initialization period, the length of simulation runs, and the number of replications to be made of each run. (Sanchez [2007] discusses this topic extensively.)

9. Production runs and analysis

Production runs and their subsequent analysis, are used to estimate measures of performance for the system designs that are being simulated. (Software to aid in this step, include AutoStat (in AutoMod), OptQuest (in several pieces of simulation software), and SimRunner (in ProModel).)

10. More runs?

Given the analysis of runs that have been completed, the analyst determines whether additional runs are needed and what design those additional experiments should follow.

11. Documentation and reporting

There are two types of documentation: program and progress. Program documentation is necessary for numerous reasons. If the program is going to be used again by the same or different analysts, it could be necessary to understand how the program operates. This will create confidence in the program, so that model users and policymakers can make decisions based on the analysis. Also, if the program is to be modified by the same or a different analyst, this step can be greatly facilitated by adequate documentation. One experience with an inadequately documented program is usually enough to convince an analyst of the necessity of this important step. Another reason for documenting a program is so that model users can change parameters at will in an effort to learn the relationships between input parameters and output measures of performance or to discover the input parameters that “optimize” some output measure of performance.

Musselman [1998] discusses progress reports that provide the important, written history of a simulation project. Project reports give a chronology of work done and decisions made. This can prove to be of great value in keeping the project on course. Musselman suggests frequent reports (monthly, at least) so that even those not involved in the day-to-day operation can be kept abreast. The awareness of these others can often enhance the successful completion of the project by surfacing misunderstandings early, when the problem can be solved easily. Musselman also suggests maintaining a project log to provide a comprehensive record of accomplishments, change requests, key decisions, and other items of importance.

On the reporting side, Musselman suggests frequent deliverables. These may or may not be the results of major accomplishments. His maxim is that “it is better to work with many intermediate milestones than with one absolute deadline.” Possibilities prior to the final report include a model specification, prototype demonstrations, animations, training results, intermediate analyses, program documentation, progress reports, and presentations. He suggests that these deliverables should be timed judiciously over the life of the project.

The results of all the analysis should be reported clearly and concisely in a final report. This will allow the model users (now the decision makers) to review the final formulation, the alternative systems that were addressed, the criteria by which the alternatives were compared, the results of the experiments, and the recommended solution(s) to the problem. Furthermore, if decisions have to be justified at a higher level, the final report should provide a vehicle of certification for the model user/decision maker and add to the credibility of the model and of the model-building process.

12. Implementation

The success of the implementation phase depends on how well the previous eleven steps have been performed. It is also contingent upon how thoroughly the analyst has involved the ultimate model user during the entire simulation process. If the model user has been involved during the entire model-building process and if the model user understands the nature of the model and its outputs, the likelihood of a vigorous implementation is enhanced [Pritsker, 1995]. Conversely, if the model and its underlying assumptions have not been properly communicated, implementation will probably suffer, regardless of the simulation model’s validity.

The simulation-model building process shown in Figure 3 can be broken down into four phases. The first phase, consisting of steps 1 (Problem formulation) and 2 (Setting of objective and overall design), is a period of discovery or orientation. The initial statement of the problem is usually quite “fuzzy,” the initial objectives will usually have to be reset, and the original project plan will usually have to be fine-tuned. These recalibrations and clarifications could occur in this phase or perhaps will occur after or during another phase (i.e., the analyst might have to restart the process).

The second phase is related to model building and data collection and includes steps 3 (Model conceptualization), 4 (Data collection), 5 (Model translation), 6 (Verification), and 7 (Validation). A continuing interplay is required among the steps. Exclusion of the model user during this phase can have dire implications at the time of implementation.

The third phase concerns the running of the model. It involves steps 8 (Experimental design), 9 (Production runs and analysis), and 10 (More runs). This phase must have a comprehensively conceived plan for experimenting with the simulation model. A discrete-event stochastic simulation is, in fact, a statistical experiment. The output variables are estimates that contain random error, and therefore a proper statistical analysis is required. Such a philosophy is in contrast to that of the analyst who makes a single run and draws an inference from that single data point.

The fourth phase, implementation, involves steps 11 (Documentation and reporting) and 12 (Implementation). Successful implementation depends on continual involvement of the model user and on the successful completion of every step in the process. Perhaps the most crucial point in the entire process is Step 7 (Validation), because an invalid model is going to lead to erroneous results, which, if implemented, could be dangerous, costly, or both.

References

BANKS, J. [2008], “Some Burning Questions about Simulation.” ICS Newsletter, INFORMS Computing Society, Spring.

BANKS, J., and R. R. GIBSON [1997], “Don’t Simulate When: 10 Rules for Determining when Simulation Is Not Appropriate,” IIE Solutions, September.

GORDON, G. [1978], System Simulation, 2d ed., Prentice-Hall, Englewood Cliffs, NJ.

HENDERSON, S. G. [2003], “Input Model Uncertainty: Why Do We Care and What Should We Do About It?” in Proceedings of the Winter Simulation Conference, eds. S. Chick, P. J. Sánchez, D. Ferrin, and D. J. Morrice, New Orleans, LA, Dec. 7–10, pp. 90–100.

KLEIJNEN, J. P. C. [1998], “Experimental Design for Sensitivity Analysis, Optimization, and Validation of Simulation Models,” in Handbook of Simulation, ed. J. Banks, John Wiley, New York.

LAW, A. M. [2007], Simulation Modeling and Analysis, 4th ed., McGraw–Hill, New York.

MORRIS, W. T. [1967], “On the Art of Modeling,” Management Science, Vol. 13, No. 12.

MUSSELMAN, K. J. [1998], “Guidelines for Success,” in Handbook of Simulation, ed. J. Banks, John Wiley, New York.

NAYLOR, T. H., J. L. BALINTFY, D. S. BURDICK, and K. CHU [1966], Computer Simulation Techniques, Wiley, New York.

PEGDEN, C. D., R. E. SHANNON, and R. P. SADOWSKI [1995], Introduction to Simulation Using SIMAN, 2d ed., McGraw–Hill, New York.

PRITSKER, A. A. B. [1995], Introduction to Simulation and SLAM II, 4th ed., Wiley & Sons, New York.

PRITSKER, A. A. B. [1998], “Principles of Simulation Modeling,” in Handbook of Simulation, ed. J. Banks, John Wiley, New York.

SANCHEZ, S.R. [2007], “Work Smarter, Not Harder: Guidelines for Designing Simulation Experiments,” in Proceedings of the 2007 Winter Simulation Conference, eds. S. G. Henderson, B. Biller, M.-H. Hsieh, J. Shortle, J. D. Tew, and R. R. Barton, Washington, DC, Dec. 9–12, pp. 84–94.

SARGENT, R.G. [2007], “Verification and Validation of Simulation Models,” in Proceedings of the 2007 Winter Simulation Conference, eds. S. G. Henderson, B. Biller, M.-H. Hsieh, J. Shortle, J. D. Tew, and R. R. Barton, Washington, DC, Dec. 9–12, pp. 124–137.

SHANNON, R. E. [1975], Systems Simulation: The Art and Science, Prentice-Hall, Englewood Cliffs, NJ.

SHANNON, R. E. [1998], “Introduction to the Art and Science of Simulation,” in Proceedings of the Winter Simulation Conference, eds. D. J. Medeiros, E. F. Watson, J. S. Carson, and M. S. Manivannan, Washington, DC, Dec. 13–16, pp. 7–14.

Exercises

  1. Name several entities, attributes, activities, events, and state variables for the following systems:

    • (a) A cafeteria
    • (b) A grocery store
    • (c) A laundromat
    • (d) A fast-food restaurant
    • (e) A hospital emergency room
    • (f) A taxicab company with 10 taxis
    • (g) An automobile assembly line
  2. Consider the simulation process shown in Figure 3.

    • (a) Reduce the steps by at least two by combining similar activities. Give your rationale.
    • (b) Increase the steps by at least two by separating current steps or enlarging on existing steps. Give your rationale.
  3. A simulation of a major traffic intersection is to be conducted, with the objective of improving the current traffic flow. Provide three iterations, in increasing order of complexity, of steps 1 and 2 in the simulation process of Figure 3.

  4. A simulation is to be conducted of cooking a spaghetti dinner, to discover at what time a person should start in order to have the meal on the table by 7:00 P.M. Download a recipe from the web for preparing a spaghetti dinner (or ask a friend or relative for the recipe). As best you can, trace what you understand to be needed, in the data-collection phase of the simulation process of Figure 3, in order to perform a simulation in which the model includes each step in the recipe. What are the events, activities, and state variables in this system?

  5. What are the events and activities associated with the use of your checkbook?

  6. Numerous reasons for simulation were given in Section 1. But there may be other reasons. Look at applications in the current WSC Proceedings and see if you can discover additional reasons. (WSC Proceedings are found at www.informs-cs.org/wscpapers.html)

  7. In the current WSC Proceedings available at www.informs-cs.org/wscpapers.html, read an article on the application of simulation related to your major area of study or interest, and prepare a report on how the author accomplishes the steps given in Figure 3.

  8. Get a copy of a recent WSC Proceedings from the URL in Exercise 7 and report on the different applications discussed in an area of interest to you.

  9. Get a copy of a recent WSC Proceedings from the URL in Exercise 7 and report on the most unusual application that you can find.

  10. Locate one of the cases in Section 12 and describe the methodology used.

  11. Go to the Winter Simulation Conference website at www.wintersim.org and address the following:

    • (a) What advanced tutorials were offered at the previous WSC or are planned at the next WSC?
    • (b) Where and when will the next WSC be held?
  12. Go to the Winter Simulation Conference website at www.wintersim.org and address the following:

    • (a) When was the largest (in attendance) WSC, and how many attended?
    • (b) In what calendar year, from the beginning of WSC, was there no conference?
    • (c) What was the largest expanse of time, from the beginning of WSC, between occurrences of the Conference?
    • (d) Beginning with the 25th WSC, can you discern a pattern for the location of the conference?
  13. What is the procedure for contributing a paper to the WSC?

  14. Classify the list of vendors at a recent WSC as software vendors and others.

  15. What is the purpose and history of the WSC Foundation?

  16. Using your favorite search engine, search the web for ‘discrete event simulation output analysis’ and prepare a report discussing what you find.

  17. Using your favorite search engine, search the web for ‘supply chain simulation’ and prepare a report discussing what you find.

  18. Using your favorite search engine, search the web for ‘web based simulation’ and prepare a report discussing what you find.

2 Simulation Examples in a Spreadsheet

This chapter uses spreadsheet examples to provide an introduction to simulation. The examples are relatively simple; many can be carried out manually as well as in a spreadsheet. Our main purpose is to introduce and illustrate some of the key concepts in simulation; it is not to teach how to formulate or develop a spreadsheet model, but rather to use a few simple spreadsheet models to illustrate, by example, some of the key elements of any simulation. These key elements range from the components of a model to experimentation with the model.

Although some types of real-world simulation models, such as those for risk analysis, financial analysis, some reliability problems and others, are amenable to a spreadsheet formulation and solution, the spreadsheet has severe limitations for most complex real-world dynamic, event-based simulations. More often, these complex models are developed in a simulation package or general purpose programming language, not in a spreadsheet.

The spreadsheet examples include both Monte Carlo simulations and dynamic simulations that track events over time. Spreadsheet simulations are carried out by devising a simulation table tha provides a method for tracking system state over time. Although the simulation tables contain a number of common elements, in general they are ad hoc, meaning they are custom designed for the problem at hand. Due to its ad hoc nature, a general framework for carrying out dynamic discrete-even simulations is needed.

The key elements introduced in this chapter include the use of random numbers to represen uncertainty, the descriptive statistics used for predicting system performance in queueing and inventory models, and the advantage of thinking of a model in terms of inputs, activities, events, states, outputs and responses. These topics are introduced here via example.

Section 1 covers the basics, such as generating random samples and the basic components of a simulation model; subsequent examples depend on the concepts and techniques learned here. The examples in the remaining sections cover application areas such as coin tossing, queueing or waiting lines, inventory policies, reliability, hitting a target (bombing or a dart board), and projec network analysis. In the examples, we put limited focus on model implementation; instead, we focus on identifying model components (inputs, events, states, and so on) and conducting a simple experiment, the key concept being trials or replications.

All of the examples in this chapter have a spreadsheet solution in Excel on the text’s web site, www.bcnn.net. The spreadsheets include notes and comments, which add technical detail to each example, including implementation details, which may prove of value to a student modifying an existing model or developing a new spreadsheet simulation model, as requested in some of the exercises.

1 The Basics of Spreadsheet Simulation

In this section we cover the basic material that allows us to carry out the example simulations in the remainder of the chapter. We will learn how to generate random numbers in a spreadsheet simulation, and where to obtain them for a manual simulation. We will learn how to generate random samples for a few simple situations, such as tossing a coin, service and arrival times for queueing simulations, and random demand for inventory models. The methods learned here are sufficient for any of the simple discrete statistical distributions used in the examples in this chapter.

1.1 How to Simulate Randomness

Almost all of the simulation models considered in this text contain one or more random variables. Clearly with coin tossing, some mechanism is needed to simulate a random toss that will result in a head or a tail. In queueing models, both service times and interarrival times may be defined by a statistical distribution when the arrival times and service times are not known in advance and canno be predicted but follow a statistical pattern.

How do we get random quantities? We leave alone the theory and general explanations behind the generation of random numbers and random variables. In this chapter, we take a pragmatic, practica point of view: How do we get random quantities for a spreadsheet or manual simulation?

Generating any random quantity begins with generating a random number in the interval from 0 to 1. The term “random number” always refers to a randomly generated quantity in the unit interval between 0 and 1. In contrast, the term “random variable” refers to any randomly generated quantity with a specified statistical distribution. Any method for generating a sequence of random numbers is called a Random Number Generator (RNG).

The generation method for random numbers should produce a sequence of numbers that have two important statistical properties:

  1. The numbers should be uniformly distributed between 0 and 1.

  2. Subsequent numbers generated should be statistically independent of all previous numbers generated.

Uniformity implies, among other things, that the probability of falling in an interval (a, b) (with a and b between 0 and 1) equals the length of the interval, b a. Statistical independence implies, among other things, that knowing the value ofpreviously generated numbers does not help in any way in predicting the value of numbers generated subsequently. In addition, it implies that the correlation between successive numbers is zero.

The resulting numbers are often called pseudo-random numbers. One reason is the paradox that, while we want the generated numbers to be statistically uniform and independent, we also wan control. We want to be able to reproduce the sequence at any time so that simulation experiments can be controlled and reproduced, and for another practical reason: to assist in model developmen and debugging.

In general, how do we get these random numbers? Where do they come from? (In what follows, VBA stands for Visual Basic for Applications, the implementation of the VB programming language in Excel and other Microsoft Office applications.) Here are a number of standard sources for random numbers:

  1. In Excel, we can use the built-in worksheet function RAND in a formula in a cell. RAND generates values between 0 and 1. Typical examples of formulas using RAND include generating a random value between 0 and 1, as follows:
=RAND() = \mathrm{RAND()}

or in a more complex expression such as the following for generating one of two values, 0 or 1:

=IF(RAND()<=0.5,0,1) = \text{IF} (\text{RAND} () < = 0. 5, 0, 1)

Note that the IF worksheet function checks a condition in its first argument, and if the condition is true returns the first value; otherwise it returns the second value.

  1. Excel also provides the worksheet function, RANDBETWEEN(), that returns uniformly distributed integer values between a specified low and high value. Excel, or some of its add-ins, provide other functions to generate random values. We use none of these.

  2. In a worksheet cell in Excel, we can call a user-written VBA function that, in turn, calls an internal VBA library function such as Rnd() or the VBA function (MRG32k3a) available on the text’s web site. The spreadsheet examples in this chapter all have the VBA function Rnd01() that can be called from a cell. (Rnd01() simply calls the internal VBA library function Rnd().)

  3. Simulation packages provide methods to generate both random numbers and random variables from a long list of standard statistical distributions as well as from data.

  4. Most general-purpose programming languages provide a built-in library function to generate random numbers, and many provide facilities to generate samples from a variety of statistical distributions. Lacking this, the model developer can program one or more algorithms.

  5. For manual (paper-and-pencil) simulations, you could use a physical RNG such as tossing one or more coins, or throwing dice. These being impractical for all but the simplest cases, another possibility is a table of random numbers or random variables from a specific distribution, such as Tables A.1 (for uniform) and A.2 (for the standard normal) in the Appendix.

Neither the worksheet function RAND() nor the VB function Rnd() should be used in professional work; they both have known deficiencies. For example, the VB function Rnd() returns a single precision value (about 5 decimal place of accuracy), while all good RNG return double precision (about 15 decimal places); secondly, Rnd() has a short period—it repeats after generating a relatively small number of values. Its period is 2^24, about 16.77 million. The RAND() function has an even shorter period and more serious deficiencies regarding the two key properties of uniformity and independence. (Note that Microsoft changed the RAND() function in Office 2003; reportedly, i has both bugs and deficiencies and has been widely criticized.) We use RAND() only in Example 1, merely for instructional purposes. Since much better generators are readily available, including the VBA function MRG32k3a, on the text’s web site in the Excel file “RandomNumberTools.xls”, we feel strongly that there is no reason (or excuse) to use a deficient generator for professional work.

Most RNG can be initialized by a user-specified number called a seed. The VBA code behind the ‘Reset Seed & Run’ button in the spreadsheet examples shows how to set the seed for VBA’s Rnd() generator. Apparently, there is no way to set the seed for Excel’s RAND generator (another reason not to use it). The MRG32k3a generator (in “RandomNumberTools.xls”) comes with the VBA function, InitializeRNSeed(), for setting that generator’s seed. By specifying the seed, the user can make a random number generator repeat a sequence of numbers. This is valuable for debugging simulation models and repeating simulation experiments. Remember that we are simulating randomness; the control given by repeatability is a feature, not a bug.

1.2 The Random Generators Used in the Examples

Each example spreadsheet has a number of VBA functions for generating random variables in a few simple cases. We advise starting with an existing spreadsheet model when developing a new model; in this way, all the VBA functions written for the examples will be available for the new model.

The VBA functions and Excel worksheet functions for generating random values in a cell in a worksheet include the following:

  1. Rnd01(), to generate a random number between 0 and 1;

  2. DiscreteUniform(min, max), to generate a random integer from the minimum value, min, to the maximum value, max, where min and max can be numbers or a single-cell range containing the number;

  3. DiscreteEmp(rCumProb, rValues), to generate samples from a discrete distribution specified by two Excel ranges (ranges of cells), rCumProb for the cumulative probabilities, and rValues for the values;

  4. Uniform(low, high), to generate a real value (not just integers) from the continuous uniform distribution between low and high, where low and high are numbers or a cel containing a number;

  5. NORMSINV(Rnd01()), to generate a standard normal with mean 0 and standard deviation 1.

All of these functions, except NORMSINV(), are VBA functions written for the examples in this chapter; NORMSINV() is an Excel worksheet function that can be used (in the form given above) to generate a standard normal. We recommend not using the worksheet functions RAND() and RANDBETWEEN(). All spreadsheet solutions have access to any of the functions, whether used or not in the supplied solution; therefore, the example spreadsheets are good starting points for some of the exercises.

At this early point in the text, we do not expect the reader to completely understand how all of these work. Our goal, however, is that you understand the nature of the random values generated by each function, and be able to use them in the exercises if modifying an example or creating a new spreadsheet model. Each of these functions is explained in more detail as they are used in an example in later sections.

1.3 How to Use the Spreadsheets

The spreadsheet simulation models are in the ‘One Trial’ worksheet of each solution workbook. This sheet contains the definition and specification of model inputs, the simulation table containing the formulas to generate each row to carry the simulation forward, and some summary statistics (and usually a histogram) representing the results of one simulation run. The two buttons on the worksheet control the simulation:

  1. On each click, the ‘Generate New Trial’ button makes a new run of the simulation, using a new sequence of random numbers each time.

  2. On each click, the ‘Reset Seed & Run’ button sets the RNG seed to the value specified by the user in an adjacent cell, and then runs the simulation using this seed. The default seed is the arbitrary value 12,345.

You can always return to the initial results by clicking the ‘Reset Seed & Run’ button.

The ‘Experiment’ worksheet allows a user to conduct a simulation experiment by repeatedly executing the ‘One Trial’ worksheet, each time with different random numbers, and recording the designated model response (from the Link cell) to the Response Table. The user specifies the number of trials, for example, 100, meaning that the ‘One Trial’ worksheet will be executed 100 times and the 100 response values recorded in the Response Table. This is called replication; the number of replications is the number of trials.

The experimental results over all trials are summarized in the “Multi-Trial Summary” table on the ‘Experiment’ sheet. These summary statistics include frequency distributions and an accompanying histogram, and standard statistics such as sample average, median, minimum, and maximum. An example is shown in Table 6 in Section 2.

To run the experiment on the ‘Experiment’ worksheet, use the two buttons as follows:

  1. On each click, the ‘Run Experiment’ button makes one run of the experiment for the specified number of trials. Each subsequent click runs the experiment using different random numbers.

  2. On each click, the ‘Reset Seed & Run’ button sets the RNG seed to the specified value in an adjacent cell (default 12,345) and makes one run of the experiment. Each click reproduces the exact same original results.

The results given in all the examples in this chapter come from clicking the ‘Reset Seed & Run button; this guarantees that a reader can reproduce these same results. Each spreadsheet solution contains comments and explanations on different aspects of the solution, including the implementation of model logic; some solutions have a worksheet named ‘Explain’ with lengthier explanations of certain aspects of the model.

1.4 How to Simulate a Coin Toss

How can we simulate a coin toss in a spreadsheet model? The solution shows how to use a uniform random number generator in a spreadsheet simulation.

Example 1: Coin Tossing

We want to simulate a sequence of 10 coin tosses. The coin is a “fair” coin, meaning that the chance of getting a head is the same as getting a tail. Each has probability 0.5 of occurring. You should run the simulation multiple times and compare the results with your expectations from real-life coin tossing. This is an example of a Monte Carlo simulation; there are no events or clock times being tracked.

The solution, shown in Table 1, is in the spreadsheet “Example2.1CoinToss.xls”. In fact, there are four solutions in the spreadsheet, the first two using the RAND() random number generator, and the last two using the supplied VBA function Rnd01(). It is left as an exercise (at the end of the chapter) to devise a justification for the statistical equivalence of the 4 solutions, even though on any click of the button ‘Generate New Trial’, the 4 sets of results are different.

Table 1 Simulation Table for Coin Tossing

BCDEFGHI
11Solution #1ASolution #1BSolution #2ASolution #2B
12TossRAND()Solution using RN from ColCSolution using RAND()TossRnd01()Solution using RN from ColGSolution using Rnd01()
13
14
1510.7317089TT10.9871114TT
1620.8285837TT20.0225598HH
1730.0701168HT30.0008356HT
1840.2147295HH40.2127686HT
1950.8613179TH50.8586159TH
2060.4159098HH60.5503362TT
2170.7492317TH70.5243730TH
2280.9671661TT80.8884351TH
2390.4823089HT90.2111118HT
24100.6738897TH100.7680427TH

The spreadsheet logic for coin tossing is simple. The second solution (Column E) is:

=IF(RAND()<=0.5,"H","T") = \text{IF} (\text{RAND} () < = 0. 5, \text{"H","T"})

while the fourth solution (Column I) is:

=IF(Rnd01()<=0.5,"H","T") = \text{IF} (\text{Rnd01} () < = 0. 5, \text{"H","T"})

Each call to RAND() or Rnd01() produces a new random number. The ‘One Trial’ workshee records the frequency for heads versus tails in the 10 tosses and graphs the results in a histogram.

The first and third solutions are two steps, an approach that is useful when a generated random number is used more than once. Columns C and G contain the generated random number, and columns D and H the result (66H3or66T3)( ^ {66} \mathrm{H} ^ {3} \mathrm{o r} ^ {66} \mathrm{T} ^ {3} ). The fourth solution is the basis for the Coin Tossing Game in Example 4.

For all future spreadsheet simulations, we use the supplied VBA function, Rnd01(), or one of the VBA functions based on Rnd01(), instead of RAND(). However, for serious professional work, we recommend using the generator implemented in the VBA function, MRG32k3a, from the file “RandomNumberTools.xls”. As previously mentioned, both the Excel worksheet function, RAND(), and the VBA function, Rnd(), have serious limitations and deficiencies, and should only be used for casual or educational purposes.

1.5 How to Simulate a Random Service Time

The following example shows how to generate random samples from an arbitrary discrete distribution. The example is simple, having just 3 possible values of service time. The key principle, namely, the transformation from a random number to a service time of a prescribed probability, easily generalizes to any discrete distribution with a finite number of possible values.

The methods described here and in Section 1.6 for arrival times are used in almost all of the subsequent examples in the chapter.

Example 2: Random Service Times

An automated telephone information service spends either 3, 6, or 10 minutes with each caller. The proportion of calls for each service length is 30%, 45%, and 25%, respectively. We want to simulate these service times in a spreadsheet. Our actual purpose is to learn how to generate random samples from a discrete distribution, in preparation for the queueing, inventory, and other examples to follow. This also is an example of a Monte Carlo simulation.

Table 2 shows the input specification and a portion of the simulation table (the first 4 callers), taken from the spreadsheet model, “Example2.2ServiceTimes.xls”. The input specification defines the probabilities for the service times, and also includes the cumulative probabilities. Cumulative probabilities always increase to 1.0; as we shall see, the generation method uses the cumulative probabilities. The method always starts with a random number and ends with the desired value, in this case, a random service time with the specified distribution. The simulation table in the spreadsheet shows the resulting frequency distribution (or histogram) of the generated service times for 25 callers.

Table 2 Input Specification and Simulation Table for Service Times

ABCD
4Service TimeProbabilityCumulative Probability
5
6
730.300.30
860.450.75
9100.251.00
10
11Number of Callers=25
12Simulation Table
13StepActivity
14CallerService Time
15
1616
1726
18310
1946

Figure 1 illustrates how to transform a random number to a service time. Think of it as throwing a special dart at a special dart board; the dart will always land somewhere on the unit interval, with equal probability of landing at any of the points on the line between 0 and 1. The subinterval where the dart lands determines the value generated.

In Figure 1, the probabilities (at the top) are represented by non-overlapping segments on a uni interval, and must add up to 1. The cumulative probabilities (just below the line) are represented by points on the line. The arrows represent the transformation. The algorithm works as follows: First, choose a random number, say R. If R is in the first interval, that is, if R is less than or equal to 0.30, the procedure generates a sample of 3 minutes for service time. Similarly, if R is between 0.30 and 0.75, the service time is 6 minutes, and finally, if R is greater than 0.75, then the service time is 10 minutes. This algorithm easily generalizes to any discrete distribution

To illustrate the procedure, we first generate 5 samples of random numbers, either in Exce (using RAND or Rnd01 or any other random number generator), or take 5 samples from a table of random numbers such as Table A.1 in the Appendix. Suppose the 5 samples are: 0.98710.02260.00080.21280.8586

After the transformation illustrated in Figure 1, the resulting service times are: 10333 10

In a small sample (here, size 5), we cannot expect the observed frequencies of occurrence of each value to be close to the probabilities; however, with a large enough sample, the sample frequencies should be fairly close to the probabilities. You can experiment with the spreadsheet example, “Example2.2ServiceTimes.xls”, to see how close or far small samples can be from the assumed probabilities.

Figure 1 ‘‘Random Dart’’ Transformation from Random Number to Service Time.

In Excel, we might think we could implement this transformation, at least for distributions with a small number of values (here, 3), with a nested IF worksheet function, as in:

=IF(Rnd01()<=0.30,3,IF(Rnd01()<=0.75,6),10)(WRONG !!!) = \text{IF} (\text{Rnd01} () < = 0. 30, 3, \text{IF} (\text{Rnd01} () < = 0. 75, 6), 10)\tag{WRONG !!!}

This attempt at a solution introduces a grave error. Each reference to the Rnd01() function generates a new random number; the transformation procedure depends on usingjust one random number. (You may want to modify the spreadsheet solution in “Example2.2ServiceTimes.xls” with this incorrect solution to see the resulting probabilities.) This approach can be modified to use two cells, the first to hold the result from Rnd01, the second with a modified IF statement.

A better approach is to use the VBA function called DiscreteEmp() (for discrete empirical, meaning defined by data) supplied with all the examples. To see how this function is used, see the spreadsheet solution, “Example2.2ServiceTimes.xls”; a typical cell for generating a random service time appears as follows:

=DiscreteEmp(D7:D9,B7:B9) = \text{DiscreteEmp} (D 7: D 9, B 7: B 9)

where $ D$7:$ D$9 is the range of cells containing the cumulative probabilities and $ B$7:$ B$9 is the range of cells containing the desired values for service times. Discrete means that only the values listed will be generated. Each of the two worksheet ranges must be a column vector (meaning al data in one column), with each having the same length, that is, the same number of cells. The “$” in each address in front of each row and column indicates an absolute address rather than a relative address; this makes it easier to copy and paste the formula into all the cells in the “Service Time” column after typing it into just one cell.)

The method used here with the supplied VBA function, DiscreteEmp(), easily generalizes to most of the examples (and exercises) in the chapter that use simple discrete distributions for model inputs. To use DiscreteEmp(), supply two ranges in the worksheet, one for cumulative probabilities and the second for the desired values. It works with any number of values in the distribution.

In future examples, keep Figure 1 in mind; it illustrates exactly how DiscreteEmp() works. Although its VBA implementation involves a loop and may appear complex to a non-programmer, its basic logic is the simple logic of Figure 1 — the simple logic of throwing a dart at a special dar board, the unit interval, and a transformation.

1.6 How to Simulate a Random Arrival Time

In this section our goal is to learn how to generate random interarrival times (times between successive arrivals) and compute arrival times of customers or other entities to a system. The interarrival times, as well as the service times in Example 2, are examples of simulation-generated time durations, called activity times or activities. These are distinguished from arrival times, which are times on a simulation clock representing the time-of-arrival to a facility.

A simulation clock is a key component of every dynamic discrete-event simulation. In all of the Excel spreadsheet solutions, the clock times are labeled just above the appropriate column titles of the simulation table, so that you can easily distinguish between the activity times (service or interarrival times, for example) and the computed clock times. In all cases, a clock time represents the time of occurrence of an event, such as an arrival, a service beginning, or a service completion in a queueing model.

Example 3: Random Arrival Times

Telephone calls to the telephone information service, where service times are defined in Example 2, occur at random times defined by a discrete distribution for which the interarrival times have values 1, 2, 3, or 4 minutes, all with equal probability. Our purpose here is to show how to generate both interarrival times and arrival times.

Since this example has one event, namely, the arrival event, it is our first example of a dynamic, event-based model (despite its simplicity). Dynamic simply means time-based, with system state changing over time; dynamic, event-based means that the model tracks the progression of even occurrences over time.

The interarrival times can be generated randomly in exactly the same manner as done in Example 2 for service times. The spreadsheets, however, supply a second VBA function to simplify random generation from a discrete uniform distribution. Uniform means that all the values have equal probabilities; in this example, all the interarrival times may have one of the values 1, 2, 3, or 4 minutes, each occurring with probability 0.25. For such discrete uniform distributions, the spreadsheets supply the VBA function, DiscreteUniform(), which takes two arguments: either the cell containing the minimum value followed by the cell containing the maximum value of the desired range of integers, or the actual low and high values, as in:

=DiscreteUniform(G5,G6) = \text{DiscreteUniform} (G 5, G 6)

or

=DiscreteUniform(1,4) = \text{DiscreteUniform} (1, 4)

The DiscreteUniform(low, high) function is implemented by a single line of VBA code, as follows:

DiscreteUniform=low+Int((high - low + 1)*Rnd() \text{DiscreteUniform} = \text{low} + \text{Int((high - low + 1)*Rnd()}

which becomes, for this example:

DiscreteUniform=1+Int(4∗Rnd()) \text{DiscreteUniform} = 1 + \text{Int} (4 * \text{Rnd()})

where Rnd() generates a random number between 0 and 1 (in VBA, it is always less than one bu may equal zero), and Int() is a VBA function that truncates (rounds down) its argument. (Note that 4 * Rnd() generates real values between 0.0 and 3.99999, so that truncating and then adding 1 yields the desired range 1 to 4. Why do we expect equal probabilities?)

Table 3 shows the input specification for interarrival times and a portion of the simulation table, taken from the spreadsheet model in “Example2.3ArrivalTimes.xls”. As shown in Step 1 (row 14), we assume that the first arrival occurs at simulation time 0. (The assumed arrival time for the firs customer is model-dependent; it could be any other specified time, constant or random.) The interarrival times are randomly and independently generated using the DiscreteUniform(1, 4) function. The arrival times are computed by a simple formula, by adding the current customer’s interarrival time to the previous customer’s arrival time. (You should verify the spreadsheet formula for arrival times.)

Table 3 Input Specification and Simulation Table for Arrival Times.

ABCD
4Interarrival Times(minutes)
5
6Minimum1
7Maximum4
8
9Number of Callers=25
10Simulation Table
11StepActivityClock
12CallerInterarrival TimeArrival Time
13
1410
15222
16313
17436

Example 3 is the first that contains an event, namely, the arrival event, and the event time associated with that event, namely, the CLOCK time for the time of arrival. Note that Table 3 distinguishes the activity times from the CLOCK times.

1.7 A Framework for Spreadsheet Simulation

The simulation table provides the structure, and the steps outlined below provide a set of general guidelines for carrying out a spreadsheet simulation. We have seen several examples of a simulation table, with Table 3 in Example 3 being the best so far—since it contains a clock time for the arrival event, making it one of the simplest possible dynamic, event-based simulations.

First, the model developer must define the model inputs, the system states, and the mode outputs. Inputs are the exogenous variables that are (usually) defined independently of other system characteristics; examples include the probability of a head on a coin toss, the service time and the interarrival time distributions in a queueing system, or the demand distribution in an inventory model. These input specifications are used to generate random activity times and other random variables. Other inputs, such as policy or decision parameters, may be constants.

Outputs are used to compute measures of system performance (also known as model responses, or simply responses). For example, an output could be an individual customer’s waiting time in a queue, or the cost of an individual transaction in an inventory system. The associated responses might be average waiting time in a queue, or the average cost per unit time in an inventory system, respectively.

Each simulation table is custom designed for the problem at hand. Each column in the table is one of the following types:

  1. An activity time associated with a model input;

  2. Any other random variable defined by a model input;

  3. A system state;

  4. An event, or the clock time of an event;

  5. A model output;

  6. Sometimes, a model response.

For the spreadsheet simulations here, the above-listed items are sufficient.

In general, model responses, also known as measures of system performance, are computed outside the simulation table after the simulation has been completed. For example, in a waiting line model, the delay in queue of each individual customer is a model output, while the average delay over all customers is a model response. The model output is tracked in the simulation table; the response is computed afterwards.

An activity time is a time defined by a constant or a statistical distribution, such as a service time, or an interarrival time. An activity is a duration of time, in contrast to event times, which are clock times.

System states include, for example, server status (busy or idle) in a queueing model and inventory levels in an inventory model. In general, the set of system states includes any information needed for the simulation to proceed through time (or from one step to the next), as well as any quantity or information that makes the simulation logic simpler or more transparent and thus easier to understand. The greatest simplicity possible, as long as the model logic is correct, assists in an ease of understanding that is of tremendous value, especially when trying to verify that a model’s logic is indeed correct.

Table 4 A Generic Simulation Table

StepActivities and System StatesOutputs
xi1x_{i1}xi2x_{i2}⋯\cdotsxijx_{ij}⋯\cdotsxipx_{ip}yiy_i
1
2
3
.
.
.
n

Each row in the simulation table represents a step in the simulation and is usually associated with the occurrence of one or more events, or the progress of one entity (such as a customer) through the system. The simulation table is designed so that a given step depends solely on model inputs and/or one or more previous steps or previously computed values in the current step.

In general, a modeler develops and runs a spreadsheet or manual simulation by following these guidelines:

  1. Determine the characteristics of each of the inputs to the simulation. Often encountered types of inputs include constants as well as probability distributions.

  2. Determine the activities, events, and system states relevant to the problem.

  3. Determine model responses or summary performance measures, depending on objectives and specific questions to meet those objectives.

  4. Determine the model outputs needed for computing model responses.

  5. Construct a simulation table. A generic representation of a simulation table is shown in Table 4. In this table, there are p activities and system states,xij,j=1,2,…,p.x_{i j} , j = 1 , 2 , \dotsc , p ., and one output, y_i, for each simulation step i=1,2,…,ni = 1 , 2 , \dots , n. Initialize the table by filling in the data for Step 1. When doing a spreadsheet model, the initial step or steps (usually just Step 1) are typically different from subsequent steps, which are defined by formulas.

  6. For each Step i, generate a value for each of the activities, then compute the system states and outputs y . Random input values may be computed by sampling values from the distributions chosen in Step 1. An output typically depends on the inputs, system states, and possibly other outputs.

  7. When the simulation is finished, use the outputs to compute the model responses or measures of performance.

In the following sections, we will see several examples of spreadsheet simulations carried out in a custom-designed simulation table. These include examples of a coin tossing game, plus examples in application areas such as queueing, inventory, reliability, and network analysis. The coin tossing game asks an easy question yet has an answer that we believe will be surprising to most readers.

The two queueing examples provide illustrations of single-server and two-server systems. The first ofthe inventory examples involves a problem that has a closed-form solution; thus, the simulation solution can be compared to the mathematical solution. The second inventory example pertains to the classic order-level model.

The remaining examples include a model of hitting a target, a reliability model, a Monte Carlo model to estimate the distribution of a complex random variable, namely, lead-time demand, and finally, a model of a project activity network. The target hitting model introduces the use of normally distributed random numbers.

2 A Coin Tossing Game

In a coin tossing game, is it more likely that you and your opponent each share the lead about 1/2 of the time (that is, on about 1/2 of the tosses), compared to, say, one of you being ahead most of the time?

With the following example, we explain in more detail the layout of the spreadsheet solutions, the two main worksheets (‘One Trial’ and ‘Experiment’), the buttons to run the simulations, and the terminology used: trials (or replications) and experiments. The details of model logic (formulas used, functions called, and so on) are explained in the spreadsheet itself, all of which can be found at the text’s web site, www.bcnn.net.

Example 4: A Coin Tossing Game

Charlize tosses a coin for her friends, Harry and Tom, exactly 100 times. Harry wins $1.00 when a head lands up, and Tom loses $1.00. Tom wins when the coin lands with tails up, with Harry paying $1. Charlize tracks their respective wins and losses as they play the game. On any toss, Harry could be ahead, or Tom could be ahead, or they could be even.

On any game (a game being exactly 100 tosses), is it more likely that both Harry and Tom are each ahead on about 1/2 of the tosses, or is it more likely that one of the two is ahead most of the time?

Note that we are not asking about winnings at the end of the game; we are not asking about the proportion of heads versus tails (which, as you know, should be close to 50:50 in the long run). The question concerns how often Harry or Tom is ahead or behind during the course of the game. Note also that the two possibilities in the question are not the only two possible results of a game; therefore, their probabilities will not add up to 1.

To be specific, which of these is more likely, and by about how much?

(A) Harry and Tom are each ahead on about 1/2 of the tosses; specifically, Harry is ahead on 45 to 55 of the tosses, and thus Tom is also ahead on 45 to 55 of the tosses; or

(B) Harry is ahead on 95 or more tosses; or

(C) Harry is ahead on 5 or fewer tosses.

Guess before looking at the results. Table 5 shows the input specifications and the first 14 tosses in the simulation table, taken from the spreadsheet model in “Example2.4CoinTossGame.xls” when using the default seed (12,345) and clicking the button ‘Reset Seed & Run’. The ‘One Trial’worksheet has the logic and results for one game of 100 tosses.

Table 5 Input Specification and Simulation Table for the Coin Tossing Game

ABCD
4CoinProbabilityCumulative Probability
5
6
7Head0.500.50
8Tail0.501.00
9
10Numer of Tosses = 100
11Simulation Table
12StepStateOutput
13TossResult of TossHarry's Winnings
141T-$1
152H0
163T-1
174H0
185H1
196T0
207H1
218T0
229T-1
2310H0
2411T-1
2512H0
2613T-1

If you inspect the ‘One Trial’worksheet in the spreadsheet solution (for the trial using the default seed for the RNG), you will see that on toss 13, Harry’s winnings are negative (he’s losing money) and they stay negative for the remainder of the game; in fact, in this game, Tom is ahead on 92 of the 100 tosses, yet his winnings at the end are just $6.00. Harry is ahead on just 2 of the 100 tosses, and they are even on 6 of the 100 tosses (the last time on toss 12).

Now, we cannot answer the questions asked by playing just one game (equivalent to clicking the ‘Generate New Trial’ button once, since each trial is one game of 100 tosses). To play many games, we use the ‘Experiment’ worksheet and set the Number of Trials (cell C3) to 400. (Any fairly large number of trials will do for our present purposes.) Then click the button labeled ‘Reset Seed & Run’, which sets the seed to its default value (12,345) and runs the experiment with this seed. Running the experiment means that the ‘One Trial’ worksheet is executed 400 times, and after each trial, the result of the trial is recorded in the ‘Experiment’ worksheet. The spreadsheet contains comments and explanations for the formulas, functions, and other technical details for implementing model logic and collecting the desired outputs.

Table 6 Experiment Worksheet for the Coin Tossing Game

ABCDEF
3Number of Trials: 400
4Link to Measure of Performance:
5Name of Measure: Link
6Number of Tosses out of 100 on which Harry is Ahead. 31
7
8
9Response TableMulti-Trial Summary
10TrialNumber Tosses w/ Harry AheadBinsFrequencyRelative Frequency
11120 to 57318.3%
1229145 to 55287.0%
133195 to 1004611.5%
14476
15517
16611Average48.2
17794Median50
18895
19978Minimum0
20100Maximum100
211140

Table 6 shows the experimental specification (400 trials and the response) plus the Response Table for the first 11 trials (first 11 games), plus the Multi-Trial Summary. Figure 2 shows the histogram based on the frequency results in the Multi-Trial Summary.

Based on the experiment with 400 trials (or replications), the results may appear surprising to many people:

Harry behind most ofthe time In 73 of the 400 games (18.3%), Harry is ahead on 5 or fewer of the 100 tosses.

Harry and Tom about the same In 28 of the 400 games (7.0%), Harry and Tom share the lead abou equally.

Harry ahead most ofthe time In 46 of the 400 games (11.5%), Harry is ahead on 95 or more of the 100 tosses.

Figure 2 Histogram for Harry’s Chances of Being Ahead.

Of course, these three possibilities are not the only possibilities; that is why the frequencies do not add up to 400 games or 100%.You may wonder: What explains that the result “0 to 5” appears to be more likely than “95 to 100”, and that both are more likely than Tom and Harry sharing the lead about half of the time? What about the magnitude of this difference? Do these results contradict the assumption that the coins are “fair” and heads and tails have equal probability? Do these results say anything about Harry or Tom’s final winnings or losses?

You may experiment by clicking the ‘Run Experiment’ button several times, to see how the results vary from one experiment to the next. With 400 games constituting each experiment, it seems intuitively that the results would not change too much. One run of the experiment is identical to an other except that a new set of random numbers is used. (You can always return to the original random numbers and original results presented here by clicking the ‘Reset Seed & Run’ button.) To verify the results quoted here based on 400 games (i.e., 400 trials), you could run an experiment with a very large number, say, 4000 trials. Accuracy increases as the number of trials increases.

3 Queueing Simulation in a Spreadsheet

We begin by describing the components of queueing or waiting line models. We follow with two examples: a single-server queue and a two-server queue; both are dynamic, event-based models.

Figure 3 Single-channel queueing system.

3.1 Waiting Line Models

A queueing system is described by its calling population, the nature of the arrivals, the service mechanism, the system capacity, and the queueing discipline. A simple single-channel queueing system is portrayed in Figure 3. The members of the calling population may be, for example, customers, telephone calls, or jobs in a repair shop; here, we refer to them as units.

In the simple models in this chapter, we assume an unlimited potential calling population and a constant arrival rate. That is, no matter how many units have already arrived or are still present in the system, the interarrival time until the next arrival follows the same statistical distribution. Arrivals for service occur one at a time in a random fashion; once they join the waiting line, they are eventually served. In addition, service times are of some random length according to a probability distribution which does not change over time. The system capacity has no limit, meaning that any number of units can wait in line. Finally, units are served in the order of their arrival (often called FIFO: firs in, first out, or FCFS: first come, first served) by a single server or multiple parallel servers.

Services and arrivals are defined by the distribution of service times and the distribution of time between arrivals, respectively, as illustrated by Examples 2 and 3. For any simple single- or multi-channel queue, the overall effective arrival rate must be less than the total service rate, or the waiting line will grow without bound. When queues grow without bound, they are termed explosive or unstable. (In some re-entrant queueing networks in which units return a number of times to the same server before finally exiting from the system, the condition that arrival rate be less than service rate might not guarantee stability. See Harrison and Nguyen [1995] for more explanation. Interestingly, this type of instability was noticed first, not in theory, but in actual manufacturing in semiconductor manufacturing plants.) More complex situations can occur—for example, arrival rates that are greater than service rates for short periods of time, or networks of queues with routing. However, this chapter sticks to the most basic queues.

How do the concepts of system state, events, and simulation clock apply to queueing models? System state for a queueing model typically consists of the number of units in the system and server status, either busy or idle. An event is a set of circumstances that causes an instantaneous change in the state of the system. In a single-channel (or any multi-channel) queueing system, the events are the arrival event, the service beginning event, and the departure event, also called the service completion event. The simulation clock is used to track simulated time.

When a departure event occurs, the simulation proceeds in the manner shown in the flow diagram of Figure 4. The departure event causes the system state to change. If there are no units waiting in the queue, server status changes to idle; if there are one or more units waiting, the next unit begins service. In both cases, the number of units in the system decreases by one.

Figure 4 Departure event flow diagram.

The flow diagram for the arrival event is shown in Figure 5. The unit finds the server either idle or busy; therefore, either the unit begins service immediately, or it enters the queue. The unit follows the course of action shown in Figure 6. If the server is busy, the unit enters the queue. If the server is idle and the queue is empty, the unit begins service. It is not possible for the server to be idle while the queue is nonempty.

Figure 5 Arrival event flow diagram.

Queue status
Not emptyEmpty
Server statusBusyEnter queueEnter queue
IdleImpossibleEnter service
Server outcomesBusyImpossible
IdleImpossible

Figure 6 Potential unit actions upon arrival.

Figure 7 Server outcomes after the completion of service.

After a service completion, the server either becomes idle or remains busy with the next unit. The relationship of these two outcomes to queue status is shown in Figure 7. If the queue is no empty, another unit engages the server, which then remains in the busy state. If the queue is empty, the server becomes idle. These two possibilities are shown as the shaded portions of Figure 7.

In most simulations, many events occur at random times, the randomness imitating uncertainty in real life. For example, it is not known with certainty when the next customer will arrive at a grocery checkout counter, or how long the bank teller will take to complete a transaction. In these cases, a statistical model of the data is developed either from data collected and analyzed or from subjective estimates and assumptions. For our purposes, we will assume simple discrete probability distributions for interarrival and service times.

Now, how can the events described here occur in simulated time? Simulations of queueing systems generally require the maintenance of an event list for determining what happens next. The event list tracks the future times at which the different types of events will occur. This chapter simplifies the simulation by tracking each unit explicitly. Note that this ad hoc approach is satisfactory for simple simulations in a spreadsheet, but the more systematic approach is essential for the more complex real-world simulations (and even the more interesting student simulations).

Table 7 was designed as a simulation table specifically for a single-channel queue that serves customers on a first-in–first-out (FIFO) basis. It keeps track of the clock time at which each even occurs. (Note that it contains no columns for outputs; these will be added in the next example.) This simulation table computes arrival times from an assumed sequence of interarrival times:

24126

Columns B, C, and E are simulation clock times. Column B, the arrival times, are computed solely from the generated interarrival times. Column E, the time for the departure (or service completion) event, is easily computed by the generated input in Column D and the time service begins in Column C. Thus we see that computing Column C, the time service begins, is the main challenge. For an arriving unit, service begins at the later of two times: its arrival time or the departure time of the previous unit. (For 2-server and other multi-server queues, it is not quite so easy to compute the service completion time.)

As shown in Table 7, the first customer arrives at clock time 0 and immediately begins service, which requires two minutes. Service is completed at clock time 2. The second customer arrives at clock time 2 and is finished at clock time 3. Note that the fourth customer arrived at clock time 7, bu service could not begin until clock time 9. This occurred because customer 3 did not finish service until clock time 9.

Table 7 Simulation Table Emphasizing Clock Times

ABCDE
Customer NumberArrival Time (Clock)Time Service Begins (Clock)Service Time (Activity)Time Service Ends (Clock)
10022
22213
36639
479211
5911112
61515419

Table 8 Chronological Ordering of Events

Event TypeCustomer NumberClock Time
Arrival10
Departure12
Arrival22
Departure23
Arrival36
Arrival47
Departure39
Arrival59
Departure411
Departure512
Arrival615
Departure619

The occurrence of the arrival and departure events in chronological order is shown in Table 8 and Figure 8. While Table 8 is ordered by clock time, the events may or may not be ordered by customer number. The chronological ordering of events is the basis of the approach to discrete-even simulation.

Figure 8 depicts the number of customers in the system over time. It is a visual image of the event listing of Table 8. Customer 1 is in the system from clock time 0 to clock time 2. Customer 2 arrives at clock time 2 and departs at clock time 3. No customers are in the system from clock time 3 to clock time 6. During some time periods, two customers are in the system, such as at clock time 8, when customers 3 and 4 are both in the system. Also, there are times when events occur simultaneously, such as at clock time 9, when customer 5 arrives and customer 3 departs.

Figure 8 Number of customers in the system.

3.2 Simulating a Single-Server Queue

The first queueing example is a single-server queue. We illustrate how to compute typical outputs and performance measures, such as the customer’s average waiting time and the proportion of time the server is idle.

Example 5: The Grocery Checkout, a Single-Server Queue

A small grocery store has one checkout counter. Customers arrive at the checkout counter at random times that range from 1 to 8 minutes apart. We assume that interarrival times are integer-valued with each of the 8 values having equal probability; this is a discrete uniform distribution, as shown in Table 9. The service times vary from 1 to 6 minutes (also integer-valued), with the probabilities shown in Table 10. Our objective is to analyze the system by simulating the arrival and service of 100 customers and to compute a variety of typical measures of performance for queueing models.

In actuality, 100 customers may be too small a sample size to draw reliable conclusions. Depending on our objectives, the accuracy of the results may be enhanced by increasing the sample size (number of customers), or by running multiple trials (or replications). A second issue is that o initial conditions. A simulation of a grocery store that starts with an empty system may or may not be realistic unless the intention is to model the system from startup or to model until steady-state operation is reached. Here, to keep calculations simple, the starting conditions are an empty grocery, and any concerns are overlooked.

Table 9 Distribution of Time Between Arrivals

GH
4Interarrival Times(minutes)
5
6Minimum1
7Maximum8

Table 10 Distribution of Service Times

ABCD
4Service Times (Minutes)ProbabilityCumulative Probability
5
6
710.100.10
820.200.30
930.300.60
1040.250.85
1150.100.95
1260.051.00

How to generate service times and arrival times from the service time and interarrival time distributions has been covered in Sections 1.5 and 1.6, respectively; the same methods apply here and in subsequent examples. For manual simulations, use the random numbers in Table A.1 in the Appendix. It is good practice to start at a random position in Table A.1 and proceed in a systematic direction, never reusing the same stream of numbers in a given problem. If the same pattern is used repeatedly, statistical bias or other odd effects could affect the results.

Table 11 shows a portion of the simulation table for the single-channel queue, taken from “Example2.5SingleServer.xls”; it also shows totals and averages for selected columns (above the simulation table). The first step is to initialize the table by filling in cells for the first customer, who is assumed to arrive at time 0 with service beginning immediately. The customer finishes at time 2 minutes (the first random service time). After the first customer, subsequent rows in the table are based on the randomly generated values for interarrival time and service time of the current customer, the completion time of the previous customer, and, for the spreadsheet solution, the simulation logic incorporated in the formulas in the cells of the simulation table.

Continuing, the second customer arrives at time 5 minutes and service begins immediately. Therefore, the second customer has no wait in the queue and the server has 3 minutes of idle time.

Skipping down, we see that the fifth customer arrives at time 16 minutes and finds the server busy. At time 18, the previous customer leaves and the fifth customer begins service, having waited 2 minutes in the queue. This process continues for all 100 customers. The spreadsheet solution in “Example2.5SingleServer.xls” contains the formulas that implement the steps described here. To best understand these formulas, you should first attempt to do a manual simulation of a few steps, figure out the logic, and then study how the formulas implement the logic.

Columns G, I, and J have been added to collect three model outputs, namely, each customer’s time in queue and in system, and the server’s idle time (if any) between the previous customer’s departure and this customer’s arrival time. These model outputs are, in turn, used to compute severa measures of performance, namely, the customer’s average time in queue and in system, and the proportion of time the server is idle.

In order to compute the system performance measures, we can use the calculated responses in Table 11, which shows totals and averages for interarrival times, service times, the time customers wait in the queue, the time customers spend in the system, and idle time of the server. These results are taken from the first trial run on the ‘One Trial’ worksheet of the spreadsheet model when using the default RNG seed (12,345). With these results, we can illustrate a number of typical performance measures for waiting line models:

Ta ble 11 M od e l Res _po n ses a n d S i m u l at i o n Ta b l e (fi rst 11 cu sto m e rs) fo r t h e G roce r_y Sto re S i m u l at i o n

ABCDEFGHIJ
15TOTALS420320163483106
16AVERAGES4.243.201.634.831.07
17Number of Customers=100
18Simulation Table
19StepActivityClockActivityClockOutputClockOutputOutput
20CustomerInterarrival Time (Minutes)Arrival TimeService Time (Minutes)Time Service BeginsWaiting Time in Queue (Minutes)Time Service EndsTime Customer Spends in System (Minutes)Idle Time of Server (Minutes)
21
22
2310020022
24255250723
25351041001443
26441441401840
27521631822150
28682422402623
29773133103435
30883953904455
31954414404510
321024664605261
331114745255690
  1. The average waiting time for a customer is 1.63 minutes, computed as follows:
Average waiting time=total time customers wait in queue (minutes)total numbers of customers=163100=1.63minutes \begin{array}{r l} \text{Average waiting time} & = \frac {\text{total time customers wait in queue (minutes)}}{\text{total numbers of customers}} \\ & = \frac {163}{100} = 1. 63 \text{minutes} \end{array}
  1. The probability that a customer has to wait in the queue is 0.46, computed as follows:
Probability (wait)=numbers of customers who waittotal number of customers=46100=0.46 \begin{array}{r l} \text{Probability (wait)} & = \frac {\text{numbers of customers who wait}}{\text{total number of customers}} \\ & = \frac {46}{100} = 0. 46 \end{array}
  1. The server is idle about 25% of the time, computed as follows:
Probability of idle=total idle time of server (minutes)total run time of simulation (minutes)=106426=0.25 \begin{array}{r l} \text{Probability of idle} & = \frac {\text{total idle time of server (minutes)}}{\text{total run time of simulation (minutes)}} \\ & = \frac {106}{426} = 0. 25 \end{array}

Therefore, the server is busy about 75% of the time.

  1. The average service time is 3.20 minutes, computed as follows:
Average service time=total service time (minutes)total number of customers=320100=3.20minutes \begin{array}{r l} \text{Average service time} & = \frac {\text{total service time (minutes)}}{\text{total number of customers}} \\ & = \frac {320}{100} = 3. 20 \text{minutes} \end{array}

This result can be compared with the expected service time by finding the mean of the service-time distribution, using the equation

E(S)=∑s=0∞sp(s) E (S) = \sum_{s = 0} ^ {\infty} s p (s)

Applying the expected-value equation to the distribution in Table 10 gives

Expected service time=1(0.10)+2(0.20)+3(0.30)+4(0.25)+5(0.10)+6(0.05)=3.2minutes \begin{array}{l} \text{Expected service time} = \\ 1 (0. 10) + 2 (0. 20) + 3 (0. 30) + 4 (0. 25) + 5 (0. 10) + 6 (0. 05) = 3. 2 \text{minutes} \end{array}

The expected service time is exactly the same as the average service time from this trial of the simulation. In general, this will not be true; here it is a pure coincidence.

  1. The average time between arrivals is 4.24 minutes, computed as follows:
Average time between=sum of all timesbetween arrivals (minutes)arrivals (minutes)=42099=4.24minutes \begin{array}{r l} \text{Average time between} & = \frac {\text{sum of all times}}{\text{between arrivals (minutes)}} \\ \text{arrivals (minutes)} & = \frac {420}{99} = 4. 24 \text{minutes} \end{array}

Since the first arrival occurs at time 0, we divide by 99 rather than 100. This result can be compared to the expected time between arrivals by finding the mean of the discrete uniform distribution whose endpoints are a 1 and b=8.b = 8 . The mean is given by

E(A)=a+b2=1+82=4.5minutes E (A) = \frac {a + b}{2} = \frac {1 + 8}{2} = 4. 5 \mathrm{minutes}

The expected time between arrivals is slightly higher than the average. However, as the simulation becomes longer, the average value of the time between arrivals tends to become closer to the theoretical mean,E(A)E ( A )6. The average waiting time of those who wait is 3.54 minutes, computed as follows:

Average waiting time ofthose who wait=total time customers wait in queue (minutes)total number of customers who wait(minutes)=16346=3.54minutes \begin{array}{r l} \text{Average waiting time of} & \\ \text{those who wait} & = \frac {\text{total time customers wait in queue (minutes)}}{\text{total number of customers who wait}} \\ (\text{minutes}) & = \frac {163}{46} = 3. 54 \text{minutes} \end{array}

Note that this is different from the average waiting time of all customers, many of whom (54 in this simulation) have no wait at all before their service begins. Over all customers, the average waiting time is 163100 = 1.63\frac {163} {100} ~ = ~ 1 . 63 minutes.The number who wait, 46, comes from the simulation table, column G under “Waiting Time in Queue,” by counting the number of nonzero waiting times, or alternately from Figure 9, which displays a histogram of the 100 waiting times.

  1. The average time a customer spends in the system is 4.83 minutes, computed in two ways. First:
Average time customer=total time customers spend in thesystem (minutes)=483100=4.83minutes \begin{array}{r l} \text{Average time customer} & = \frac {\text{total time customers spend in the}}{\text{system (minutes)}} \\ & = \frac {483}{100} = 4. 83 \text{minutes} \end{array}

The second way is to realize that the following relationship must hold:

Average timeaverage timeaverage timecustomer spendscustomer spendscustomer spendsin the system=waiting in the+in service(minutes)queue (minutes)(minutes) \begin{array}{c c c c} \text{Average time} & \text{average time} & \text{average time} \\ \text{customer spends} & \text{customer spends} & \text{customer spends} \\ \text{in the system} & = & \text{waiting in the} + & \text{in service} \\ (\text{minutes}) & \text{queue (minutes)} & & (\text{minutes}) \end{array}

Frequency of Individual Customer Waiting Time in Queue Figure 9 Frequency of waiting time in queue.

From findings 1 and 4, this results in

Average time customer spends in the system 1.633.204.83 minutes

We are now interested in running an experiment to address the question of how the average time in queue for the first 100 customers varies from day to day. Running the ‘One Trial’ workshee once with 100 customers corresponds to one day. Running it 50 times corresponds to using the ‘Experiment’ worksheet with “Number of Trials” set to 50, where each trial represents one day.

For Example 5, the frequency of waiting time in queue for the first trial of 100 customers is shown in Figure 9. (Note: In all histograms in the remainder of this chapter, the upper limit of the bin is indicated on the legend on the x-axis, even if the legend is shown centered within the bin.) As shown in the histogram, 54% of the customers did not have to wait, and of those who did wait, 34% waited less than four minutes (but more than zero minutes). These results and the histogram in Figure 9 represent the results of one trial, and by themselves do not constitute an answer to our question.

To answer our question, we use the ‘Experiment’sheet, setting “Number ofTrials” to 50 and click the button labeled ‘Reset Seed & Run’. This results in 50 estimates of average time in queue (each averaged over 100 customers). The overall average waiting time over 50 trials was 1.32 minutes. Figure 10 shows a histogram of the 50 average waiting times for the 50 trials. This shows how average waiting time varies day-by-day over a sample of 50 days.

By experimenting with the spreadsheet solution and doing some of the related exercises, you can discover the effects of randomness and of the assumed input data. For example, what if you run 400 trials, or 10 trials, instead of 50? How much does the shape of the distribution in Figure 10 change the number of trials? Why is the range (0 to 12 minutes) in Figure 9 so much wider than the range (0.5 to 3 minutes) in Figure 10?

Figure 10 Frequency distribution of average waiting times for 50 trials.

3.3 Simulating a Queue with Two Servers

The second queueing example is a queue with two servers that have different service times.

Example 6: The Able–Baker Call Center Problem

A computer technical support center is staffed by two people, Able and Baker, who take calls and try to answer questions and solve computer problems. The time between calls ranges from 1 to 4 minutes, with distribution as shown in Table 12. Able is more experienced and can provide service faster than Baker. The distributions of their service times are shown in Tables 13 and 14.

When both are idle, Able takes the call. If both are busy, the call goes on hold; this is basically the same as a customer having to wait in line in any queueing model. In general, arrival times, service times, and hence clock times in a simulation should be continuous (real-valued) variables; the fac that they are discrete, integer-valued here (and in other examples) is simply for ease of explanation as well as understanding the random variable generation techniques explained earlier.

Table 12 Interarrival Distribution of Calls for Technical Support

BCD
4Interarrival Distribution of Calls
5Interarrival Time (Minutes)ProbabilityCumulative Probability
6
7
810.250.25
920.400.65
1030.200.85
1140.151.00

Table 13 Distribution of Able’s Service Time

FGH
4Able's Service Time Distribution
5Service Times (Minutes)ProbabilityCumulative Probability
6
7
820.300.30
930.280.58
1040.250.83
1150.171.00

Table 14 Distribution of Baker’s Service Time

IJK
4Baker's Service Time Distribution
5Service Times (Minutes)ProbabilityCumulative Probability
6
7
830.350.35
940.250.60
1050.200.80
1160.201.00

The simulation proceeds in a manner similar to the single-server case in Example 5, excep that the underlying logic (the spreadsheet formulas in the simulation table) is more complex for two reasons: There are two servers, and the two servers have different service times. The complete solution is in the workbook “Example2.6AbleBaker.xls”, a portion of which is shown in Table 15, along with some totals needed to estimate caller delay (hold time). The workbook provides a detailed explanation of the simulation steps, including the underlying logic (formulas) for computing each step. (To understand the steps, it would first be helpful for you to do a manual simulation, perhaps by starting with a simulation table containing Step 1 (row 20) and the columns for interarrival and service times, and attempting to match the results in Table 15.)

Our objective is to estimate caller delay (hold time) waiting for Able or Baker to answer. To estimate this and other desired measures of system performance, a simulation of the first 100 callers is made.

Looking at Table 15, we see that Caller 1, by assumption, arrives at clock time 0. Able is idle, so Caller 1 begins service immediately. The service time, 4 minutes, is generated from the distribution given in Table 13 by following the procedure (throwing the “random dart”) in Example 2. Thus, Caller 1 completes service at clock time 4 minutes and is not delayed.

Ta b l e 15 S i m u l at i o n Ta b l e fo r Ca l l -Ce nte r Exa m _p l e (fi rst 10 of 1 00 ca l l e rs)

BCDEFGHIJKLM
13TOTALS73432
14Number of Callers=100Seed for Random Numbers12,345
15Simulation Table
16StepActivityClockClockClockStateActivityClockClockClockOutputOutput
17Caller NumberInterarrival Time (Minutes)Arrival TimeWhen Able AvailableWhen Baker AvailableServer ChosenService Time (Minutes)Time Service BeginsService Completion TimeCaller Delay (Minutes)Time in System (Minutes)
18AbleBaker
19
201000Able40404
2121140Baker41504
2231245Able34725
2343575Baker35803
2452778Able571205
25629128Baker591405
2671101214Able5121727
2782121714Baker4141826
2894161718Able2171913
29101171918Baker3182114

Figure 11 Frequency of caller delay for first trial.

An interarrival time of 1 minute, generated from Table 12 by following the procedure in Example 3, makes Caller 2 arrive at clock time 1 minute. Able is busy, so Caller 2 is served by Baker.

Looking at Caller 3, serviced by Able from clock time 4 minutes to clock time 7 minutes, we see that Caller 3 arrived at time 2 minutes to find both servers busy, hence had to wait.

For the single trial of 100 callers, the frequency chart in Figure 11 shows that 78 of 100 (78%) of the callers had no delay, 16% had a delay of one minute, while a few had to wait up to 3 minutes. Other trials, using different random numbers, might get similar or vastly different results; only experimentation can determine the inherent variability when simulating 100 customers.

The distribution of caller delay in Figure 11 is skewed to the right. On the ‘One Trial’ sheet, click the button ‘Generate New Trial’ repeatedly and note that the caller delay distribution often has a long, thin tail to the right. Along with the tall bars (high frequency) close to zero, what does this say about the nature of caller delay? One trial does not provide sufficient data on which to form reliable conclusions, but this is one of the great advantages to having the spreadsheet—the effec of variability is quite evident—and the simulation can be repeated any number of times using the ‘Experiment’ worksheet.

In Table 15, total customer delay is 73 minutes, or about 0.73 minutes per caller on the average. The histogram in Figure 11 shows, however, that the average of 0.73 minutes by itself is not a good indicator of how long a caller has to wait for Able or Baker. While 78% of the customers in this tria experienced no delay, a few experienced delays up to 3 minutes. This illustrates the importance of choosing the proper measures of system performance, depending on the model’s goals and objectives. After all, the callers who do not have to wait will not complain about waiting, but those who wai a long time will not care that the average was 0.73 minutes. (In actuality, in some later trials, the average delay is considerably higher, and the distribution is skewed even more to the right. You should click ‘Generate New Trial’ several times to see how much random variability this system may exhibit. Each trial represents a different day.)

Figure 12 Frequency of average caller delay for experiment of 400 trials.

Next, we ask the question: How does average caller delay (for the first 100 customers) vary from day to day? Using the ‘Experiment’ worksheet, and associating each day as one trial, we set the “Number of Trials” to 400 (representing 400 days). The resulting distribution of average caller delay is shown in the histogram in Figure 12. Note that this histogram is not a histogram of individua caller delay, as in Figure 11.

From Figure 12, we see that about 22% of the average delays (87 of 400) are longer than one minute, and about 78% (313 of 400) are 1 minute or less. Only about 1.25% (5 of 400) are longer than 2 minutes. We see that the result of the first trial (an average caller delay of 0.73 minutes) falls in the most frequent bin, but there are days that have much higher average delays. This example shows that a one-day (one trial) simulation may well be unrepresentative of long-term system performance.

In summary, whether, and to what extent, Able and Baker can handle the demand for service depends on your criteria, and the cost or value of the delays customers experience. We can guess that adding an additional server may well reduce caller delay (hold time) to nearly zero; however, the benefit of reduced customer delay would have to be traded off against the cost of an additiona server.

4 Inventory Simulation in a Spreadsheet

An important class of simulation problems involves inventory systems. The simple inventory system shown in Figure 13 is called an (M, N) system, which has an inventory review every N time periods and maximum inventory level M. At each N time units, the inventory level is checked and an order is made to bring the inventory up to the level M.

Figure 13 Probabilistic order-level inventory system.

For simplicity, the lead time (i.e., the length of time between the placement and receipt of an order) is shown as zero in Figure 13; orders arrive immediately after being placed. In reality, lead time may vary greatly and would need to be modeled as a known constant or as a random variable.

Demands are not usually known with certainty, so the order quantities are modeled by a probability distribution. In the graph of Figure 13, demand is shown as being uniform over the time period. In actuality, demands are not usually uniform and do fluctuate over time.

At the end of the first review period, an order quantity,Q1Q_{1}, is placed to bring the inventory leve up to M. This is repeated at every inventory review.

Notice that, in the second cycle, the amount in inventory drops below zero, indicating a shortage. In Figure 13, these units are backordered; when the order arrives, the demand for the backordered items is satisfied first. To avoid shortages, a buffer, or safety, stock would need to be carried. In some inventory systems, a portion of sales may be lost rather than backordered when inventory runs out.

Inventory systems have a number of potential sources of revenue and costs:

  1. Revenue from sales;

  2. Cost of items sold;

  3. Carrying cost, the cost of carrying stock in inventory;

  4. Ordering cost, the cost associated with placing orders;

  5. Cost of lost sales or backorders;

  6. Cost due to scrap;

  7. Salvage revenue from scrap or other damaged goods.

The carrying cost can be attributed to the interest paid on funds borrowed to buy the items (or equivalently, the loss from not having the funds available for other investment purposes). Carrying costs also include the cost for handling and storage space, hiring of guards, and other similar costs. Ordering cost may include shipping and transportation, and discounts depending on order quantity.

When trying to improve an inventory system, you face a number of trade-offs. An alternative to carrying high inventory (with high carrying costs) is to make more frequent reviews and, consequently, more frequent purchases or replenishments. This has an associated cost, the ordering cost. There may also be costs associated with running out of goods, with such shortages causing customers to become angry and a subsequent loss of good will. Larger inventories decrease the probability of a shortage. By varying the policy or decision parameters, the costs may be traded off in order to minimize the total cost of an inventory system.

The total cost (or total profit) of an inventory system is the measure of performance. This can be affected by the policy alternatives. For example, in Figure 13, the decision maker can control the maximum inventory level, M, and the length of the cycle, N.

Inventory systems and policies have a number of parameters, some controllable and some not. The controllable variables are the decision or policy variables. For each item in inventory, these include:

  1. The maximum inventory level, M

  2. The review period, N

  3. The order quantity (for replenishment), Q

  4. Lead time for replenishment, L

Lead time may be random when it cannot be controlled; in other situations, lead time may be tightly controlled, in effect a known constant (as in a just-in-time manufacturing system when ordering parts or components), in which case it becomes a policy variable.

In a model of an (M, N) inventory system, the events that may occur are the demand for items in the inventory, the review of the inventory position and resulting decision to place a replenishment order, and the arrival ofreplenishment stock. When the lead time is assumed to be zero, as in Figure 13, the last two events occur at the same time.

In the examples and exercises, we simulate a variety of inventory systems and policies.

4.1 Simulating the News Dealer’s Problem

In the following example, a news dealer must decide how many newspapers to buy. In this and similar problems, only a single time period of specified length is relevant, and only a single procurement is made. Inventory remaining at the end of the single time period is sold for scrap, discarded or recycled. A wide variety of real-world problems have similar characteristics, including the stocking of certain spare parts, perishable items, style goods, and special seasonal items [Hadley and Whitin, 1963].

Example 7: The News Dealer’s Problem

A news dealer buys papers for 33 cents each and sells them for 50 cents each. Newspapers not sold at the end of the day are sold as scrap for 5 cents each. Newspapers can be purchased in bundles of 10. Thus, the newsstand can buy 50 or 60 or 70 papers, and so on. The order quantity, Q, is the only policy decision. Unlike some inventory problems, the order quantity Q is fixed since ending inventory is always zero due to scrapping leftover papers.

Table 16 Distribution of Daily Newspaper Demand, by Type of Newsday

BCDEFGH
4Distribution of Newspapers Demanded
5DemandDemand ProbabilitiesCumulative Probabilities
6GoodFairPoorGoodFairPoor
7400.030.100.440.030.100.44
8500.050.180.220.080.280.66
9600.150.400.160.230.680.82
10700.200.200.120.430.880.94
11800.350.080.060.780.961.00
12900.150.040.000.931.001.00
131000.070.000.001.001.001.00

There are three types of newsdays: “good”, “fair”, and “poor”, but the news dealer cannot predict which type will occur on any given day. Table 16 gives the distribution of newspapers demanded by type of day. Table 17 provides the distribution for type of newsday.

Our objective is to compute the optimal number of papers the newsstand should purchase (the order quantity, Q). This will be accomplished by simulating demands for 20 days (in the ‘One Trial’ worksheet) and recording profits from sales each day for a given order quantity. After a tria is completed, total profit (the model response or performance measure) is calculated. To complete the experiment, we use the ‘Experiment’ sheet to replicate some number of times for a given order quantity (for example, 70 papers). Finally, we vary the order quantity over some reasonable range (40, 50, 60, 70, and so on) and compare different order policies based on total profit over the 20-day period.

Daily profit is given by the following relationship:

Profit=(revenuefrom sales)−(cost ofnewspapers)−(lost profit fromexcess demand)+(salvage from saleof scrap papers) \text{Profit} = \binom{\text{revenue}}{\text{from sales}} - \binom{\text{cost of}}{\text{newspapers}} - \binom{\text{lost profit from}}{\text{excess demand}} + \binom{\text{salvage from sale}}{\text{of scrap papers}}

Since the revenue from sales is 50 cents per paper, and the cost to the dealer is 33 cents per paper, the lost profit from excess demand is 17 cents for each paper demanded that could not be provided.

Table 17 Distribution of Type of Newsday

JKL
4Type of Newsday
5TypeProbabilityCumulative Probability
6
7Good0.350.35
8Fair0.450.80
9Poor0.201.00

Table 18 Simulation Table for Purchase of 70 Newspapers

BCDEFGHII
16Simulation Table
17DayType of NewsdayDemandRevenue from SalesLost Profit from Excess DemandSalvage from Sale of ScrapDaily CostDaily Profit
18
19
201Fair50$25.00$0.00$1.00$23.10$2.90
212Fair50$25.00$0.00$1.00$23.10$2.90
223Fair70$35.00$0.00$0.00$23.10$11.90
234Good80$35.00$1.70$0.00$23.10$10.20
245Poor40$20.00$0.00$1.50$23.10-$1.60
256Fair50$25.00$0.00$1.00$23.10$2.90
267Poor50$25.00$0.00$1.00$23.10$2.90
278Fair70$35.00$0.00$0.00$23.10$11.90
289Good40$20.00$0.00$1.50$23.10-$1.60
2910Good100$35.00$5.10$0.00$23.10$6.80
3011Fair70$35.00$0.00$0.00$23.10$11.90
3112Poor50$25.00$0.00$1.00$23.10$2.90
3213Fair50$25.00$0.00$1.00$23.10$2.90
3314Poor40$20.00$0.00$1.50$23.10-$1.60
3415Good80$35.00$1.70$0.00$23.10$10.20
3516Good70$35.00$0.00$0.00$23.10$11.90
3617Good80$35.00$1.70$0.00$23.10$10.20
3718Poor40$20.00$0.00$1.50$23.10-$1.60
3819Fair70$35.00$0.00$0.00$23.10$11.90
3920Good100$35.00$5.10$0.00$23.10$6.80
40TOTAL PROFIT =$114.70

Such a shortage cost is somewhat controversial, but makes the problem much more interesting. The salvage value of scrap papers is 5 cents each.

The simulation table for the decision to purchase 70 newspapers, taken from the solution workbook, “Example2.7NewsDealer.xls”, is shown in Table 18. On day 1, the demand is for 50 newspapers, so with 70 available, there are 20 to scrap. The revenue from the sale of the 50 newspapers is $25.00, and the scrap value is $1.00, so the first-day profit is computed as follows:

First - day Profit=25.00−23.10−0+1.00=2.90 \text{First - day Profit} = 25. 00 - 23. 10 - 0 + 1. 00 = 2. 90

The profit from other days is easily computed in the same manner. The profit for the 20-day period is the sum of the daily profits, $114.70, as shown in Table 18. In general, because the results of one day are independent of previous days, inventory problems of this type are much easier than queueing problems to solve in a spreadsheet.

With the ‘Experiment’ worksheet from “Example2.7NewsDealer.xls”, we set up an experimen with 400 trials or replications for the order policy of ordering 70 newspapers. Figure 14 shows the result of these 400 trials, each trial being a 20-day simulation run. The average total (20-day) profit was $135.49 (averaged over the 400 trials). The minimum 20-day profit was $86.60 and the maximum was $198.00. Figure 14 shows that only 38 of the 400 trials resulted in a total 20-day profit of more than $160. (Recall that the number beneath a bin is the upper limit of the bin.)

Figure 14 Frequency of total (20-day) profit when news dealer orders 70 papers per day.

The single trial shown in Table 18 had a profit of $114.70, which is on the low side of the distribution in Figure 14. This illustrates once again that the result for one 20-day trial may not be representative of long-term performance, and shows the necessity of simulating a number of trials as well as conducting a careful statistical analysis before drawing conclusions.

On the ‘One Trial’ sheet, look how Daily Profit varies when clicking the button ‘Generate New Trial’ multiple times. The results vary quite a bit both in the histogram entitled ‘Frequency of Daily Profit’ (showing what happened on each of the 20 days) and in the total profit over those 20 days. Figure 15 shows four typical histograms for daily profit from the first four trials, whose shape varies quite a bit more than the shape for the histogram for total 20-day profit.

Exercise 28 asks you to conduct an experiment to determine the optimum number of newspapers for the news dealer to order. To solve this problem by simulation requires setting a policy of buying a certain number of papers each day and running the experiment for a large number of trials. The policy (number of newspapers purchased) is changed to other values in a reasonable range (say, 40, 50, 60, and so on) and the simulation repeated until the best value is found. To estimate with confidence whether a simulated difference is likely to be real and not a random fluke, requires additional statistical methods

Figure 15 Four typical histograms of daily profit for the News Dealer’s Problem.

4.2 Simulating an (M, N) Inventory Policy

The next example is the classic order-up-to-level (M, N) inventory policy with a fixed review period (N), a maximum inventory level (M), random demand, and random lead time.

Example 8: A Refrigerator Inventory Problem

A company selling refrigerators maintains inventory by conducting a review after a fixed number of days (say N) and making a decision about how many to order to replenish the store’s inventory. The current policy is to order up to a level (the order up to level—say, M), using the following relationship:

Order quantity=(Order - up - to level)−(Ending inventory)+(Shortage quantity) \text{Order quantity} = (\text{Order - up - to level}) - (\text{Ending inventory}) + (\text{Shortage quantity})

For example, if the order-up-to level (M) is 11 refrigerators, the review period (N) is five days, and the ending inventory on day 5 is 3 refrigerators, then on the fifth day of the cycle, 8 refrigerators will be ordered from the supplier. On the other hand, if there had been a shortage of two refrigerators on the fifth day, then 13 refrigerators would have been ordered; the first two received would be provided to the customers who placed an order and were willing to wait (a so-called backorder). (In contrast, the lost sales case occurs when customer demand is lost if inventory is not available.)

The daily demand, or number of refrigerators purchased each day by customers, is randomly distributed as shown in Table 19. After the company places an order to replenish their supply, the lead time is 1 to 3 days, randomly distributed, as shown in Table 20. Assume that the orders are placed at the end of the day. With a lead time of zero, the order from the supplier will arrive the next morning, and the refrigerators will be available for distribution that next day. With a lead time of one day (the smallest possibility in Table 20), the order from the supplier arrives the second morning after, and will be available for distribution that day.

Table 19 Distribution of Daily Demand

BCD
4Distribution of Daily Demand
5DemandProbabilityCumulative Probability
6
700.100.10
810.250.35
920.350.70
1030.210.91
1140.091.00

Table 20 Distribution of Lead Time

FGH
4Distribution of Lead Time
5Lead Time (days)ProbabilityCumulative Probability
6
710.600.60
820.300.90
930.101.00

The simulation table for the policy to order-up-to 11 refrigerators, shown in Table 21, is taken from the spreadsheet solution in “Example2.8RefrigInventory.xls”. The simulation was started with assumed initial conditions as follows: a beginning inventory of 3 refrigerators and a previous replenishment order for 8 refrigerators to arrive in 2 days’ time. (These values can be changed in the spreadsheet solution, if desired.)

Following the simulation table for several selected days indicates the simulation logic. The order for 8 refrigerators is available on the morning of the third day of the first cycle, raising the inventory level from zero refrigerators to 8 refrigerators. Demands during the remainder of the firs cycle reduced the ending inventory level to 3 refrigerators at the end of the fifth day. Thus, an order for 8 refrigerators was placed; the lead time turns out to be 2 days. This order is added to inventory on the morning of day 7 in cycle 2.

Note that on day 10, there is a shortage, resulting in a backorder and an order for 13 refrigerators. Since the lead time is 2 days, additional shortages occur before the order arrives, so that when the order of 13 refrigerators does arrive, the backorders plus current demand take inventory down to 6.

From the simulation of 25 days, representing 5 inventory review periods, the average ending inventory is approximately 2.76 (69/25) units. On 5 of 25 days, a shortage condition existed.

Ta ble 21 S i m u l at i o n Ta b l e fo r I nve nto r_y Po l i c_y with O rd e r- U _p-To 11 Refri _g e rato rs

BCDEFGHIJK
13Simulation Table
14StepStateStateStateInputStateStateStateActivityState
15ClockCycleDay within CycleBeginning InventoryDemandEnding InventoryShortage QuantityPending Order (Quantity)Lead Time (days)Days until Order Arrives
16Day
17
18005--30822
19111321081
202121100
213138260
224146150
235155230811
246213300
257228260
268236330
279243210
28102513021322
2911310103131
3012320205
31133313260
3214346330
3315353120911
3416412020
35174211470
3618437250
3719445320
38204523011211
3921510203
40225212180
4123538440
4224544130
4325553120911
44TOTAL6914
45AVERAGE2.042.760.56

Frequency Distribution for Average Daily Ending Inventory of Refrigerators Figure 16 Histogram of 25-day average ending inventory.

In Example 8, there cannot be more than one order outstanding from the supplier at any one time, but there are situations where lead times are so long that the relationship shown so far needs to be modified as follows:

Order quantity=(Order - up - to level)−(Ending inventory)−(On order)+(Shortage quantity) \text{Order quantity} = (\text{Order - up - to level}) - (\text{Ending inventory}) - (\text{On order}) + (\text{Shortage quantity})

The inclusion of the on-order quantity guarantees that double ordering does not occur.

On the ‘One Trial’ worksheet, repeatedly clicking on ‘Generate New Trial’ will run the nex trial or replication with different random numbers, showing that, for a 25-day simulation, results are highly variable for daily ending inventory. (Watch the histogram change as you run new trials.) In contrast, setting the number of trials to 100 in the ‘Experiment’worksheet and running the experimen repeatedly, by clicking the ‘Run Experiment’ button, produces much less variability in the average daily ending inventory (the average being taken over one trial of 25 days). The 25-day average is usually in the range from 1 to 5 refrigerators, as shown in the resulting histogram in Figure 16. This difference in variability illustrates a well-known fact: averages vary less than individual observations. Which to use in any specific analysis depends on the objectives and questions being asked.

The spreadsheet solution in “Example2.8RefrigInventory.xls” allows you to change the ordering policy (i.e., the values of M and N). It also allows you to make some changes to the statistica distributions for daily demand and lead time, as long as certain restrictions are met: the lead time must be one or more days, the review period must be larger than the largest lead time, and possibly other limitations; otherwise, the formulas implementing the logic may be incorrect.

5 Other Examples of Simulation

This section includes four miscellaneous examples: a reliability problem, a bombing mission, the estimation of the distribution of lead-time demand, and a project activity network.

5.1 Simulation of a Reliability Problem

The next example compares two replacement policies for replacing bearings in a milling machine. The example is a Monte Carlo simulation, not a dynamic event-based model, since events and clock times are not included. Each bearing life is randomly generated 15 times and the resulting costs computed.

Example 9: Replacing Bearings in a Milling Machine

A milling machine has three different bearings that fail in service. The distribution of the life of each bearing is identical, as shown in Table 22. When a bearing fails, the mill stops, a mechanic is called, and he or she installs a new bearing (costing $32 per bearing). The delay time for the mechanic to arrive varies randomly, having the distribution given in Table 23. Downtime for the mill is estimated to cost $10 per minute. The direct on-site cost of the mechanic is $30 per hour. The mechanic takes 20 minutes to change one bearing, 30 minutes to change two bearings, and 40 minutes to change three bearings. The engineering staff has proposed a new policy to replace al three bearings whenever one bearing fails. Management needs an evaluation of the proposal, using total cost per 10,000 bearing-hours as the measure of performance.

Table 22 Distribution for Bearing Life

BCD
3Distribution of Bearing-Life
4Bearing LifeProbabilityCumulative Probability
5
610000.100.1
711000.130.23
812000.250.48
913000.130.61
1014000.090.70
1115000.120.82
1216000.020.84
1317000.060.90
1418000.050.95
1519000.051.00

Table 23 Distribution of Delay until Mechanic Arrives

FGH
4Distribution of Delay Time
5Delay TimeProbabilityCumulative Probability
6
750.600.60
8100.300.90
9150.101.00

Table 24 Bearing Replacement under Current Method

BCDEFGH
17Simulation Table
18StepBearing 1Bearing 2Bearing3
19Life (Hours)Delay (minutes)Life (Hours)Delay (minutes)Life (Hours)Delay (minutes)
20
21110005170010130010
222120051100511005
233120010100010130010
24415005100010110015
2551700519001512005
26612005120010150010
2771300515005110010
2881700517005140015
2991000513005180015
30101800101300512005
3111120051100515005
32121100518005110010
331313001012005170010
341413001011005130010
35151100513005130010
36TOTALS19,6009520,20010519,900145

The simulation table for the current policy, shown in Table 24 and taken from the spreadsheet “Example2.9CurrentBearings.xls”, represents a simulation of 15 bearing changes under the current policy of replacing only the single bearing that fails. Note that there are instances where more than one bearing fails at the same time. This is unlikely to occur in practice and is due to the crude simplifying assumption that bearing life is a multiple of 100 hours (so that we could have a simple discrete distribution rather than a more realistic one). Here, we assume that the times are never exactly the same and thus no more than one bearing is changed at any breakdown.

From this single trial (or replication) of the simulation, the cost of the current system is estimated as follows:

Cost of bearing=45bearings×32/bearing=1,440Cost of delay time=(95+105+145)minutes×10/minute=3,450Cost of downtime during repair=45bearings×20minutes/bearing×10/minute=9,000Cost of mechanics=45bearings×20minutes/bearing×30/60minutes=450Total cost=1,440+3,450+9,000+450=14,340 \begin{array}{r l} \text{Cost of bearing} & = 45 \text{bearings} \times 32 / \text{bearing} \\ & = 1, 440 \\ \text{Cost of delay time} & = (95 + 105 + 145) \text{minutes} \times 10 / \text{minute} \\ & = 3, 450 \\ \text{Cost of downtime during repair} & = 45 \text{bearings} \times 20 \text{minutes/bearing} \times 10 / \text{minute} \\ & = 9, 000 \\ \text{Cost of mechanics} & = 45 \text{bearings} \times 20 \text{minutes/bearing} \times 30 / 60 \text{minutes} \\ & = 450 \\ \text{Total cost} & = 1, 440 + 3, 450 + 9, 000 + 450 \\ & = 14, 340 \end{array}

The total life of all 45 bearings is (19,600+20,200+19,900)=59,700( 19 , 600 + 20 , 200 + 19 , 900 ) = 59 , 700 hours. Therefore, the tota cost per 10,000 bearing-hours is ($14,340/5.97) $2,402.

The simulation table for the proposed method, shown in Table 25, is taken from the spreadshee “Example2.9ProposedBearings.xls”. For the first set of bearings, the earliest failure is at 1,100 hours.

Table 25 Bearing Replacement under Proposed Method

BCDEFG
17Simulation Table
18StepBearing 1Bearing 2Bearing 3FirstFailure(Hours)
19Life(Hours)Life(Hours)Life(Hours)Delay(minutes)
20
2111300110013001,10010
2221100120015001,1005
2331100140018001,10015
2441200150011001,10010
2551700130013001,3005
2661700110010001,00010
2771000190012001,00010
2881500170013001,30015
2991300110018001,1005
30101200110013001,1005
31111000120012001,00015
32121500170012001,20010
33131300170010001,00010
34141800120011001,10010
35151300130011001,10010
36TOTALS16600145

All three bearings are replaced at that time, even though the remaining bearings had more life in them. For example, Bearing 1 would have lasted 200 additional hours

From this single trial (or replication) of the model, the cost of the proposed policy is estimated as follows:

Cost of bearings=45bearings×32/bearing=1,440 \begin{array}{r l} \text{Cost of bearings} & = 45 \text{bearings} \times 32 / \text{bearing} \\ & = 1, 440 \end{array} Cost of delay time=145minutes×10/minute=1,450 \begin{array}{r l} \text{Cost of delay time} & = 145 \text{minutes} \times 10 / \text{minute} \\ & = 1, 450 \end{array} Cost of downtime during repairs=15sets×40minutes / set×10/minute=6,000 \begin{array}{r l} \text{Cost of downtime during repairs} & = 15 \text{sets} \times 40 \text{minutes / set} \times 10 / \text{minute} \\ & = 6, 000 \end{array} Cost of mechanics=15sets×40minutes / set×30/60minutes=300 \begin{array}{r l} \text{Cost of mechanics} & = 15 \text{sets} \times 40 \text{minutes / set} \times 30 / 60 \text{minutes} \\ & = 300 \end{array} Total cost=1,440+1,450+6,000+300=9,190 \begin{array}{r l} \text{Total cost} & = 1, 440 + 1, 450 + 6, 000 + 300 \\ & = 9, 190 \end{array}

The total life of the bearings is (16,600×3)=49,800( 16 , 600 \times 3 ) = 49 , 800 hours. Therefore, the total cost per 10,000 bearing-hours is ($9,190/4.98) $1,845. The new policy generates a savings of $557 per 10,000 hours of bearing-life.

The spreadsheet solutions for Example 9 are in: “Example2.9CurrentBearings.xls” for the current policy and “Example2.9ProposedBearings.xls” for the proposed policy. In each spreadsheet, a user can change a number of inputs: the distribution of bearing life, the distribution of delay time unti mechanic arrival, the cost parameters, and the repair time per bearing or set of bearings.

5.2 Simulation of Hitting a Target

The next example simulates a bombing mission where the actual location a bomb hits varies from its target by a random amount defined by a normal distribution. The spreadsheet solution has a method for generating these normal random variables; the manual solution uses standard normal numbers from Table A.2 in the Appendix.

For our purposes, recall that a normal distribution (the bell-shaped curve) is symmetric around its mean with a likely range determined by its standard deviation; its use in the next example is a classic use of the normal distribution to represent an error, in this case the deviation from a target. This example is a pure Monte Carlo sampling experiment, since it contains neither events nor clock times; therefore, it is not a dynamic, discrete-event model.

Example 10: A Bombing Mission

Consider a bomber attempting to destroy an ammunition depot, as shown in Figure 17. (This bomber has conventional rather than laser-guided weapons.) If a bomb falls anywhere inside the target, a hi is scored; otherwise, the bomb is a miss. (Note that when a bomb appears visually to have touched a boundary line, it may or may not have hit the target; the model determines mathematically whether a hit has occurred, using the (X, Y) coordinates and the equations of the piecewise-linear boundary of the depot.)

Figure 17 Ammunition depot with 10 bomb locations.

The bomber flies in the horizontal direction and carries 10 bombs. The aiming point is (0,0). The actual point of impact is assumed to be normally distributed around the aiming point with a standard deviation of 400 meters in the direction of flight and 200 meters in the perpendicular direction. The problem is to simulate the operation and estimate the number of bombs on target.

Recall that the standardized normal variate Z,Z ,, having mean 0 and standard deviation 1, is distributed as

Z=X−μσ Z = \frac {X - \mu}{\sigma}

where XX is a normal random variable,μ\mu is the mean of the distribution of X, and σ is the standard deviation of X. Then, with mean zero and standard deviations given by σX=400\sigma_{X} = 400 and σY=200\sigma_{Y} = 200, we have

X=400ZiY=200Zj \begin{array}{c} {X = 400 Z_{i}} \\ {Y = 200 Z_{j}} \end{array}

where (X, Y) are the simulated coordinates where the bomb hits.

Table 26 Simulated Bombing Run

FGHIJKLMNOPQ
3Point of Impact of Each Bomb(1-10)
4Bomb12345678910NumberHits
5X891.8-1257.3429.624.5-321.0-77.3131.4304.5-442.7-403.9
6Y-400.7-159.425.3243.6146.5260.7-228.3-62.049.751.0
7Hit ?MissMissHitHitHitHitHitHitMissMiss6

The i and j subscripts have been added to indicate that the values of Z should be different for x and y. What are these Z values and where can they be found? The values of Z are random norma numbers with mean zero and standard deviation of one. These can be generated from uniformly distributed random numbers. For our purposes, we can use Table A.2 in the Appendix for manua simulations and the Excel formula listed in Section 1.2 for spreadsheet models.

For example, the first two random normal numbers from Table A.2, are 0.23 and -0.17, which results in (x, y) coordinates for the first bomb of (92.0, 34.0), obtained by multiplying the norma random number by the respective standard deviations of 400 and 200, as shown in the preceding formula.

Table 26 shows the results of one simulated bombing run. For our spreadsheet solution in “Example2.10Target.xls”, we use the worksheet function, NORMSINV(Rnd01()), described in Section 1.2, to generate the normal variates with the desired standard deviation, as follows:

=E5∗NORMSINV(Rnd01()) = E 5 * N O R M S I N V (R n d 01 ())

for the x coordinate (where cell E5 contains the standard deviation in the x direction). A similar formula works for the y coordinate.

Using the spreadsheet solution in “Example2.10Target.xls” with the assumed shape and standard deviations, we ran an experiment with 400 trials (each trial being 10 bombs). The histogram in Figure 18 gives the frequency of number of hits, that is, the number of bombing runs on which there were a given number of hits (with number of possible hits ranging from 0 to 10).

From the “Multi-Trial Summary” on the ‘Experiment’ sheet of the spreadsheet model, note tha the actual results range from 2 hits to 10 hits, and the average is 6.77 hits. (Clearly, no hits or one hi are possible. Since we made 400 replications, the experiment suggests, however, that one hit or no hits are extremely unlikely to occur on a bombing mission having the assumed characteristics.) If we simulate only one mission (that is, one trial), a very misleading result could occur, but Figure 18 provides useful descriptive information. For instance, in 17% (68 of 400) of the bombing runs there are 5 or fewer hits. In about 60% of the runs (239 of 400), there were 7 or more hits.

The spreadsheet model in “Example2.10Target.xls” allows you to change the target’s shape by editing the (X, Y) coordinates of each endpoint of each side of the target, so long as a convex shape is maintained. You can also change the standard deviations, with a smaller standard deviation increasing the likelihood of being closer to the target and a larger one increasing the chances of being further from the target. In the spreadsheet solution, whether or not a bomb with a simulated (X, Y) landing spot hits the target is determined by linear inequalities using elementary algebra; the details are explained in the spreadsheet.

Frequency Distribution for Number of Hits in 400 Bombing Missions Figure 18 Histogram for number of hits on a bombing mission.

5.3 Estimating the Distribution of Lead-Time Demand

The purpose of the next example is to determine the distribution of lead-time demand, that is, the total demand received over the lead time. Lead time is the time from placement of a replenishmen order until the order is received. During this period, demands continue to arrive from customers. The total customer demand over this period is the lead-time demand.

This model is an example of a Monte Carlo simulation; it is not a dynamic, event-based simulation. Essentially, there are no events and no clock times; it is a pure sampling experiment whose purpose is to estimate a complex statistical distribution. The distribution of lead-time demand is often of use in devising better inventory policies to reduce backorders and lost sales for the least cost.

We assume that both lead time and demand are random variables. Lead-time demand is thus a random variable defined as the sum of the demands over the lead time, or ∑i=0TDi\textstyle \sum_{i = 0} ^ {T} D_{i}, where T is the lead time and DiD_{i} is the demand during the ith time period. The distribution of lead-time demand is found by simulating many cycles of lead time and for each period in the lead time, generating the random demand and totalling it, and building a histogram based on the results.

Example 11: Lead-Time Demand

A firm sells bulk rolls of newsprint. The daily demand is given by the following probability distribution:

Daily Demand (Rolls)3456
Probability0.200.350.300.15

Table 27 Simulation Table for Lead-Time Demand

BCDEFG
13Simulation Table
14CycleLead TimeDemand Day1Demand Day2Demand Day3Lead Time Demand
15
16
1712358
182144
1932358
204345413
215345615
226133
237166
24825611
2592538
2610343512
2711144
2812155
291334414
3014166
3115133
32162538
331724610
3418345514
3519343613
362025611

The lead time (the number of days from placing an order until the firm receives the order from the supplier), is a random variable given by the following distribution:

Lead Time (Days)123
Probability0.360.420.22

Table 27 shows the simulation table, taken from “Example2.11LeadTimeDemand.xls”. One feature of this simulation, different from previous ones, is that the number of random demands generated in one cycle is itself random. If a lead time of 2 days is generated, then two random demands are generated and summed; if the lead time is 3 days, then three random demands must be generated and summed.

Using the spreadsheet solution, you can generate many cycles, sum the demands over each cycle to get the lead-time demand, and with the histogram, see the resulting distribution of lead-time demand, as illustrated in Figure 19. This result was obtained by using the ‘One Trial’ worksheet to simulate 20 cycles of lead-time demand by clicking ‘Reset Seed & Run’ in the spreadsheet solution “Example2.11LeadTimeDemand.xls”. By clicking the ‘Generate New Trial’ button several times, you can see how variable the lead-time demand can be over just 20 cycles.

Frequency Distribution for Lead Time Demand over 20 Cycles Figure 19 Frequency of lead-time demand.

Compare these results over 20 cycles to the results in the spreadsheet model on the ‘Experiment sheet, which shows the results for 200 trials, each trial being one lead-time demand. This comparison shows that, due to the small sample, the histogram in Figure 19 may not be representative of the shape of the distribution of lead-time demand. This illustrates the importance of having a sample size (number of trials) large enough to obtain accurate estimates of the desired response variable.

5.4 Simulating an Activity Network

Suppose you have a project that requires the completion of a number of activities. Each activity takes a certain amount of time, either constant or random. Some activities must be carried out sequentially, that is, in a specified order; other activities can be done in parallel. The project can be represented by a network of activities, as illustrated by Figure 20. The arcs represent activities and the nodes represent the start or end of an activity.

In the network in Figure 20, there are three paths, each going from the node labeled “Start” to the node labeled “Finish”. Each path represents a sequence of activities that must be completed in order. The activities on different paths can be carried out in parallel. The time for each activity is noted on the arc, where, for example, U(2, 4) represents a random variable that is uniformly distributed between 2 and 4 minutes. The time to complete all activities on a path is the sum of the activity times along the path. To complete the entire project, all activities must be completed; therefore, projec completion time is the maximum over all path completion times.

Unlike any of the previous examples, here we are using a continuous uniform distribution; that is, all values between the lower and upper limit are allowed, not just the integer values. The VBA function, Uniform(), supplied in the add-in file “BCNNvba.xla” and available to any spreadshee model, implements uniform generation in one line of VBA code, in a simple formula that transforms the VBA random number generator Rnd(), which is uniform on 0 to 1, to any other specified range, as follows:

' In the Uniform function, low is the lower limit,
'    high is the upper limit.
' Type ``Double'' is a real value (double precision).
Function Uniform(low As Double, high As Double) As Double
Uniform = low + (high - low) * Rnd()
End Function

We hope that this simple formula has some intuitive appeal. Basically, since Rnd() is uniform on the unit interval (0, 1), it follows that the function Uniform() will be uniformly distributed on the specified interval (low, high).

Pritsker [1995] was a pioneer in applying simulation techniques to project activity networks. While Example 12 is a Monte Carlo simulation, some activity network models, due to their greater complexity, may be implemented in a discrete-event simulation package or a specialized package designed for such models.

Example 12: Project Simulation

Suppose that three friends want to cook bacon, eggs, and toast for breakfast for some weekend visitors. They divide the work, with each friend preparing one item. Figure 20 represents the sequence of activities, with each path representing the tasks for one person, as follows:

Top path: Start → A Crack eggs
A → B Scramble eggs
B → Finish Cook eggs
Middle path: Start → C Make toast
C → Finish Butter toast
Bottom path: Start → Finish Fry bacon

The time to accomplish each activity, being somewhat uncertain, is represented by the uniform distribution shown on the associated arc in Figure 20. The friends want to estimate the distribution of total preparation time so that they can tell the visitor when to be at the breakfast table. With the distribution, and not just the mean or average total preparation time, they can estimate the probability of preparing breakfast within a specified amount of time. The model is in the spreadshee “Example2.12Project.xls”.

Figure 20 Activity network for Example 12.

Since the mean time for a continuous uniform is the midpoint between the lower and upper limit, you can see that each of the 3 paths in the project network of Figure 20 has a mean of 9 minutes. Based on the lower limit of each uniform, you can see that the minimum time for each path is 6 minutes; similarly, the maximum time is 12 minutes. Do these times provide any help in predicting the total project completion time?

For breakfast preparation, the project completion time is the maximum time over all of the paths. With the spreadsheet solution, “Example2.12Project.xls”, we can sample the task times for a large number of trials and get an idea of the range and distribution of possible project completion times. The ‘One Trial’ worksheet provides the solution for one trial or replication of the network simulation. The logic and formulas implementing it are much simpler than many of the previous examples and we leave those for the student.

With the ‘Experiment’worksheet, we can run many trials and estimate the likely range for project completion time, as well as other statistical measures. We set “Number of Trials” to 400 and run the experiment by clicking the ‘Reset Seed & Run’ button once. With 400 trials and using the default seed, the results are as follows:

Sample Mean: 10.21 minutes

Minimum: 6.65 minutes

Maximum: 11.99 minutes

The so-called critical path is the path that turns out to be the longest on a particular trial; that is, that path’s time is the project completion time. Over 400 trials with each using different random numbers, each path will have some probability of being the critical path. For each of the 400 trials, the experiment determines which path was critical, with these results:

Top path: 25.50% of the trials

Middle path: 32.25%

Bottom path: 42.25%

We conclude that the chance of the bacon being the last item ready is approximately 42.25%. Why aren’t the paths each represented about 1/3 of the time? In addition, how accurate is 42.25%? You can click the ‘Run Experiment’ button several times to get an idea of how variable this estimate tends to be; it varies by a few percent on each click. The magnitude of this random variation depends on the number of trials (400 in this example) in the experiment.

Frequency Distribution of Project Completion Time Figure 21 Histogram of project completion times based on 400 trials.

The project completion times were placed in a frequency chart or histogram, shown in Figure 21. From the chart, we draw the following inferences:

The chances are about 10.5% (42 of 400) that breakfast will be ready in 9 minutes or less.

The chances are about 24.25% (97 of 400) that it will take from 11 to 12 minutes.

Note that the bin labeled “12.0” is actually the interval from 11.0 to 12.0 minutes, since the bin labe is always the upper limit of the bin.

Recalling that the mean time along each of the 3 paths is 9 minutes, the histogram tells us that the chance of taking longer than 9 minutes is approximately 89.5%. In other words, the mean of each path tells us little about the distribution of project completion time, which, after all, is determined by the slowest sequence of tasks.

6 Summary

The purpose of this chapter was to introduce a few key simulation concepts by means of examples, to illustrate a few general areas of application.

We used the simulation table, custom designed for each problem, as the organizing principle. The columns in the simulation table represented activity times or other random input (such as demand), clock times for the occurrence of an event, system states, and model outputs. The rows represented a simulation step, for example, a customer or one day’s demand. The formulas in each cell implement the simulation logic, or compute model outputs. The examples illustrate the need for working out the characteristics of the input data, generating random variables from the input assumptions, defining and computing model responses (measures of performance), and analyzing the resulting responses.

Model inputs were defined by constant values for policy and decision parameters, or simple statistical distributions for such variables as service times, interarrival times, lead time, and demand. Separately from the simulation table, but using the model outputs and other data, model responses, also known as system performance measures, were computed based on the results of one trial or one run of the simulation. These model responses included totals, averages, and frequency distributions (used for the histograms).

In the examples, we covered how to generate random samples from four distribution types: the discrete empirical, the discrete uniform, the continuous uniform, and the normal distributions (Empirical means that the distribution is based on data and specified probabilities.) The spreadshee examples, available on the text’s web site at www.bcnn.net, provide VBA functions to generate each type of distribution. You should use these as a starting point for any of the exercises at the end of the chapter.

Events in a simulation table were generated by using the random variables and the logic (formulas) of the particular model. The queueing examples, especially the two-channel queue, illustrate some of the complex dependencies that can occur—in the examples discussed, between subsequent customers visiting the queue. Because of these complexities, the ad-hoc simulation table approach fails or becomes unbearably complex, even with relatively simple networks of queues and other moderately complex models. For this and other reasons, a more systematic methodology, such as the event-scheduling approach, is needed.

We introduced the idea, and necessity, of running an experiment consisting of multiple trials or replications. We saw the resulting statistical variability, and the need to conduct some kind of further analysis.

REFERENCES

HADLEY G., AND T.M. WHITIN [1963], Analysis ofInventory Systems, Prentice-Hall, Englewood Cliffs, NJ. HARRISON, J.M.,ANDV. NGUYEN [1995], “Some Badly Behaved Closed Queueing Networks,” Proceedings ofIMA Workshop on Stochastic Networks, eds. F. Kelly and R.J. Williams.

PRITSKER, A. A. B. [1995], Introduction to Simulation and SLAM II, 4th ed., John Wiley, New York SEILA,A.,V. CERIC,AND P. TADIKAMALLA [2003],Applied Simulation Modeling, Duxbury, Belmont, CA.

Simulation Examples in a Spreadsheet

EXERCISES

Spreadsheet and Manual Exercises

For hints on implementation in Excel, study the spreadsheet solutions at www.bcnn.net and read the ‘Explain’ worksheet for any example of interest. You may also need one or more of the VBA functions in the spreadsheet solutions. Therefore, to have these VBA functions available, it is easiest to start with an existing spreadsheet model, say, one of the examples closest to the exercise, and to have the Excel add-in file, “BCNNvba.xla”, in the same folder as your spreadsheet. The add-in file can be found on the text’s web site. As long as a VBA function is in a VB module in Excel’s VBA environment (in the spreadsheet itself, or an opened or referenced add-in), you can call it in a formula from a spreadsheet cell.

For any exercise where you are constructing a spreadsheet model, start with one of the examples, delete, modify or add to the existing inputs and simulation table in the ‘One Trial’ worksheet, and use what remains. On the ‘Experiment’ worksheet, change the response in the cell just below the word “Link”, and change any of the text in the titles and column headers as desired. The VBA implementations of all the functions described in Section 1.5 are in the add-in file “BCNNvba.xla”. Each function is available to every example spreadsheet, whether or not the example currently uses the function.

  1. Consider the following continuously operating job shop. Interarrival times ofjobs are distributed as follows:
Time Between Arrivals (Hours)Probability
0.23
1.37
2.28
3.12

Processing times for jobs are normally distributed, with mean 50 minutes and standard deviation 8 minutes. Construct a simulation table and perform a simulation for 10 new customers. Assume that, when the simulation begins, there is one job being processed (scheduled to be completed in 25 minutes) and there is one job with a 50-minute processing time in the queue.

(a) What was the average time in the queue for the 10 new jobs?

(b) What was the average processing time of the 10 new jobs?

(c) What was the maximum time in the system for the 10 new jobs?

  1. A baker is trying to figure out how many dozens of bagels to bake each day. The probability distribution of the number of bagel customers is as follows:
Number of Customers/Day8101214
Probability0.350.300.250.10

Customers order 1, 2, 3, or 4 dozen bagels according to the following probability distribution

Number of Dozen Ordered/Customer1234
Probability0.40.30.20.1

Bagels sell for $8.40 per dozen. They cost $5.80 per dozen to make. All bagels not sold at the end of the day are sold at half-price to a local grocery store. Based on 5 days of simulation, how many dozen (to the nearest 5 dozen) bagels should be baked each day?

  1. Develop and interpret flow diagrams analogous to Figures 4 and 5 for a queueing system with i channels.

  2. Smalltown Taxi operates one vehicle during the 9:00 A.M. to 5:00 P.M. period. Currently, consideration is being given to the addition of a second vehicle to the fleet. The demand for taxis follows the distribution shown:

Time Between Calls (Minutes)1520253035
Probability0.140.220.430.170.04

The distribution of time to complete a service is as follows:

Service Time (Minutes)515253545
Probability0.120.350.430.060.04

Simulate 5 individual days of operation of the current system and of the system with an additional taxicab. Compare the two systems with respect to the waiting times of the customers and any other measures that might shed light on the situation.

  1. The random variables X, Y, and Z are distributed as follows:
X∼N(μ=100,σ2=100)Y∼N(μ=300,σ2=225)Z∼N(μ=40,σ2=64) \begin{array}{l} {X \sim N (\mu = 100, \sigma^{2} = 100)} \\ {Y \sim N (\mu = 300, \sigma^{2} = 225)} \\ {Z \sim N (\mu = 40, \sigma^{2} = 64)} \end{array}

Simulate 50 values of the random variable

W=X+YZ W = \frac {X + Y}{Z}

Prepare a histogram of the resulting values, using class intervals of width equal to 3.

  1. Given A, B, and C, which are uncorrelated random variables. Variable A is normally distributed with μ=100\mu = 100 and σ2=400\sigma^{2} = 400. Variable B is discrete uniformly distributed with a probability distribution given by p(b)=1/5p ( b ) = 1 / 5 with b 0, 1, 2, 3 and 4. Variable C is distributed in accordance with the following table:
Value of CProbability
10.10
20.25
30.50
40.15

Use simulation to estimate the mean of a new variable D, that is defined as

D=(A−25B)/(2C) D = (A - 25 B) / (2 C)

Use a sample of size 100.

  1. Estimate, by simulation, the average number of lost sales per week for an inventory system tha functions as follows:

(a) Whenever the inventory level falls to or below 10 units, an order is placed. Only one order can be outstanding at a time.

(b) The size of each order is equal to 20 I, where I is the inventory level when the order is placed.

(c) If a demand occurs during a period when the inventory level is zero, the sale is lost.

(d) Daily demand is normally distributed, with a mean of 5 units and a standard deviation of 1.5 units. (Round off demands to the closest integer during the simulation and, if a negative value results, give it a demand of zero.)

(e) Lead time is distributed uniformly between zero and 5 days—integers only.

(f) The simulation will start with 18 units in inventory.

(g) For simplicity, assume that orders are placed at the close ofthe business day and received after the lead time has occurred. Thus, if lead time is one day, the order is available for distribution on the morning of the second day of business following the placement of the order.

(h) Let the simulation run for 5 weeks.

  1. An elevator in a manufacturing plant carries exactly 400 kilograms of material. There are three kinds of material packaged in boxes that arrive for a ride on the elevator. These materials and their distributions of time between arrivals are as follows:
MaterialWeight (kilograms)Interarrival Time (Minutes)
A2005 ± 2 (uniform)
B1006 (constant)
C50P(2) = 0.33
P(3) = 0.67

It takes the elevator 1 minute to go up to the second floor, 2 minutes to unload, and 1 minute to return to the first floor. The elevator does not leave the first floor unless it has a full load. Simulate 1 hour of operation of the system. What is the average transit time for a box of material A (time from its arrival until it is unloaded)? What is the average waiting time for a box of material B? How many boxes of material C made the trip in 1 hour?

  1. The random variables X and Y are real-valued (not integers) and uniformly distributed over intervals as follows:
X∼10±10(uniform)Y∼10±8(uniform) \begin{array}{l} X \sim 10 \pm 10 (\text{uniform}) \\ Y \sim 10 \pm 8 (\text{uniform}) \end{array}

(a) Simulate 200 values of the random variable

Z=XY Z = X Y

Prepare a histogram of the resulting values. What is the range of Z and what is its average value?

(b) Same as (a), except that

Z=X/Y Z = X / Y
  1. Consider the assembly of two steel plates, each plate having a hole drilled in its center. The plates are to be joined by a pin. The plates are aligned for assembly relative to the bottom left corner (0,0). The hole placement is centered at (3,2) on each plate. The standard deviation in each direction is 0.0045. The hole diameter is normally distributed, with a mean of 0.3 and a standard deviation of 0.005. The pin diameter is also distributed normally, with a mean of 0.29 and a standard deviation of 0.004. What fraction of pins will go through the assembled plates? Base your answer on a simulation of 50 observations.
[Hint]:Clearance=Min⁡(h1,h2)−[(x1−x2)2+(y1−y2)2].5−p,where [ H i n t ]: \text{Clearance} = \operatorname{Min} (h_{1}, h_{2}) - [ (x_{1} - x_{2}) ^ {2} + (y_{1} - y_{2}) ^ {2} ] ^ {. 5} - p, \text{where}

h hole diameter, i plate 1, 2

p pin diameter

x distance to center of plate hole, horizontal direction, i plate 1, 2

y distance to center of plate hole, vertical direction, i plate 1, 2

  1. In the exercise above, the pin will wobble if it is too loose. Wobbling occurs if Min(h , h ) p 0.006. What fraction of the assemblies wobble? (Conditional probability—i.e., given that the pins go through.)

  2. Three points are chosen at random on the circumference of a circle. Estimate the probability tha they all lie on the same semicircle, by Monte Carlo sampling methods. Perform 5 replications.

  3. Two theorems from statistics are as follows:

Theorem 1 Let Z1,Z2,…,ZkZ_{1} , Z_{2} , \ldots , Z_{k} be normally and independently distributed random variables with mean μ=0\mu = 0 and variance σ2=1\sigma^{2} = 1. Then the random variable

χ2=Z12+Z22+⋯+Zk2 \chi^{2} = Z_{1} ^ {2} + Z_{2} ^ {2} + \dots + Z_{k} ^ {2}

is said to follow the chi-squared distribution with k degrees of freedom, abbreviated χk2\chi_{k} ^ {2} Theorem 2 Let Z∼N(0,1)Z \sim N ( 0 , 1 ) and V be a chi-squared random variable with k degrees of freedom. If Z and V are independent, then the random variable

T=ZV/k T = \frac {Z}{\sqrt {V / k}}

is said to follow the t distribution with k degrees of freedom, abbreviated tkt_{k} Generate one sample of a t-distributed random variate with 3 degrees of freedom. Use as many of the following random values as needed, in the order shown:

random numbersrandom normal numbers
0.67291.06
0.1837-0.72
0.25720.28
0.8134-0.18
0.5251-0.63

How many random numbers and standard random normals are needed to generate one sample from a t-distribution?

  1. A bank has one drive-in teller and room for one additional customer to wait. Customers arriving when the queue is full park and go inside the bank to transact business. The times between arrivals and the service-time distributions follow:
Time Between Arrivals (Minutes)ProbabilityService Time (Minutes)Probability
00.0910.20
10.1720.40
20.2730.28
30.2040.12
40.15
50.12

Simulate the operation of the drive-in teller for 10 new customers. The first of the 10 new customers arrives at a time determined at random. Start the simulation with one customer being served, leaving at time 3, and one in the queue. How many customers went into the bank to transact business?

  1. The number of acres covered by Cedar Bog Lake is being estimated. The lake is shown next, with the scale shown in feet:

Use simulation to estimate the size of the lake. (One acre 43,560 square feet.)

  1. In Example 6, assume that the average delay with another server, Charlie, is virtually zero. But another server costs $20/hour. If the average caller delay costs $200 per hour, at what point is it advisable to add another server?

  2. In Example 12, why isn’t each path represented about 1/3 of the time?

  3. In Example 11, the only way to have a lead-time demand of 3 or 4 is to have lead time of one day and a demand of 3 or 4. The probability of that happening is 0.36(0.200.35) 0.198. Using this logic, what is the probability of having lead-time demand equal 11 or 12? What is the probability of having it equal 18? (Use computation, not simulation.)

  4. Run the experiment in Example 4 (the Coin Tossing Game) for 4000 trials. Explain why the probability for Harry being ahead on 5 or fewer of the 100 tosses should be larger than the probability that Harry is ahead for 95 or more of the tosses. And why you can say the same thing about Tom—with no contradiction.

Exercises based on the Spreadsheet Examples

  1. Modify Example 2 in Section 1.5 to use the “WRONG !!” formula to generate the service times. Generate a large number of service times, say, 400, and develop a histogram of the resulting frequencies. How close are the sample frequencies to the specified probabilities for each value of service time? Explain why the results differ. That is, explain why the formula is wrong.

  2. In Example 5, let the arrival distribution be uniformly distributed between 1 and 10 minutes (integers only). Run the experiment for 50 trials. Is there any difference between the bin frequencies shown and those of Figure 10?

  3. In Example 5, let the service-time distribution be changed to the following:

Service Time (Minutes)123456
Probability0.050.100.200.300.250.10

Run the experiment for 50 trials. Is there any difference between the average waiting time here and that in Example 5 before the change was made? If there is a difference, to what do you attribute it?

  1. Run the experiment in Example 5 for 25, 50, 100, 200, and 400 trials. (All trials are with different sets of random numbers.) What are the differences in the minimum and maximum values of the average waiting times? If there are differences, how do you explain them?

  2. In Example 6, run 10 experiments, each with 100 trials. What was the fraction of trials in each experiment such that the callers had an average delay of three minutes or less? For the 1000 trials just simulated, what fraction of the callers had an average delay of two minutes or less?

  3. In Example 6, conduct an experiment of400 trials. Explain the large spread between the minimum average delay and the maximum average delay.

  4. In Example 6,^ {6 ,} run 10 experiments with 50 trials each and 10 experiments with 400 trials each. Explain the differences in output that you observe, if any, between the two experiments.

  5. In Example 6, modify the spreadsheet so that the number of calls taken by Able and Baker can be displayed. What fraction did each take in an experiment of 400 trials?

  6. In Example 7, determine the best policy for ordering newspapers based on experiments of 50 trials.

  7. Run 10 experiments, each with 400 trials, in Example 7. What is the largest difference that you got between the maximum and minimum daily profit?

  8. Use the spreadsheet for Example 8. For 100 trials, what is the average ending inventory ifM 11 and N 4, 5, 6?

  9. Use the spreadsheet for Example 8. For 100 trials, what is the average ending inventory if N 5 and M 10, 11, 12?

  10. Starting with the solution to Example 8, modify the solution to model the case where sales are lost; that is, instead of a shortage, those sales are lost. Keep track of the lost sales.

  11. At what bearing cost in Example 9 is the total cost per 10,000 hours virtually the same for the current and proposed systems? Base your estimate on 10 experiments of the current system and of the proposed system, each experiment consisting of 400 trials.

  12. Change the bin width for the histogram on the Experiment sheet for Example 9 (current or proposed) to a width of $50 beginning below the minimum value (for example, if the minimum value is $1528.46, let the first cell begin at $1500). What is the advantage of doing this?

  13. Using the spreadsheet for Example 9 (proposed), run 10 experiments of 40 trials each, and record the range (maximum value minimum value) of the results. Next, compute the average range. Then do the same as before, but use 400 trials in each experiment. If there is a difference, how do you explain it?

  14. Set σx=600\sigma_{x} = 600 meters and σy=300\sigma_{y} = 300 meters in the spreadsheet for Example 10. Leave the target intact. Conduct a simulation with 200 trials. What was the average number of hits?

  15. Set σx=300\sigma_{x} = 300 meters and σy=600\sigma _ {\mathrm{y}} = 600 meters in the spreadsheet for Example 10. Leave the targe intact. Conduct a simulation with 200 trials. What was the average number of hits?

  16. Set σx=300\sigma_{x} = 300 meters and σy=150\sigma_{y} = 150 meters in the spreadsheet for Example 10. Leave the targe intact. Conduct a simulation with 200 trials. What was the average number of hits? Explain the difference between this exercise and the previous one.

  17. Set σx=2σy\sigma_{x} = 2 \sigma_{y} meters in the spreadsheet for Example 10. Leave the target intact. What is the value of σx\sigma_{x} if the average number of hits is to be about 6.0, based on one experiment of 400 trials

  18. In Example 11, suppose you wanted a better estimate of the distribution of lead-time demand: Would you (1) increase the number of cycles on the ‘One Trial’ worksheet or (2) increase the number of trials on the ‘Experiment’ worksheet? Explain your answer.

  19. In Example 11, suppose you wanted a better estimate of the mean lead-time demand? Wha would you do?

  20. In Example 11, let the demand probabilities be equal for the possible values 3, 4, 5, and 6. Run an experiment with 400 trials. Compare the average lead-time demand from using the original input data and from using the new input data.

  21. In Example 11, let the lead-time probabilities be equal for the possible values 1, 2, and 3. Run an experiment with 400 trials. Compare the average lead-time demand from using the origina input data and from using the new input data.

  22. In Example 12, run the experiment 20 times, each with 400 trials. Record the number of times that the middle path was the longest. What is your best estimate of the probability that the middle path is taken?

  23. In the above exercise, what is the smallest value and the largest value encountered for the number of times that the middle path was selected? What if you had conducted one simulation, gotten the smallest (or largest) value, and reported that as the result? How could you argue yourself ou of that jam?

  24. In Example 12, suppose the third pathway (the bottom one in Figure 20) is changed so that it consists of six U(1,2) activities. Modify the spreadsheet to accommodate this. Which is the mos frequently occurring path now? What insight does this exercise provide?

  25. Using Excel, generate 1000 values in a column, using the formula =-10*LN(RAND()).

(a) Compute descriptive statistics about the data in that column, including the minimum value, the maximum value, the mean, the median, and the standard deviation.

(b) Tabulate the values into 10 bins, each of width equal to 5, the first bin beginning at 0, and the eleventh bin for overflow (if any).

(c) Does the histogram resemble any distribution with which you are familiar? If so, what is its name?

Hint: Use FREQUENCY or COUNT in an Excel formula to count bin frequencies.

  1. Using Excel, generate 12 columns, each with 250 values, using the formula =RAND().

In cell M1, place the formula =SUM(A1:L1)-6 and copy it to the 249 cells below M1 in column M.

(a) Compute descriptive statistics about the data in column M, including minimum value, maximum value, mean, median, and standard deviation

(b) Tabulate the values with 9 bins. The first bin will include all values less than or equal to 3.5; the next 6 bins are of width one; the last bin will include all values greater than 3.5.

(c) Does the histogram resemble any distribution with which you are familiar? If so, what is its name?

Hint 1: Use FREQUENCY or COUNT in an Excel formula to count bin frequencies.

Hint 2: The values in Column M can be used as a rough approximation to those in Table A.2.

  1. Using Excel, generate a table that can be used instead of Table A.1, using the formula =INT(RAND()*100000).

  2. Use Excel to devise a Monte Carlo experiment to estimate the value of π, as in the equation for the area of a circle,

A=πr2 \mathrm{A} = \pi \mathrm{r} ^ {2}

Hint: Consider a quarter circle with unit radius inside a unit square. Throw a random dart onto the unit square.

  1. A college student is making financial plans for the next year. Expenses include the following known costs:

Tuition $8,400

Dormitory $5,400

There are also a lot of uncertain expenses, with ranges as follows:

Meals $900–$1,350

Entertainment $600–$1,200

Transportation $200–$600

Books $400–$800

The student foresees income to pay for next year. The only certain amounts are as follows:

State scholarship $3,000

Parental contribution $4,000

Some of the income is variable, with ranges as follows:

Waiting tables $3,000–$5,000

Library aide $2,000–$3,000

The student predicts that a loan will be needed. Develop a spreadsheet model and use it with 1,000 trials to forecast the probability distribution for the size of the loan. Treat any amounts that are variable as uniformly distributed over the range indicated.

  1. The 22-stop Bally 1090 slot machine had the following number of symbols on each reel:
SymbolsReel 1Reel 2Reel 3
Cherries252
Oranges237
Plums5110
Bells1021
Bars2101
7's111

Payoffs were as follows:

CombinationPayoffCombinationPayoff
Left cherry2Three plums20
Right cherry2Plum plum bar14
Any two cherries5Bar plum plum14
Three cherries20Three bells20
Three oranges20Bell bell bar18
Orange orange bar10Bar bell bell18
Bar orange orange10Three bars50
Three 7's100

Using Excel, simulate 1,000 plays of this slot machine, each for $1.

How much was the gain or loss?

List of Materials Available on www.bcnn.net

Example2.1CoinToss.xls - Tossing a Coin

Example2.2ServiceTimes.xls - Service Times

Example2.3ArrivalTimes.xls - Arrival Time

Example2.4CoinTossGame.xls - A Coin Tossing Question

Example2.5SingleServer.xls - Grocery Store (single-server queue)

Example2.6AbleBaker.xls - Call Center (two-channel queue)

Example2.7NewsDealer.xls - News Dealer’s Inverntory Problem

Example2.8RefrigInventory.xls - Refrigerator Sales (inventory ordering)

Example2.9CurrentBearings.xls - Current Bearing Replacement Policy

Example2.9ProposedBearings.xls - Proposed Bearing Replacement Policy

Example2.10Target.xls - A Bombing Mission

Example2.11LeadTimeDemand - Lead-Time Demand Distribution

Example2.12Project.xls - Project Activity Network

BCNNvba.xla - Excel add-in (VBA code) to run examples

Chap2Excel5ed.zip - a zip file containing all Excel examples

3 General Principles

This chapter develops a common framework for the modeling of complex systems by using discreteevent simulation. It covers the basic building blocks of all discrete-event simulation models: entities and attributes, activities, and events. In discrete-event simulation, a system is modeled in terms of its state at each point in time; of the entities that pass through the system and the entities that represen system resources; and of the activities and events that cause the system state to change. Discrete-event models are appropriate for those systems for which changes in system state occur only at discrete points in time.

The discussion in this chapter focuses on the discrete-event concepts and methodologies of simulation languages and software (collectively called simulation packages).

This chapter introduces and explains the fundamental concepts and methodologies underlying al discrete-event simulation packages. These concepts and methodologies are not tied to any particular package. Many of the packages use different terminology from that used here, and most have a number of higher-level constructs designed to make modeling simpler and more straightforward for their application domain. For example, this chapter discusses the fundamental abstract concept of an entity, but not covered are more concrete realizations of entities, such as machines, conveyors, and vehicles that are built into some of the packages to facilitate modeling in the manufacturing, materia handling, or other domains

Section 1 covers the general principles and concepts of discrete-event simulation, the even scheduling/time advance algorithm, and the three prevalent world views: event scheduling, process interaction, and activity scanning. Section 2 introduces some of the notions of list processing, one of the more important methodologies used in discrete-event simulation software.

1 Concepts in Discrete-Event Simulation

This chapter deals exclusively with dynamic, stochastic systems (i.e., involving time and containing random elements) that change in a discrete manner. This section expands on these concepts and proposes a framework for the development of a discrete-event model of a system. The major concepts are briefly defined and then illustrated by examples:

System A collection of entities (e.g., people and machines) that interact together over time to accomplish one or more goals.

Model An abstract representation of a system, usually containing structural, logical, or mathematical relationships that describe a system in terms of state, entities and their attributes, sets, processes, events, activities, and delays.

System state A collection of variables that contain all the information necessary to describe the system at any time.

Entity Any object or component in the system that requires explicit representation in the mode (e.g., a server, a customer, a machine).

Attributes The properties of a given entity (e.g., the priority of a waiting customer, the routing of a job through a job shop).

List A collection of (permanently or temporarily) associated entities, ordered in some logica fashion (such as all customers currently in a waiting line, ordered by “first come, first served,” or by priority).

Event An instantaneous occurrence that changes the state of a system (such as an arrival of a new customer).

Event notice A record of an event to occur at the current or some future time, along with any associated data necessary to execute the event; at a minimum, the record includes the even type and the event time.

Event list A list of event notices for future events, ordered by time of occurrence; also known as the future event list (FEL).

Activity A duration of time of specified length (e.g., a service time or interarrival time), which is known when it begins (although it may be defined in terms of a statistical distribution).

Delay A duration of time of unspecified indefinite length, which is not known until it ends (e.g., a customer’s delay in a last-in–first-out waiting line which, when it begins, depends on future arrivals).

Clock A variable representing simulated time, called CLOCK in the examples to follow.

Different simulation packages use different terminology for the same or similar concepts—for example, lists are sometimes called sets, queues, or chains. Sets or lists are used to hold both entities and event notices. The entities on a list are always ordered by some rule, such as first-in–first-out or last-in–first-out, or are ranked by some entity attribute, such as priority or due date. The future event list is always ranked by the event time recorded in the event notice. Section 2 discusses a number of methods for handling lists and introduces some of the methodologies for efficient processing o ordered sets or lists.

An activity typically represents a service time, an interarrival time, or any other processing time whose duration has been characterized and defined by the modeler. An activity’s duration may be specified in a number of ways:

a. Deterministic—for example, always exactly 5 minutes;

b. Statistical—for example, as a random draw from the set 2, 5, 7 with equal probabilities;

c. A function depending on system variables and/or entity attributes—for example, loading time for an iron ore ship as a function of the ship’s allowed cargo weight and the loading rate in tons per hour.

However it is characterized, the duration of an activity is computable from its specification at the instant it begins. Its duration is not affected by the occurrence of other events (unless, as is allowed by some simulation packages, the model contains logic to cancel or postpone an activity in progress). To keep track of activities and their expected completion time, at the simulated instant that an activity duration begins, an event notice is created having an event time equal to the activity’s completion time. For example, if the current simulated time is CLOCK 100 minutes and an inspection time of exactly 5 minutes is just beginning, then an event notice is created that specifies the type of even (an end-of-inspection event), and the event time (1005 105 minutes).

In contrast to an activity, a delay’s duration is not specified by the modeler ahead of time, bu rather is determined by system conditions. Quite often, a delay’s duration is measured and is one of the desired outputs of a model run. Typically, a delay ends when some set of logical conditions becomes true or one or more other events occur. For example, a customer’s delay in a waiting line may be dependent on the number and duration of service of other customers ahead in line as well as the availability of servers and equipment.

A delay is sometimes called a conditional wait, an activity an unconditional wait. The completion of an activity is an event, often called a primary event, that is managed by placing an event notice on the FEL. In contrast, delays are managed by placing the associated entity on another list, perhaps representing a waiting line, until such time as system conditions permit the processing of the entity. The completion of a delay is sometimes called a conditional or secondary event, but such events are not represented by event notices, nor do they appear on the FEL.

The systems considered here are dynamic, that is, changing over time. Therefore, system state, entity attributes and the number of active entities, the contents of sets, and the activities and delays

currently in progress are all functions of time and are constantly changing over time. Time itself is represented by a variable called CLOCK.

Consider the Able–Baker call center system of Example 6 from the Simulation Examples in a Spreadsheet chapter. A discrete-event model has the following components:

System state LQ(t)L_{Q}(t), the number of callers waiting to be served at time tt;LA(t)L_{A}(t), 0 or 1 to indicate Able as being idle or busy at time tt;LB(t)L_{B}(t), 0 or 1 to indicate Baker as being idle or busy at time tt.

Entities Neither the callers nor the servers need to be explicitly represented, except in terms of the state variables, unless certain caller averages are desired (compare Examples 4 and 5).

Events Arrival event; Service completion by Able; Service completion by Baker.

Activities Interarrival time, defined in Table 12 from the Simulation Examples in a Spreadsheet chapter; Service time by Able, defined in Table 13 from the Simulation Examples in a Spreadsheet chapter; Service time by Baker, defined in Table 14 from the Simulation Examples in a Spreadsheet chapter.

Delay A caller’s wait in queue until Able or Baker becomes free.

The definition of the model components provides a static description of the model. In addition, a description of the dynamic relationships and interactions between the components is also needed. Some questions that need answers include:

  1. How does each event affect system state, entity attributes, and set contents?

  2. How are activities defined (i.e., deterministic, probabilistic, or some other mathematical equation)? What event marks the beginning or end of each activity? Can the activity begin regardless of system state, or is its beginning conditioned on the system being in a certain state? (For example, a machining “activity” cannot begin unless the machine is idle, not broken, and not in maintenance.)

  3. Which events trigger the beginning (and end) of each type of delay? Under what conditions does a delay begin or end?

  4. What is the system state at time 0? What events should be generated at time 0 to “prime” the model—that is, to get the simulation started?

A discrete-event simulation is the modeling over time of a system all of whose state changes occur at discrete points in time—those points when an event occurs. A discrete-event simulation (hereafter called a simulation) proceeds by producing a sequence of system snapshots (or system images) that represent the evolution of the system through time. A given snapshot at a given time (CLOCK t) includes not only the system state at time t, but also a list (the FEL) of all activities currently in progress and when each such activity will end, the status of all entities and current membership of all sets, plus the current values of cumulative statistics and counters that will be used to calculate summary statistics at the end of the simulation. A prototype system snapshot is shown in Figure 1. (Not all models will contain every element exhibited in Figure 1. Further illustrations are provided in the examples in this chapter.)

1.1 The Event Scheduling/Time Advance Algorithm

The mechanism for advancing simulation time and guaranteeing that all events occur in correc chronological order is based on the future event list (FEL). This list contains all event notices for events that have been scheduled to occur at a future time. Scheduling a future event means that, at the instant an activity begins, its duration is computed or drawn as a sample from a statistical distribution; and that the end-activity event, together with its event time, is placed on the future event list. In the real world, most future events are not scheduled but merely happen—such as random breakdowns or random arrivals. In the model, such random events are represented by the end of some activity, which in turn is represented by a statistical distribution

At any given time t, the FEL contains all previously scheduled future events and their associated event times (called t1,t2,…t_{1} , t_{2} , \ldots in Figure 1). The FEL is ordered by event time, meaning that the events are arranged chronologically—that is, the event times satisfy

t<t1≤t2≤t3≤⋯≤tn. t < t_{1} \leq t_{2} \leq t_{3} \leq \dots \leq t_{n}.

Time t is the value of CLOCK, the current value of simulated time. The event associated with time t1t_{1} is called the imminent event; that is, it is the next event that will occur. After the system snapshot at simulation time CLOCK t has been updated, the CLOCK is advanced to simulation time CLOCK=t1{\mathrm{C L O C K}} = t_{1}, the imminent event notice is removed from the FEL, and the event is executed. Execution of the imminent event means that a new system snapshot for time t1t_{1} is created, one based on the old snapshot at time t and the nature of the imminent event. At time t1.t_{1} ., new future

CLOCKSystem stateEntities and attributesSet 1Set 2…Future event list (FEL)Cumulative statistics and counters
t(x,y,z,…)(3,t1)- Type 3 event to occur at time t1(1,t2)- Type 1 event to occur at time t2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Figure 1 Prototype system snapshot at simulation time t.

events may or might not be generated, but if any are, they are scheduled by creating event notices and putting them into their proper position on the FEL. After the new system snapshot for time t1t_{1} has been updated, the clock is advanced to the time of the new imminent event and that event is executed. This process repeats until the simulation is over. The sequence of actions that a simulator (or simulation language) must perform to advance the clock and build a new system snapshot is called the event-scheduling/time-advance algorithm, whose steps are listed in Figure 2 (and explained thereafter).

The length and contents ofthe FEL are constantly changing as the simulation progresses, and thus its efficient management in a simulation software package will have a major impact on the model’s computer runtime. The management of a list is called list processing. The major list processing operations performed on a FEL are removal of the imminent event, addition of a new event to the list, and occasionally removal of some event (called cancellation of an event). As the imminent event is usually at the top of the list, its removal is as efficient as possible. Addition of a new event (and cancellation of an old event) requires a search of the list. The efficiency of this search depends on the logical organization of the list and on how the search is conducted. In addition to the FEL, al the sets in a model are maintained in some logical order, and the operations of addition and remova of entities from the set also require efficient list-processing techniques. A brief introduction to lis processing in simulation is given in Section 2.

The removal and addition of events from the FEL is illustrated in Figure 2. Event 3 with event time t1t_{1} represents, say, a service completion event at server 3. Since it is the imminent event at time t, it is removed from the FEL in Step 1 (Figure 2) of the event-scheduling/time-advance algorithm. When event 4 (say, an arrival event) with event time t∗t^{*} is generated at Step 4, one possible way to determine its correct position on the FEL is to conduct a top-down search:

If t∗<t2,place event 4 at the top of the FEL.If t2≤t∗<t3,place event 4 second on the list.If t3≤t∗<t4,place event 4 third on the list.⋮If tn≤t∗,place event 4 last on the list. \begin{array}{c c} \text{If }t^{*} < t_{2}, & \text{place event 4 at the top of the FEL.} \\ \text{If }t_{2} \leq t^{*} < t_{3}, & \text{place event 4 second on the list.} \\ \text{If }t_{3} \leq t^{*} < t_{4}, & \text{place event 4 third on the list.} \\ \vdots \\ \text{If }t_{n} \leq t^{*}, & \text{place event 4 last on the list.} \end{array}

(In Figure 2, it was assumed that t∗t^{*} was between t2t_{2} and t3.)t_{3} . )) Another way is to conduct a bottom-up search. The least efficient way to maintain the FEL is to leave it as an unordered list (additions placed arbitrarily at the top or bottom), which would require at Step 1 of Figure 2 a complete search of the list for the imminent event before each clock advance. (The imminent event is the event on the FEL with the lowest event time.)

The system snapshot at time 0 is defined by the initial conditions and the generation of the so-called exogenous events. The specified initial conditions define the system state at time 0. For example, in Figure 2,if⁡t=02 , \operatorname{i f} t = 0, then the state (5, 1, 6) might represent the initial number of customers at three different points in the system. An exogenous event is a happening “outside the system” tha impinges on the system. An important example is an arrival to a queueing system. At time 0, the firs arrival event is generated and is scheduled on the FEL (meaning that its event notice is placed on the FEL). The interarrival time is an example of an activity. When the clock eventually is advanced to the time of this first arrival, a second arrival event is generated. First, an interarrival time, call it a∗.a^{*} ., is

Old system snapshot at time t

CLOCKSystem state⋯\cdotsFuture event list⋯\cdots
tt(5, 1, 6)(3,t1)−Type 3 event to occur at timet1(3, t_1) - \text{Type 3 event to occur at time} t_1
(1,t2)−Type 1 event to occur at timet2(1, t_2) - \text{Type 1 event to occur at time} t_2
(1,t3)−Type 1 event to occur at timet3(1, t_3) - \text{Type 1 event to occur at time} t_3
⋅⋅⋅\cdot \cdot \cdot
(2,tn)−Type 2 event to occur at timetn(2, t_n) - \text{Type 2 event to occur at time} t_n

Event-scheduling/time-advance algorithm

Step 1. Remove the event notice for the imminent event (event 3, time t1)t_{1} ) from FEL.

Step 2. Advance CLOCK to imminent event time (i.e., advance CLOCK from t to t ).

Step 3. Execute imminent event: update system state, change entity attributes, and set membership as needed.

Step 4. Generate future events (if necessary) and place their event notices on FEL, ranked by event time. (Example: Event 4 to occur at time t∗, where t2<t∗<t3.)t_{2} < t^{*} < t_{3} . ) Step 5. Update cumulative statistics and counters.

New system snapshot at time t1t_{1}| CLOCK | System state |⋯\cdots| Future event list |⋯\cdots| | — | — | — | — | — | |t1t_{1}| (5, 1, 5) | |(1,t2)−Type 1 event to occur at timet2(1, t_{2}) - \text{Type 1 event to occur at time} t_{2}(4,t∗)−Type 4 event to occur at timet∗(4, t^{*}) - \text{Type 4 event to occur at time} t^{*}(1,t3)−Type 1 event to occur at timet3(1, t_{3}) - \text{Type 1 event to occur at time} t_{3}⋅⋅⋅\cdot \cdot \cdot(2,tn)−Type 2 event to occur at timetn(2, t_{n}) - \text{Type 2 event to occur at time} t_{n}| |

Figure 2 Advancing simulation time and updating system image.

generated; it is added to the current time,CLOCK=t;{\mathrm{C L O C K}} = t ; the resulting (future) event time,t+a∗=t∗t + a^{*} = t^{*} is used to position the new arrival event notice on the FEL. This method of generating an external arrival stream is called bootstrapping; it provides one example of how future events are generated in Step 4 of the event-scheduling/time-advance algorithm. Bootstrapping is illustrated in Figure 3.

Figure 3 Generation of an external arrival stream by bootstrapping.

The first three interarrival times generated are 3.7, 0.4, and 3.3 time units. The end of an interarriva interval is an example of a primary event.

A second example of how future events are generated (Step 4 of Figure 2) is provided by a service completion event in a queueing simulation. When one customer completes service, at current time CLOCK=t,\mathrm{C L O C K} = t , if the next customer is present, then a new service time,s∗s^{*}, will be generated for the next customer. The next service completion event will be scheduled to occur at future time t∗=t+s∗t^{*} = t + s^{*}, by placing onto the FEL a new event notice, of type service completion, with event time t∗. In addition, a service-completion event will be generated and scheduled at the time of an arrival event provided that, upon arrival, there is at least one idle server in the server group. A service time is an example of an activity. Beginning service is a conditional event, because its occurrence is triggered only on the condition that a customer be present and a server be free. Service completion is an example of a primary event. Note that a conditional event, such as beginning service, is triggered by a primary event’s occurring and by certain conditions prevailing in the system. Only primary events appear on the FEL.

A third important example is the alternate generation of runtimes and downtimes for a machine subject to breakdowns. At time 0, the first runtime will be generated, and an end-of-runtime even will be scheduled. Whenever an end-of-runtime event occurs, a downtime will be generated, and an end-of-downtime event will be scheduled on the FEL. When the CLOCK is eventually advanced to the time of this end-of-downtime event, a runtime is generated, and an end-of-runtime event is scheduled on the FEL. In this way, runtimes and downtimes continually alternate throughout the simulation. A runtime and a downtime are examples of activities, and end of runtime and end of downtime are primary events.

Every simulation must have a stopping event, here called E, which defines how long the simulation will run. There are generally two ways to stop a simulation:

  1. At time 0, schedule a stop simulation event at a specified future time TE.T_{E} .. Thus, before simulating, it is known that the simulation will run over the time interval [0,TE][ 0 , T_{E} ]. Example: Simulate a job shop for TE=40T_{E} = 40 hours.

  2. Run length TET_{E} is determined by the simulation itself. Generally,TET_{E} is the time of occurrence of some specified event E. Examples:TET_{E} could be the time of the 100th service completion

at a certain service center.TET_{E} could be the time of breakdown of a complex system.TET_{E} could be the time of disengagement or total kill (whichever occurs first) in a combat simulation.TET_{E} could be the time at which a distribution center ships the last carton in a day’s orders.

In case 2,TE2 , T_{E} is not known ahead of time. Indeed, it could be one of the statistics of primary interest to be produced by the simulation.

1.2 World Views

When using a simulation package or even when doing a manual simulation, a modeler adopts a world view or orientation for developing a model. The most prevalent world views are the eventscheduling world view, as discussed in the previous section, the process-interaction world view, and the activity-scanning world view. Even if a particular package does not directly support one or more of the world views, understanding the different approaches could suggest alternative ways to mode a given system.

To summarize the previous discussion, when using the event-scheduling approach, a simulation analyst concentrates on events and their effect on system state. This world view will be illustrated by the manual simulations of Section 1.3.

When using a package that supports the process-interaction approach, a simulation analyst thinks in terms of processes. The analyst defines the simulation model in terms of entities or objects and their life cycle as they flow through the system, demanding resources and queueing to wait for resources. More precisely, a process is the life cycle of one entity. This life cycle consists of various events and activities. Some activities might require the use of one or more resources whose capacities are limited. These and other constraints cause processes to interact, the simplest example being an entity forced to wait in a queue (on a list) because the resource it needs is busy with another entity. The process-interaction approach is popular because it has intuitive appeal and because the simulation packages that implement it allow an analyst to describe the process flow in terms of high-level block or network constructs, while the interaction among processes is handled automatically.

In more precise terms, a process is a time-sequenced list of events, activities, and delays, including demands for resources, that define the life cycle of one entity as it moves through a system. An example of a “customer process” is shown in Figure 4. In this figure, we see the interaction between two customer processes as customer n 1 is delayed until the previous customer’s “end service event” occurs. Usually, many processes are active simultaneously in a model, and the interaction among processes could be quite complex.

Underlying the implementation of the process interaction approach in a simulation package, bu usually hidden from a modeler’s view, events are being scheduled on a future event list and entities are being placed onto lists whenever they face delays, causing one process to temporarily suspend its execution while other processes proceed. It is important that the modeler have a basic understanding of the concepts and, for the simulation package being used, a detailed understanding of the built-in but hidden rules of operation. Schriber and Brunner [2003] provide understanding in this area.

Both the event-scheduling and the process-interaction approach use a variable time advance— that is, when all events and system state changes have occurred at one instant of simulated time, the simulation clock is advanced to the time of the next imminent event on the FEL. The activity-scanning approach, in contrast, uses a fixed time increment and a rule-based approach to decide whether any activities can begin at each point in simulated time.

Figure 4 Two interacting customer processes in a single-server queue.

With the activity-scanning approach, a modeler concentrates on the activities of a model and those conditions, simple or complex, that allow an activity to begin. At each clock advance, the conditions for each activity are checked, and, if the conditions are true, then the corresponding activity begins. Proponents claim that the activity-scanning approach is simple in concept and leads to modular models that are more easily maintained, understood, and modified by other analysts a later times. They admit, however, that the repeated scanning to discover whether an activity can begin results in slow runtime on computers. Thus, the pure activity-scanning approach has been modified (and made conceptually somewhat more complex) by what is called the three-phase approach, which combines some of the features of event scheduling with activity scanning to allow for variable time advance and the avoidance of scanning when it is not necessary, but keeps the main advantages o the activity-scanning approach.

In the three-phase approach, events are considered to be activities of duration zero time units. With this definition, activities are divided into two categories, which are called B and C.

B activities activities bound to occur; all primary events and unconditional activities.

C activities activities or events that are conditional upon certain conditions being true.

The B-type activities and events can be scheduled ahead of time, just as in the event-scheduling approach. This allows variable time advance. The FEL contains only B-type events. Scanning to learn whether any C-type activities can begin or C-type events occur happens only at the end of each time advance, after all B-type events have been completed. In summary, with the three-phase approach, the simulation proceeds with repeated execution of the 3 phases until it is completed:

Phase A Remove the imminent event from the FEL and advance the clock to its event time. Remove from the FEL any other events that have the same event time.

Phase B Execute all B-type events that were removed from the FEL. (This could free a number of resources or otherwise change system state.)

Phase C Scan the conditions that trigger each C-type activity and activate any whose conditions are met. Rescan until no additional C-type activities can begin and no events occur.

The three-phase approach improves the execution efficiency of the activity-scanning method. In addition, proponents claim that the activity-scanning and three-phase approaches are particularly good at handling complex resource problems in which various combinations of resources are needed to accomplish different tasks. These approaches guarantee that all resources being freed at a given simulated time will be freed before any available resources are reallocated to new tasks.

Example 2: Call Center, Back Again

For the Call Center in Example 1, ifwe were to adopt the three-phase approach to the activity-scanning world view, the conditions for beginning each activity in Phase C would be as follows:

ActivityCondition
Service time by AbleA caller is in queue and Able is idle
Service time by BakerA caller is in queue, Baker is idle and Able is busy

Ifit were to take the process-interaction world view, we would view the model from the viewpoint of a caller and its “life cycle.” Considering a life cycle as beginning upon arrival, a customer process is pictured in Figure 4.

In summary, the process-interaction approach has been adopted by the simulation packages most popular in the USA. On the other hand, a number of activity-scanning packages are popular in the UK and Europe. Some of the packages allow portions of a model to be event-scheduling-based, if tha orientation is convenient, mixed with the process-interaction approach. Finally, some of the packages are based on a flow chart, block diagram, or network structure, which upon closer examination turns out to be a specific implementation of the process-interaction concept.

1.3 Manual Simulation Using Event Scheduling

In the conducting ofan event-scheduling simulation, a simulation table is used to record the successive system snapshots as time advances.

Example 3: Single-Channel Queue

Consider the grocery store with one checkout counter that is simulated in Example 5 from the Simulation Examples in a Spreadsheet chapter by an ad hoc method. The system consists of those customers in the waiting line plus the one (if any) checking out. A stopping time of 60 minutes is set for this example. The model has the following components:

System state (LQ(t), LS(t)), where LQ(t) is the number of customers in the waiting line, and LS(t) is the number being served (0 or 1) at time t.

Entities The server and customers are not explicitly modeled, except in terms of the state variables.

Events

Arrival (A);

Departure (D);

Stopping event (E), scheduled to occur at time 60.

Event notices

(A, t), representing an arrival event to occur at future time t;

(D, t), representing a customer departure at future time t;

(E, 60), representing the simulation stop event at future time 60.

Activities

Interarrival time, defined in Table 9 from the Simulation Examples in a Spreadsheet chapter; Service time, defined in Table 10 from the Simulation Examples in a Spreadsheet chapter.

Delay Customer time spent in waiting line.

The event notices are written as (event type, event time). In this model, the FEL will always contain either two or three event notices. The effect of the arrival and departure events is shown in detail in Figures 5 and 6.

Figure 5 Execution of the arrival event.

Figure 6 Execution of the departure event.

The simulation table for the checkout counter is given in Table 1. The reader should cover all system snapshots except one, starting with the first, and attempt to construct the next snapshot from the previous one and the event logic in Figures 5 and 6.

Interarrival Times116375241···
Service Times425415414···

Initial conditions are that the first customer arrive at time 0 and begin service. This is reflected in Table 1 by the system snapshot at time zero (CLOCK=0)( \mathbf{C L O C K} = 0 ), with LQ(0)=0,LS(0)=1L Q ( 0 ) = 0 , L S ( 0 ) = 1, and both a departure event and arrival event on the FEL. Also, the simulation is scheduled to stop at time 60. Only two statistics, server utilization and maximum queue length, will be collected. Server utilization is defined by total server busy time (B) divided by total time (TE)( T_{E} )). Total busy time, B, and maximum queue length, MQ, will be accumulated as the simulation progresses. A column headed “Comments” is included to aid the reader (a∗( a^{*} and s∗s^{*} are the generated interarrival and service times, respectively).

As soon as the system snapshot at time CLOCK 0 is complete, the simulation begins. At time 0, the imminent event is (A,1)( \mathsf {A} , 1 ). The CLOCK is advanced to time 1, and (A,1)( \mathsf {A} , 1 ) is removed from the FEL. Because LS(t)=1L S ( t ) = 1 for 0≤t≤1(i.e.0 \leq t \leq 1 ( \mathrm{i . e .}, the server was busy for 1 minute), the cumulative busy time is increased from B=0B = 0 to B=1B = 1. By the event logic in Figure 6, set LS(1)=1L S ( 1 ) = 1(the

Table 1 Simulation Table for Checkout Counter

CLOCKSystem stateFuture event listCommentCumulative statistics
LQ(t)LQ(t)LS(t)LS(t)BMQ
001(A, 1) (D, 4) (E, 60)First A occurs (a∗=1)(a^{*}=1) Schedule next A (s∗=4)(s^{*}=4) Schedule first D00
111(A, 2) (D, 4) (E, 60)Second A occurs: (A, 1) (a∗=1)(a^{*}=1) Schedule next A(Customer delayed)11
221(D, 4) (A, 8) (E, 60)Third A occurs: (A, 2) (a∗=6)(a^{*}=6) Schedule next A(Two customers delayed)22
411(D, 6) (A, 8) (E, 60)First D occurs: (D, 4) (s∗=2)(s^{*}=2) Schedule next D(Customer delayed)42
601(A, 8) (D, 11) (E, 60)Second D occurs: (D, 6) (s∗=5)(s^{*}=5) Schedule next D62
811(D, 11) (A, 11) (E, 60)Fourth A occurs: (A, 8) (a∗=3)(a^{*}=3) Schedule next A(Customer delayed)82
1111(D, 15) (A, 18) (E, 60)Fifth A occurs: (A, 11) (a∗=7)(a^{*}=7) Schedule next AThird D occurs: (D, 11) (s∗=4)(s^{*}=4) Schedule next D(Customer delayed)112
1501(D, 16) (A, 18) (E, 60)Fourth D occurs: (D, 15) (s∗=1)(s^{*}=1) Schedule next D152
1600(A, 18) (E, 60)Fifth D occurs: (D, 16)162
1801(D, 23) (A, 23) (E, 60)Sixth A occurs (a∗=5)(a^{*}=5) Schedule next A (s∗=5)(s^{*}=5) Schedule next D162
2301(A, 25) (D, 27) (E, 60)Seventh A occurs: (A, 23) (a∗=2)(a^{*}=2) Schedule next ArrivalSixth D occurs: (D, 23)212

server becomes busy). The FEL is left with three future events, (A, 2), (D, 4), and (E, 60). The simulation CLOCK is next advanced to time 2, and an arrival event is executed. The interpretation of the remainder of Table 1 is left to the reader.

The simulation in Table 1 covers the time interval [0,23]. At simulated time 23, the system empties, but the next arrival also occurs at time 23. The server was busy for 21 of the 23 time units simulated, and the maximum queue length was two. This simulation is, of course, too short to draw any reliable conclusions. Note that the simulation table gives the system state at all times, not jus the listed times. For example, from time 11 to time 15, there is one customer in service and one in the waiting line.

When an event-scheduling algorithm is implemented in simulation software, the software maintains just one set of system states and other attribute values, that is, just one snapshot (the curren one or partially updated one). With the idea of implementing event scheduling in Java or some other general-purpose language, the following rule should be followed. A new snapshot can be derived only from the previous snapshot, newly generated random variables, and the event logic (Figures 5 and 6). Past snapshots should be ignored for advancing of the clock. The current snapshot mus contain all information necessary to continue the simulation.

Example 4: The Checkout-Counter Simulation, Continued

Suppose that, in the simulation of the checkout counter in Example 3, the simulation analyst desires to estimate mean response time and mean proportion of customers who spend 5 or more minutes in the system. A response time is the length of time a customer spends in the system. In order to estimate these customer averages, it is necessary to expand the model in Example 3 to represent the individual customers explicitly. In addition, to be able to compute an individual customer’s response time when that customer departs, it will be necessary to know that customer’s arrival time. Therefore, a customer entity with arrival time as an attribute will be added to the list of model components in Example 3. These customer entities will be stored in a list to be called “CHECKOUT LINE”; they will be called C1, C2, C3, . . . Finally, the event notices on the FEL will be expanded to indicate which customer is affected. For example, (D,4,C1) means that customer C1 will depart at time 4. The additional model components are the following:

Entities

(Ci, t), representing customer Ci who arrived at time t.

Event notices

(A, t, Ci), the arrival of customer Ci at future time t;

(D, t, Cj), the departure of customer Cj at future time t,

Set

“CHECKOUT LINE,” the set of all customers currently at the checkout counter (being served or waiting to be served), ordered by time of arrival

Three new cumulative statistics will be collected: S, the sum of customer response times for al customers who have departed by the current time; F, the total number of customers who spend 5 or more minutes at the checkout counter; and ND.N_{D} ., the total number of departures up to the curren simulation time. These three cumulative statistics will be updated whenever the departure even occurs; the logic for collecting these statistics would be incorporated into Step 5 of the departure event in Figure 6.

Table 2 Simulation Table for Example 4

CLOCKSystem stateCHECKOUT LINEFuture event listCumulative statistics
LQ(t)LQ(t)LS(t)LS(t)SNDN_{D}F
001(C1,0)(A,1,C2) (D,4,C1) (E,60)000
111(C1,0) (C2,1)(A,2,C3) (D,4,C1) (E,60)000
221(C1,0) (C2,1) (C3,2)(D,4,C1) (A,8,C4) (E,60)000
411(C2,1) (C3,2)(D,6,C2) (A,8,C4) (E,60)410
601(C3,2)(A,8,C4) (D,11,C3) (E,60)921
811(C3,2) (C4,8)(D,11,C3) (A,11,C5) (E,60)921
1111(C4,8) (C5,11)(D,15,C4) (A,18,C6) (E,60)1832
1501(C5,11)(D,16,C5) (A,18,C6) (E,60)2543
1600(A,18,C6) (E,60)3054
1801(C6,18)(D,23,C6) (A,23,C7) (E,60)3054
2301(C7,23)(A,25,C8) (D,27,C7) (E,60)3565

The simulation table for Example 4 is shown in Table 2. The same data for interarrival and service times will be used again; so Table 2 essentially repeats Table 1, except that the new components are included (and the comment column has been deleted). These new components are needed for the computation of the cumulative statistics S, F, and NDN_{D}. For example, at time 4, a departure event occurs for customer C1. The customer entity C1 is removed from the list called “CHECKOUT LINE”; the attribute “time of arrival” is noted to be 0, so the response time for this customer was 4 minutes. Hence, S is incremented by 4 minutes.NDN_{D} is incremented by one customer, but F is not incremented, for the time in system was less than five minutes. Similarly, at time 23, when the departure even (D, 23, C6) is being executed, the response time for customer C6 is computed by

Response time=CLOCK TIME−attribute “time of arrival”=23−18=5minutes \begin{array}{r l} \text{Response time} & = \text{CLOCK TIME} - \text{attribute ``time of arrival''} \\ & = 23 - 18 \\ & = 5 \text{minutes} \end{array}

Then S is incremented by 5 minutes, and F and NDN_{D} by one customer.

For a simulation run length of 23 minutes, the average response time was S/ND=35/6=5.83S / N_{D} = 35 / 6 = 5 . 83 minutes, and the observed proportion of customers who spent 5 or more minutes in the system was F/ND=0.83F / N_{D} = 0 . 83. Again, this simulation was far too short to regard these estimates as having any degree of accuracy. The purpose of Example 4, however, was to illustrate the notion that, in many simulation models, the information desired from the simulation (such as the statistics S/NDS / N_{D} and F/ND)F / N_{D} ) to some extent dictates the structure of the model.

Figure 7 Dump truck problem.

Example 5: The Dump-Truck Problem

Six dump trucks are used to haul coal from the entrance of a small mine to the railroad. Figure 7 provides a schematic of the dump-truck operation. Each truck is loaded by one of two loaders. After a loading, the truck immediately moves to the scale, to be weighed as soon as possible. Both the loaders and the scale have a first-come–first-served waiting line (or queue) for trucks. Travel time from a loader to the scale is considered negligible. After being weighed, a truck begins a travel time (during which time the truck unloads) and then afterward returns to the loader queue.

The distributions of loading time, weighing time, and travel time are given in Tables 3, 4, and 5, respectively. These activity times are generated in exactly the same manner as service times in Section 1.5, Example 2 from the Simulation Examples in a Spreadsheet chapter, using the cumulative probabilities to divide the unit interval into subintervals whose lengths correspond to the probabilities of each individual value. Random numbers come from Table A.1 in the Appendix or one of Excel’s random number generators. A random number is drawn and the interval it falls into determines the next random activity time

The purpose of the simulation is to estimate the loader and scale utilizations (percentage of time busy). The model has the following components:

System state

[LQ(t), L(t), WQ(t), W(t)], where

LQ(t) number of trucks in loader queue;

L(t) number of trucks (0, 1, or 2) being loaded

WQ(t) = number of trucks in weigh queue;

W(t) number of trucks (0 or 1) being weighed, all at simulation time t.

Entities

The six dump trucks (DT1, . . . , DT6).

Event notices

(ALQ, t, DTi), DTi arrives at loader queue (ALQ) at time t;

(EL, t, DTi), DTi ends loading (EL) at time t;

(EW, t, DTi), DTi ends weighing (EW) at time t.

Table 3 Distribution of Loading Time for the Dump Trucks

Loading TimeProbabilityCumulative ProbabilityRandom Number Interval
50.300.300.0≤R≤0.30.0 \leq R \leq 0.3
100.500.800.3<R≤0.80.3 < R \leq 0.8
150.201.000.8<R≤1.00.8 < R \leq 1.0

Table 4 Distribution of Weighing Time for the Dump Trucks

Weighing TimeProbabilityCumulative ProbabilityRandom Number Interval
120.700.700.0≤R≤0.70.0 \leq R \leq 0.7
160.301.000.7<R≤1.00.7 < R \leq 1.0

Table 5 Distribution of Travel Time for the Dump Trucks

Travel TimeProbabilityCumulative ProbabilityRandom Number Interval
400.400.400.0≤R≤0.40.0 \leq R \leq 0.4
600.300.700.4<R≤0.70.4 < R \leq 0.7
800.200.900.7<R≤0.90.7 < R \leq 0.9
1000.101.000.9<R≤1.00.9 < R \leq 1.0

Lists

Loader queue, all trucks waiting to begin loading, ordered on a first-come–first-served basis;

Weigh queue, all trucks waiting to be weighed, ordered on a first-come–first-served basis.

Activities

Loading time, weighing time, and travel time.

Delays

Delay at loader queue, and delay at scale.

The simulation table is given in Table 6. To initialize the table’s first row, we assume that, at time 0, five trucks are at the loaders and one is at the scale. For simplicity, we take the (randomly generated) activity times from the following list as needed:

Loading Time105510151010
Weighing Time121212161216
Travel Time60100404080

When an end-loading (EL) event occurs, say, for dump truck j at time t, other events might be triggered. If the scale is idle [W(t)=0][ W ( t ) = 0 ], dump truck j begins weighing and an end-weighing even (EW) is scheduled on the FEL; otherwise, dump truck j joins the weigh queue. If, at this time, there is another truck waiting for a loader, it will be removed from the loader queue and will begin loading by the scheduling of an end-loading event (EL) on the FEL. Both this logic for the occurrence of the end-loading event and the appropriate logic for the other two events, should be incorporated into an event diagram, as in Figures 5 and 6 of Example 3. The construction of these event-logic diagrams is left as an exercise for the reader (Exercise 2).

As an aid to the reader, in Table 6, whenever a new event is scheduled, its event time is written as “t (activity time).” For example, at time 0, the imminent event is an EL event with event time 5. The clock is advanced to time t=5t = 5, dump truck 3 joins the weigh queue (because the scale is occupied), and dump truck 4 begins to load. Thus, an EL event is scheduled for truck 4 at future time 10, computed by (present time) (loading time) =5+5=10= 5 + 5 = 10 In order to estimate the loader and scale utilizations, two cumulative statistics are maintained:

B total busy time of both loaders from time 0 to time t

BS=total busy time of the scale from time 0 to timet B_{S} = \text{total busy time of the scale from time 0 to time} t

Both loaders are busy from time 0 to time 20,20 ,, so BL=40B_{L} = 40 at time t 20—but, from time 20 to time 24, only one loader is busy; thus,BLB_{L} increases by only 4 minutes over the time interval [20, 24]. Similarly, from time 25 to time 36, both loaders are idle (L(25)=0)( L ( 25 ) = 0 ), so BLB_{L} does not change. For the relatively short simulation in Table 6, the utilizations are estimated as follows:

Average loader utilization=49/276=0.32 \text{Average loader utilization} = \frac {49 / 2}{76} = 0. 32 Average scale utilization=7676=1.00 \text{Average scale utilization} = \frac {76}{76} = 1. 00

These estimates cannot be regarded as accurate estimates of the long-run “steady-state” utilizations of the loader and scale; a considerably longer simulation would be needed to reduce the effect of the assumed conditions at time 0 (five of the six trucks at the loaders) and to realize accurate estimates. On the other hand, if the analyst were interested in the so-called transient behavior of the system over a short period of time (say 1 or 2 hours), given the specified initial conditions, then the results in Table 6 can be considered representative (or constituting one sample) of that transient behavior. Additional samples can be obtained by conducting additional simulations, each one having the same initial conditions but using a different stream of random numbers to generate the activity times.

Table 6, the simulation table for the dump-truck operation, could have been simplified somewha by not explicitly modeling the dump trucks as entities—that is, the event notices could be written as (EL,t).( E L , t ) ., and so on, and the state variables used to keep track merely of the number of trucks in each

Table 6 Simulation Table for Dump-Truck Operation

CLOCK ttSystem stateListsFuture event listCumulative statistics
Loader queueWeigh queueBLB_LBSB_S
LQ(t)L(t)WQ(t)W(t)
03201DT4DT5DT6(EL, 5, DT3)(EL, 10, DT2)(EW, 12, DT1)00
52211DT5DT6DT3(EL, 10, DT2)(EL, 5 + 5, DT4)(EW, 12, DT1)105
101221DT6DT3DT2(EL, 10, DT4)(EW, 12, DT1)(EL, 10 + 10, DT5)2010
100231DT3DT2DT4(EW, 12, DT1)(EL, 20, DT5)(EL, 10 + 15, DT6)2010
120221DT2DT4(EL, 20, DT5)(EW, 12 + 12, DT3)(EL, 25, DT6)(ALQ, 12 + 60, DT1)2412
200131DT2DT4DT5(EW, 24, DT3)(EL, 25, DT6)(ALQ, 72, DT1)4020
240121DT4DT5(EL, 25, DT6)(EW, 24 + 12, DT2)(ALQ, 72, DT1)(ALQ, 24 + 100, DT3)4424
250031DT4DT5DT6(EW, 36, DT2)(ALQ, 72, DT1)(ALQ, 124, DT3)4525
360021DT5DT6(EW, 36 + 16, DT4)(ALQ, 72, DT1)(ALQ, 36 + 40, DT2)(ALQ, 124, DT3)4536
520011DT6(EW, 52 + 12, DT5)(ALQ, 72, DT1)(ALQ, 76, DT2)(ALQ, 52 + 40, DT4)(ALQ, 124, DT3)4552
640001(ALQ, 72, DT1)(ALQ, 76, DT2)(EW, 64 + 16, DT6)(ALQ, 92, DT4)(ALQ, 124, DT3)(ALQ, 64 + 80, DT5)4564
720101(ALQ, 76, DT2)(EW, 80, DT6)(EL, 72 + 10, DT1)(ALQ, 92, DT4)(ALQ, 124, DT3)(ALQ, 144, DT5)4572
760201(EW, 80, DT6)(EL, 82, DT1)(EL, 76 + 10, DT2)(ALQ, 92, DT4)(ALQ, 124, DT3)(ALQ, 144, DT5)4976

part of the system, not which trucks were involved. With this representation, the same utilization statistics could be collected. On the other hand, if mean “system” response time, or proportion o trucks spending more than 30 minutes in the “system,” were being estimated, where “system” refers to the loader queue and loaders and the weigh queue and scale, then dump truck entities (DTi), together with an attribute equal to arrival time at the loader queue, would be indispensable. Whenever a truck left the scale, that truck’s response time could be computed as current simulation time (t) minus the arrival-time attribute. This new response time would be used to update the cumulative statistics: S total response time of all trucks that have been through the “system" and F number of truck response times that have been greater than 30 minutes. This example again illustrates the notion that, to some extent, the complexity of the model depends on the performance measures being estimated.

Example 6: The Dump-Truck Problem (revisited)

For the Dump Truck problem in Example 5, if we were to adopt the activity-scanning approach, the conditions for beginning each activity would be as follows:

Activity Condition

Loading time Truck is at front of loader queue, and at least one loader is idle

Weighing time Truck is at front of weigh queue, and weigh scale is idle.

Travel time Truck has just completed a weighing.

If we were to take the process-interaction world view, we would view the model from the viewpoint of one dump truck and its “life cycle.” Considering a life cycle as beginning at the loader queue, we can picture a dump-truck process as in Figure 8.

Dump-truck process

DelayLoadingDelayWeighTravel time
ALQELEWALQ

Figure 8 The dump-truck process.

2 List Processing

List processing deals with methods for handling lists of entities and the future event list. Simulation packages provide, both explicitly for an analyst’s use and covertly in the simulation mechanism behind the language, facilities for an analyst or the model itself to use lists and to perform the basic operations on lists.

Section 2.1 describes the basic properties and operations performed on lists. Section 2.2 discusses the use of arrays for processing lists and the use of array indices to create linked lists, arrays being a simpler mechanism for describing the basic operations than the more general dynamically allocated linked lists discussed in section 2.3. Finally, section 2.4 briefly introduces some of the more advanced techniques for managing lists.

The purpose of this discussion of list processing is not to prepare the reader to implement lists and their processing in a general-purpose language such as Visual Basic, C, C++, or Java, but rather to increase the reader’s understanding of lists and of their underlying concepts and operations.

2.1 Basic Properties and Operations Performed on Lists

As has previously been discussed, lists are a set of ordered or ranked records. In simulation, each record represents one entity or one event notice.

Lists are ranked, so they have a top or head (the first item on the list), some way to traverse the list (to find the second, third, etc. items on the list), and a bottom or tail (the last item on the list). A head pointer is a variable that points to or indicates the record at the top of the list. Some implementations of lists also have a tail pointer that points to the bottom item on the list.

For purposes of discussion, an entity, along with its attributes or an event notice, will be referred to as a record. An entity identifier and its attributes arefields in the entity record; the event type, event time, and any other event-related data are fields in the event-notice record. Each record on a list wil also have a field that holds a “next pointer” that points to the next record on the list, providing a way to traverse the list. Some lists also require a “previous pointer,” to allow for traversing the list from bottom to top.

For either type of list, the main activities in list processing are adding a record to a list and removing a record from a list. More specifically, the main operations on a list are the following:

a. removing a record from the top of the list;

b. removing a record from any location on the list;

c. adding a record to the top or bottom of the list;

d. adding a record at an arbitrary position in the list, one specified by the ranking rule

The first and third operations, removing or adding a record to the top or bottom of the list, can be carried out in minimal time by adjusting two record pointers and the head or tail pointer; the other two operations require at least a partial search through the list. Making these two operations efficient is the goal of list-processing techniques.

In the event-scheduling approach, when time is advanced and the imminent event is due to be executed, the removal operation takes place first—namely, the event at the top of the FEL is removed from the FEL. If an arbitrary event is being canceled, or an entity is removed from a list based on some of its attributes (say, for example, its priority and due date) to begin an activity, then the second removal operation is performed. When an entity joins the back of a first-in–first-out queue implemented as a list, then the third operation, adding an entity to the bottom of a list, is performed. Finally, if a queue has the ranking rule earliest due date first, then, upon arrival at the queue, an entity must be added to the list not at the top or bottom but at the position determined by the due-date ranking rule.

For simulation on a computer, whether via a general-purpose language (such as Visual Basic, C, C , or Java) or via a simulation package, each entity record and event notice is stored in a physica location in computer memory. There are two basic possibilities: (a) All records are stored in arrays. Arrays hold successive records in contiguous locations in computer memory. They therefore can be referenced by an array index that can be thought of as a row number in a matrix. (b) All entities

and event notices are represented by structures (as in C) or classes (as in Java), allocated from RAM memory as needed, and tracked by pointers to a record or structure.

Most simulation packages use dynamically allocated records and pointers to keep track of lists of items; as arrays are conceptually simpler, the concept of linked lists is first explained through arrays and array indices in Section 2.2 and then applied to dynamically allocated records and pointers in Section 2.3.

2.2 Using Arrays for List Processing

The array method of list storage may be implemented as an array of records; that is, each array element is a record that contains the fields needed to track the properties of the event notices or entries in the list. For convenience, we use the notation R(i) to refer to the i-th record in the array, however it may be stored in the language being used. Most modern simulation packages do not use arrays for list storage, but rather, use dynamically allocated records—that is, records that are created upon first being needed and subsequently destroyed when they are no longer needed.

Arrays are advantageous in that any specified record, say the i-th, can be retrieved quickly withou searching, merely by referencing R(i). Arrays are disadvantaged when items are added to the middle of a list or the list must be rearranged. In addition, arrays typically have a fixed size, determined at compile time or upon initial allocation when a program first begins to execute. In simulation, the maximum number of records for any list could be difficult (or impossible) to predict, and the curren number of them in a list may vary widely over the course of the simulation run. Worse yet, most simulations require more than one list; if they are kept in separate arrays, each would have to be dimensioned to the largest the list would ever be, potentially using excessive amounts of computer memory.

In the use of arrays for storing lists, there are two basic methods for keeping track of the ranking of records in a list. One method is to store the first record in R(1), the second in R(2), and so on, and the last in R(tailptr), where tailptr is used to refer to the last item in the list. Although simple in concept and easy to understand, this method will be extremely inefficient for all except the shortes lists, those of less than five or so records, because adding an item, for example, in position 41 in a list of 100 items, will require that the last 60 records be physically moved down one array position to make space for the new record. Even if the list were a first-in–first-out list, removing the top item from the list would be inefficient, as all remaining items would have to be physically moved up one position in the array. The physical rearrangement method of managing lists will not be discussed further. What is needed is a method to track and rearrange the logical ordering of items in a lis without having to move the records physically in computer memory.

In the second method, a variable called a head pointer, with name headptr, points to the record at the top of the list. For example, if the record in position R(11) were the record at the top of the list, then headptr would have the value 11. In addition, each record has a field that stores the index or pointer of the next record in the list. For convenience, let R(i, next) represent the next index field.

Example 7: A List for the Dump Trucks at the Weigh Queue

In Example 5, the dump-truck problem, suppose that a waiting line of three dump trucks occurred at the weigh queue, specifically, DT3, DT2, and DT4, in that order, at exactly CLOCK time 10 in Table 6. Suppose further that the model is tracking one attribute of each dump truck: its arrival time at the weigh queue, updated each time it arrives. Finally, suppose that the entities are stored in records

in an array dimensioned from 1 to 6,^ {6 ,} one record for each dump truck. Each entity is represented by a record with 3 fields: the first is an entity identifier; the second is the arrival time at the weigh queue; the last is a pointer field to “point to” the next record, if any, in the list representing the weigh queue, as follows:

[DTi, arrival time at weigh queue, next index]

Before its first arrival at the weigh queue, and before being added to the weigh queue list, a dump truck’s second and third fields are meaningless. At time 0, the records would be initialized as follows:

R(1)=[DT1,0.0,0]R(2)=[DT2,0.0,0]⋮R(6)=[DT6,0.0,0] \begin{array}{l} \mathrm{R(1)=[DT1,0.0,0]} \\ \mathrm{R(2)=[DT2,0.0,0]} \\ \vdots \\ \mathrm{R(6)=[DT6,0.0,0]} \end{array}

Then, at CLOCK time 10 in the simulation in Table 6, the list of entities in the weigh queue would be defined by

headptr=3R(1)=[DT1,0.0,0]R(2)=[DT2,10.0,4]R(3)=[DT3,5.0,2]R(4)=[DT4,10.0,0]R(5)=[DT5,0.0,0]R(6)=[DT6,0.0,0]tailptr=4 \begin{array}{l} \text{headptr} = 3 \\ \mathrm{R(1)} = [ \mathrm{DT1,0.0,0} ] \\ \mathrm{R(2)} = [ \mathrm{DT2,10.0,4} ] \\ \mathrm{R(3)} = [ \mathrm{DT3,5.0,2} ] \\ \mathrm{R(4)} = [ \mathrm{DT4,10.0,0} ] \\ \mathrm{R(5)} = [ \mathrm{DT5,0.0,0} ] \\ \mathrm{R(6)} = [ \mathrm{DT6,0.0,0} ] \\ \text{tailptr} = 4 \end{array}

To traverse the list, start with the head pointer, go to that record, retrieve that record’s next pointer, and proceed, to create the list in its logical order—for example,

headptr=3R(3)=[DT3,5.0,2]R(2)=[DT2,10.0,4]R(4)=[DT4,10.0,0] \begin{array}{l} \text{headptr} = 3 \\ \mathrm{R(3)} = [ \mathrm{DT3,5.0,2} ] \\ \mathrm{R(2)} = [ \mathrm{DT2,10.0,4} ] \\ \mathrm{R(4)} = [ \mathrm{DT4,10.0,0} ] \end{array}

The zero entry for next pointer in R(4), as well as tailptr 4, indicates that DT4 is at the end of the list.

Using next pointers for a first-in–first-out list, such as the weigh queue in this example, makes the operations of adding and removing entity records, as dump trucks join and leave the weigh queue, particularly simple. At CLOCK time 12, dump truck DT3 begins weighing and thus leaves the weigh queue. To remove the DT3 entity record from the top of the list, update the head pointer by setting it equal to the next pointer value of the record at the top of the list:

headptr=R(headptr,next) h e a d p t r = R (h e a d p t r, \mathrm{next})

In this example, we get

headptr=R(3,next)=2 h e a d p t r = R (3, \mathrm{next}) = 2

meaning that dump truck DT2 in R(2) is now at the top of the list.

Similarly, at CLOCK time 20, dump truck DT5 arrives at the weigh queue and joins the rear of the queue. To add the DT5 entity record to the bottom of the list, the following steps are taken:

R(tailptr, next) 5 (update the next pointer field of the previously last item)

tailptr 5 (update the value of the tail pointer)

R(tailptr, next) 0 (for the new tail item, set its next pointer field to zero)

This approach becomes slightly more complex when a list is a ranked list, such as the future event list, or an entity list ranked by an entity attribute. For ranked lists, to add or remove an item anywhere except to the head or tail of the list, searching is usually required. See Example 8.

Note that, in the dump-truck problem, the loader queue could also be implemented as a list using the same six records and the same array, because each dump-truck entity will be on at most one of the two lists and, while loading, weighing or traveling, a dump truck will be on neither list.

2.3 Using Dynamic Allocation and Linked Lists

In procedural languages, such as C and Java, and in most simulation languages, entity records are dynamically created when an entity is created and event-notice records are dynamically created whenever an event is scheduled on the future-event list. The languages themselves, or the operating systems on which they are running, maintain a linked list of free chunks of computer memory and allocate a chunk of desired size upon request to running programs. (Another use of linked lists!) When an entity “dies,” that is, exits from the simulated system, and also after an event occurs and the event notice is no longer needed, the corresponding records are freed, making that chunk of computer memory available for later reuse; the language or operating system adds the chunk to the list of free memory.

In this text, we are not concerned with the details of allocating and freeing computer memory, so we will assume that the necessary operations occur as needed. With dynamic allocation, a record is referenced by a pointer instead of by an array index. When a record is allocated in C or Java, the allocation routine returns a pointer to the allocated record, which must be stored in a variable or a field of another record for later use. A pointer to a record can be thought of as the physical or logical address in computer memory of the record.

In our example, we will use a notation for records identical to that in the previous section (2.2):

Entities: [ID, attributes, next pointer]

Event notices: [event type, event time, other data, next pointer]

but we will not reference them by the array notation R(i) as before, because it would be misleading. If for some reason we wanted the third item on the list, we would have to traverse the list, counting items until we reached the third record. Unlike in arrays, there is no way to retrieve the i-th record in a linked list directly, because the actual records could be stored at any arbitrary location in computer memory and are not stored contiguously, as arrays are.

Example 8: The Future Event List and the Dump-Truck Problem Beginning from Table 6, event notices in the dump-truck problem of Example 5 are expanded to include a pointer to the next event notice on the future event list and can be represented by

[event type, event time, DTi, nextptr],

—for example,

[EL, 10, DT3, nextptr]

where EL is the end-loading event to occur at future time 10 for dump truck DT3, and the field nextptr points to the next record on the FEL. Keep in mind that the records may be stored anywhere in computer memory, and in particular are not necessarily stored contiguously. Figure 9 represents the future event list at CLOCK time 10, taken from Table 6. The fourth field in each record is a pointer value to the next record in the future event list.

The C and Java languages, and other general-purpose languages, use different notation for referencing data from pointer variables. For discussion purposes, if R is a pointer to a record, then

R→eventtype,R→eventtime,R→next \mathrm{R} \rightarrow \text{eventtype}, \mathrm{R} \rightarrow \text{eventtime}, \mathrm{R} \rightarrow \text{next}

are the event type, the event time and the next record for the event notice that R points to. For example, if R is set equal to the head pointer for the FEL at CLOCK time 10, then

R→eventtype=EW \mathrm{R} \rightarrow \text{eventtype} = \mathrm{EW} R→eventtime=12 \mathrm{R} \rightarrow \text{eventtime} = 12

R next is the pointer to the second event notice on the FEL,

Figure 9 The dump-truck future event list as a linked list.

General Principles

so that

R next eventtype = EL

R next eventtime = 20

R next next is the pointer to the third event notice on the FEL

If one of the pointer fields is zero (or null), then that record is the last item in the list, and the pointer variable tailptr points to that last record, as depicted in Figure 9.

What we have described are called singly-linked lists, because there is a one-way linkage from the head of the list to its tail. The tail pointer is kept mostly for convenience and efficiency, especially for lists for which items are added at the bottom of the list. Of course, a tail pointer is not strictly necessary, because the last item can always be found by traversing the list, but it does make some operations more efficient.

For some purposes, it is desirable to traverse or search a list by starting at the tail in addition to the head. For such purposes, a doubly-linked list can be used. Records on a doubly-linked list have two pointer fields, one for the next record and one for the previous record. Good references that discuss arrays, singly- and doubly-linked lists, and searching and traversing of lists are Cormen, et al. [2001] and Sedgewick [1998].

2.4 Advanced Techniques

Many of the modern simulation packages use techniques and representations of lists that are more efficient than searching through a doubly-linked list. Most of these topics are too advanced for this text. The purpose of this section is to introduce some of the more advanced ideas briefly.

One idea to speed up processing of doubly-linked lists is to use a middle pointer in addition to a head and tail pointer. With special techniques, the mid pointer will always point to the approximate middle of the list. Then, when a new record is being added to the list, the algorithm first examines the middle record to decide whether to begin searching at the head of the list or the middle of the list. Theoretically, except for some overhead due to maintenance of the mid pointer, this technique should cut search times in half. A few advanced techniques use one or more mid pointers, depending on the length of the list

Some advanced algorithms use list representations other than a doubly-linked list, such as heaps or trees. These topics are beyond the scope of this text. Good references are Cormen, et al. [2001] and Sedgewick [1998].

3 Summary

This chapter introduced the major concepts and building blocks in simulation, the most important being entities and attributes, events, and activities. The three major world views—event scheduling, process interaction, activity scanning—were discussed. Finally, to gain an understanding of one of the most important underlying methodologies, Section 2 introduced some of the basic notions of lis processing.

REFERENCES

CORMEN, T. H., C. E. LEISEROON,AND R. L. RIVEST [2001], Introduction toAlgorithms, 2nd ed., McGraw-Hill, New York.

SCHRIBER, T. J., AND D. T. BRUNNER [2003], “Inside Simulation Software: How it Works and Why it Matters,” Proceedings of the 2003 Winter Simulation Conference, S. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, eds., New Orleans, LA, Dec. 7–10, pp. 113–123.

SEDGEWICK, R. [1998], Algorithms in C , 3d ed., Addison-Wesley, Reading, MA.

EXERCISES

Instructions to the reader: For most exercises, the reader should first construct a model by explicitly defining the following:

  1. system state;

  2. system entities and their attributes;

  3. sets, and the entities that may be put into the sets;

  4. events and activities; event notices;

  5. variables needed to collect cumulative statistics.

Second, the reader should either (1) develop the event logic (as in Figures 5 and 6 for Example 3) in preparation for using the event-scheduling approach, or (2) develop the system processes (as in Figure 4) in preparation for using the process-interaction approach.

Most problems contain activities that are uniformly distributed over an interval [a, b]. When conducting a manual simulation, assume that a,a+1,a+2,…,ba , a + 1 , a + 2 , \ldots , b are the only possible values; that is, the activity time is a discrete random variable. The discreteness assumption will simplify the manual simulation.

  1. (a) Using the event-scheduling approach, continue the (manual) checkout-counter simulation in Example 3, Table 1. Use the same interarrival and service times that were previously generated and used from the Simulation Examples in a Spreadsheet chapter in Table 11, the simulation table for Example 5. (This refers to columns C and E of Table 11.) Continue until all arriving customers receive service.After using the last interarrival time, assume there are no more arrivals.

(b) Do exercise 1(a) again, adding the model components necessary to estimate mean response time and proportion of customers who spend 5 or more minutes in the system. [Hint: See Example 4, Table 2.]

(c) Comment on the relative merits of manual versus computerized simulations.

  1. Construct the event-logic diagrams for the dump-truck problem, Example 5.

  2. In the dump-truck problem of Example 5, it is desired to estimate mean response time and the proportion of response times which are greater than 30 minutes. A response time for a truck begins when that truck arrives at the loader queue and ends when the truck finishes weighing. Add the model components and cumulative statistics needed to estimate these two measures of system performance. Simulate for 8 hours.

  3. Prepare a table in the manner of Table 2, until the CLOCK reaches time 15, using the interarriva and service times given below in the order shown. The stopping event will be at time 30.

Interarrival times:15638
Service times:35415
  1. Continue Table 2 until caller C7 departs.

  2. The data for Table 2 are changed to the following:

Interarrival times:452837
Service times:534627

Prepare a table in the manner of Table 2 with a stopping event at time 25.

  1. Redo Example 6 from the Simulation Examples in a Spreadsheet chapter (the Able–Baker cal center problem) by a manual simulation, using the event-scheduling approach.

  2. Redo Example 8 from the Simulation Examples in a Spreadsheet chapter (the (M, N) inventory system) by a manual simulation, using the event-scheduling approach.

  3. Redo Example 9 from the Simulation Examples in a Spreadsheet chapter (the bearing-replacement problem) by a manual simulation, using the event-scheduling approach.

  4. Rework Example 5, but using the following data:

Loading times:10510105105
Weigh times:12161212161212
Travel times:4060408010040

4 Simulation Software

In this chapter, we first discuss the history of simulation software and speculate on its future. Simulation software has a history that is just reaching middle age. We base this history on our collective experience, articles written by Professor Richard Nance, panel discussions at the annual Winter Simulation Conference, and a recent article by one of the co-authors.

Next, we discuss features and attributes of simulation software. If you were about to purchase simulation software, what would concern you? Would it be the cost, the ease of learning, the ease o use, or would it be the power to model the kind of system with which you are concerned? Or would it be the animation capabilities? Following the discussion of features, we discuss other issues and concerns related to the selection of simulation software.

Software used to develop simulation models can be divided into three categories. First, there are the general-purpose programming languages, such as C, C , and Java. Second, there are simulation programming languages, examples being GPSS/H and SIMAN V®. Third, there are the simulation environments. This category includes many products that are distinguished one way or another (by, for example, cost, application area, or type of animation), but have common characteristics, such as a graphical user interface and an environment that supports all (or most) aspects of a simulation study. Many simulation environments contain a simulation programming language, but some take a graphical approach similar to process-flow diagramming.

In the first category, we discuss simulation in Java. Java is a general-purpose programming language that was not specifically designed for use in simulation. Java was chosen since it is widely

used and widely available. Today very few people writing discrete-event simulation models are using programming languages alone; however, in certain application areas, some people are using packages based on Java or on some other general-purpose language. Understanding how to develop a model in a general-purpose language helps to understand how basic concepts and algorithms are implemented.

In the second category, we discuss GPSS/H, a highly structured process-interaction simulation language. GPSS was designed for relatively easy simulation of queueing systems, as in job shops, but it has been used to simulate systems of great complexity. It was first introduced by IBM; today, there are various implementations of GPSS, GPSS/H being one of the most widely used.

In the third category, we have selected a number of simulation software packages for discussion. There are many simulation packages currently available; we have selected a few that have survived and thriven for a number of years, to represent different approaches for model building.

One of the important components of a simulation environment is the output analyzer, which is used to conduct experimentation and assist with analyses. To illustrate the range of desirable characteristics, we look at four tools incorporated into some of the simulation environments. Typically these statistical analysis tools compute summary statistics, confidence intervals, and other statistica measures. Some support warmup determination, design of experiments, and sensitivity analyses. Many packages now offer optimization techniques based on genetic algorithms, evolutionary strategies, tabu search, scatter search, and other recently developed heuristic methods. In addition to the support for statistical analysis and optimization, the simulation environments offer data management, scenario definition, and run management. Data management offers support for managing all the inpu and output data associated with the analyses.

1 History of Simulation Software

Our discussion of the history of simulation software is based on Nance [1995], who breaks the years from 1955 through 1986 into five periods. Additional historical information is taken from a panel discussion at the 1992 Winter Simulation Conference entitled “Perspectives of the Founding Fathers” [Wilson et al., 1992], during which eight early users of simulation presented their historica perspectives. We add a sixth and most recent period, and then speculate on the future:

  1. 1955–1960 The Period of Search

  2. 1961–1965 The Advent

  3. 1966–1970 The Formative Period

  4. 1971–1978 The Expansion Period

  5. 1979–1986 The Period of Consolidation and Regeneration

  6. 1987–2008 The Period of Integrated Environments

  7. 2009–2011 The Future

The following subsections provide a brief presentation of this history. As indicated in Nance [1995], there were at least 137 simulation programming languages reported as of 1981, and many more since then. This brief history is far from comprehensive. The languages and packages we mention have stood the test of time by surviving to the present day or were the historical forerunner of a package in present use.

1.1 The Period of Search (1955–1960)

In the early years, simulation was conducted in FORTRAN or other general-purpose programming language, without the support of simulation-specific routines. In their first period, much effort was expended on the search for unifying concepts and the development of reusable routines to facilitate simulation. The General Simulation Program of K.D. Tocher and D.G. Owen [1960] is considered the first “language effort.” Tocher identified and developed routines that could be reused in subsequent simulation projects.

1.2 The Advent (1961–1965)

The forerunners of the simulation programming languages (SPLs) in use today appeared in the period 1961–1965. As Harold Hixson said in Wilson et al., [1992], “in the beginning there were FORTRAN, ALGOL, and GPSS”—that is, there were the FORTRAN-based packages (such as SIMSCRIPT and GASP), the ALGOL descendent SIMULA, and GPSS.

The first process-interaction SPL, GPSS was developed by Geoffrey Gordon at IBM and appeared in about 1961. Gordon developed GPSS (General Purpose Simulation System) for quick simulations of communications and computer systems, but its ease of use quickly spread its popularity to other application areas. GPSS is based on a block-diagram representation (similar to a process-flow diagram) and is suited for queueing models of all kinds. As reported by Reitman in Wilson et al., [1992], as early as 1965 GPSS was connected to an interactive display terminal that could interrup and display intermediate results, a foreshadowing of the interactive simulations of today, but far too expensive at the time to gain widespread use.

Harry Markowitz (later to receive a Nobel Prize for his work in portfolio theory) provided the major conceptual guidance for SIMSCRIPT, first appearing in 1963. The RAND Corporation developed the language under sponsorship of the U.S. Air Force. SIMSCRIPT originally was heavily influenced by FORTRAN, but in later versions, its developers broke from its FORTRAN base and created its own SPL. The initial versions were based on event scheduling.

Phillip J. Kiviat of theApplied Research Laboratory of the United States Steel Corporation began the development of GASP (General Activity Simulation Program) in 1961. Originally, it was based on the general-purpose programming language ALGOL, but later a decision was made to base it on FORTRAN. GASP, like GPSS, used flowchart symbols familiar to engineers. It was not a language proper, but rather a collection of FORTRAN routines to facilitate simulation in FORTRAN.

Numerous other SPLs were developed during this time. Notably, they included SIMULA, an extension of ALGOL, developed in Norway and widely used in Europe, and the Control and Simulation Language (CSL), which took an activity-scanning approach.

1.3 The Formative Period (1966–1970)

During this period, concepts were reviewed and refined to promote a more consistent representation of each language’s worldview. The major SPLs matured and gained wider usage.

Rapid hardware advancements and user demands forced some languages, notably GPSS, to undergo major revisions. GPSS/360, with its extensions to earlier versions of GPSS, emerged for the IBM 360 computer. Its popularity motivated at least six other hardware vendors and other groups to produce their own implementations of GPSS or a look-alike.

SIMSCRIPT II represented a major advancement in SPLs. In its free-form English-like language and “forgiving” compiler, an attempt was made to give the user major consideration in the language design.

ECSL, a descendent of CSL, was developed and became popular in the UK. In Europe, SIMULA added the concept of classes and inheritance, thus becoming a precursor of the modern object-oriented programming languages.

1.4 The Expansion Period (1971–1978)

Major advances in GPSS during this period came from outside IBM. Julian Reitman of Norden Systems headed the development of GPSS/NORDEN, a pioneering effort that offered an interactive, visual online environment. James O. Henriksen of Wolverine Software developed GPSS/H, released in 1977 for IBM mainframes, later for mini-computers and the PC. It was notable for being compiled and reportedly 5 to 30 times faster than standard GPSS. With the addition of new features, including an interactive debugger, it has become the principal version of GPSS in use today.

Alan Pritsker at Purdue made major changes to GASP, with GASP IV appearing in 1974. It incorporated state events in addition to time events, thus adding support for the activity-scanning worldview in addition to the event-scheduling worldview.

Efforts were made during this period to try and simplify the modeling process. Using SIMULA, an attempt was made to develop a system definition from a high-level user perspective that could be translated automatically into an executable model. Similar efforts included interactive program generators, the “Programming by Questionnaire,” and natural-language interfaces, together with automatic mappings to the language of choice. As did earlier over-optimistic beliefs in automatic programming, these efforts ran into severe limitations in the generality of what could be modeled— that is, they ran into the unavoidable complexity of real-world systems. Nevertheless, efforts to simplify simulation modeling continue, with the most success seen in simulation systems designed for application to narrow domains.

1.5 The Period of Consolidation and Regeneration (1979–1986)

The fifth period saw the beginnings of SPLs written for, or adapted to, desktop computers and the microcomputer. During this period, the predominant SPLs extended their implementations to many computers and microprocessors while maintaining their basic structure.

Two major descendants ofGASP appeared: SLAM II and SIMAN. The Simulation Language for Alternative Modeling (SLAM), produced by Pritsker and Associates, Inc., sought to provide multiple modeling perspectives and combined modeling capabilities [Pritsker and Pegden, 1979]—that is, it had an event-scheduling perspective based on GASP, a network worldview (a variant of the processinteraction perspective), and a continuous component. With SLAM, you could select one worldview or use a mix of all three.

SIMAN (SIMulation ANalysis) possessed a general modeling capability found in SPLs such as GASP IV, but also had a block-diagram component similar in some respects to that in SLAM and GPSS. C. Dennis Pegden developed SIMAN as a one-person faculty project over a period o about two years; he later founded Systems Modeling Corporation to market SIMAN. SIMAN was the first major simulation language executable on the IBM PC and designed to run under MS-DOS constraints. Similar to GASP, SIMAN allowed an event-scheduling approach by programming in FORTRAN with a supplied collection of FORTRAN routines, a block-diagram approach (another variant of the process-interaction worldview) analogous in some ways to that of GPSS and SLAM, and a continuous component.

1.6 The Period of Integrated Environments (1987–2008)

This period is notable for the growth of SPLs on the personal computer and the emergence of simulation environments with graphical user interfaces, animation, and other visualization tools. AutoMod and Extend were two of the earliest software packages to offer integrated simulation environments. Today, virtually all simulation packages come with environments that integrate model building, model debugging, animation, and interactive running of models. Many of these environments also contain input-data analyzers and output analyzers. Some packages attempt to simplify the modeling process by the use of process-flow or block diagramming and of “fill-in-the-blank” windows that avoid the need to learn programming syntax. Animation ranges from schematic-like representations to 2-D and 3-D scale drawings.

Recent advancements have been made in web-based simulation. Simulation has been deemed to have a role in supply-chain management. The combination of simulation and emulation shows promise. (Emulation is the imitation of a device such as those material handling devices illustrated in www.demo3d.com.)

1.7 The Future (2009–2011)

In an article in the ICS Newsletter [Banks, 2008], one ofthe co-authors asked a panel ofsimulationists, including well-known experts in their field, their opinion or best guess regarding future developments in discrete-event simulation. The first question was: “What remarkable results will we observe in simulation software in the near term, say, within three years?”

The most-often mentioned future developments, including more use of virtual reality, included an improved user interface, better animation, and a paradigm shift such as a major adoption o agent-based modeling in discrete-event modeling. Although, to date, agent-based modeling has been widely used in modeling collective behavior (civil violence, war, even determining what elements cause a standing ovation) and social phenomenon (seasonal migration, pollution, transmission of disease, and sexual reproduction, to name a few) its use in industrial and commercial simulations is just beginning.

Agent-based modeling is a method for simulating the actions and interactions of autonomous individuals (the agents) in a network, with a view to assessing their effects on the system as a whole. Agents may be people or animals or other entities that have agency, meaning that they are not passive, they actively make decisions, retain memory of past situations and decisions, and exhibit learning. In summary, agents are active and may exhibit cognition, memory, and learning. They may or may not be goal-directed.

Each agent’s behavior is governed by a set oflocal rules; that is, the agent responds in a prescribed way to local, near-by conditions. The interest is in patterns of behavior that emerge for the group of agents, called emergent behavior.

An interesting and well known example is the “boids” (that is, simulated birds flying in a given 2-D or 3-D area) in which flocking behavior emerges. (You can find many examples of the boids model on the Internet, each based on similar but not identical assumptions or rules. For one, see www.navgen.com/3d boids.) The flocking behavior is not scripted or explicitly programmed, but rather it emerges naturally (and somewhat surprisingly) from a set of fairly simple rules. The basic rule is that if a boid comes close to one or more other boids, then it adjusts its direction and speed to the other boids. In most of the boids simulations found on the Internet, the boids are no goal-directed; that is, they have no destination but simply fly. In at least one boids example, the boids do have a goal; there are two or more flocks of boids, and members of one flock attack and kil members of other flocks.

Software packages and toolkits for agent-based modeling include

AnyLogic (www.xjtek.com) discussed in Section 7.1,

Ascape (www.nutechsolutions.com),

MASON (cs.gmu.edu/%7Eeclab/projects/mason),

• NetLogo (ccl.northwestern.edu/netlogo),

StarLogo (education.mit.edu/starlogo),

Swarm (www.swarm.org), and

RePast (www.repast.sourceforge.net),

to name a few.

Information about various software packages is given in Section 7, including the websites of the vendors. A view of current developments in simulation software is available from these websites.

2 Selection of Simulation Software

This chapter includes a brief introduction to a number of simulation-software packages. Every two years, the journal OR/MS Today publishes a simulation-software survey [Swain, 2007]. The 2007 issue had 48 products, including simulation support packages such as input-data analyzers.

There are many features that are relevant when selecting simulation software [Banks, 1996]. Some of these features are shown, along with a brief description, in Tables 1 to 5. We offer the following advice when evaluating and selecting simulation software:

  1. Do not focus on a single issue, such as ease of use. Consider the accuracy and level of detai obtainable, ease of learning, vendor support, and applicability to your applications.

  2. Execution speed is important. Do not think exclusively in terms of experimental runs that take place at night and over the weekend. Speed affects development time. During debugging, an analyst might have to wait for the model to run up to the point in simulated time where an error occurs many times before the error is identified.

  3. Beware of advertising claims and demonstrations. Many advertisements exploit positive features of the software only. Similarly, the demonstrations solve the test problem very well, but perhaps not your problem.

  4. Ask the vendor to solve a small version of your problem.

Ta ble 1 M od e l - B _u i l d i n _g Feat_u res

FeatureDescription
Modeling worldviewProcess interaction, event perspectives, and continuous modeling, depending on needs
Input-data analysis capabilityEstimate empirical or statistical distributions from raw data
Graphical model buildingProcess-flow, block-diagram, or network approach
Conditional routingRoute entities based on prescribed conditions or attributes
Simulation programmingCapability to add procedural logic through a high-level powerful simulation language
SyntaxEasily understood, consistent, unambiguous, English-like
Input flexibilityAccepts data from external files, databases, spreadsheets, or interactively
Modeling concisenessPowerful actions, blocks, or nodes
RandomnessRandom-variate generators for all common distributions, e.g., exponential triangular uniform normal
Specialized components and templatesMaterial handling: vehicles, conveyors, bridge cranes, AS/RS, etc. Handling of liquids and bulk materials Communication systems Computer systems Call centers Others
User-built custom objectsReusable objects, templates, and submodels
Continuous flowTanks and pipes or bulk conveyors
Interface with general-programming languageLink code in C, C++, Java, or other general-programming language

Table 2 Runtime Environment

FeatureDescription
Execution speedMany runs needed for scenarios and replications. Impacts development as well as experimentation
Model size; number of variables and attributesShould have no built-in limits
Interactive debuggerMonitor the simulation in detail as it progresses. Ability to break, trap, run until, step; to display status, attributes and variables; etc.
Model status and statisticsDisplay at any time during simulation
Runtime licenseAbility to change parameters and run a model (but not to change logic or build a new model)
  1. Beware of “checklists” with “yes” and “no” as the entries. For example, many packages claim to have a conveyor entity. However, implementations have considerable variation and leve of fidelity. Implementation and capability are what is important. As a second example, mos packages offer a runtime license, but these vary considerably in price and features.

Table 3 Animation and Layout Features

FeatureDescription
Type of animationImport drawing and object filesTrue to scale or iconic (such as process-flow diagram)From CAD (vector formats) drawings or icons (bit-mapped or raster graphics)
Dimension2-D, 2-D with perspective, 3-D
MovementMotion of entities or status indicators
Quality of motionSmooth or jerky
Libraries of common objectsExtensive predrawn graphics
NavigationPanning, zooming, rotation
ViewsUser defined, named
Display stepControl of animation speed
Selectable objectsDynamic status and statistics displayed upon selection
Hardware requirementsStandard or special video card

Table 4 Output Features

FeatureDescription
Scenario managerCreate user-defined scenarios to simulate
Run managerMake all runs (scenarios and replications) and save results for future analyses
Warmup capabilityFor steady-state analysis
Independent replicationsUsing a different set of random numbers
OptimizationGenetic algorithms, tabu search, etc.
Standardized reportsSummary reports including averages, counts, minimum and maximum, etc.
Customized reportsTailored presentations for managers
Statistical analysisConfidence intervals, designed experiments, etc.
Business graphicsBar charts, pie charts, time lines, etc.
Costing moduleActivity-based costing included
File exportInput to spreadsheet or database for custom processing and analysis
Database maintenanceStore output in an organized manner

Table 5 Vendor Support and Product Documentation

FeatureDescription
TrainingRegularly scheduled classes of high quality
DocumentationQuality, completeness, online
Help systemGeneral or context-sensitive
TutorialsFor learning the package or specific features
SupportTelephone, e-mail, web
Upgrades, maintenanceRegularity of new versions and maintenance releases that address customer needs
Track recordStability, history, customer relations
  1. Simulation users ask whether the simulation model can link to and use code or routines written in external languages such as C, C , or Java. This is a good feature, especially when the external routines already exist and are suitable for the purpose at hand. However, the more important question is whether the simulation package and language are sufficiently powerful to avoid having to write logic in any external language.

  2. There may be a significant trade-off between the graphical model-building environments and ones based on a simulation language. Graphical model building removes the learning curve

due to language syntax, but it does not remove the need for procedural logic in most realworld models and the debugging to get it right. Beware of “no programming required” unless either the package is a near-perfect fit to your problem domain or programming (customized procedural logic) is possible with the supplied blocks, nodes, or process-flow diagram—in which case “no programming required” refers to syntax only and not the development of procedural logic.

3 An Example Simulation

Example 1: The Checkout Counter: A Typical Single-Server Queue

The system, a grocery checkout counter, is modeled as a single-server queue. The simulation will run until 1000 customers have been served. In addition, assume that the interarrival times of customers are exponentially distributed with a mean of 4.5 minutes, and that the service times are (approximately) normally distributed with a mean of 3.2 minutes and a standard deviation of 0.6 minute. (The approximation is that service times are always positive.) When the cashier is busy, a queue forms with no customers turned away. This example was simulated manually by using the event-scheduling point of view. The model contains two events: the arrival and departure events.

The following three sections illustrate the simulation ofthis single-server queue in Java, GPSS/H, and SSF (Scalable Simulation Framework). Although this example is much simpler than models that arise in the study of complex systems, its simulation contains the essential components of all discrete-event simulations.

4 Simulation in Java

Java is a widely available programming language that has been used extensively in simulation. It does not, however, provide any facilities directly aimed at aiding the simulation analyst, who therefore must program all details of the event-scheduling/time-advance algorithm, the statistics-gathering capability, the generation ofsamples from specified probability distributions, and the report generator. Nevertheless, the runtime library does provide a random-number generator. Unlike FORTRAN or C, the object-orientedness of Java does support modular construction of large models. For the mos part, the special-purpose simulation languages hide the details of event scheduling, whereas in Java all the details must be explicitly programmed. To a certain extent though, simulation libraries such as SSF [Cowie, 1999] alleviate the development burden by providing access to standardized simulation functionality and by hiding low-level scheduling minutiae.

There are many online resources for learning Java; we assume a prior working knowledge of the language. Any discrete-event simulation model written in Java contains the components discussed in Section 3: system state, entities and attributes, sets, events, activities and delays, and the components listed below. To facilitate development and debugging, it is best to organize the Java model in a modular fashion by using methods. The following components are common to almost all models written in Java:

Clock A variable defining simulated time

Initialization method A method to define the system state at time 0

Min-time event method A method that identifies the imminent event, that is, the element of the future event list (FutureEventList) that has the smallest time-stamp

Event methods For each event type, a method to update system state (and cumulative statistics) when that event occurs

Random-variate generators Methods to generate samples from desired probability distributions

Main program To maintain overall control of the event-scheduling algorithm

Report generator A method that computes summary statistics from cumulative statistics and prints a report at the end of the simulation

Figure 1 Overall structure of an event-scheduling simulation program.

The overall structure of a Java simulation program is shown in Figure 1.

The simulation begins by setting the simulation Clock to zero, initializing cumulative statistics to zero, generating any initial events (there will always be at least one) and placing them on the FutureEventList, and defining the system state at time 0. The simulation program then cycles, repeatedly passing the current least-time event to the appropriate event methods until the simulation is over.At each step, after finding the imminent event but before calling the event method, the simulation Clock is advanced to the time of the imminent event. (Recall that, during the simulated time between the occurrence of two successive events, the system state and entity attributes do not change in value. Indeed, this is the definition of discrete-event simulation: The system state changes only when an event occurs.) Next, the appropriate event method is called to execute the imminent event, update cumulative statistics, and generate future events (to be placed on the FutureEventList). Executing the imminent event means that the system state, entity attributes, and set membership are changed to reflect the fact that the event has occurred. Notice that all actions in an event method take place a one instant of simulated time. The value of the variable Clock does not change in an event method. If the simulation is not over, control passes again to the time-advance method, then to the appropriate event method, and so on. When the simulation is over, control passes to the report generator, which computes the desired summary statistics from the collected cumulative statistics and prints a report.

The efficiency of a simulation model in terms of computer runtime is determined to a large extent by the techniques used to manipulate the FutureEventList and other sets. As discussed earlier in Section 3, removal of the imminent event and addition of a new event are the two main operations performed on the FutureEventList. Java includes general, efficient data structures for searching and priority lists; it is usual to build a customized interface to these to suit the application. In the example to follow, we use customized interfaces to implement the event list and the list o waiting customers. The underlying priority-queue organization is efficient, in the sense of having access costs that grow only in the logarithm of the number of elements in the list.

Example 2: Single-Server Queue Simulation in Java

The grocery checkout counter, defined in detail in Example 1, is simulated by using Java.

Class Event represents an event. It stores a code for the event type (arrival or departure), and the event time-stamp. It has associated methods (functions) for creating an event and accessing its data. It also has an associated method compareTo, which compares the event with another (passed as an argument) and reports whether the first event should be considered to be smaller, equal, or larger than the argument event. The methods for this model and the flow of control are shown in Figure 2, which is an adaptation of Figure 1 for this particular problem. Table 6 lists the variables used for system state, entity attributes and sets, activity durations, and cumulative and summary statistics; the functions used to generate samples from the exponential and normal distributions; and all the other methods needed.

Table 6 Definitions of Variables, Functions, and Methods in the Java Model of the Single-Server Queue

VariablesDescription
System state
QueueLengthNumber of customers queued (but not in service) at current simulated time
NumberInServiceNumber being served at current simulated time
Entity attributes and sets
CustomersFCFS queue of customers in system
Future event list
FutureEventListPriority-ordered list of pending events
Activity durations
MeanInterArrivalTimeThe interarrival time between the previous customer’s arrival and the next arrival
MeanServiceTimeThe service time of the most recent customer to begin service
Input parameters
MeanInterarrivalTimeMean interarrival time (4.5 minutes)
MeanServiceTimeMean service time (3.2 minutes)
SIGMAStandard deviation of service time (0.6 minute)
TotalCustomersThe stopping criterion—number of customers to be served (1000)
Simulation variables
ClockThe current value of simulated time
Statistical Accumulators
LastEventTimeTime of occurrence of the last event
TotalBusyTotal busy time of server (so far)
MaxQueueLengthMaximum length of waiting line (so far)
SumResponseTimeSum of customer response times for all customers who have departed (so far)
NumberOfDeparturesNumber of departures (so far)
LongServiceNumber of customers who spent 4 or more minutes at the checkout counter (so far)
Summary statistics
RHO =BusyTime/ClockProportion of time server is busy (here the value of Clock is the final value of simulated time)
AVGRAverage response time (equal to SumResponseTime/TotalCustomers)
PC4Proportion of customers who spent 4 or more minutes at the checkout counter
FunctionsDescription
exponential(mu)normal(xmu, SIGMA)Function to generate samples from an exponential distribution with mean muFunction to generate samples from a normal distribution with mean xmu and standard deviation SIGMA
MethodsDescription
InitializationProcessArrivalProcessDepartureReportGenerationInitialization methodEvent method that executes the arrival eventEvent method that executes the departure eventReport generator

Figure 2 Overall structure of Java simulation of a single-server queue.

class Sim {// Class Sim variables
    public static double Clock, MeanInterArrivalTime, MeanServiceTime,
    SIGMA, LastEventTime, TotalBusy, MaxQueueLength, SumResponseTime;
    public static long NumberOfCustomers, QueueLength, NumberInService,
    TotalCustomers, NumberOfDepartures, LongService;

    public final static int arrival = 1;
    public final static int departure = 2;

    public static EventList FutureEventList;
    public static Queue Customers;
    public static Random stream;

    public static void main(String argv[]) {MeanInterArrivalTime = 4.5; MeanServiceTime = 3.2;
    SIGMA = 0.6; TotalCustomers = 1000;
    long seed = Long.parseLong(argv[0]);
    stream = new Random(seed); // initialize rng stream
    FutureEventList = new EventList();
    Customers = new Queue();

    Initialization();

    // Loop until first "TotalCustomers" have departed
    while (NumberOfDepartures < TotalCustomers) {Event evt = (Event)FutureEventList.getMin(); // get imminent event
    FutureEventList.dequeue(); // be rid of it
    Clock = evt.get_time(); // advance in time
    if (evt.get_type() == arrival) ProcessArrival(evt);
    else ProcessDeparture(evt);}
    ReportGeneration();}

Figure 3 Java main program for the single-server queue simulation.

The entry point of the program and the location of the control logic is through class Sim, shown in Figure 3. Variables of classes EventList and Queue are declared. As these classes are all useful for programs other than Sim, their declarations are given in other files, per Java rules. A variable of the Java built-in class Random is also declared; instances of this class provided randomnumber streams. The main method controls the overall flow of the event-scheduling/time-advance algorithm.

public static void Initialization() {Clock = 0.0;
    QueueLength = 0;
    NumberInService = 0;
    LastEventTime = 0.0;
    TotalBusy = 0;
    MaxQueueLength = 0;
    SumResponseTime = 0;
    NumberOfDepartures = 0;
    LongService = 0;

    // create first arrival event
    Event evt =
    new Event(arrival, exponential(stream, MeanInterArrivalTime));
    FutureEventList.enqueue(evt);}

Figure 4 Java initialization method for the single-server queue simulation.

The main program method first gives values to variables describing model parameters; it creates instances of the random-number generator, event list, and customer queue; and then it calls method Initialization to initialize other variables, such as the statistics-gathering variables. Contro then enters a loop which is exited only after TotalCustomers customers have received service. Inside the loop, a copy of the imminent event is obtained by calling the getMin method of the priority queue, and then that event is removed from the event list by a call to dequeue. The globa simulation time Clock is set to the time-stamp contained in the imminent event, and then either ProcessArrival or ProcessDeparture is called, depending on the type of event. When the simulation is finally over, a call is made to method ReportGeneration to create and print out the final report.

A listing for the Sim class method Initialization is given in Figure 4. The simulation clock, system state, and other variables are initialized. Note that the first arrival event is created by generating a local Event variable whose constructor accepts the event’s type and time. The even time-stamp is generated randomly by a call to Sim class method exponential and is passed to the random-number stream to use with the mean of the exponential distribution from which to sample. The event is inserted into the future event list by calling method enqueue. This logic assumes tha the system is empty at simulated time Clock 0, so that no departure can be scheduled. It is straightforward to modify the code to accommodate alternative starting conditions by adding events to FutureEventList and Customers as needed.

Figure 5 gives a listing of Sim class method ProcessArrival, which is called to process each arrival event. The basic logic of the arrival event for a single-server queue (where LQ corresponds to QueueLength and LS corresponds to NumberInService). First, the new arrival is added to the queue Customers of customers in the system. Next, if the server is idle (NumberInService 0) then the new customer is to go immediately into service, so Sim class method ScheduleDeparture is called to do that scheduling. An arrival to an idle queue does no update the cumulative statistics, except possibly the maximum queue length. An arrival to a busy queue does not cause the scheduling of a departure, but does increase the total busy time by the amount of simulation time between the current event and the one immediately preceding it (because, if the server is busy now, it had to have had at least one customer in service by the end of processing the previous event). In either case, a new arrival is responsible for scheduling the nex arrival, one random interarrival time into the future. An arrival event is created with simulation time equal to the current Clock value plus an exponential increment, that event is inserted into the future event list, the variable LastEventTime recording the time of the last event processed is set to the current time, and control is returned to the main method of class Sim.


public static void ProcessArrival(Event evt) {Customers.enqueue(evt);
    QueueLength++;
    // if the server is idle, fetch the event, do statistics
    // and put into service
    if (NumberInService == 0) ScheduleDeparture();
    else TotalBusy += (Clock -LastEventTime); // server is busy

    // adjust max queue length statistics
    if (MaxQueueLength < QueueLength) MaxQueueLength = QueueLength;

    // schedule the next arrival
    Event next_arrival =
    new Event(arrival, Clock+exponential(stream,MeanInterArrivalTime));
    FutureEventList.enqueue(next_arrival);
    LastEventTime = Clock;}

Figure 5 Java arrival event method for the single-server queue simulation.

Sim class method ProcessDeparture, which executes the departure event, is listed in Figure 6, as is method ScheduleDeparture. After removing the event from the queue of al customers, the number in service is examined. If there are customers waiting, then the departure of the next one to enter service is scheduled. Then, cumulative statistics recording the sum of al response times, sum of busy time, number of customers who used more than 4 minutes of service time, and number of departures are updated. (Note that the maximum queue length cannot change in value when a departure occurs.) Notice that customers are removed from Customers in FIFO order; hence, the response time response of the departing customer can be computed by subtracting the arrival time of the job leaving service (obtained from the copy of the arrival event removed from the Customers queue) from the current simulation time. After the incrementing of the total number o departures and the saving of the time of this event, control is returned to the main program.

Figure 6 also gives the logic of method ScheduleDeparture, called by both Process-Arrival and ProcessDeparture to put the next customer into service. The Sim class method normal, which generates normally distributed service times, is called until it produces a nonnegative sample. A new event with type departure is created, with event time equal to the current simulation time plus the service time just sampled. That event is pushed onto FutureEventList, the number

public static void ScheduleDeparture() {double ServiceTime;
    // get the job at the head of the queue
    while ((ServiceTime = normal(stream, MeanServiceTime, SIGMA)) < 0);
    Event depart = new Event(departure, Clock + ServiceTime);
    FutureEventList.enqueue(depart);
    NumberInService = 1;
    QueueLength--;}

public static void ProcessDeparture(Event e) {// get the customer description
    Event finished = (Event) Customers.dequeue();
    // if there are customers in the queue then schedule
    // the departure of the next one
    if (QueueLength > 0) ScheduleDeparture();
    else NumberInService = 0;
    // measure the response time and add to the sum
    double response = (Clock - finished.get_time());
    SumResponseTime += response;
    if (response > 4.0) LongService++; // record long service
    TotalBusy += (Clock - LastEventTime);
    NumberOfDepartures++;
    LastEventTime = Clock;}

Figure 6 Java departure event method for the single-server queue simulation.

in service is set to one, and the number waiting (QueueLength) is decremented to reflect the fact that the customer entering service is waiting no longer.

The report generator, Sim class method ReportGeneration, is listed in Figure 7. The summary statistics, RHO, AVGR, and PC4, are computed by the formulas in Table 6; then the input parameters are printed, followed by the summary statistics. It is a good idea to print the input parameters at the end of the simulation, in order to verify that their values are correct and that these values have not been inadvertently changed.

Figure 8 provides a listing of Sim class methods exponential and normal, used to generate random variates. Both of these functions call method nextDouble, which is defined for the built-in Java Random class generates a random number uniformly distributed on the (0,1) interval. We use Random here for simplicity of explanation; superior random-number generators can be built by hand. The techniques for generating exponentially and normally distributed random variates are based on first generating a U(0,1) random number.

The output from the grocery-checkout-counter simulation is shown in Figure 9. It should be emphasized that the output statistics are estimates that contain random error. The values shown are influenced by the particular random numbers that happened to have been used, by the initia conditions at time 0, and by the run length (in this case, 1000 departures).

public static void ReportGeneration() {double RHO = TotalBusy/Clock;
    double AVGR = SumResponseTime/TotalCustomers;
    double PC4 = ((double)LongService)/TotalCustomers;

    System.out.print("SINGLE SERVER QUEUE SIMULATION");
    System.out.println("- GROCERY STORE CHECKOUT COUNTER");
    System.out.println("\tMEAN INTERARRIVAL TIME + MeanInterArrivalTime);
    System.out.println("\tMEAN SERVICE TIME + MeanServiceTime);
    System.out.println("\tSTANDARD DEVIATION OF SERVICE TIMES + SIGMA);
    System.out.println("\tNUMBER OF CUSTOMERS SERVED + TotalCustomers);
    System.out.println();
    System.out.println("\tSERVER UTILIZATION + RHO);
    System.out.println("\tMAXIMUM LINE LENGTH + MaxQueueLength);
    System.out.println("\tAVERAGE RESPONSE TIME + AVGR + " MINUTES");
    System.out.println("\tPROPORTION WHO SPEND FOUR ");
    System.out.println("\t MINUTES OR MORE IN SYSTEM + PC4);
    System.out.println("\tSIMULATION RUNLENGTH + Clock + " MINUTES");
    System.out.println("\tNUMBER OF DEPARTURES + TotalCustomers);}

Figure 7 Java report generator for the single-server queue simulation.

In some simulations, it is desired to stop the simulation after a fixed length of time, say TE 12 hours 720 minutes. In this case, an additional event type, stop event, is defined and is scheduled to occur by scheduling a stop event as part of simulation initialization. When the stopping event does occur, the cumulative statistics will be updated and the report generator called. The main program and method Initialization will require minor changes. Exercise 1 asks the reader to make these changes. Exercise 2 considers the additional change that any customer at the checkout counter at simulated time Clock TE should be allowed to exit the store, but no new arrivals are allowed after time TE.


public static double exponential(Random rng, double mean) {return -mean*Math.log( rng.nextDouble() );}

public static double SaveNormal;
public static int NumNormals = 0;
public static final double PI = 3.1415927;

public static double normal(Random rng, double mean, double sigma) {double ReturnNormal;
    // should we generate two normals?
    if (NumNormals == 0) {double r1 = rng.nextDouble();
    double r2 = rng.nextDouble();
    ReturnNormal = Math.sqrt(-2*Math.log(r1))*Math.cos(2*PI*r2);
    SaveNormal = Math.sqrt(-2*Math.log(r1))*Math.sin(2*PI*r2);
    NumNormals = 1;} else {NumNormals = 0;
    ReturnNormal = SaveNormal;}
    return ReturnNormal*sigma + mean;}

Figure 8 Random-variate generators for the single-server queue simulation.

SINGLE SERVER QUEUE SIMULATION - GROCERY STORE CHECKOUT COUNTER
MEAN INTERARRIVAL TIME 4.5
MEAN SERVICE TIME 3.2
STANDARD DEVIATION OF SERVICE TIMES 0.6
NUMBER OF CUSTOMERS SERVED 1000
SERVER UTILIZATION 0.671
MAXIMUM LINE LENGTH 9.0
AVERAGE RESPONSE TIME 6.375 MINUTES
PROPORTION WHO SPEND FOUR
MINUTES OR MORE IN SYSTEM 0.604
SIMULATION RUNLENGTH 4728.936 MINUTES
NUMBER OF DEPARTURES 1000

Figure 9 Output from the Java single-server queue simulation.

5 Simulation in GPSS

GPSS is a highly structured, special-purpose simulation programming language based on the processinteraction approach and oriented toward queueing systems. A block diagram provides a convenien way to describe the system being simulated. There are over 40 standard blocks in GPSS. Entities called transactions may be viewed as flowing through the block diagram. Blocks represent events, delays, and other actions that affect transaction flow. Thus, GPSS can be used to model any situation where transactions (entities, customers, units of traffic) are flowing through a system (e.g., a network of queues, with the queues preceding scarce resources). The block diagram is converted to block statements, control statements are added, and the result is a GPSS model.

The first version of GPSS was released by IBM in 1961. It was the first process-interaction simulation language and became popular; it has been implemented anew and improved by many parties since 1961, with GPSS/H being the most widely used version today. Example 3 is based on GPSS/H.

GPSS/H is a product ofWolverine Software Corporation, www.wolverinesoftware.com [Banks, Carson, and Sy, 1995; Henriksen, 1999]. It is a flexible, yet powerful tool for simulation. Unlike the original IBM implementation, GPSS/H includes built-in file and screen I/O, use of an arithmetic expression as a block operand, an interactive debugger, faster execution, expanded contro statements, ordinary variables and arrays, a floating-point clock, built-in math functions, and built-in random-variate generators.

The animator for GPSS/H is ProofAnimation™, another product of Wolverine Software Corporation [Henriksen, 1999]. ProofAnimation provides a 2-D or 3-D animation, usually based on a scale drawing. It can run in postprocessed mode (after the simulation has finished running) or concurrently. In postprocessed mode, the animation is driven by two files: the layout file for the static background, and a trace file that contains commands to make objects move and produce other dynamic events. It can work with any simulation package that can write the ASCII trace file. Alternately, it can run concurrently with the simulation by sending the trace file commands as messages, or it can be controlled directly by using its DLL (dynamic link library) version.

Example 3: Single-Server Queue Simulation in GPSS/H

Figure 10 exhibits the block diagram and Figure 11 the GPSS program for the grocery-store checkoutcounter model described in Example 2. Note that the program (Figure 11) is a translation of the block diagram together with additional definition and control statements. (In the discussion that follows, all nonreserved words are shown in italics.)

In Figure 10, the GENERATE block represents the arrival event, with the interarrival times specified by RVEXPO(1,&IAT). RVEXPO stands for “random variable, exponentially distributed,” the 1 indicates the random-number stream to use, and &IAT indicates that the mean time for the exponential distribution comes from a so-called ampervariable &IAT. Ampervariable names begin with the “&” character; Wolverine added ampervariables to GPSS because the original IBM implementation had limited support for ordinary global variables, with no user freedom for naming them.

The next block is a QUEUE with a queue named SYSTIME. It should be noted that the QUEUE block is not needed for queues or waiting lines to form in GPSS. The true purpose of the QUEUE block is to work in conjunction with the DEPART block to collect data on queues or any other subsystem. In Example 3, we want to measure the system response time—that is, the time a transaction spends in the system. Placing a QUEUE block at the point that transactions enter the system and placing its counterpart the DEPART block, at the point that the transactions complete their processing causes the response times to be collected automatically. The purpose of the DEPART block is to signal the end of data collection for an individual transaction. The QUEUE and DEPART block combination is not necessary for queues to be modeled, but rather is used for statistical data collection.

Figure 10 GPSS block diagram for the single-server queue simulation.

Figure 11 GPSS/H program for the single-server queue simulation.

The next QUEUE block (with queue named LINE) begins data collection for the waiting line before the cashier. The customers may or may not have to wait for the cashier. Upon arrival at an idle checkout counter, or after advancing to the head of the waiting line, a customer captures the cashier, as represented by the SEIZE block with the resource named CHECKOUT. Once the transaction representing a customer captures the cashier represented by the resource CHECKOUT, the data collection for the waiting-line statistics ends, as represented by the DEPART block for the queue named LINE. The transaction’s service time at the cashier is represented by an ADVANCE block. RVNORM indicates “random variable, normally distributed.” Again, random-number stream 1 is being used, the mean time for the normal distribution is given by ampervariable &MEAN, and its standard deviation is given by ampervariable &STDEV. Next, the customer gives up the use o the facility CHECKOUT with a RELEASE block. The end of the data collection for response times is indicated by the DEPART block for the queue SYSTIME.

Next, there is a TEST block that checks to see whether the time in the system, M1, is greater than or equal to 4 minutes. (Note that M1 is a reserved word in GPSS/H; it automatically tracks transaction total time in system.) In GPSS/H, the maxim is “if true, pass through.” Thus, if the customer has been in the system four minutes or longer, the next BLET block (for block LET) adds one to the counter &COUNT. If not true, the escape route is to the block labeled TER. That label appears before the TERMINATE block, whose purpose is the removal of the transaction from the system. The TERMINATE block has a value “1”, indicating that one more transaction is added toward the limiting value (or “transactions to go”).

The control statements in this example are all of those lines in Figure 11 that precede or follow the block section. (There are eleven blocks in the model from the GENERATE block to the TERMINATE block.) The control statements that begin with an “*” are comments, some of which are used for spacing purposes. The control statement SIMULATE tells GPSS/H to conduct a simulation; if it is omitted, GPSS/H compiles the model and checks for errors only. The ampervariables are defined as integer or real by control statements INTEGER and REAL. It seems that the ampervariable &COUNT should be defined as an integer; however, it will be divided later by a real value. If it is integer, the result of an integer divided by a real value is truncation, and that is not desired in this case. The four assignment statements (LET) provide data for the simulation. These four values could have been placed directly into the program; however, the preferred practice is to place them in ampervariables at the top of the program so that changes can be made more easily or the model can be modified to read them from a data file

To ensure that the model data is correct, and for the purpose of managing different scenarios simulated, it is good practice to echo the input data. This is accomplished with a PUTPIC (for “pu picture”) control statement. The five lines following PUTPIC provide formatting information, with the asterisks being markers (called picture formatting) in which the values of the four ampervariables replace the asterisks when PUTPIC is executed. Thus, “**.**” indicates a value that may have two digits following the decimal point and up to two before it.

Mean interarrival time4.50 minutes
Mean service time3.20 minutes
Standard deviation of service time0.60 minutes
Number of customers to be served1000
Server utilization0.676
Maximum line length7
Average response time6.33 minutes
Proportion who spend four minutes or more in the system0.646
Simulation runlength4767.27 minutes
Number of departures1000

Figure 12 Customized GPSS/H output report for the single-server queue simulation.

The START control statement controls simulation execution. It starts the simulation, sets up a “termination-to-go” counter with initial value its operand (&LIMIT), and controls the length of the simulation.

After the simulation completes, a second PUTPIC control statement is used to write the desired output data to the same file OUT. The printed statistics are all gathered automatically by GPSS. The first output in the parenthesized list is the server utilization. FR(CHECKOUT)/1000 indicates tha the fractional utilization of the resource CHECKOUT is printed. Because FR(CHECKOUT) is in parts per thousand, the denominator is provided to compute fractional utilization. QM(LINE) is the maximum value in the queue LINE during the simulation. QT(SYSTIME) is the average time in the queue SYSTIME. &COUNT/N(TER) is the number of customers who had a response time of four or more minutes divided by the number of customers that went through the block with label TER, or N(TER). AC1 is the clock time, whose last value gives the length of the simulation.

The contents of the customized output file OUT are shown in Figure 12. The standard GPSS/H output file is displayed in Figure 13. Although much of the same data shown in the file OUT can be found in the standard GPSS/H output, the customized file is more compact and uses the language of the problem rather than GPSS jargon. There are many other reasons that customized output files are useful. For example, if 50 replications of the model are to be made and the lowest, highest, and average value of a response are desired, this can be accomplished by using control statements, with the results in a very compact form, rather than extracting the desired values from 50 standard outpu files.

6 Simulation in SSF

The Scalable Simulation Framework (SSF) is an Application Program Interface (API) that describes a set of capabilities for object-oriented, process-view simulation. The API is sparse and was designed to allow implementations to achieve high performance (e.g., on parallel computers). SSF APIs exis for both C and Java, and implementations exist in both languages. SSF has a wide user base— particularly in network simulation by using the add-on framework SSFNet (www.ssfnet.org). Our chapter on network simulation uses SSFNet.

BLOCK CURRENTTOTALBLOCKCURRENTTOTAL
11003TER1000
21003
331003
41000
51000
61000
71000
81000
91000
10646
–AVG-UTIL-DURING–
FACILITYTOTALAVAILUNAVLENTRIESAVERAGECURRENTPERCENTSEIZINGPREEMPTING
TIMETIMETIMETIME/XACTSTATUSAVAILXACTXACT
CHECKOUT0.67610003.224AVAIL
QUEUEMAXIMUMAVERAGETOTALZEROPERCENTAVERAGE$ AVERAGEQTABLECURRENT
CONTENTSCONTENTSENTRIESENTRIESZEROSTIME/UNITTIME/UNITNUMBERCONTENTS
SYSTIME81.331100306.3256.2353
LINE70.655100333433.33.1114.6653
RANDOMANTITHETICINITIALCURRENTSAMPLECHI-SQUARE
STREAMVARIATESPOSITIONPOSITIONCOUNTUNIFORMITY
1OFF10000010300430040.83

Fi_g u re 13 Sta n d a rd G PSS/H o ut_p ut re _po rt fo r th e s i n _g l e-se rve r _q u e u e s i m u l at i o n

The SSFAPI defines five base classes. process is a class that implements threads of control; the action method ofa derived class contains the execution body ofthe thread. The Entity class is used to describe simulation objects. It contains state variables, processes, and communication endpoints. The inChannel and outChannel classes are communication endpoints. The Event class defines messages sent between entities. One model entity communicates with another by “writing” an Event into an outChannel; at some later time, it is available at one or more inChannels. A process that expects input on an inChannel can suspend, waiting for an event on it. These points, and others, will be elaborated upon as we work through an SSF implementation of the single-server queue.

Source code given in Figure 14 expresses the logic of arrival generation in SSF for the singleserver queue example. The example is built on two SSF processes. One of these generates jobs and adds them to the system, the other services the enqueued jobs. Class SSQueue is a class tha contains the whole simulation experiment. It uses the auxiliary classes Random (for random-number generation) and Queue (to implement FIFO queueing of general objects). SSQueue defines experimental constants (“public static final” types) and contains SSF communication endpoints out and in, through which the two processes communicate. SSQueue also defines an inner class arrival, which stores the identity and arrival time of each job.

Class Arrivals is an SSF process. Its constructor stores the identity of the entity that owns it, and creates a random-number generator that is initialized with the seed passed to it. For all bu the initial call, method action generates and enqueues a new arrival, then blocks (via SSF method waitFor) for an inter-arrival time; on the first call, it by-passes the job-generation step and blocks for an initial interarrival time. The call to waitFor highlights details needing explanation. An SSQueue object calls the Arrival constructor and is saved as the “owner.” This class contains an auxiliary method exponential, which samples an exponential random variable with specified mean by using a specified random-number stream. It also contains methods d2t and t2d that translate between a discrete “tick”-based integer clock and a double-precision floating-point representation. In the waitFor call, we use the same code seen earlier to sample the exponential in double-precision format, but then use d2t to convert it into the simulator’s integer clock format. The specific conversion factor is listed as an SSQueue constant, 10^9 ticks per unit time.

SSF interprocess communication is used sparingly in this example. Because service is nonpreemptive, when ajob’s service completes, the process providing service can examine the list of waiting customers (in variable owner.Waiting) to see whether it needs to give service to another customer. Thus, the only time the server process needs to be told that there is a job waiting is when a job arrives to an empty system. This is reflected in Arrivals.action by use of its owner’s out channel.

A last point of interest is that Arrivals is, in SSF terminology, a “simple” process. This means that every statement in action that might suspend the process would be the last statement executed under normal execution semantics. The Arrivals class tells SSF that it is simple by overriding a default method isSimple to return the value true, rather than the default value (false). The key reason for using simple processes is performance—they require that no state be saved, only the condition under which the process ought to be reanimated. And, when it is reanimated, it starts executing at the first line of action.

// SSF MODEL OF JOB ARRIVAL PROCESS
class SSQueue extends Entity {private static Random rng;
    public static final double MeanServiceTime = 3.2;
    public static final double SIGMA = 0.6;
    public static final double MeanInterarrivalTime = 4.5;
    public static final long ticksPerUnitTime = 1000000000;
    public long generated=0;
    public Queue Waiting;
    outChannel out;
    inChannel in;

    public static long TotalCustomers=0, MaxQueueLength=0, TotalServiceTime=0;
    public static long LongResponse=0, SumResponseTime=0, jobStart;

    class arrival {long id, arrival_time;
    public arrival(long num, long a) {id=num; arrival_time = a;}}

    class Arrivals extends process {private Random rng;
    private SSQueue owner;
    public Arrivals (SSQueue _owner, long seed) {super(_owner); owner = _owner;
    rng = new Random(seed);}
    public boolean isSimple() {return true;}
    public void action() {if (generated++ > 0) {// put a new Customer on the queue with the present arrival time
    int Size = owner.Waiting.numElements();
    owner.Waiting.enqueue( new arrival(generated, now()));
    if (Size == 0) owner.out.write( new Event()); // signal start of burst}
    waitFor(owner.d2t( owner.exponential(rng, owner.MeanInterarrivalTime)));}}}

Figure 14 SSF Model of Job-Arrival Process.

Figure 15 illustrates the code for the Server process. Like process Arrival, its constructor is called by an instance of SSQueue and is given the identity of that instance and a random-number seed. Like Arrival, it is a simple process. It maintains state variable in service to remember the specifics of a job in service and state variable service time to remember the value of the service time sampled for the job in service. When the SSF kernel calls action, either a job has completed service, or the Arrival process has just signaled Server though the inChannel. We distinguish the cases by looking at variable in service, which will be nonnull if a job is in service, just now completed. In this case, some statistics are updated. After this task is done, a test is made for customers waiting for service. The first waiting customer is dequeued from the waiting list and is

// SSF MODEL OF SINGLE SERVER QUEUE : ACCEPTING JOBS
class Server extends process {private Random rng;
    private SSQueue owner;
    private arrival in_service;
    private long service_time;

    public Server(SSQueue _owner, long seed) {super(_owner);
    owner = _owner;
    rng = new Random(seed);}

    public boolean isSimple() {return true;}

    public void action() {// executes due to being idle and getting a job, or by service time expiration.
    // if there is a job awaiting service, take it out of the queue
    // sample a service time, do statistics, and wait for the service epoch

    // if in_service is not null, we entered because of a job completion
    if (in_service != null) {owner.TotalServiceTime += service_time;
    long in_system = (now() -in_service.arrival_time);
    owner.SumResponseTime += in_system;
    if (owner.t2d(in_system) > 4.0) owner.LongResponse++;
    in_service = null;
    if (owner.MaxQueueLength < owner.Waiting.numElements() + 1)
    owner.MaxQueueLength = owner.Waiting.numElements() + 1;
    owner.TotalCustomers++;}
    if (owner.Waiting.numElements() > 0) {in_service = (arrival)owner.Waiting.dequeue();
    service_time = -1;
    while (service_time < 0.0)
    service_time = owner.d2t(owner.normal(rng, owner.MeanServiceTime, owner.SIGMA)); // model service time
    waitFor(service_time);} else {waitOn(owner.in); // we await a wake-up call}}

Figure 15 SSF Model of Single-Server Queue : Server.

copied into the in service variable; the process then samples a service time and suspends through a waitFor call. If no customer was waiting, the process suspends on a waitOn statement until an event from the Arrival process awakens it.

SSF bridges the gap between models developed in pure Java and models developed in languages specifically designed for simulation. It provides the flexibility offered by a general-programming language, yet has essential support for simulation.

7 Simulation Environments

All the simulation packages described in later subsections run on a PC under Microsoft Windows 2000 or XP. Most run under Vista. Although in terms of specifics the packages all differ, generally they have many things in common.

Common characteristics include a graphical user interface, animation, and automatically collected outputs to measure system performance. In virtually all packages, simulation results may be displayed in tabular or graphical form in standard reports and interactively while running a simulation. Outputs from different scenarios can be compared graphically or in tabular form. Most provide statistical analyses that include confidence intervals for performance measures and comparisons, plus a variety of other analysis methods. Some of the statistical-analysis modules are described in Section 8.

All the packages described here take the process-interaction worldview. A few also allow eventscheduling models and mixed discrete-continuous models. For animation, some emphasize scale drawings in 2-D or 3-D; others emphasize iconic-type animations based on schematic drawings or process-flow diagrams. A few offer both scale drawing and schematic-type animations. Almost al offer dynamic business graphing in the form of time lines, bar charts, and pie charts.

In addition to the information contained in this chapter, the websites given below can be investigated:

AnyLogic www.anylogic.com

Arena www.arenasimulation.com

AutoMod www.automod.com

Enterprise Dynamics www.incontrol.ne

ExtendSim www.extendsim.com

Flexsim www.flexsim.com

ProModel www.promodel.com

SIMUL8 www.simul8.com

7.1 AnyLogic

AnyLogic is a multi-method simulation software that supports discrete-event (process-centric) modeling, agent-based modeling, and system dynamics. The main idea behind AnyLogic is that the modeler can choose the method (or, perhaps, a combination of methods) and abstraction level best fitting the problem and thus capture the complexity and heterogeneity of manufacturing, logistics, business processes, human resources, or customer behavior, as well as macro level dynamics o economic and social systems, and their interactions.

AnyLogic includes a library of objects for process modeling (Source, Delay, Queue, Resource-Pool, etc.), supports space, mobility, networks, interaction, and various behavior definition forms for agents, and stock-and-flow diagrams for system dynamics models. The AnyLogic simulation engine supports hybrid (discrete plus continuous) time.

AnyLogic models (as well as the model development environment) are based on Java and thus are cross-platform. Models can be published as Java applets on the web so that remote users can execute them within their web browsers. The models have many “extension points” where the user can enter expressions and actions in Java.

The animation editor is a part of the AnyLogic model development environment. The editor supports a large variety of graphical shapes, controls (sliders, buttons, text inputs, etc.), images, GIS (Geographical Information System) map, and imported CAD drawings. Scalable and hierarchica animations can be developed. For example, the user can create a global view of a manufacturing process with some aggregated indicators as well as detailed animations of particular operations, and switch between those views.

The input data for the model can be processed with the distribution fitting software Stat::Fit (www.geerms.com), which supports AnyLogic syntax for probability distributions. The simulation output can be statistically processed and visualized within the model (a variety of charts and histograms is offered), or exported to a database, text file, or a spreadsheet.

The AnyLogic experiment framework includes simple simulation, parameter variation, compare runs, sensitivity analysis, Monte Carlo, calibration, optimization, and free-form custom experiments. The OptQuest optimization engine (see Section 8.2) is fully integrated into AnyLogic.

AnyLogic is available in two editions, Advanced and Professional. The Professional edition allows the user to export models as standalone Java applications, embed GIS maps and CAD drawings: It integrates with version control software for better teamwork, includes a full-featured debugger, and allows the user to save the state of the model during a simulation run and restore it at a later time. It also includes Pedestrian Library for high-precision physical level modeling of areas with dense pedestrian traffic.

7.2 Arena

Arena Basic and Professional Editions are offered by Rockwell Automation. Arena is a generalpurpose simulation software that can be used for simulating discrete and continuous systems.

The Arena Basic Edition is targeted at modeling business processes and other systems in suppor of high-level analysis needs. It represents process dynamics in a hierarchical flowchart and stores system information in data spreadsheets. It has built-in activity-based costing and is closely integrated with the flowcharting software Visio.

The Arena Professional Edition (PE) is designed for more detailed models of discrete and continuous systems. First released in 1993, Arena PE employs an object-based design for entirely graphica model development. Simulation models are built from graphical objects called modules to define system logic and such physical components as machines, operators, clerks, or doctors. Modules are represented by icons plus associated data entered in a dialog window. These icons are connected to represent entity flow. Modules are organized into collections called templates. The template is the core collection of modules providing general-purpose features for modeling all types of applications. In addition to standard features, such as resources, queues, process logic, and system data, the Arena templates include modules focused on specific aspects of manufacturing, material-handling, and flow process systems. Arena PE can also be used to model combined discrete/continuous systems, such as pharmaceutical and chemical production, through its built-in continuous-modeling capabilities and specialized flow template. This version also gives the user the capability to craft custom simulation objects that mirror components of the real system, including terminology, process logic, data, performance metrics, and animation.

The Arena family also includes products designed specifically to model call centers and highspeed production lines, namely Arena Contact Center and Arena Packaging Edition. These products can be used in combination with the Professional Edition.

At the heart of Arena is the SIMAN simulation language. Arena’s open architecture, including embedded Visual Basic for Applications (VBA), enables data transfer with other applications as well as custom interface development. For animating simulation models, Arena’s core modeling constructs are accompanied by standard graphics that show queues, resource status, and entity flow. Arena’s 2-D animations are created by using Arena’s built-in drawing tools and by incorporating clip art, AutoCAD, Visio, and other graphics. The Arena 3DPlayer can be used to create 3D imagery for viewing 3-D animations of Arena models.

Arena’s Input Analyzer automates the process of selecting the proper distribution and its parameters for representing existing data, such as process and interarrival times. The OptQuest optimization engine (Section 8.2) is fully integrated into Arena. The Output Analyzer and Process Analyzer (Section 8.2) automate comparison of different design alternatives.

7.3 AutoMod

The AutoMod Product Suite is offered by Applied Materials. It includes the Automod simulation package, AutoStat for experimentation and analysis, and AutoView for making AVI movies of the 3-D animation. The main focus of the AutoMod simulation product is manufacturing and materialhandling systems. AutoMod’s strength is in detailed, large models used for planning, operationa decision support, and control-systems testing.

AutoMod has built-in templates for most common material-handling systems, including vehicle systems, conveyors, automated storage and retrieval systems, bridge cranes, power and free conveyors, and kinematic (robotic) systems. It also includes a powerful model communication module, which allows models to communicate with control systems, and other simulation models.

AutoMod’s pathmover vehicle system can be used to model lift trucks, humans walking or pushing carts, automated guided vehicles, tuggers, trains, overhead transport vehicles, monorails, trucks, and cars. All the movement templates are based on a 3-D scale drawing (drawn or imported from CAD as 2-D or 3-D). All the components of a template are highly parameterized. For example, the conveyor template contains conveyor sections, motors that power the conveyor sections, stations for load induction or removal, and photo-eyes. Sections are defined by length, width, speed, acceleration, and type (accumulating or non-accumulating), plus other specialized parameters. As produc is moved by the conveyor system, the size of the product (loads), along with the attributes of the conveyor sections, are all accurately accounted for, providing tools for extremely accurate simulation results.

In addition to the material-handling templates,AutoMod contains a full simulation programming language. An AutoMod model consists of one or more systems. A system can be either a process system, in which flow and control logic are defined, or a movement system, based on one of the material-handling templates. A model may contain any number of systems (there are no size limitations), which can be saved and reused as objects in other models. Processes can contain complex logic to control the flow of either manufacturing materials (loads) or control messages. The process logic, executed by loads, can be as simple or as complex as needed to accomplish the desired simulation behavior. Its 3-D animation can be viewed from any angle or perspective in real time or at an accelerated time scale. The user can freely zoom, pan, or rotate the 3-D world of the simulation model.

In the AutoMod worldview, loads (products, parts, etc.) move from process to process and compete for resources (equipment, operators, vehicles, conveyor space, and queues). The load is the active entity, executing action statements in each process. Loads can be sent from process to process either directly, or by using a conveyor or vehicle movement system.

AutoStat, described in Section 8.2, works with AutoMod models to provide a complete environment for the user to define scenarios, determine warmup, conduct experimentation including design of experiments, and perform analyses. It also offers optimization based on evolution strategies.

7.4 Enterprise Dynamics

Enterprise Dynamics is a simulation platform, offered by Incontrol Simulation Software, Inc. Enterprise Dynamics is an object-oriented event-scheduling discrete-event simulator with its own built-in functional simulation programming language, 4DScript. Enterprise Dynamics comes with a library o Atoms, allowing fast model building in core application areas, manufacturing and material-handling systems, logistics, and transportation. A separate suite of Atoms and applications allows an airpor simulator, including baggage and passenger flows.

Enterprise Dynamics has an OpenGL-based 3D visualization engine that provides 3D visualization in “virtual reality.” The 3D visualization can be viewed during both simulation and modeling phases.

When factory-provided Atom libraries are not sufficient for specific modeling needs, additional aspects of the models appearance and behavior can be customized in its simulation language 4DScript, using more than 1500 available functions. The model code can be changed “on-the fly” without the need to recompile or stop the simulation. Other platform features aimed at supporting model development include a CAD drawing import wizard, a database interface (both ODBC and ADO) to enable storage of model structure and data for larger models in RDBMS (SQL Server, Oracle, MySQL, Access), XML support to enable information exchange with other systems, and ActiveX interfaces that enable the development of customized simulation solutions using Enterprise Dynamics’ simulation engine invisible behind the scenes.

A relatively new addition to Enterprise Dynamics is the Emulation add-on, which allows an interface of the simulated model of the production system with the logistics software managing it. The user can then test the logistics software before the actual hardware becomes available. This emulation interface is available on various levels, starting from direct PLC communication (using OPC) for testing of PLC circuits, up to high level interfaces with logistics software.

Results can be exported to MS Office applications for further analysis if necessary. The OptQues optimization engine (see Section 8.2) is fully integrated into Enterprise Dynamics.

7.5 ExtendSim

The ExtendSim family of products is offered by Imagine That Inc. [Krahl, 2008]. ExtendSim OR is for simulating discrete-event and mixed discrete-continuous systems. ExtendSim AT adds a discrete rate module for rate-based batch systems, and ExtendSim Suite adds 3D animation.

ExtendSim CP is for continuous modeling only. ExtendSim combines a drag-and-drop user interface with a development environment for creating custom components. Graphical objects, called blocks, represent logical as well as physical elements. Models can be built graphically by placing and connecting blocks, then entering parameters in the block’s dialog. Models can also be created programmatically using the ExtendSim scripting capability.

Each ExtendSim block has an icon, user interface, animation, precompiled code, and online help. Elemental blocks include Create, Queue, Activity, Resource Pool, and Exit. The active entities, called items in ExtendSim, originate at Create blocks and move from block to block by way of item connectors. Separate value connectors allow the attachment of a calculation to a block parameter or the retrieval of statistical information for reporting purposes. Input parameters can be changed interactively during a model run and can come from internal or external sources. Outputs are displayed dynamically and in graphical and tabular format. Blocks are collectively organized into libraries o general-purpose elements as well as libraries for specific applications such as high-speed packaging lines and chemical production. Third-party developers have created ExtendSim libraries for vertica markets, including supply-chain dynamics, communication systems, and pulp and paper processing.

ExtendSim provides iconic process-flow animation of the block diagram. The Suite produc includes 3D animation that is separate from but integrated with the logical simulation model: 3D animation can run concurrently or be buffered. Collections of blocks representing a submodel, such as a subassembly line or a functional process, can be grouped into a hierarchical block on the model worksheet. ExtendSim supports multiple layers of hierarchy, and hierarchical blocks can be stored in a library for reuse. Clones of critical parameters can be grouped and displayed at the worksheet level for user access to a model dashboard. Agent-based modeling, activity-based costing, and statistical analysis ofoutput data with confidence intervals are also supported. ExtendSim includes an Evolutionary Optimizer as well as an integrated, relational database. Block parameters and data tables dynamically link with ExtendSim database tables for centralized data management.

ExtendSim supports the Microsoft component object model (COM/ActiveX), open database connectivity (ODBC), and file transfer protocol (FTP) for internet data exchange. New blocks can be created either hierarchically or by using the compiled C-based programming environment. The message-based language includes simulation-specific functions and custom interface developmen tools. ExtendSim has an open architecture – source code is provided for block modification and custom development. The architecture also supports linking to and using code and routines written in external languages.

7.6 Flexsim

Flexsim simulation software was developed and is owned by Flexsim Software Products, Inc. of Orem, Utah [Nordgren, 2003]. Flexsim is a discrete-event, object-oriented simulator developed in C++, using Open GL technology. Animation is shown in 3-D and as virtual reality. All views can be shown concurrently during the model development or run phase. Flexsim integrates Microsoft’s Visual C++ IDE and compiler within a graphical 3-D click-and-drag simulation environment.

In 2007, Flexsim introduced a precompiled language to Flexsim called Flexscript that allows programming without the need to compile before the model run. Flexsim currently offers both Flexscript and C++ for modeling complex algorithms. A simulation model of any flow system or process can be created in Flexsim by using drag-and-drop model-building objects. Flexsim provides the ability to customize objects for specific needs. Users can add modified objects to their own user library which can be saved and shared within their organization. Robust defaults allow a modeler to have a model up and running quickly. Flexsim provides object libraries for discrete event, continuous, and agent-based modeling.

In 2008 Flexsim introduced discrete-event simulation (DS) software for running large models over a computer network or internet with the processing of the model distributed across any number of processors. Flexsim DS can be used to model large and complex systems using hundreds of computers linked together. Flexsim DS allows multi-user model collaboration. Teams of modelers

can work together via the internet from a remote location to build a model, analyze results, and run experiments. Flexsim DS enables evolving models and collaborative design, all in a virtual reality environment.

7.7 ProModel

ProModel is an offering of ProModel Corporation, founded in 1988. It is a simulation and animation tool designed primarily for modeling manufacturing systems. Though ProModel can be and often is used for modeling non-manufacturing systems, the company offers similar products for healthcare simulation (MedModel) and service system simulation (ServiceModel).

ProModel is a Microsoft Gold Certified Partner and offers a plug-in to Microsoft Visio called Process Simulator for simulating process charts, value stream maps, and facility layouts for any industry. It also offers a plug-in to Microsoft Project for modeling projects of all types that may have variable task times and shared resources.

In addition to providing solutions aimed at modeling a broad range of processes and projects, ProModel offers several focused simulation products aimed at specific types of planning problems. These include Emergency Department Simulator (EDS) for determining resource requirements and analyzing patient flows in emergency departments; and Portfolio Simulator for visualizing, analyzing, and optimizing product and project portfolios.Additional products have been developed and are being successfully used in the U.S. Department of Defense for resource capacity planning.

ProModel provides both 2-D and 3-D animation as well as dynamic plots and counters that update during the simulation. The animation layout is created automatically as the model is developed, using graphics from predefined libraries or imported by the user.

Models are built using a graphical user interface and modeling constructs. ProModel’s capabilities including constructs for modeling operators, fork trucks, conveyors, cranes, automatic-guided vehicle systems, and pumps and tanks. ProModel automatically tracks cost data based on material, labor, and equipment costs entered by the user.

ProModel interfaces with Microsoft Excel and other commercial database programs for developing integrated solutions. It also has a COM interface for customization and creating connectivity with other applications. ProModel supports collaborative modeling in which models can be built and maintained separately and then run in concert when desired.

In addition to generating both standard and customized output reports, ProModel exports data to Excel for more extensive analysis as well as to Minitab for automatically creating six-sigma six-pack charts and process capability diagrams. ProModel’s runtime interface allows a user to define multiple scenarios for experimentation and side-by-side comparison. SimRunner, discussed in Section 8.2, adds the capability of performing simulation optimization. It is based on an evolutionary strategy algorithm, a variant of the genetic algorithm approach. The OptQuest optimization engine (discussed in Section 8.2) is fully integrated into ProModel.

7.8 SIMUL8

SIMUL8 is provided by SIMUL8 Corporation and was first introduced in 1995. In SIMUL8, models are created by drawing the flow of work with the computer mouse, using icons and arrows to represen the resources and queues in the system. Default values are provided for all properties of the icons so that the animation can be viewed very early in the modeling process. Drilling down in property boxes

opens up progressively more detailed properties. The main focus of SIMUL8 is service industries where people are processing transactions or are themselves the transactions (for example, in a bank, call center, or hospital).

Like some other packages SIMUL8 has the concepts of “Templates” and “Components.” Templates, or prebuilt simulations, focus on particular recurring decision types that can be quickly parameterized to fit a specific company issue. Components are user-defined icons that can be reused and shared across a company’s simulations. This reduces time-to-build simulations, standardizes how some situation are handled across a corporation, and often removes much of the data collection phase of a simulation study.

SIMUL8 Corporation’s approach is to spread simulation very widely across businesses, rather than concentrate it in the hands of dedicated and highly trained simulation professionals. This means they have very different pricing and support policies, but it also means the software has to contain features that watch how the product is being used, and provides assistance if some potentially invalid analysis is conducted.

SIMUL8 saves its simulation model and data in XML format so that it is easy to transfer it to and from other applications. It has an interface for building “front ends” for customized data entry and supports COM/ActiveX so that external applications can build and control SIMUL8 simulations.

The product has a web-based version that allows anyone with an internet browser to run models and is available in two levels, Standard and Professional. The two levels provide the same simulation features, but Professional adds 3-D, “virtual reality” views of the simulation, database links to corporate databases, an optimizer, version tracking, and other features likely only to be useful to full-time simulation modelers.

8 Experimentation and Statistical-Analysis Tools

8.1 Common Features

Virtually all simulation packages offer various degrees of support for statistical analysis of simulation outputs. In recent years, many packages have added optimization as one of the analysis tools. To support analysis, most packages provide scenario definition, run-management capabilities, and data export to spreadsheets and other external applications.

Optimization is used to find a “near-optimal” solution. The user must define an objective or fitness function, usually a cost or cost-like function that incorporates the trade-off between additiona throughput and additional resources. Until recently, the methods available for optimizing a system had difficulty coping with the random and nonlinear nature of most simulation outputs. Advances in the field of metaheuristics have offered new approaches to simulation optimization, ones based on artificial intelligence, neural networks, genetic algorithms, evolutionary strategies, tabu search, and scatter search.

8.2 Products

This section briefly discussesArena’s Output and ProcessAnalyzer,AutoStat forAutoMod, OptQues (which is used in a number of simulation products), and SimRunner for ProModel.

Arena’s Output and Process Analyzer

Arena comes with the Output Analyzer and Process Analyzer. In addition, Arena uses OptQuest for optimization.

The Output Analyzer provides confidence intervals, comparison of multiple systems, and warmup determination to reduce initial condition biases. It creates various plots, charts, and histograms, smoothes responses, and does correlation analysis.

The ProcessAnalyzer adds sophisticated scenario-management capabilities toArena for comprehensive design of experiments. It allows a user to define scenarios, make the desired runs, and analyze the results. It allows an arbitrary number of controls and responses. Responses can be added after runs have been completed. It will rank scenarios by any response and provide summaries and statistical measures of the responses. A user can view 2-D and 3-D charts of response values across either replications or scenarios.

AutoStat

AutoStat is the run manager and statistical-analysis product in the AutoMod product family. AutoSta provides a number of analyses, including warm-up determination for steady-state analysis, absolute and comparison confidence intervals, design of experiments, sensitivity analysis, and optimization via an evolutionary strategy.

With AutoStat, an end-user can define any number of scenarios by defining factors and their range of values. Factors include model input parameters, such as resource capacity, the number of vehicles, or vehicle speed. Data files (either a specific cell or the entire file) can also be defined as input factors. By allowing a data file to be a factor, a user can experiment with, for example, alternate production schedules, customer orders for different days, different labor schedules, or any other numerical inputs typically specified in a data file. Any standard or custom output can be designated as a response. For each defined response, AutoStat computes descriptive statistics (average, standard deviation, minimum, and maximum) and confidence intervals. New responses can be defined after runs are made, because AutoStat saves and compresses the standard and custom outputs from al runs. Various charts and plots are available to provide graphical comparisons.

AutoStat helps to determine which results and alternatives are statistically significant, which means that with high probability, the observed results are not caused by random fluctuations.AutoSta supports correlated sampling using common random numbers. This sampling technique minimizes variation between paired samples, giving a better indication of the true effects of model changes.

AutoStat is capable of distributing simulation runs across a local area network and pulling back all results to the user’s computer. Support for multiple computers and CPUs gives users the ability to make many more runs of the simulation than would otherwise be possible, by using idle computers during off-hours. This is especially useful in multifactor analysis and optimization studies, both of which could require large numbers of runs. AutoStat also has a diagnostics capability tha automatically detects “unusual” runs, where the definition of “unusual” is determined by the user.

AutoStat also works with AutoSched AP, a rule-based simulation package for finite-capacity scheduling in the semiconductor industry.

OptQuest

OptQuest was developed by Fred Glover, James Kelly, and Manuel Laguna of the University o Colorado, cofounders of OptTek Systems, Inc. [April et al., 2003]. OptQuest is based on a combination of methods: Scatter search, tabu search, linear/integer programming, and data mining, including neural networks. Scatter search is a population-based approach where existing solutions are combined to create new solutions. Tabu search is an adaptive memory search method that is then superimposed to drive the method away from past solutions toward better ones, and data mining additionally screens out solutions likely to be poor. The combination of methods allows the search process to escape loca optimality in the quest for the best solution. Some of the features of OptTek’s methods include:

The ability to handle nonlinear and discontinuous relationships that are not specifiable by the kinds of equations and formulas used in standard mathematical programming formulations;

The ability to handle multiple kinds of constraints (linear and nonlinear);

The ability to handle multiple goals;

The ability to create an efficient frontier of solutions to support decision-making analysis;

The ability to solve problems that involve uncertain supplies, demands, prices, costs, flow rates, and queueing rates.

The core OptQuest technology has also been embedded in many simulation-based applications ranging from Project Portfolio Management to Workforce Optimization.

SimRunner

SimRunner was developed by PROMODEL Corporation out ofthe simulation-optimization research of Royce Bowden, Mississippi State University [Harrell et al., 2003]. It is available for ProModel, MedModel, and ServiceModel.

SimRunner uses genetic algorithms and evolution strategies, which are variants of evolutionary algorithms. Evolutionary algorithms manipulate a population of solutions to a problem in such a way that poor solutions fade away and good solutions continually evolve toward an optimum solution. These population-based direct-search techniques have the ability to avoid being trapped in locally optimal solutions. Evolutionary algorithms have proved robust in that they have been successfully used to solve a wide variety of difficult real-world problems that are nonlinear, multimodal, multidimensional, discontinuous, and stochastic.

Before invoking the evolutionary algorithms in SimRunner, a user first specifies input factors (integer or real-valued decision variables) composed of ProModel macros and then specifies an objective function composed of simulation-output responses. SimRunner manipulates the input factors within constraints specified by the user as it seeks to minimize, maximize, or achieve a user-specified target value for the objective function. The optimization-output report includes a confidence interva on the mean value of the objective function for each solution evaluated over the course of the optimization and displays 3-D plots of the simulation’s output-response surface for the solutions evaluated. The solutions can be sorted by the value of the objective function (default), by the individua simulation-output responses used to define the objective function, or by any decision variable.

In addition to the multivariable optimization module, SimRunner has modules for helping users estimate the end of the warm-up phase (initialization bias) of a steady-state simulation and the number of replications needed to obtain an estimate of the objective function’s mean value to within a specified percentage error and confidence level. Both modules are valuable for achieving accurate estimates of an objective function’s mean value, which is necessary for successful decision making and simulation optimization

REFERENCES

APRIL, J., F. GLOVER, J. P. KELLY, AND M. LAGUNA [2003], “Practical Introduction to Simulation Optimization,” Proceedings of the 2003 Winter Simulation Conference, eds. S. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, New Orleans, LA, Dec. 7–10, pp. 71–78.

BANKS, J., J. S. CARSON, AND J. N. SY [1995], Getting Started with GPSS/H, 2d ed., Wolverine Software Corporation, Annandale, VA.

BANKS, J. [1996], “Interpreting Software Checklists,” OR/MS Today, Vol. 22, No. 3, pp. 74–78.

BANKS, J. [2008], “Some burning questions about simulation,” ICS Newsletter, Spring.

COWIE, J. [1999], “Scalable Simulation FrameworkAPI Reference Manual,” www.ssfnet.org/SSFdocs /ssfapiManual.pdf.

HARRELL, C. R., B. K. GHOSH, AND R. BOWDEN [2003], Simulation Using ProModel, 2d ed., New York: McGraw-Hill.

HENRIKSEN, J. O. [1999], “General-Purpose Concurrent and Post-Processed Animation with Proof,” Proceed ings ofthe 1999 Winter Simulation Conference, eds. P. A. Farrington, H. B. Nembhard, D. T. Sturrock, G. W. Evans, Phoenix, AZ, Dec. 5–8, pp. 176–181.

KRAHL, D. [2008], “ExtendSim 7” Proceedings of the 2008 Winter Simulation Conference, eds. S.J. Mason, R.R. Hill, L. M¨onch, O. Rose, T. Jefferson, and J.W. Fowler, Miami, FL, Dec. 7–10 pp. 215–221.

NANCE, R. E. [1995], “Simulation Programming Languages: An Abridged History,” Proceedings ofthe 1995 Winter Simulation Conference, eds. C. Alexopoulos, K. Kang, W. R. Lilegdon, and D. Goldsman, Arlington, VA, Dec. 13–16, pp. 1307–1313.

NORDGREN, W. B. [2003], “Flexsim Simulation Environment,” Proceedings of the 2003 Winter Simulation Conference, eds. S. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, New Orleans, LA, Dec. 7–10, pp. 197–200.

PRITSKER, A. A. B., AND C. D. PEGDEN [1979], Introduction to Simulation and SLAM, John Wiley, New York.

SWAIN, J. J. [2007], “New Frontiers in Simulation: Biennial Survey of Discrete-Event Simulation Software Tools,” OR/MS Today, October, Vol.34, No. 5, pp. 23–43.

TOCHER, D. D., AND D. G. OWEN [1960], “The Automatic Programming of Simulations,” Proceedings of the Second International Conference on Operational Research, eds. J. Banbury and J. Maitland, pp. 50–68.

WILSON, J. R., et al. [1992], “The Winter Simulation Conference: Perspectives of the Founding Fathers,” Proceedings of the 1992 Winter Simulation Conference, eds. J. Swain. D. Goldsman. R. C. Crain, and J. R. Wilson, Arlington, VA, Dec. 13–16, pp.37–62.

EXERCISES

For the exercises below, the reader should code the model in a general-purpose language (such as C, C , or Java), a special-purpose simulation language (such as GPSS/H), or any desired simulation environment.

Most problems contain activities that are uniformly distributed over an interval [a,b][ a , b ]. Assume that all values between a and b are possible; that is, the activity time is a continuous random variable.

The uniform distribution is denoted by U(a,b)U ( a , b ), where a and b are the endpoints of the interval, or by m±h,m \pm h , where m is the mean and h is the “spread” of the distribution. These four parameters are related by the equations

m=a+b2h=b−a2 m = \frac {a + b}{2} h = \frac {b - a}{2} a=m−hb=m+h {a} {= m - h} {b = m + h}

Some of the uniform-random-variate generators available require specification of a and b;b ; others require m and h.

Some problems have activities that are assumed to be normally distributed, as denoted by N(μ,σ2)N ( \mu , \sigma^{2} ), where μ\mu is the mean and σ2\sigma^{2} the variance. (Since activity times are nonnegative, the normal distribution is appropriate only if μ≥kσ\mu \geq k \sigma, where k is at least 4 and preferably 5 or larger. If a negative value is generated, it is discarded.) Other problems use the exponential distribution with some rate λ or mean 1/λ. All of the languages have a facility to easily generate samples from these distributions. For C, C++, or Java simulations, the student may use the functions given in Section 4 for generating samples from the normal and exponential distributions.

  1. Make the necessary modifications to the Java model of the checkout counter (Example 2) so that the simulation will run for exactly 60 hours.

  2. In addition to the change in Exercise 1, also assume that any customers still at the counter at time 60 hours will be served, but no arrivals after time 60 hours are allowed. Make the necessary changes to the Java code and run the model.

  3. Implement the changes in Exercises 1 and 2 in any of the simulation packages.

  4. Ambulances are dispatched at a rate of one every 15 10 minutes in a large metropolitan area. Fifteen percent of the calls are false alarms, which require 122 minutes to complete. All other calls can be one of two kinds. The first kind are classified as serious. They constitute 15% of the non-false alarm calls and take 255 minutes to complete. The remaining calls take 20±1020 \pm 10 minutes to complete. Assume that there are a very large number of available ambulances, and that any number can be on call at any time. Simulate the system until 500 calls are completed.

  5. In Exercise 4, estimate the mean time that an ambulance takes to complete a call.

  6. (a) In Exercise 4, suppose that there is only one ambulance available. Any calls that arrive while the ambulance is out must wait. Can one ambulance handle the work load? (b) Simulate with x ambulances, where x=1,2,3,x = 1 , 2 , 3 , or 4, and compare the alternatives on the basis of length of time a call must wait, percentage of calls that must wait, and percentage of time the ambulance is ou on call.

  7. There are four agents at the check-in counter for Drafty Airlines at the Dusty Plains Airport. Passengers arrive for check-in every 30±3030 \pm 30 seconds. It takes 100±30100 \pm 30 seconds to check in a passenger. Drafty Airlines is going to replace the agents with automatic passenger check-in devices (APCID).AnAPCID takes 120±45120 \pm 45 seconds to check in a passenger. How manyAPCIDs are needed to achieve an average waiting time not greater than the current waiting time with the four agents? Run for 10 hours of simulated time.

  8. A superhighway connects one large metropolitan area to another. A vehicle leaves the first city every 20±1520 \pm 15 seconds. Twenty percent of the vehicles have 1 passenger, 30% of the vehicles have 2 passengers, 10% have 3 passengers, and 10% have 4 passengers. The remaining 30% of the vehicles are buses, which carry 40 people. It takes 60±1060 \pm 10 minutes for a vehicle to travel between the two metropolitan areas. How long does it take for 5000 people to arrive in the second city?

  9. People arrive at a meat counter at a rate of one every 25±1025 \pm 10 seconds. There are two sections: one for beef and one for chicken. People want goods from them in the following proportion: beef only, 50%; chicken only, 30%; beef and chicken, 20%. It takes 45±2045 \pm 20 seconds for a butcher to serve one customer for one order. All customers place one order, except “beef and chicken” customers place two orders. Assume that there are enough butchers available to handle all customers present at any time. How long does it take for 200 customers to be served?

  10. In Exercise 9, what is the maximum number of butchers needed during the course of simulation? Would this number always be sufficient to guarantee that no customer ever had to wait?

  11. In Exercise 9, simulate with x butchers, where x=1,2,3,4x = 1 , 2 , 3 , 4. When all butchers are busy, a line forms. For each value of x, estimate the mean number of busy butchers.

  12. A one-chair unisex hair shop has arrivals at the rate of one every 20±1520 \pm 15 minutes. One-half of the arriving customers want a dry cut, 30% want a style, and 20% want a trim only. A dry cut takes 15±515 \pm 5 minutes, a style cut takes 25±1025 \pm 10 minutes, and a trim takes 10±310 \pm 3 minutes. Simulate 400 customers coming through the hair shop. Compare the given proportion of service requests of each type with the simulated outcome. Are the results reasonable?

  13. An airport has two concourses. Concourse 1 passengers arrive at a rate of one every 15±215 \pm 2 seconds. Concourse 2 passengers arrive at a rate of one every 10±510 \pm 5 seconds. It takes 30±530 \pm 5 seconds to walk down concourse 1 and 35±1035 \pm 10 seconds to walk down concourse 2. Both concourses empty into the main lobby, adjacent to the baggage claim. It takes 10±310 \pm 3 seconds to reach the baggage claim area from the main lobby. Only 60% of the passengers g0{\bf g 0} to the

baggage claim area. Simulate the passage of 500 passengers through the airport system. How many of these passengers went through the baggage claim area? In this problem, the expected number through the baggage claim area can be computed by 0.60(500)=3000 . 60 ( 500 ) = 300. How close is the simulation estimate to the expected number? Why the difference if a difference exists?

  1. In a multiphasic screening clinic, patients arrive at a rate of one every 5±25 \pm 2 minutes to enter the audiology section. The examination takes 3±13 \pm 1 minutes. Eighty percent of the patients were passed on to the next test with no problems. Of the remaining 20%, one-half require simple procedures that take 2±12 \pm 1 minutes and are then sent for reexamination with the same probability of failure. The other half are sent home with medication. Simulate the system to estimate how long it takes to screen and pass 200 patients. (Note: Patients sent home with medication are not considered “passed.”)

  2. Consider a bank with four tellers. tellers 3 and 4 deal only with business accounts; Tellers 1 and 2 deal only with general accounts. Clients arrive at the bank at a rate of one every 3±13 \pm 1 minutes. Of the clients, 33% are business accounts. Clients randomly choose between the two tellers available for each type of account. (Assume that a customer chooses a line without regard to its length and does not change lines.) Business accounts take 15±1015 \pm 10 minutes to complete, and general accounts take 6±56 \pm 5 minutes to complete. Simulate the system for 500 transactions to be completed. What percentage of time is each type of teller busy? What is the average time that each type of customer spends in the bank?

  3. Repeat Exercise 15, but assume that customers join the shortest line for the teller handling their type of account.

  4. In Exercises 15 and 16, estimate the mean delay of business customers and of general customers. (Delay is time spent in the waiting line, and is exclusive of service time.) Also estimate the mean length of the waiting line, and the mean proportion of customers who are delayed longer than 1 minute.

  5. Three different machines are available for machining a special type of part for 1 hour of each day. The processing-time data is as follows:

MachineTime to Machine One Part
120 ± 4 seconds
210 ± 3 seconds
315 ± 5 seconds

Assume that parts arrive by conveyor at a rate of one every 15±515 \pm 5 seconds for the first 3 hours of the day. Machine 1 is available for the first hour, machine 2 for the second hour, and machine 3 for the third hour of each day. How large a storage area is needed for parts waiting for a machine? Do parts “pile up” at any particular time? Why?

  1. People arrive at a self-service cafeteria at the rate of one every 30 20 seconds. Forty percent go to the sandwich counter, where one worker makes a sandwich in 60 30 seconds. The rest go to the main counter, where one server spoons the prepared meal onto a plate in 45±3045 \pm 30 seconds. Al customers must pay a single cashier, which takes 25±1025 \pm 10 seconds. For all customers, eating takes 20±1020 \pm 10 minutes. After eating, 10% of the people go back for dessert, spending an additiona 10±210 \pm 2 minutes altogether in the cafeteria. Simulate until 100 people have left the cafeteria. How many people are left in the cafeteria, and what are they doing, at the time the simulation stops?

  2. Thirty trucks carrying bits and pieces of a C-5N cargo plane leave Atlanta at the same time for the Port of Savannah. From past experience, it is known that it takes 6±26 \pm 2 hours for a truck to make the trip. Forty percent of the drivers stop for coffee, which takes an additional 15±515 \pm 5 minutes. (a) Model the situation as follows: For each driver, there is a 40% chance of stopping for coffee. When will the last truck reach Savannah? (b) Model it so that exactly 40% of the drivers stop for coffee. When will the last truck reach Savannah?

  3. Customers arrive at the Last National Bank every 40 35 seconds. Currently, the customers pick one of two tellers at random. A teller services a customer in 75±2575 \pm 25 seconds. Once a customer joins a line, the customer stays in that line until the transaction is complete. Some customers want the bank to change to the single-line method used by the Lotta Trust Bank. Which is the faster method for the customer? Simulate for one hour before collecting any summary statistics, then simulate for an 8-hour period. Compare the two queueing disciplines on the basis of teller utilization (percentage of busy time), mean delay of customers, and proportion of customers who must wait (before service begins) more than 1 minute, and more than 3 minutes.

  4. Loana Tool Company rents chain saws. Customers arrive to rent chain saws at the rate of one every 30 30 minutes. Dave and Betty handle these customers. Dave can rent a chain saw in 144 minutes. Betty takes 10±510 \pm 5 minutes. Customers returning chain saws arrive according to the same distribution as those renting chain saws. Dave and Betty spend 2 minutes with a customer to check in the returned chain saw. Service is first-come-first-served. When no customers are present, or Betty alone is busy, Dave gets these returned saws ready for re-renting. For each saw, this maintenance and cleanup takes him 6±46 \pm 4 minutes and 10±610 \pm 6 minutes, respectively. Whenever Dave is idle, he begins the next maintenance or cleanup. Upon finishing a maintenance or cleanup, Dave begins serving customers if one or more is waiting. Betty is always available for serving customers. Simulate the operation of the system starting with an empty shop at 8:00 A.M., closing the doors at 6:00 P.M., and getting chain saws ready for re-renting until 7:00 P.M. From 6:00 until 7:00 P.M., both Dave and Betty do maintenance and cleanup. Estimate the mean delay of customers who are renting chain saws.

  5. In Exercise 22, change the shop rule regarding maintenance and cleanup to get a chain saw ready for re-rental. Now Betty does all this work. Upon finishing a cleanup on a saw, she helps Dave if a line is present. (That is, Dave and Betty both serve new customers and check in returned saws until Dave alone is busy, or the shop is empty.) Then she returns to her maintenance and cleanup duties. (a) Estimate the mean delay of customers who are renting chain saws. Compare the two shop rules on this basis. (b) Estimate the proportion of customers who must wait more

than 5 minutes. Compare the two shop rules on this basis. (c) Discuss the pros and cons of the two criteria in parts (a) and (b) for comparing the two shop rules. Suggest other criteria.

  1. U of LA (University of Lower Altoona) has only one color printer for student use. Students arrive at the color printer every 15±1015 \pm 10 minutes to use it for 12±612 \pm 6 minutes. If the color printer is busy, 60% will come back in 10 minutes to try again. If the color printer is still busy, 50% (of the 60%) will return in 15 minutes. How many students fail to use the color printer compared to 500 that actually finish? Demand and service occur 24 hours a day.

  2. A warehouse holds 1000 cubic meters of cartons. These cartons come in three sizes: little (1 cubic meter), medium (2 cubic meters), and large (3 cubic meters). The cartons arrive at the following rates: little, every 10±1010 \pm 10 minutes; medium, every 15 minutes; and large, every 8±88 \pm 8 minutes. If no cartons are removed, use simulation to determine how long will it take to fill an empty warehouse?

  3. Go Ape! buys a Banana II computer to handle all of its web-browsing needs. Web-browsing employees arrive every 10±1010 \pm 10 minutes to use the computer. Web-browsing takes 7±77 \pm 7 minutes. The monkeys that run the computer cause a system failure every 60±6060 \pm 60 minutes. The failure lasts for 8±48 \pm 4 minutes. When a failure occurs, the web-browsing that was being done resumes processing from where it left off. Simulate the operation of this system for 24 hours. Estimate the mean system response time. (A system response time is the length of time from arrival unti web-browsing is completed.) Also estimate the mean delay for those web-browsing employees who are in service when a computer system failure occurs.

  4. Able, Baker, and Charlie are three carhops at the Sonic Drive-In (service at the speed of sound!). Cars arrive every 5±55 \pm 5 minutes. The carhops service customers at the rate of one every 10±610 \pm 6 minutes. However, the customers prefer Able over Baker, and Baker over Charlie. If the carhop of choice is busy, the customers choose the first available carhop. Simulate the system for 1000 service completions. Estimate Able’s, Baker’s, and Charlie’s utilization (percentage of time busy).

  5. Jiffy Car Wash is a five-stage operation that takes 21 minutes for each stage. There is room for 6 cars to wait to begin the car wash. The car wash facility holds 5 cars, which move through the system in order, one car not being able to move until the car ahead of it does. Cars arrive every 2.5±22 . 5 \pm 2 minutes for a wash. If the car cannot get into the system, it drives across the street to Speedy Car Wash. Estimate the balking rate per hour. That is, how many cars drive off per hour? Simulate for one 12-hour day.

  6. Workers come to an internal supply store at the rate ofone every 104 minutes. Their requisitions are handled by one of three clerks; a clerk takes 22±1022 \pm 10 minutes to handle a requisition. Al requisitions are then passed to a single cashier, who spends 7±67 \pm 6 minutes per requisition. Simulate the system for 120 hours. (a) Estimate the utilization of each clerk, based on the 120- hour simulation. (b) How many workers are completely served? How many do the three clerks serve? How many workers arrive? Are all three clerks ever busy at the same time? What is the average number of busy clerks?

  7. People arrive at a barbershop at the rate of one every 4.5 minutes. If the shop is full (it can hold five people altogether), 30% of the potential customers leave and come back in 60±2060 \pm 20 minutes. The others leave and do not return. One barber gives a haircut in 8±28 \pm 2 minutes; the second talks a lot and takes 124 minutes. If both barbers are idle, a customer prefers the first barber. (Treat customers trying to reenter the shop as if they are new customers.) Simulate this system until 300 customers have received a haircut. (a) Estimate the balking rate, that is, the number turned away per minute. (b) Estimate the number turned away per minute who do not try again. (c) What is the average time spent in the shop? (d) What is the average time spent getting a haircut (not including delay)? (e) What is the average number of customers in the shop?

  8. People arrive at a microscope exhibit at a rate of one every 82 minutes. Only one person can see the exhibit at a time. It takes 52 minutes to see the exhibit. A person can buy a “privilege” ticket for $1 which gives him or her priority in line over those who are too cheap to spend the buck. Some 50% of the viewers are willing to do this, but they make their decision to do so only if one or more people are in line when they arrive. The exhibit is open continuously from 10:00 A.M. to 4:00 P.M. Simulate the operation of the system for one complete day. How much money is generated from the sale of privilege tickets?

  9. Two machines are available for drilling parts (A-type and B-type). A-type parts arrive at a rate of one every 10±310 \pm 3 minutes, B-type parts at a rate of one every 32 minutes. For B-type parts, workers choose an idle machine, or if both drills, the Dewey and the Truman, are busy, they choose a machine at random and stay with their choice. A-type parts must be drilled as soon as possible; therefore, if a machine is available, preferably the Dewey, it is used; otherwise the part goes to the head of the line for the Dewey drill. All jobs take 4±34 \pm 3 minutes to complete. Simulate the completion of 100 A-type parts. Estimate the mean number ofA-type parts waiting to be drilled.

  10. A computer center has two color printers. Students arrive at a rate of one every 82 minutes to use the color printer. They can be interrupted by professors, who arrive at a rate of one every 12±212 \pm 2 minutes. There is one systems analyst who can interrupt anyone, but students are interrupted before professors. The systems analyst spends 64 minutes on the color printer and then returns in 205 minutes. Professors and students spend 42 minutes on the color printer. If a person is interrupted, that person joins the head of the queue and resumes service as soon as possible. Simulate for 50 professor-or-analyst jobs. Estimate the interruption rate per hour, and the mean length of the waiting line of students.

  11. Parts are machined on a drill press. They arrive at a rate of one every 5±35 \pm 3 minutes, and it takes 3±23 \pm 2 minutes to machine them. Every 60±6060 \pm 60 minutes, a rush job arrives, which takes 12±312 \pm 3 minutes to complete. The rush job interrupts any nonrush job. When the regular job returns to the machine, it stays only for its remaining process time. Simulate the machining of 10 rush jobs. Estimate the mean system response time for each type of part. (A response time is the tota time that a part spends in the system.)

  12. E-mail messages are generated at a rate of one every 35±1035 \pm 10 seconds for transmission one at a time. Transmission takes 20±520 \pm 5 seconds. At intervals of 6±36 \pm 3 minutes, urgent e-mail messages with transmission times of 10±310 \pm 3 seconds take over the transmission line. Any e-mail message in progress must be reprocessed for 2 minutes before it can be resubmitted for transmission. When resubmitted, it goes to the head of the line. Simulate for 90 minutes. Estimate the percentage of time the line is busy with ordinary e-mail messages.

  13. A worker packs boxes that arrive at a rate of one every 153 minutes. It takes 103 minutes to pack a box. Once every hour, the worker is interrupted to wrap specialty orders that take 16±316 \pm 3 minutes to pack. Upon completing the specialty order, the worker then completes the interrupted order. Simulate for 40 hours. Estimate the mean proportion of time that the number of boxes waiting to be packed is more than five and the average number of boxes waiting to be packed.

  14. A patient arrives at the Emergency Room at Hello Hospital about 40±1940 \pm 19 minutes. Each patient will be treated by either Doctor Slipup or Doctor Gutcut. Twenty percent of the patients are classified as NIA (need immediate attention) and the rest as CW (can wait). NIA patients are given the highest priority (3), see a doctor as soon as possible for 40±3740 \pm 37 minutes, but then their priority is reduced to 2 and they wait until a doctor is free again, when they receive further treatment for 30±2530 \pm 25 minutes and are then discharged. CW patients initially receive the priority 1 and are treated (when their turn comes) for 15±1415 \pm 14 minutes; their priority is then increased to 2, they wait again until a doctor is free and receive 10±810 \pm 8 minutes of final treatment, and are then discharged. Simulate for 20 days of continuous operation, 24 hours per day. Precede this by a 2-day initialization period to load the system with patients. Report conditions at times 0 days, 2 days, and 22 days. Does a 2-day initialization appear long enough to load the system to a level reasonably close to steady-state conditions? (a) Measure the average and maximum queue length of NIA patients from arrival to first seeing a doctor. What percent do not have to wai at all? Also tabulate and plot the distribution of this initial waiting time for NIA patients. Wha percent wait less than 5 minutes before seeing a doctor? (b) Tabulate and plot the distribution of total time in system for all patients. Estimate the 90% quantile—that is, 90% of the patients spend less than x amount of time in the system. Estimate x. (c) Tabulate and plot the distribution of remaining time in system from after the first treatment to discharge, for all patients. Estimate the 90% quantile. (Note: Most simulation packages provide the facility to automatically tabulate the distribution of any specified variable.)

  15. People arrive at a newspaper stand with an interarrival time that is exponentially distributed with a mean of 0.5 minute. Fifty-five percent of the people buy just the morning paper, 25% buy the morning paper and a Wall Street Journal. The remainder buy only the Wall Street Journal. One clerk handles the Wall Street Journal sales, another clerk morning-paper sales. A person buying both goes to the Wall Street Journal clerk. The time it takes to serve a customer is normally distributed with a mean of 40 seconds and a standard deviation of 4 seconds for all transactions. Collect statistics on queues for each type of transaction. Suggest ways for making the system more efficient. Simulate for 4 hours.

  16. Bernie remodels houses and makes room additions. The time it takes to finish a job is normally distributed with a mean of 17 elapsed days and a standard deviation of 3 days. Homeowners sign contracts for jobs at exponentially distributed intervals having a mean of 20 days. Bernie has only one crew. Estimate the mean waiting time (from signing the contract until work begins) for those jobs where a wait occurs. Also estimate the percentage of time the crew is idle. Simulate until 100 jobs have been completed.

  17. Parts arrive at a machine in random fashion with exponential interarrival times having a mean of 60 seconds. All parts require 5 seconds to prepare and align for machining. There are three different types of parts, in the proportions shown below. The times to machine each type of part are normally distributed with mean and standard deviation as follows:

Part TypePercentMean (seconds)σ (seconds)
150488
230559
3208512

Find the distribution of total time to complete processing for all types of parts. What proportion of parts take more than 60 seconds for complete processing? How long do parts have to wait, on average? Simulate for one 8-hour day.

  1. Shopping times at a department store have been found to have the following distribution:
Shopping Time (minutes)Number of Shoppers
0–1090
10–20120
20–30270
30–40145
40–5088
50–6028

After shopping, the customers choose one of six checkout counters. Checkout times are normally distributed with a mean of 5.1 minutes and a standard deviation of 0.7 minutes. Interarrival times are exponentially distributed with a mean of 1 minute. Gather statistics for each checkout counter (including the time waiting for checkout). Tabulate the distribution of time to complete shopping and the distribution of time to complete shopping and checkout procedures. What proportion of customers spend more than 45 minutes in the store? Simulate for one 16-hour day.

  1. The interarrival time for parts needing processing is given as follows:
Interarrival Time (seconds)Proportion
10–200.20
20–300.30
30–400.50

There are three types of parts: A, B, and C. The proportion of each part, and the mean and standard deviation of the normally distributed processing times are as follows:

Part TypeProportionMeanStandard Deviation
A0.530 seconds3 seconds
B0.340 seconds4 seconds
C0.250 seconds7 seconds

Each machine processes any type of part, one part at a time. Use simulation to compare one machine with two machines working in parallel, and two machines with three machines working in parallel. What criteria would be appropriate for such a comparison?

  1. Orders are received for one of four types of parts. The interarrival time between orders is exponentially distributed with a mean of 10 minutes. The table that follows shows the proportion of the parts by type and the time needed to fill each type of order by the single clerk.
Part TypePercentageService Time (minutes)
A40N(6.1, 1.3)
B30N(9.1, 2.9)
C20N(11.8, 4.1)
D10N(15.1, 4.5)

Orders of types A and B are picked up immediately after they are filled, but orders of types C and D must wait 105 minutes to be picked up. Tabulate the distribution of time to complete delivery for all orders combined. What proportion take less than 15 minutes? What proportion take less than 25 minutes? Simulate for an 8-hour initialization period, followed by a 40-hour run. Do not use any data collected in the 8-hour initialization period.

  1. Three independent widget-producing machines all require the same type of vital part, which needs frequent maintenance. To increase production it is decided to keep two spare parts on

hand (for a total of 2+3=52 + 3 = 5 parts). After 2 hours of use, the part is removed from the machine and taken to a single technician, who can do the required maintenance in 30±2030 \pm 20 minutes. After maintenance, the part is placed in the pool of spare parts, to be put into the first machine that requires it. The technician has other duties, namely, repairing other items which have a higher priority and which arrive every 60±2060 \pm 20 minutes requiring 15±1515 \pm 15 minutes to repair. Also, the technician takes a 15-minute break in each 2-hour time period. That is, the technician works 1 hour 45 minutes, takes off 15 minutes, works 1 hour 45 minutes, takes off 15 minutes, and so on. (a) What are the model’s initial conditions—that is, where are the parts at time 0 and what is their condition? Are these conditions typical of “steady state”? (b) Make each replication of this experiment consist of an 8-hour initialization phase followed by a 40-hour data-collection phase. Make four statistically independent replications of the experiment all in one computer run (i.e., make four runs with each using a different set of random numbers). (c) Estimate the mean number of busy machines and the proportion of time the technician is busy. (d) Parts are estimated to cost the company $50\$50 per part per 8-hour day (regardless of how much they are in use). The cost of the technician is $20 per hour. A working machine produces widgets worth $100 for each hour of production. Develop an expression to represent total cost per hour which can be attributed to widget production (i.e., not all of the technician’s time is due to widget production). Evaluate this expression, given the results of the simulation.

  1. The Wee Willy Widget Shop overhauls and repairs all types of widgets. The shop consists of five work stations, and the flow of jobs through the shop is as depicted here:

Regular jobs arrive at station A at the rate of one every 15±1315 \pm 13 minutes. Rush jobs arrive every 4±34 \pm 3 hours and are given a higher priority, except at station C, where they are put on a conveyor and sent through a cleaning and degreasing operation along with all other jobs. For jobs the firs

time through a station, processing and repair times are as follows:

StationNumber of Machines or WorkersProcessing and/or Repair Times (minutes)Description
A112±212 \pm 2Receiving clerk
B340±2040 \pm 20Disassembly and parts replacement
C120Degreaser
D450±4050 \pm 40Reassembly and adjustments
E340±540 \pm 5Packing and shipping

The times listed above hold for all jobs that follow one of the two sequences A B C⟶D⟶EorA⟶B⟶D⟶E\mathrm{C} \longrightarrow \mathrm{D} \longrightarrow \mathrm{E o r A} \longrightarrow \mathrm{B} \longrightarrow \mathrm{D} \longrightarrow \mathrm{E}. However, about 10% of the jobs coming out of station D are sent back to B for further work (which takes 30±1030 \pm 10 minutes) and then are sent to D and finally to E. The path of these jobs is as follows:

Every 2 hours, beginning 1 hour after opening, the degreasing station C shuts down for routine maintenance, which takes 101 minute. However, this routine maintenance does not begin unti the current widget, if any, has completed its processing. (a) Make three independent replications of the simulation model, where one replication equals an 8-hour simulation run, preceded by a 2-hour initialization run. The three sets of output represent three typical days. The main performance measure of interest is mean response time per job, where a response time is the total time a job spends in the shop. The shop is never empty in the morning, but the model will be empty without the initialization phase. So run the model for a 2-hour initialization period and collect statistics from time 2 hours to time 10 hours. This “warm-up” period will reduce the downward bias in the estimate of mean response time. Note that the 2-hour warm-up is a device to load a simulation model to some more realistic level than empty. From each of the three independen replications, obtain an estimate of mean response time. Also obtain an overall estimate, the sample average of the three estimates.

(b) Management is considering putting one additional worker at the busiest station (A, B, D, or E). Would this significantly improve mean response time? (c) As an alternative to part (b), management is considering replacing machine C with a faster one that processes a widget in only 14 minutes. Would this significantly improve mean response time?

  1. A building-materials firm loads trucks with two payloader tractors. The distribution of truckloading times has been found to be exponential, with a mean loading time of 6 minutes. The truck interarrival time is exponentially distributed with an arrival rate of 16 per hour. The waiting time of a truck and driver is estimated to cost $50 per hour. How much (if any) could the firm save (per 10-hour day) if an overhead hopper system that would fill any truck in a constant time of 2 minutes is installed? (Assume that the present tractors could and would adequately service the conveyors loading the hoppers.)

  2. A milling-machine department has 10 machines. The runtime until failure occurs on a machine is exponentially distributed with a mean of 20 hours. Repair times are uniformly distributed between 3 and 7 hours. Select an appropriate run length and appropriate initial conditions. (a) How many repair people are needed to ensure that the mean number of machines running is greater than eight? (b) If there are two repair people, estimate the number of machines that are either running or being serviced.

  3. Forty people are waiting to pass through a turnstile that takes 2.5±1.02 . 5 \pm 1 . 0 seconds to traverse. Simulate this system 10 times, each one independent of the others, and determine the range and the average time for all 40 people to traverse.

  4. People borrow Gone with the Wind from the local library and keep it for 21±1021 \pm 10 days. There is only one copy of the book in the library. You are the sixth person on the reservation list (five are ahead of you). Simulate 50 independent cycles of book borrowing to determine the probability that you will receive the book within 100 days.

  5. Jobs arrive every 300 30 seconds to be handled by a process that consists of four operations: OP10 requires 50±2050 \pm 20 seconds, OP20 requires 70±2570 \pm 25 seconds, OP30 require 60±1560 \pm 15 seconds, OP40 requires 90±3090 \pm 30 seconds. Simulate this process until 250 jobs are completed; then combine the four operations of the job into one with the distribution 240±100240 \pm 100 seconds and simulate the process with this distribution. Does the average time in the system change for the two alternatives?

  6. Two types ofjobs arrive to be processed on the same machine. Type 1 jobs arrive every 50±3050 \pm 30 seconds and require 35±2035 \pm 20 seconds for processing. Type 2 jobs arrive every 100±40100 \pm 40 seconds and require 20±1520 \pm 15 seconds for processing. For an 8-hour simulation, what is the average number of jobs waiting to be processed?

  7. Two types ofjobs arrive to be processed on the same machine. Type 1 jobs arrive every 80±3080 \pm 30 seconds and require 35 20 seconds for processing. Type 2 jobs arrive every 100 40 seconds and require 20 15 seconds for processing. Engineering has judged that there is excess capacity on the machine. For a simulation of 8 hours of operation of the system, find X for Type 3 jobs that arrive every X±0.4XX \pm 0 . 4 X seconds and require a time of 30 seconds on the machine so that the average number of jobs waiting to be processed is two or less.

  8. Using spreadsheet software, generate 1000 uniformly distributed random values with mean 10 and spread 2. Plot these values with intervals of width 0.5 between 8 and 12. How close did the simulated set of values come to the expected number in each interval?

  9. Using a spreadsheet, generate 1000 exponentially distributed random values with a mean of 10. What is the maximum of the simulated values? What fraction of the generated values is less than the mean of 10? Plot a histogram of the generated values. [Hint: If you cannot find an exponential generator in the spreadsheet you use, use the formula −10∗LOG(1−R)- 10^{*} \mathrm{L O G} ( 1 - \mathrm{R} ), where R is a uniformly distributed random number from 0 to 1 and LOG is the natural logarithm.]

  10. There are many “boids” simulations on the internet. Search the internet for two examples of a boids simulation. For each one, find a description of the rules that each boid follows. Compare and contrast the two sets of rules. At a minimum, answer the following questions regarding each model. (a) Are the boids flying in a 2-D or 3-D space? Are they flying in a world with boundary, or without boundary? [Hint: Do they turn at edges or walls? Or do they re-appear on the other side? If so, this implies that two apparent boundaries are glued together and are not really boundaries at all.] Describe the world or universe in which the boids are flying. (b) Does the model have user-adjustable parameters? Such parameters may include the number of boids, the closeness factor (how close one boid must be to other boids before it’s affected by the other’s behavior), speed, and so forth. Make a list of all such parameters. (c) How long does it take for flocking behavior to emerge?

List of Materials Available on www.bcnn.net

Base classes for programming-language based simulations

5 Statistical Models in Simulation

In modeling real-world phenomena, there are few situations where the actions ofthe entities within the system under study can be predicted completely. The world the model builder sees is probabilistic rather than deterministic. There are many causes of variation. The time it takes a repairperson to fix a broken machine is a function of the complexity of the breakdown, whether the repairperson brought the proper replacement parts and tools to the site, whether another repairperson asks for assistance during the course ofthe repair, whether the machine operator receives a lesson in preventive maintenance, and so on. To the model builder, these variations appear to occur by chance and canno be predicted. However, some statistical model might well describe the time to make a repair.

An appropriate model can be developed by sampling the phenomenon of interest. Then, through educated guesses (or using software for the purpose), the model builder would select a known distribution form, make an estimate of the parameter(s) of this distribution, and then test to see how good a fit has been obtained. Through continued efforts in the selection of an appropriate distribution form, a postulated model could be accepted.

Section 1 contains a review of probability terminology and concepts. Some typical applications of statistical models, or distribution forms, are given in Section 2. Then, a number of selected discrete and continuous distributions are discussed in Sections 3 and 4. The selected distributions are those tha describe a wide variety of probabilistic events. Additional discussion about the distribution forms appearing in this chapter, and about distribution forms mentioned but not described, is available from a number of sources [Devore, 1999; Hines and Montgomery, 1990; Law and Kelton, 2000; Papoulis, 1990; Ross, 2002; Walpole and Myers, 2002]. Section 5 describes the Poisson process and its relationship to the exponential distribution. Section 6 discusses empirical distributions.

1 Review of Terminology and Concepts

1.1 Discrete random variables

Let X be a random variable. If the number of possible values of X is finite, or countably infinite, X is called a discrete random variable. The possible values of X may be listed as x1,x2,…x_{1} , x_{2} , \ldots. In the finite case, the list terminates; in the countably infinite case, the list continues indefinitely.

Example 1

The number of jobs arriving each week at a job shop is observed. The random variable of interest is X, where

X=number of jobs arriving each week X = \text{number of jobs arriving each week}

The possible values of X are given by the range space of X, which is denoted by RXR_{X}. Here RX=R_{X} ={0,1,2,… }.\{0 , 1 , 2 , \dots \} . Let X be a discrete random variable. With each possible outcome xix_{i} in RXR_{X}, a number p(xi)=p ( x_{i} ) =P(X = xi)P ( X \ = \ x_{i} ) gives the probability that the random variable equals the value of x . The numbers p(xi),i=1,2,...,p ( x_{i} ) , i = 1 , 2 , . . . , must satisfy the following two conditions:

a.p(xi)≥0p ( x_{i} ) \geq 0, for all i

b.∑i=1∞p(xi)=1 \mathrm{b.} \sum_{i = 1} ^ {\infty} p (x_{i}) = 1

The collection of pairs (xi,p(xi)),i=1,2,...( x_{i} , p ( x_{i} ) ) , i = 1 , 2 , . . .. is called the probability distribution of X, and p(xi)p ( x_{i} ) is called the probability mass function (pmf) of X.

Example 2

Consider the experiment of tossing a single die. Define X as the number of spots on the up face of the die after a toss. Then RX={1,2,3,4,5,6}R_{X} = \{1 , 2 , 3 , 4 , 5 , 6 \}. Assume the die is loaded so that the probability that a given face lands up is proportional to the number of spots showing. The discrete probability distribution for this random experiment is given by

xix_{i}123456
p(xi)p(x_{i})1/212/213/214/215/216/21

The conditions stated earlier are satisfied—that is,p(xi)≥0p ( x_{i} ) \geq 0 for i=1,2,…,6i = 1 , 2 , \dots , 6 and ∑i=1∞p(xi)=\textstyle \sum_{i = 1} ^ {\infty} p ( x_{i} ) =1/21+⋅⋅⋅+6/21=11 / 21 + \cdot \cdot \cdot + 6 / 21 = 1. The distribution is shown graphically in Figure 1.

Figure 1 Probability mass function for loaded-die example.

1.2 Continuous random variables

If the range space RXR_{X} of the random variable X is an interval or a collection of intervals, X is called a continuous random variable. For a continuous random variable X, the probability that X lies in the interval [a, b] is given by

P(a≤X≤b)=∫abf(x)dx(1) P (a \leq X \leq b) = \int_{a} ^ {b} f (x) d x\tag{1}

The function f(x)f ( x ) is called the probability density function (pdf) of the random variable X. The pdf satisfies the following conditions:

a.f(x)≥0f ( x ) \geq 0 for all x in RXR_{X} b.∫RXf(x)dx=1\textstyle \int _ {R_{X}} f ( x ) d x = 1 c.f(x)=0f ( x ) = 0 if x is not in RXR_{X} As a result of Equation (1), for any specified value x0,P(X=x0)=0x_{0} , P ( X = x_{0} ) = 0, because

∫x0x0f(x)dx=0 \int_ {x_{0}} ^ {x_{0}} f (x) d x = 0

Figure 2 Graphical interpretation of P(a<X<b)P ( a < X < b )P(X=x0)=0P ( X = x_{0} ) = 0 also means that the following equations hold:

P(a≤X≤b)=P(a<X≤b)=P(a≤X<b)=P(a<X<b)(2) P (a \leq X \leq b) = P (a < X \leq b) = P (a \leq X < b) = P (a < X < b)\tag{2}

The graphical interpretation of Equation (1) is shown in Figure 2. The shaded area represents the probability that X lies in the interval [a, b].

Example 3

The life of a device used to inspect cracks in aircraft wings is given by X, a continuous random variable assuming all values in the range x≥0x \ge 0. The pdf of the device’s lifetime, in years, is as follows:

f(x)={12e−x/2,x≥00,otherwise f (x) = \left\{\begin{array}{l l} \frac {1}{2} e^{- x / 2}, & x \geq 0 \\ 0, & \text{otherwise} \end{array} \right.

This pdf is shown graphically in Figure 3. The random variable X is said to have an exponentia distribution with mean 2 years.

The probability that the life of the device is between 2 and 3 years is calculated as

P(2≤X≤3)=12∫23e−x/2dx=−e−3/2+e−1=−0.223+0.368=0.145 \begin{array}{r l} P (2 \leq X \leq 3) & = \frac {1}{2} \int_{2} ^ {3} e^{- x / 2} d x \\ & = - e^{- 3 / 2} + e^{- 1} \\ & = - 0. 223 + 0. 368 \\ & = 0. 145 \end{array}

Figure 3 pdf for inspection-device life.

1.3 Cumulative distribution function

The cumulative distribution function (cdf), denoted by F(x)F ( x ), measures the probability that the random variable X assumes a value less than or equal to x, that is,F(x)=P(X≤x)F ( x ) = P ( X \leq x ).

If X is discrete, then

F(x)=∑allxi≤xp(xi)(3) F(x) = \sum_{\substack{\text{all}\\ x_{i}\leq x}}p(x_{i})\tag{3}

If X is continuous, then

F(x)=∫−∞xf(t)dt(4) F (x) = \int_{- \infty} ^ {x} f (t) d t\tag{4}

Some properties of the cdf are listed here:

a. F is a nondecreasing function. If a<b,a < b ,, then F(a)≤F(b)F ( a ) \leq F ( b )).

b. lim x⟶∞F(x)=1_ {x \longrightarrow \infty} F ( x ) = 1 c. lim x⟶−∞F(x)=0x {\longrightarrow} - \infty \overset {} {F} ( x ) = 0 All probability questions about X can be answered in terms of the cdf. For example,

P(a<X≤b)=F(b)−F(a)foralla<b(5) P (a < X \leq b) = F (b) - F (a) \quad \mathrm{forall} a < b\tag{5}

For continuous distributions, not only does Equation (5) hold, but also the probabilities in Equation (2) are equal to F(b)−F(a)F ( b ) - F ( a )

Example 4

The die-tossing experiment described in Example 2 has a cdf given as follows:

x(−∞,1)(-\infty, 1)[1,2)[1, 2)[2,3)[2, 3)[3,4)[3, 4)[4,5)[4, 5)[5,6)[5, 6)[6,∞)[6, \infty)
F(x)01/213/216/2110/2115/2121/21

where [a,b)={a≤x<b}b ) = \{a \leq x < b \}. The cdf for this example is shown graphically in Figure 4.

If X is a discrete random variable with possible values x1,x2,…,x_{1} , x_{2} , \dotsc ,, where x1<x2<....x_{1} < x_{2} < . . . ., the cdf is a step function. The value of the cdf is constant in the interval [xi−1,xi)[ x_{i - 1} , x_{i} ) and then takes a step, or jump, of size p(xi)p ( x_{i} ) at xi.x_{i} .. Thus, in Example 4,p(3)=3/21p ( 3 ) = 3 / 21, which is the size of the step when x=3x = 3 Figure 4 cdf for loaded-die example.

Example 5

The cdf for the device described in Example 3 is given by

F(x)=12∫0xe−t/2dt=1−e−x/2 F (x) = \frac {1}{2} \int_{0} ^ {x} e^{- t / 2} d t = 1 - e^{- x / 2}

The probability that the device will last for less than 2 years is given by

P(0≤X≤2)=F(2)−F(0)=F(2)=1−e−1=0.632 P (0 \leq X \leq 2) = F (2) - F (0) = F (2) = 1 - e^{- 1} = 0. 632

The probability that the life of the device is between 2 and 3 years is calculated as

P(2≤X≤3)=F(3)−F(2)=(1−e−3/2)−(1−e−1)=−e−3/2+e−1=−0.223+0.368=0.145 \begin{array}{c} P (2 \leq X \leq 3) = F (3) - F (2) = (1 - e^{- 3 / 2}) - (1 - e^{- 1}) \\ = - e^{- 3 / 2} + e^{- 1} = - 0. 223 + 0. 368 = 0. 145 \end{array}

as found in Example 3.

1.4 Expectation

An important concept in probability theory is that of the expectation of a random variable. If X is a random variable, the expected value of X, denoted by E(X)E ( X ), for discrete and continuous variables, is defined as follows:

E(X)=∑allixip(xi)ifXis discrete(6) E (X) = \sum_ {\text{all} i} x_{i} p (x_{i}) \quad \text{if} X \text{is discrete}\tag{6}

and

E(X)=∫−∞∞xf(x)dxifXis continuous(7) E (X) = \int_{- \infty} ^ {\infty} x f (x) d x \quad \text{if} X \text{is continuous}\tag{7}

The expected value E(X) of a random variable X is also referred to as the mean,μ.\mu ., or the first moment of X. The quantity E(Xn),n≥1E ( X^{n} ) , n \geq 1, is called the nth moment of X, and is computed as follows:

E(Xn)=∑allixinp(xi)ifXis discrete(8) E (X^{n}) = \sum_ {\text{all} i} x_{i} ^ {n} p (x_{i}) \quad \text{if} X \text{is discrete}\tag{8}

and

E(Xn)=∫−∞∞xnf(x)dxifXis continuous(9) E (X^{n}) = \int_{- \infty} ^ {\infty} x^{n} f (x) d x \quad \text{if} X \text{is continuous}\tag{9}

The variance of a random variable X denoted by V(X) or var(X) or σ2\sigma^{2}, is defined by

V(X)=E[(X−E[X])2] V (X) = E [ (X - E [ X ]) ^ {2} ]

A useful identity in computing V(X) is given by

V(X)=E(X2)−[E(X)]2(10) V (X) = E (X^{2}) - [ E (X) ] ^ {2}\tag{10}

The mean E(X)E ( X ) is a measure of the central tendency of a random variable. The variance of X measures the expected value of the squared difference between the random variable and its mean. Thus, the variance,V(X)V ( X ), is a measure of the spread or variation of the possible values of X around the mean E(X)E ( X ). The standard deviation, σ, is defined to be the square root of the variance,σ2\sigma^{2}. The mean,E(X)E ( X ), and the standard deviation,σ=V(X)\sigma = \sqrt {V ( X )}, are expressed in the same units.

Example 6

The mean and variance of the die-tossing experiment described in Example 2 are computed as follows:

E(X)=1(121)+2(221)+⋯+6(621)=9121=4.33 E (X) = 1 \left(\frac {1}{21}\right) + 2 \left(\frac {2}{21}\right) + \dots + 6 \left(\frac {6}{21}\right) = \frac {91}{21} = 4. 33

To compute V(X)V ( X ) from Equation (10), first compute E(X2)E ( X^{2} ) from Equation (8) as follows:

E(X2)=12(121)+22(221)+⋯+62(621)=21 E \left(X^{2}\right) = 1^{2} \left(\frac {1}{21}\right) + 2^{2} \left(\frac {2}{21}\right) + \dots + 6^{2} \left(\frac {6}{21}\right) = 21

Thus,

V(X)=21−(9121)2=21−18.78=2.22 V (X) = 21 - \left(\frac {91}{21}\right) ^ {2} = 21 - 18. 78 = 2. 22

and

σ=V(X)=1.49 \sigma = \sqrt {V (X)} = 1. 49

Example 7

The mean and variance of the life of the device described in Example 3 are computed as follows:

E(X)=12∫0∞xe−x/2dx=−xe−x/2∣0∞+∫0∞e−x/2dx=0+11/2e−x/2∣0∞=2years \begin{array}{l} E (X) = \frac {1}{2} \int_{0} ^ {\infty} x e^{- x / 2} d x = - x e^{- x / 2} \Big | _ {0} ^ {\infty} + \int_{0} ^ {\infty} e^{- x / 2} d x \\ = 0 + \frac {1}{1 / 2} e^{- x / 2} \Big | _ {0} ^ {\infty} = 2 \text{years} \end{array}

To compute V(X)V ( X ) from Equation (10), first compute E(X2)E ( X^{2} )) from Equation (9) as follows:

E(X2)=12∫0∞x2e−x/2dx E (X^{2}) = \frac {1}{2} \int_{0} ^ {\infty} x^{2} e^{- x / 2} d x

Thus,

E(X2)=−x2e−x/2∣0∞+2∫0∞xe−x/2dx=8 E (X^{2}) = - x^{2} e^{- x / 2} \big | _ {0} ^ {\infty} + 2 \int_{0} ^ {\infty} x e^{- x / 2} d x = 8

giving

V(X)=8−22=4years V (X) = 8 - 2^{2} = 4 \mathrm{years}

Statistical Models in Simulation

and

σ=V(X)=2years \sigma = \sqrt {V (X)} = 2 \mathrm{years}

With a mean life of 2 years and a standard deviation of 2 years, most analysts would conclude tha actual lifetimes, X, have a fairly large variability.

1.5 The mode

The mode is used in describing several statistical models that appear in this chapter. In the discrete case, the mode is the value of the random variable that occurs most frequently. In the continuous case, the mode is the value at which the pdf is maximized. The mode might not be unique; if the modal value occurs at two values of the random variable, the distribution is said to be bimodal.

2 Useful Statistical Models

Numerous situations arise in the conduct of a simulation where an investigator may choose to introduce probabilistic events. In a queueing system, interarrival and service times are often probabilistic. In an inventory model, the time between demands and the lead times (time between placing and receiving an order) can be probabilistic. In a reliability model, the time to failure could be probabilistic. In each of these instances, the simulation analyst desires to generate random events and to use a known statistical model if the underlying distribution can be found. In the following paragraphs, statistical models appropriate to these application areas will be discussed. Additionally, statistica models useful in the case of limited data are mentioned.

2.1 Queueing systems

In queueing examples, interarrival- and service-time patterns, the times between arrivals and the service times are often probabilistic. However, it is possible to have a constant interarrival time (as in the case of a line moving at a constant speed in the assembly of an automobile), or a constant service time (as in the case of robotized spot welding on the same assembly line). The following example illustrates how probabilistic interarrival times might occur.

Example 8

Mechanics arrive at a centralized tool crib as shown in Table 1. Attendants check in and check out the requested tools to the mechanics. The collection of data begins at 10:00 A.M. and continues unti 20 different interarrival times are recorded. Rather than record the actual time of day, the absolute time from a given origin could have been computed Thus the first mechanic could have arrived at time 0,0 , the second mechanic at time 7:13 (7 minutes, 13 seconds), and so on.

Table 1 Mechanics’ Arrival Data

Arrival NumberArrival (hour:minutes::seconds)Interarrival Time (minutes::seconds)
110:05::03—
210:12::167::13
310:15::483::32
410:24::278::39
510:32::197::52
610:35::433::24
710:39::514::08
810:40::300::39
910:41::170::47
1010:44::122::55
1110:45::471::35
1210:50::475::00
1311:00::059::18
1411:04::584::53
1511:06::121::14
1611:11::235::11
1711:16::315::08
1811:17::180::47
1911:21::264::08
2011:24::433::17
2111:31::196::36

Example 9

Another way of presenting interarrival data is to find the number of arrivals per time period. Here, such arrivals occur over approximately 1.5 hours; it is convenient to look at 10-minute time intervals for the first 20 mechanics. That is, in the first 10-minute time period, one arrival occurred at 10:05::03. In the second time period, two mechanics arrived, and so on. The results are summarized in Table 2. This data could then be plotted in a histogram, as shown in Figure 5.

The distribution of time between arrivals and the distribution of the number of arrivals per time period are important in the simulation of waiting-line systems. “Arrivals” occur in numerous ways; as machine breakdowns, as jobs coming into a job shop, as units being assembled on a line, as orders to a warehouse, as data packets to a computer system, as calls to a call center, and so on.

Service times could be constant or probabilistic. If service times are completely random, the exponential distribution is often used for simulation purposes; however, there are several other possibilities. It could happen that the service times are constant, but some random variability causes fluctuations in either a positive or a negative way. For example, the time it takes for a lathe to traverse a 10-centimeter shaft should always be the same. However, the material could have slight differences in hardness or the tool might wear; either event could cause different processing times. In these cases, the normal distribution might describe the service time.

Table 2 Arrivals in Successive Time Period

Time PeriodNumber of ArrivalsTime PeriodNumber of Arrivals
1161
2273
3183
4392
54——

A special case occurs when the phenomenon of interest seems to follow the normal probability distribution, but the random variable is restricted to be greater than or less than a certain value. In this case, the truncated normal distribution can be utilized.

The gamma and Weibull distributions are also used to model interarrival and service times. (Actually, the exponential distribution is a special case of both the gamma and the Weibull distributions.) The differences between the exponential, gamma, and Weibull distributions involve the location of the modes of the pdfs and the shapes of their tails for large and small times. The exponential distribution has its mode at the origin, but the gamma and Weibull distributions have their modes at some point (≥0)( \geq 0 ) that is a function of the parameter values selected. The tail of the gamma distribution is long, like an exponential distribution; the tail of the Weibull distribution can decline more rapidly or less rapidly than that of an exponential distribution. In practice, this means that, if there are more large service times than an exponential distribution can account for, a Weibul distribution might provide a better model of these service times.

Number of arrivals in 10-minute period Figure 5 Histogram of arrivals per time period.

2.2 Inventory and supply-chain systems

In realistic inventory and supply-chain systems, there are at least three random variables: (1) the number ofunits demanded per order or per time period, (2) the time between demands, and (3) the lead time. (The lead time is defined as the time between the placing of an order for stocking the inventory system and the receipt of that order.) In very simple mathematical models of inventory systems, demand is a constant over time, and lead time is zero, or a constant. However, in most real-world cases, and, hence, in simulation models, demand occurs randomly in time, and the number of units demanded each time a demand occurs is also random, as illustrated by Figure 6.

Distributional assumptions for demand and lead time in inventory theory texts are usually based on mathematical tractability, but those assumptions could be invalid in a realistic context. In practice, the lead-time distribution can often be fitted fairly well by a gamma distribution [Hadley and Whitin, 1963]. Unlike analytic models, simulation models can accommodate whatever assumptions appear most reasonable.

The geometric, Poisson, and negative binomial distributions provide a range of distribution shapes that satisfy a variety of demand patterns. The geometric distribution, which is a special case of the negative binomial, has its mode at unity, given that at least one demand has occurred. If demand data are characterized by a long tail, the negative binomial distribution might be appropriate. The Poisson distribution is often used to model demand because it is simple, it is extensively tabulated, and it is well known. The tail of the Poisson distribution is generally shorter than that of the negative binomial, which means that fewer large demands will occur if a Poisson model is used than if a negative binomial distribution is used (assuming that both models have the same mean demand).

Figure 6 Random demands in time.

2.3 Reliability and maintainability

Time to failure has been modeled with numerous distributions, including the exponential, gamma, and Weilbull. If only random failures occur, the time-to-failure distribution may be modeled as exponential. The gamma distribution arises from modeling standby redundancy, where each component has an exponential time to failure. The Weibull distribution has been extensively used to represent time to failure, and its nature is such that it can be made to approximate many observed phenomena [Hines and Montgomery, 1990]. When there are a number of components in a system and failure is due to the most serious of a large number of defects, or possible defects, the Weibull distribution seems to do particularly well as a model. In situations where most failures are due to wear, the normal distribution might very well be appropriate [Hines and Montgomery, 1990]. The lognormal distribution has been found to be applicable in describing time to failure for some types of components.

2.4 Limited data

In many instances, simulations begin before data collection has been completed. There are three distributions that have application to incomplete or limited data. These are the uniform, triangular, and beta distributions. The uniform distribution can be used when an interarrival or service time is known to be random, but no information is immediately available about the distribution [Gordon, 1975]. However, there are those who do not favor using the uniform distribution, calling it the “distribution of maximum ignorance” because it is not necessary to specify more than the continuous interval in which the random variable may occur. The triangular distribution can be used when assumptions are made about the minimum, maximum, and modal values of the random variable. Finally, the beta distribution provides a variety of distributional forms on the unit interval, ones that, with appropriate modification, can be shifted to any desired interval. The uniform distribution is a special case of the beta distribution. Pegden, Shannon, and Sadowski [1995] discuss the subject of limited data in some detail.

2.5 Other distributions

Several other distributions may be useful in discrete-system simulation. The Bernoulli and binomia distributions are two discrete distributions which might describe phenomena of interest. The hyperexponential distribution is similar to the exponential distribution, but its greater variability might make it useful in certain instances.

3 Discrete Distributions

Discrete random variables are used to describe random phenomena in which only integer values can occur. Numerous examples were given in Section 2—for example, demands for inventory items. Four distributions are described in the following subsections.

3.1 Bernoulli trials and the Bernoulli distribution

Consider an experiment consisting of n trials, each of which can be a success or a failure. Let Xj=1X_{j} = 1 if the jth experiment resulted in a success, and let Xj=0X_{j} = 0 if the jth experiment resulted in a failure.

The n Bernoulli trials are called a Bernoulli process if the trials are independent, each trial has only two possible outcomes (success or failure), and the probability of a success remains constant from trial to trial. Thus,

p(x1,x2,…,xn)=p1(x1)⋅p2(x2)⋅⋅⋅pn(xn) p (x_{1}, x_{2}, \ldots , x_{n}) = p_{1} (x_{1}) \cdot p_{2} (x_{2}) \cdot \cdot \cdot p_{n} (x_{n})

and

pj(xj)=p(xj)={p,xj=1,j=1,2,…,n1−p=q,xj=0,j=1,2,…,n0,otherwise(11) p_{j} (x_{j}) = p (x_{j}) = \left\{\begin{array}{l l} p, & x_{j} = 1, j = 1, 2, \ldots , n \\ 1 - p = q, & x_{j} = 0, j = 1, 2, \ldots , n \\ 0, & \text{otherwise} \end{array} \right.\tag{11}

For one trial, the distribution given in Equation (11) is called the Bernoulli distribution. The mean and variance of XjX_{j} are calculated as follows:

E(Xj)=0⋅q+1⋅p=p E (X_{j}) = 0 \cdot q + 1 \cdot p = p

and

V(Xj)=[(02⋅q)+(12⋅p)]−p2=p(1−p) V (X_{j}) = [ (0^{2} \cdot q) + (1^{2} \cdot p) ] - p^{2} = p (1 - p)

3.2 Binomial distribution

The random variable X that denotes the number of successes in n Bernoulli trials has a binomia distribution given by p(x)p ( x ), where

p(x)={(nx)pxqn−x,x=0,1,2,…,n0,otherwise(12) p (x) = \left\{\begin{array}{l l} \binom {n} {x} p^{x} q^{n - x}, & x = 0, 1, 2, \ldots , n \\ 0, & \text{otherwise} \end{array} \right.\tag{12}

Equation (12) is motivated by computing the probability ofa particular outcome with all the successes, each denoted by S, occurring in the first x trials, followed by the n−xn - x failures, each denoted by an F—that is,

P(SSS.… ....................................................⏞xof theseFF.… ..........................⏞n−xof these=pxqn−x P \overbrace {(S S S . \dots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .} ^ {x \text{of these}} \overbrace {F F. \dots . . . . . . . . . . . . . . . . . . . . . . . . . .} ^ {n - x \text{of these}} = p^{x} q^{n - x}

where q=1−pq = 1 - p. There are

(nx)=n!x!(n−x)! \binom {n} {x} = \frac {n !}{x ! (n - x) !}

outcomes having the required number of SsS \mathrm{s} and Fs.F \mathbf{s} .. Therefore, Equation (12) results. An easy approach to calculating the mean and variance of the binomial distribution is to consider X as a sum of n independent Bernoulli random variables, each with mean pp and variance p(1−p)=pqp ( 1 - p ) = p q. Then,

X=X1+X2+⋯+Xn X = X_{1} + X_{2} + \dots + X_{n}

and the mean, E(X), is given by

E(X)=p+p+⋯+p=np(13) E (X) = p + p + \dots + p = n p\tag{13}

and the variance V(X) is given by

V(X)=pq+pq+⋯+pq=npq(14) V (X) = p q + p q + \dots + p q = n p q\tag{14}

Example 10

A production process manufactures computer chips on the average at 2%2 \% nonconforming. Every day, a random sample of size 50 is taken from the process. If the sample contains more than two nonconforming chips, the process will be stopped. Compute the probability that the process is stopped by the sampling scheme.

Consider the sampling process as n=50n = 50 Bernoulli trials, each with p=0.02p = 0 . 02; then the total number of nonconforming chips in the sample, X, would have a binomial distribution given by

p(x)={(50x)(0.02)x(0.98)50−x,x=0,1,2,…,500,otherwise p (x) = \left\{\begin{array}{l l} \binom {50} {x} (0. 02) ^ {x} (0. 98) ^ {50 - x}, & x = 0, 1, 2, \ldots , 50 \\ 0, & \text{otherwise} \end{array} \right.

It is much easier to compute the right-hand side of the following identity to compute the probability that more than two nonconforming chips are found in a sample:

P(X>2)=1−P(X≤2) P (X > 2) = 1 - P (X \leq 2)

The probability P(X≤2)P ( X \leq 2 ) is calculated from

P(X≤2)=∑x=02(50x)(0.02)x(0.98)50−x=(0.98)50+50(0.02)(0.98)49+1225(0.02)2(0.98)48≐0.92 \begin{array}{r l} P (X \leq 2) & = \sum_{x = 0} ^ {2} \binom {50} {x} (0. 02) ^ {x} (0. 98) ^ {50 - x} \\ & = (0. 98) ^ {50} + 50 (0. 02) (0. 98) ^ {49} + 1225 (0. 02) ^ {2} (0. 98) ^ {48} \\ & \doteq 0. 92 \end{array}

Thus, the probability that the production process is stopped on any day, based on the sampling process, is approximately 0.08. The mean number of nonconforming chips in a random sample of size 50 is given by

E(X)=np=50(0.02)=1 E (X) = n p = 50 (0. 02) = 1

and the variance is given by

V(X)=npq=50(0.02)(0.98)=0.98 V (X) = n p q = 50 (0. 02) (0. 98) = 0. 98

The cdf for the binomial distribution has been tabulated by Banks and Heikes [1984] and others. The tables decrease the effort considerably for computing probabilities such as P(a<X≤b)P ( a < X \leq b )). Under certain conditions on n and p,p , both the Poisson distribution and the normal distribution may be used to approximate the binomial distribution [Hines and Montgomery, 1990].

3.3 Geometric and Negative Binomial distributions

The geometric distribution is related to a sequence of Bernoulli trials; the random variable of interest, X, is defined to be the number of trials to achieve the first success. The distribution of X is given by

p(x)={qx−1p,x=1,2,…0,otherwise(15) p (x) = \left\{\begin{array}{l l} q^{x - 1} p, & x = 1, 2, \ldots \\ 0, & \text{otherwise} \end{array} \right.\tag{15}

The event {X=x}\{X = x \} occurs when there are x−1x - 1 failures followed by a success. Each of the failures has an associated probability of q=1−p;q = 1 - p_{;}, and each success has probability p.p . Thus,

P(FFF⋅⋅⋅FS)=qx−1p P (F F F \cdot \cdot \cdot F S) = q^{x - 1} p

The mean and variance are given by

E(X)=1p(16) E (X) = \frac {1}{p}\tag{16}

and

V(X)=qp2(17) V (X) = \frac {q}{p^{2}}\tag{17}

More generally, the negative binomial distribution is the distribution of the number of trials unti the kth success, for k=1,2,….ffYk = 1 , 2 , \ldots . \mathrm{f f} Y has a negative binomial distribution with parameter pp and k, then the distribution of Y is given by

p(y)={(y−1k−1)qy−kpk,y=k,k+1,k+2,…0,otherwise(18) p (y) = \left\{\begin{array}{l l} \binom {y - 1} {k - 1} q^{y - k} p^{k}, & y = k, k + 1, k + 2, \ldots \\ 0, & \text{otherwise} \end{array} \right.\tag{18}

Because we can think of the negative binomial random variable Y as the sum of kk independen geometric random variables, it is easy to see that E(Y)=k/pE ( Y ) = k / p and V(X)=kq/p2V ( X ) = k q / p^{2}

Example 11

Forty percent of the assembled ink-jet printers are rejected at the inspection station. Find the probability that the first acceptable ink-jet printer is the third one inspected. Considering each inspection as a Bernoulli trial with q=0.4q = 0 . 4 and p=0.6p = 0 . 6 yields

p(3)=0.42(0.6)=0.096 p (3) = 0. 4^{2} (0. 6) = 0. 096

Thus, in only about 10% of the cases is the first acceptable printer the third one from any arbitrary starting point. To determine the probability that the third printer inspected is the second acceptable printer, we use the negative binomial distribution Equation (18),

p(3)=(3−12−1)0.43−2(0.6)2=(21)0.4(0.6)2=0.288 p (3) = \binom {3 - 1} {2 - 1} 0. 4^{3 - 2} (0. 6) ^ {2} = \binom {2} {1} 0. 4 (0. 6) ^ {2} = 0. 288

3.4 Poisson distribution

The Poisson distribution describes many random processes quite well and is mathematically quite simple. The Poisson distribution was introduced in 1837 by S. D. Poisson in a book concerning criminal and civil justice matters. (The title of this rather old text is Recherches sur la probabilit´e desjugements en mati`ere criminelle et en mati`ere civile. Evidently, the rumor handed down through generations of probability theory professors concerning the origin of the Poisson distribution is jus not true. Rumor has it that the Poisson distribution was first used to model deaths from the kicks o horses in the Prussian Army.)

The Poisson probability mass function is given by

p(x)={e−ααxx!,x=0,1,…0,otherwise(19) p (x) = \left\{\begin{array}{l l} \frac {e^{- \alpha} \alpha^{x}}{x !}, & x = 0, 1, \ldots \\ 0, & \text{otherwise} \end{array} \right.\tag{19}

where α>0> 0. One of the important properties of the Poisson distribution is that the mean and variance are both equal to α, that is,

E(X)=α=V(X) E (X) = \alpha = V (X)

The cumulative distribution function is given by

F(x)=∑i=0xe−ααii!(20) F (x) = \sum_{i = 0} ^ {x} \frac {e^{- \alpha} \alpha^{i}}{i !}\tag{20}

The pmf and cdf for a Poisson distribution with α=2\alpha = 2 are shown in Figure 7. A tabulation of the cd is given in Table A.4 in the Appendix.

(a)

(b) Figure 7 Poisson pmf and cdf. Example 12

A computer repair person is “beeped” each time there is a call for service. The number of beeps per hour is known to occur in accordance with a Poisson distribution with a mean of α=2\alpha = 2 per hour. The probability of three beeps in the next hour is given by Equation (19) with x=3,x = 3 ,, as follows:

p(3)=e−2233!=(0.135)(8)6=0.18 p (3) = \frac {e^{- 2} 2^{3}}{3 !} = \frac {(0 . 135) (8)}{6} = 0. 18

This same result can be read from the left side of Figure 7 or from Table A.4 by computing

F(3)−F(2)=0.857−0.677=0.18 F (3) - F (2) = 0. 857 - 0. 677 = 0. 18

Example 13

In Example 12, find the probability of two or more beeps in a 1-hour period.

P(2or more)=1−p(0)−p(1)=1−F(1)=1−0.406=0.594 \begin{array}{c} P (2 \text{or more}) = 1 - p (0) - p (1) = 1 - F (1) \\ = 1 - 0. 406 = 0. 594 \end{array}

The cumulative probability,F(1)F ( 1 ), can be read from the right side of Figure 7 or from Table A.4.

Example 14

The lead-time demand in an inventory system is the accumulation of demand for an item from the point at which an order is placed until the order is received—that is.\mathrm{i} \mathbf{s} .

L=∑i=1TDi(21) L = \sum_{i = 1} ^ {T} D_{i}\tag{21}

where LL is the lead-time demand,DiD_{i} is the demand during the ith time period, and T is the number of time periods during the lead time. Both DiD_{i} and TT may be random variables.

An inventory manager desires that the probability of a stockout not exceed a certain fraction during the lead time. For example, it may be stated that the probability of a shortage during the lead time not exceed 5%.

If the lead-time demand is Poisson distributed, the determination of the reorder point is greatly facilitated. The reorder point is the level of inventory at which a new order is placed.

Assume that the lead-time demand is Poisson distributed with a mean of α=10\alpha = 10 units and that 95% protection from a stockout is desired. Thus, it is desired to find the smallest value of x such that the probability that the lead-time demand not exceed x is greater than or equal to 0.95. Using Equation (20) requires finding the smallest x such that

F(x)=∑i=0xe−1010ii!≥0.95 F (x) = \sum_{i = 0} ^ {x} \frac {e^{- 10} 10^{i}}{i !} \geq 0. 95

The desired result occurs at x=15x = 15, which can be found by using Table A.4 or by computation of p(0),p(1)p ( 0 ) , p ( 1 )

4 Continuous Distributions

Continuous random variables can be used to describe random phenomena in which the variable o interest can take on any value in some interval—for example, the time to failure or the length of a rod. Nine distributions are described in the following subsections.

4.1 Uniform distribution

A random variable X is uniformly distributed on the interval [a, b] if its pdf is given by

f(x)={1b−a,a≤x≤b0,otherwise(22) f (x) = \left\{\begin{array}{l l} \frac {1}{b - a}, & a \leq x \leq b \\ 0, & \text{otherwise} \end{array} \right.\tag{22}

The cdf is given by

F(x)={0,x<ax−ab−a,a≤x<b1,x≥b(23) F (x) = \left\{\begin{array}{l l} 0, & x < a \\ \frac {x - a}{b - a}, & a \leq x < b \\ 1, & x \geq b \end{array} \right.\tag{23}

Figure 8 pdf and cdf for uniform distribution.

Note that

P(x1<X<x2)=F(x2)−F(x1)=x2−x1b−a P (x_{1} < X < x_{2}) = F (x_{2}) - F (x_{1}) = \frac {x_{2} - x_{1}}{b - a}

is proportional to the length of the interval, for all x1x_{1} and x2x_{2} satisfying a≤x1<x2≤b.a \leq x_{1} < x_{2} \leq b . The mean and variance of the distribution are given by

E(X)=a+b2(24) E (X) = \frac {a + b}{2}\tag{24}

and

V(X)=(b−a)212(25) V (X) = \frac {(b - a) ^ {2}}{12}\tag{25}

The pdf and cdf when a=1a = 1 and b=6b = 6 are shown in Figure 8.

The uniform distribution plays a vital role in simulation. Random numbers, uniformly distributed between 0 and 1, provide the means to generate random events. Numerous methods for generating uniformly distributed random numbers have been devised. Uniformly distributed random numbers are then used to generate samples of random variates from all other distributions.

Example 15

A simulation of a warehouse operation is being developed. About every 3 minutes, a call comes for a forklift truck operator to proceed to a certain location. An initial assumption is made that the time between calls (arrivals) is uniformly distributed with a mean of 3 minutes. By Equation (25), the uniform distribution with a mean of 3 and the greatest possible variability would have parameter values of a=0a = 0 and b=6b = 6 minutes. With very limited data (such as a mean of approximately 3 minutes) plus the knowledge that the quantity of interest is variable in a random fashion, the uniform distribution with greatest variance can be assumed, at least until more data are available.

Example 16

A bus arrives every 20 minutes at a specified stop beginning at 6:40 A.M. and continuing unti 8:40 A.M. A certain passenger does not know the schedule, but arrives randomly (uniformly distributed) between 7:00 A.M. and 7:30 A.M. every morning. What is the probability that the passenger waits more than 5 minutes for a bus?

The passenger has to wait more than 5 minutes only if the arrival time is between 7:00 A.M. and 7:15 A.M. or between 7:20 A.M. and 7:30 A.M. If X is a random variable that denotes the number of minutes past 7:00 A.M. that the passenger arrives, the desired probability is

P(0<X<15)+P(20<X<30) P (0 < X < 15) + P (20 < X < 30)

Now, X is a uniform random variable on (0, 30). Therefore, the desired probability is given by

F(15)+F(30)−F(20)=1530+1−2030=56 F (15) + F (30) - F (20) = \frac {15}{30} + 1 - \frac {20}{30} = \frac {5}{6}

4.2 Exponential distribution

A random variable X is said to be exponentially distributed with parameter λ>0\lambda > 0 if its pdf is given by

f(x)={λe−λx,x≥00,elsewhere(26) f (x) = \left\{\begin{array}{l l} \lambda e^{- \lambda x}, & x \geq 0 \\ 0, & \text{elsewhere} \end{array} \right.\tag{26}

The density function is shown in Figures 9 and 3. Figure 9 also shows the cdf.

The exponential distribution has been used to model interarrival times when arrivals are completely random and to model service times that are highly variable. In these instances, λ is a rate: arrivals per hour or services per minute. The exponential distribution has also been used to model the lifetime of a component that fails catastrophically (instantaneously), such as a light bulb; then λ is the failure rate.

Several different exponential pdfs are shown in Figure 10. The value of the intercept on the vertical axis is always equal to the value of λ. Note also that all pdfs eventually intersect. (Why?)

Figure 9 Exponential density function and cumulative distribution function.

Figure 10 pdfs for several exponential distributions.

The exponential distribution has mean and variance given by

E(X)=1λandV(X)=1λ2(27) E (X) = \frac {1}{\lambda} \quad \text{and} \quad V (X) = \frac {1}{\lambda^{2}}\tag{27}

Thus, the mean and standard deviation are equal. The cdf can be exhibited by integrating Equation (26) to obtain

F(x)={0,x<0∫0xλe−λtdt=1−e−λx,x≥0(28) F (x) = \left\{\begin{array}{l l} 0, & x < 0 \\ \int_{0} ^ {x} \lambda e^{- \lambda t} d t = 1 - e^{- \lambda x}, & x \geq 0 \end{array} \right.\tag{28}

Example 17

Suppose that the life of an industrial lamp, in thousands of hours, is exponentially distributed with failure rate λ=1/3\lambda = 1 / 3(one failure every 3000 hours, on the average). The probability that the lamp will last longer than its mean life, 3000 hours, is given by P(X>3)=1−P(X≤3)=1−F(3)P ( X > 3 ) = 1 - P ( X \le 3 ) = 1 - F ( 3 ) Equation (28) is used to compute F(3), obtaining

P(X>3)=1−(1−e−3/3)=e−1=0.368 P (X > 3) = 1 - \left(1 - e^{- 3 / 3}\right) = e^{- 1} = 0. 368

Regardless of the value of λ,\lambda ,, this result will always be the same! That is, the probability that an exponential random variable is greater than its mean is 0.368, for any value o λ.\lambda . The probability that the industrial lamp will last between 2000 and 3000 hours is computed as

P(2≤X≤3)=F(3)−F(2) P (2 \leq X \leq 3) = F (3) - F (2)

Again, from the cdf given by Equation (28),

F(3)−F(2)=(1−e−3/3)−(1−e−2/3)=−0.368+0.513=0.145 \begin{array}{c} F (3) - F (2) = (1 - e^{- 3 / 3}) - (1 - e^{- 2 / 3}) \\ = - 0. 368 + 0. 513 = 0. 145 \end{array}

One of the most important properties of the exponential distribution is that it is “memoryless,” which means that, for all s≥0s \geq 0 and t≥0t \geq 0

P(X>s+t∣X>s)=P(X>t)(29) P (X > s + t | X > s) = P (X > t)\tag{29}

Let X represent the life of a component (a battery, light bulb, computer chip, laser, etc.) and assume that X is exponentially distributed. Equation (29) states that the probability that the component lives for at least s+ts + t hours, given that it has survived s hours, is the same as the initial probability that it lives for at least t hours. If the component is alive at time s (if X>s)X > s ), then the distribution of the remaining amount of time that it survives, namely X−s,X - s ,, is the same as the original distribution of a new component. That is, the component does not “remember” that it has already been in use for a time s. A used component is as good as new.

That Equation (29) holds is shown by examining the conditional probability

P(X>s+t∣X>s)=P(X>s+t)P(X>s)(30) P (X > s + t | X > s) = \frac {P (X > s + t)}{P (X > s)}\tag{30}

Equation (28) can be used to determine the numerator and denominator of Equation (30), yielding

P(X>s+t∣X>s)=e−λ(s+t)e−λs=e−λt=P(X>t) \begin{array}{c} P (X > s + t | X > s) = \frac {e^{- \lambda (s + t)}}{e^{- \lambda s}} = e^{- \lambda t} \\ = P (X > t) \end{array}

Example 18

Find the probability that the industrial lamp in Example 17 will last for another 1000 hours, given that it is operating after 2500 hours. This determination can be found using Equations (29) and (28), as follows:

P(X>3.5∣X>2.5)=P(X>1)=e−1/3=0.717 P (X > 3. 5 | X > 2. 5) = P (X > 1) = e^{- 1 / 3} = 0. 717

Example 18 illustrates the memoryless property—namely, that a used component that follows an exponential distribution is as good as a new component. The probability that a new component will have a life greater than 1000 hours is also equal to 0.717. Stated in general, suppose that a component which has a lifetime that follows the exponential distribution with parameter λ is observed and found to be operating at an arbitrary time. Then, the distribution of the remaining lifetime is also exponential with parameter λ. The exponential distribution is the only continuous distribution that has the memoryless property. (The geometric distribution is the only discrete distribution that possesses the memoryless property.)

4.3 Gamma distribution

A function used in defining the gamma distribution is the gamma function, which is defined for al β>0\beta > 0 as

Γ(β)=∫0∞xβ−1e−xdx(31) \Gamma (\beta) = \int_{0} ^ {\infty} x^{\beta - 1} e^{- x} d x\tag{31}

By integrating Equation (31) by parts, it can be shown that

Γ(β)=(β−1)Γ(β−1)(32) \Gamma (\beta) = (\beta - 1) \Gamma (\beta - 1)\tag{32}

If β\beta is an integer, then, by using Γ(1)=1\Gamma ( 1 ) = 1 and applying Equation (32), it can be seen that

Γ(β)=(β−1)!(33) \Gamma (\beta) = (\beta - 1)!\tag{33}

The gamma function can be thought of as a generalization of the factorial notion to all positive numbers, not just integers.

A random variable X is gamma distributed with parameters β\beta and θ if its pdf is given by

f(x)={βθΓ(β)(βθx)β−1e−βθx,x>00,otherwise(34) f (x) = \left\{\begin{array}{l l} \frac {\beta \theta}{\Gamma (\beta)} (\beta \theta x) ^ {\beta - 1} e^{- \beta \theta x}, & x > 0 \\ 0, & \text{otherwise} \end{array} \right.\tag{34}

β\beta is called the shape parameter, and θ\theta is called the scale parameter. Several gamma distributions for θ=1\theta = 1 and various values of β\beta are shown in Figure 11.

The mean and variance of the gamma distribution are given by

E(X)=1θ(35) E (X) = \frac {1}{\theta}\tag{35}

and

V(X)=1βθ2(36) V (X) = \frac {1}{\beta \theta^{2}}\tag{36}

The cdf of X is given by

F(x)={1−∫x∞βθΓ(β)(βθt)β−1e−βθtdt,x>00,x≤0(37) F (x) = \left\{\begin{array}{l l} 1 - \int_{x} ^ {\infty} \frac {\beta \theta}{\Gamma (\beta)} (\beta \theta t) ^ {\beta - 1} e^{- \beta \theta t} d t, & x > 0 \\ 0, & x \leq 0 \end{array} \right.\tag{37}

Figure 11 pdfs for several gamma distributions with θ=1\theta = 1 When ⋅β\boldsymbol {\cdot} \beta is an integer, the gamma distribution is related to the exponential distribution in the following manner: If the random variable X is the sum of β\beta independent, exponentially distributed random variables, each with parameter βθ\beta \theta, then X has a gamma distribution with parameters β\beta and θ. Thus, i

X=X1+X2+⋯+Xβ(38) X = X_{1} + X_{2} + \dots + X_{\beta}\tag{38}

where the pdf of XjX_{j} is given by

g(xj)={(βθ)e−βθxj,x≥00,otherwise g (x_{j}) = \left\{\begin{array}{l l} (\beta \theta) e ^ {- \beta \theta x_{j}}, & x \geq 0 \\ 0, & \text{otherwise} \end{array} \right.

and the XjX_{j} are mutually independent, then X has the pdf given in Equation (34). Note that, when β=1\beta = 1, an exponential distribution results. This result follows from Equation (38) or from letting β=1\beta = 1 in Equation (34).

4.4 Erlang distribution

The pdf given by Equation (34) is often referred to as the Erlang distribution of order (or number of phases) k when β=k,\beta = k , an integer. Erlang was a Danish telephone engineer who was an early developer of queueing theory. The Erlang distribution could arise in the following context: Consider a series of k stations that must be passed through in order to complete the servicing of a customer. An additional customer cannot enter the first station until the customer in process has negotiated all the stations. Each station has an exponential distribution of service time with parameter kθ. Equations (35) and (36), which state the mean and variance of a gamma distribution, are valid regardless of the value of β.\beta .. However, when β=k,\beta = k , an integer, Equation (38) may be used to derive the mean of the distribution in a fairly straightforward manner. The expected value of the sum of random variables is the sum of the expected value of each random variable. Thus,

E(X)=E(X1)+E(X2)+⋯+E(Xk) E (X) = E (X_{1}) + E (X_{2}) + \dots + E (X_{k})

The expected value of each of the exponentially distributed XjX_{j} is given by 1/kθ1 / k \theta. Thus,

E(X)=1kθ+1kθ+⋯+1kθ=1θ E (X) = \frac {1}{k \theta} + \frac {1}{k \theta} + \dots + \frac {1}{k \theta} = \frac {1}{\theta}

If the random variables XjX_{j} are independent, the variance of their sum is the sum of the variances, or

V(X)=1(kθ)2+1(kθ)2+⋯+1(kθ)2=1kθ2 V (X) = \frac {1}{(k \theta) ^ {2}} + \frac {1}{(k \theta) ^ {2}} + \dots + \frac {1}{(k \theta) ^ {2}} = \frac {1}{k \theta^{2}}

When β=k,\beta = k ,, a positive integer, the cdf given by Equation (37) may be integrated by parts, giving

F(x)={1−∑i=0k−1e−kθx(kθx)ii!,x>00,x≤0(39) F (x) = \left\{\begin{array}{l l} 1 - \sum_{i = 0} ^ {k - 1} \frac {e^{- k \theta x} (k \theta x) ^ {i}}{i !}, & x > 0 \\ 0, & x \leq 0 \end{array} \right.\tag{39}

which is the sum of Poisson terms with mean α=kθx\alpha = k \theta x. Tables of the cumulative Poisson distribution may be used to evaluate the cdf when the shape parameter is an integer.

Example 19

A college professor of electrical engineering is leaving home for the summer, but would like to have a light burning at all times to discourage burglars. The professor rigs up a device that will hold two light bulbs. The device will switch the current to the second bulb if the first bulb fails. The box in which the light bulbs are packaged says, “Average life 1000 hours, exponentially distributed.” The professor will be gone 90 days (2160 hours). What is the probability that a light will be burning when the summer is over and the professor returns?

The probability that the system will operate at least x hours is called the reliability function R(x)R ( x ):

R(x)=1−F(x) R (x) = 1 - F (x)

In this case, the total system lifetime is given by Equation (38) with β=k=2\beta = k = 2 bulbs and kθ=1/1000k \theta = 1 / 1000 per hour, so θ=1/2000\theta = 1 / 2000 per hour. Thus,F(2160)F ( 2160 ) can be determined from Equation (39) as follows:

F(2160)=1−∑i=01e−(2)(1/2000)(2160)[(2)(1/2000)(2160)]ii!=1−e−2.16∑i=01(2.16)ii!=0.636 \begin{array}{l} F (2160) = 1 - \sum_{i = 0} ^ {1} \frac {e^{- (2) (1 / 2000) (2160)} [ (2) (1 / 2000) (2160) ] ^ {i}}{i !} \\ = 1 - e^{- 2. 16} \sum_{i = 0} ^ {1} \frac {(2 . 16) ^ {i}}{i !} = 0. 636 \end{array}

Therefore, the chances are about 36% that a light will be burning when the professor returns.

Example 20

A medical examination is given in three stages by a physician. Each stage is exponentially distributed with a mean service time of 20 minutes. Find the probability that the exam will take 50 minutes or less. Also, compute the expected length of the exam. In this case,k=3k = 3 stages and kθ=1/20k \theta = 1 / 20, so that θ=1/60\theta = 1 / 60 per minute. Thus,F(50)F ( 50 ) can be calculated from Equation (39) as follows:

F(50)=1−∑i=02e−(3)(1/60)(50)[(3)(1/60)(50)]ii!=1−∑i=02e−5/2(5/2)ii! \begin{array}{l} F (50) = 1 - \sum_{i = 0} ^ {2} \frac {e^{- (3) (1 / 60) (50)} [ (3) (1 / 60) (50) ] ^ {i}}{i !} \\ = 1 - \sum_{i = 0} ^ {2} \frac {e^{- 5 / 2} (5 / 2) ^ {i}}{i !} \end{array}

The cumulative Poisson distribution, shown in Table A.4, can be used to calculate that

F(50)=1−0.543=0.457 F (50) = 1 - 0. 543 = 0. 457

The probability is 0.457 that the exam will take 50 minutes or less. The expected length of the exam is found from Equation (35):

E(X)=1θ=11/60=60minutes E (X) = \frac {1}{\theta} = \frac {1}{1 / 60} = 60 \text{minutes}

In addition, the variance of X is V(X)=1/βθ2=1200V ( X ) = 1 / \beta \theta^{2} = 1200 minutes^2—incidentally, the mode of the Erlang distribution is given by

Mode=k−1kθ(40) \mathrm{Mode} = \frac {k - 1}{k \theta}\tag{40}

Thus, the modal value in this example is

Mode=3−13(1/60)=40minutes \mathrm{Mode} = \frac {3 - 1}{3 (1 / 60)} = 40 \mathrm{minutes}

4.5 Normal distribution

A random variable X with mean −∞<μ<∞- \infty < \mu < \infty and variance σ2>0\sigma^{2} > 0 has a normal distribution if it has the pdf

f(x)=1σ2πexp⁡[−12(x−μσ)2],−∞<x<∞(41) f (x) = \frac {1}{\sigma \sqrt {2 \pi}} \exp \left[ - \frac {1}{2} \left(\frac {x - \mu}{\sigma}\right) ^ {2} \right], \quad - \infty < x < \infty\tag{41}

Figure 12 pdf of the normal distribution.

The normal distribution is used so often that the notation X∼N(μ,σ2)X \sim N ( \mu , \sigma^{2} )) has been adopted by many authors to indicate that the random variable X is normally distributed with mean μ\mu and variance σ2\sigma^{2} The normal pdf is shown in Figure 12.

Some of the special properties of the normal distribution are listed here:

a. lim 1x⟶−∞f(x)=01_{x} {\longrightarrow} - \infty f ( x ) = 0 and lim 1x⟶∞f(x)=0;\begin{array} {r} {{1} _ {x \longrightarrow \infty} f ( x ) = 0 ;} \end{array} the value off(x) approaches zero as x approaches negative infinity and, similarly, as x approaches positive infinity.

b.f(μ−x)=f(μ+x);f ( \mu - x ) = f ( \mu + x ) ;; the pdf is symmetric about μ\mu.

c. The maximum value of the pdf occurs at x=μ;x = \mu ; the mean and mode are equal.

The cdf for the normal distribution is given by

F(x)=P(X≤x)=∫−∞x1σ2πexp⁡[−12(t−μσ)2]dt(42) F (x) = P (X \leq x) = \int_{- \infty} ^ {x} \frac {1}{\sigma \sqrt {2 \pi}} \exp \left[ - \frac {1}{2} \left(\frac {t - \mu}{\sigma}\right) ^ {2} \right] d t\tag{42}

It is not possible to evaluate Equation (42) in closed form. Numerical methods could be used, but it appears that it would be necessary to evaluate the integral for each pair (μ,σ2)( \mu , \sigma^{2} ). However, a transformation of variables,z=(t−μ)/σz = ( t - \mu ) / \sigma, allows the evaluation to be independent of μ\mu and σ\sigma. If X∼N(μ,σ2)X \sim N ( \mu , \sigma^{2} ), let Z=(X−μ)/σZ = ( X - \mu ) / \sigma to obtain

F(x)=P(X≤x)=P(Z≤x−μσ)=∫−∞(x−μ)/σ12πe−z2/2dz=∫−∞(x−μ)/σϕ(z)dz=Φ(x−μσ)(43) \begin{array}{l} F (x) = P (X \leq x) = P \left(Z \leq \frac {x - \mu}{\sigma}\right) \\ = \int_{- \infty} ^ {(x - \mu) / \sigma} \frac {1}{\sqrt {2 \pi}} e ^ {- z^{2} / 2} d z \\ = \int_{- \infty} ^ {(x - \mu) / \sigma} \phi (z) d z = \Phi \left(\frac {x - \mu}{\sigma}\right) \end{array}\tag{43}

Figure 13 pdf of the standard normal distribution.

The pdf

ϕ(z)=12πe−z2/2,−∞<z<∞(44) \phi (z) = \frac {1}{\sqrt {2 \pi}} e ^ {- z^{2} / 2}, - \infty < z < \infty\tag{44}

is the pdf of a normal distribution with mean 0 and variance 1. Thus,Z∼N(0,1)Z \sim N ( 0 , 1 ) and it is said tha ZZ has a standard normal distribution. The standard normal distribution is shown in Figure 13. The cdf for the standard normal distribution is given by

Φ(z)=∫−∞z12πe−t2/2dt(45) \Phi (z) = \int_{- \infty} ^ {z} \frac {1}{\sqrt {2 \pi}} e ^ {- t^{2} / 2} d t\tag{45}

Equation (45) has been widely tabulated. The probabilities Φ(z)\Phi ( z ) for z≥0z \geq 0 are given in Table A.3. Several examples are now given that indicate how Equation (43) and Table A.3 are used.

Example 21

Suppose that it is known that X∼N(50,9)X \sim N ( 50 , 9 ). Compute F(56)=P(X≤56)F ( 56 ) = P ( X \leq 56 )). Using Equation (43), we get

F(56)=Φ(56−503)=Φ(2)=0.9772 F (56) = \Phi \left(\frac {56 - 50}{3}\right) = \Phi (2) = 0. 9772

from Table A.3. The intuitive interpretation is shown in Figure 14. Figure 14(a)14 ( \mathrm{a} ) shows the pdf of X∼N(50,9)X \sim N ( 50 , 9 ) with the specific value,x0=56x_{0} = 56, marked. The shaded portion is the desired probability. Figure 14(b) shows the standard normal distribution o Z∼N(0,1)Z \sim N ( 0 , 1 )) with the value 2 marked;x0=56x_{0} = 56 is 2σ (where σ=3)\sigma = 3 ) greater than the mean. It is helpful to make both sketches such as those in Figure 14 to avoid confusion in figuring out required probabilities.

(a)

Figure 14 Transforming to the standard normal distribution.

Example 22

The time in hours required to load an ocean-going vessel, X, is distributed as N(12,4)N ( 12 , 4 ). The probability that the vessel will be loaded in less than 10 hours is given by F(10)F ( 10 ), where

F(10)=Φ(10−122)=Φ(−1)=0.1587 F (10) = \Phi \left(\frac {10 - 12}{2}\right) = \Phi (- 1) = 0. 1587

The value of Φ(−1)=0.1587\Phi ( - 1 ) = 0 . 1587 is looked up in Table A.3 by using the symmetry property of the normal distribution. Note that Φ(1)=0.8413\Phi ( 1 ) = 0 . 8413. The complement of 0.8413, or 0.1587, is contained in the tail, the shaded portion of the standard normal distribution shown in Figure 15(a). In Figure 15(b), the symmetry property is used to work out the shaded region to be Φ(−1)=1−Φ(1)=0.1587\Phi ( - 1 ) = 1 - \Phi ( 1 ) = 0 . 1587[From this logic, it can be seen that Φ(2)=0.9772\Phi ( 2 ) = 0 . 9772 and Φ(−2)=1−Φ(2)=0.0228\Phi ( - 2 ) = 1 - \Phi ( 2 ) = 0 . 0228. In general,Φ(−x)=1−Φ(x).]\Phi ( - x ) = 1 - \Phi ( x ) . ] The probability that 12 or more hours will be required to load the ship can also be discovered by inspection, by using the symmetry property ofthe normal pdfand the mean as shown by Figure 16. The shaded portion of Figure 16(a) shows the problem as originally stated [i.e., evaluate P(X<12).P ( X < 12 ) .]. Now,P(X > 12) = 1−F(12)P ( X \ > \ 12 ) \ = \ 1 - F ( 12 ). The standardized normal in Figure 16(b) is used to evaluate F(12)=Φ(0)=0.50F ( 12 ) = \Phi ( 0 ) = 0 . 50. Thus,P(X > 12) = 1−0.50 = 0.50P ( X \ > \ 12 ) \ = \ 1 - 0 . 50 \ = \ 0 . 50. (The shaded portions in both Figure 16(a) and (b) contain 0.50 of the area under the normal pdf.)

(a)

Figure 15 Using the symmetry property of the normal distribution.

Figure 16 Evaluation of probability by inspection.

Figure 17 Transformation to standard normal for vessel-loading problem.

The probability that between 10 and 12 hours will be required to load a ship is given by

P(10≤X≤12)=F(12)−F(10)=0.5000−0.1587=0.3413 P (10 \leq X \leq 12) = F (12) - F (10) = 0. 5000 - 0. 1587 = 0. 3413

using earlier results presented in this example. The desired area is shown in the shaded portion of Figure 17(a). The equivalent problem shown in terms of the standardized normal distribution is shown in Figure 17(b). The probability statement is F(12)−F(10)=Φ(0)−Φ(−1)=0.5000−0.1587=F ( 12 ) - F ( 10 ) = \Phi ( 0 ) - \Phi ( - 1 ) = 0 . 5000 - 0 . 1587 =0.3413, from Table A.3.

Example 23

The time to pass through a queue to begin self-service at a cafeteria has been found to be N(15,9)N ( 15 , 9 ) The probability that an arriving customer waits between 14 and 17 minutes is computed as follows:

P(14≤X≤17)=F(17)−F(14)=Φ(17−153)−Φ(14−153)=Φ(0.667)−Φ(−0.333) \begin{array}{r l} P (14 \leq X \leq 17) & = F (17) - F (14) = \Phi \left(\frac {17 - 15}{3}\right) - \Phi \left(\frac {14 - 15}{3}\right) \\ & = \Phi (0. 667) - \Phi (- 0. 333) \end{array}

The shaded area shown in Figure 18(a) represents the probability F(17)−F(14)F ( 17 ) - F ( 14 ). The shaded area shown in Figure 18(b) represents the equivalent probability,Φ(0.667) − Φ(−0.333)\Phi ( 0 . 667 ) \mathrm{~ - ~} \Phi ( - 0 . 333 )), for the standardized normal distribution. From Table A.3,Φ(0.667) = 0.7476\Phi ( 0 . 667 ) \mathrm{~ = ~} 0 . 7476. Now,Φ(−0.333)=\Phi ( - 0 . 333 ) =

(b) Figure 18 Transformation to standard normal for cafeteria problem.1−Φ(0.333)=1−0.6304=0.3696.1 - \Phi ( 0 . 333 ) = 1 - 0 . 6304 = 0 . 3696 .. Thus,(0.667)−Φ(−0.333)=0.3780( 0 . 667 ) - \Phi ( - 0 . 333 ) = 0 . 3780. The probability is 0.3780 that the customer will pass through the queue in a time between 14 and 17 minutes.

Example 24

Lead-time demand, X, for an item is approximated by a normal distribution having mean 25 and variance 9. It is desired to compute the value for lead time that will be exceeded only 5% of the time. Thus, the problem is to find x0x_{0} such that P(X>x0)=0.05P ( X > x_{0} ) = 0 . 05, as shown by the shaded area in Figure 19(a). The equivalent problem is shown as the shaded area in Figure 19(b). Now,

P(X>x0)=P(Z>x0−253)=1−Φ(x0−253)=0.05 P (X > x_{0}) = P \left(Z > \frac {x_{0} - 25}{3}\right) = 1 - \Phi \left(\frac {x_{0} - 25}{3}\right) = 0. 05

or, equivalently,

Φ(x0−253)=0.95 \Phi \left(\frac {x_{0} - 25}{3}\right) = 0. 95

From Table A.3, it can be seen that (1.645) 0.95. Thus,x0x_{0} can be found by solving

x0−253=1.645 \frac {x_{0} - 25}{3} = 1. 645

(a)

Figure 19 Finding x0x_{0} for lead-time-demand problem.

x0=29.935 x_{0} = 29. 935

Therefore, in only 5% of the cases will demand during lead time exceed available inventory if an order to purchase is made when the stock level reaches 30.

4.6 Weibull distribution

The random variable X has a Weibull distribution if its pdf has the form

f(x)={βα(x−να)β−1exp⁡[−(x−να)β],x≥ν0,otherwise(46) f (x) = \left\{\begin{array}{l l} \frac {\beta}{\alpha} \left(\frac {x - \nu}{\alpha}\right) ^ {\beta - 1} \exp \left[ - \left(\frac {x - \nu}{\alpha}\right) ^ {\beta} \right], & x \geq \nu \\ 0, & \text{otherwise} \end{array} \right.\tag{46}

The three parameters of the Weibull distribution are ν(−∞<ν<∞)( - \infty < \nu < \infty ), which is the location parameter; α(α>0)( \alpha > 0 ), which is the scale parameter; and β(β>0)\beta \left( \beta > 0 \right), which is the shape parameter. When ν=0,\nu = 0 ,, the Weibull pdf becomes

f(x)={βα(xα)β−1exp⁡[−(xα)β],x≥00,otherwise(47) f (x) = \left\{\begin{array}{l l} \frac {\beta}{\alpha} \left(\frac {x}{\alpha}\right) ^ {\beta - 1} \exp \left[ - \left(\frac {x}{\alpha}\right) ^ {\beta} \right], & x \geq 0 \\ 0, & \text{otherwise} \end{array} \right.\tag{47}

Figure ^20 Weibull pdfs for ν = 0; α = 1; β = ^1 , 1, 2, 4.

Figure 20 shows several Weibull densities when ν=0\nu = 0 and α=1\alpha = 1. When β=1\beta = 1, the Weibul distribution is reduced to

f(x)={1αe−x/α,x≥00,otherwise f (x) = \left\{\begin{array}{l l} \frac {1}{\alpha} e^{- x / \alpha}, & x \geq 0 \\ 0, & \text{otherwise} \end{array} \right.

which is an exponential distribution with parameter λ=1/α\lambda = 1 / \alpha The mean and variance of the Weibull distribution are given by the following expressions:

E(X)=ν+αΓ(1β+1)(48) E (X) = \nu + \alpha \Gamma \left(\frac {1}{\beta} + 1\right)\tag{48} V(X)=α2[Γ(2β+1)−[Γ(1β+1)]2](49) V (X) = \alpha^{2} \left[ \Gamma \left(\frac {2}{\beta} + 1\right) - \left[ \Gamma \left(\frac {1}{\beta} + 1\right) \right] ^ {2} \right]\tag{49}

where Γ(⋅)\Gamma ( \cdot ) is defined by Equation (31). Thus, the location parameter ν has no effect on the variance; however, the mean is increased or decreased by ν. The cdf of the Weibull distribution is given by

F(x)={0,x<ν1−exp⁡[−(x−να)β],x≥ν(50) F (x) = \left\{\begin{array}{l l} 0, & x < \nu \\ 1 - \exp \left[ - \left(\frac {x - \nu}{\alpha}\right) ^ {\beta} \right], & x \geq \nu \end{array} \right.\tag{50}

Example 25

The time to failure for a component is known to have a Weibull distribution with ν=0,α=200hours\nu = 0 , \alpha = 200 \mathrm{h o u r s} and β=1/3\beta = 1 / 3. The mean time to failure is given by Equation (48) as

E(X)=200Γ(3+1)=200(3!)=1200hours E (X) = 200 \Gamma (3 + 1) = 200 (3!) = 1200 \text{hours}

The probability that a unit fails before 2000 hours is computed from Equation (50) as

F(2000)=1−exp⁡[−(2000200)1/3]=1−e−310=1−e−2.15=0.884 \begin{array}{r l} F (2000) & = 1 - \exp \left[ - \left(\frac {2000}{200}\right) ^ {1 / 3} \right] \\ & = 1 - e ^ {- 3 \sqrt {10}} = 1 - e^{- 2. 15} = 0. 884 \end{array}

Example 26

The time it takes for an aircraft to land and clear the runway at a major international airport has a Weibull distribution with ν=1.34\nu = 1 . 34 minutes,α=0.04\alpha = 0 . 04 minutes, and β=0.5\beta = 0 . 5. Find the probability that an incoming airplane will take more than 1.5 minutes to land and clear the runway. In this case P(X>1.5)P ( X > 1 . 5 ) is computed as follows:

P(X≤1.5)=F(1.5)=1−exp⁡[−(1.5−1.340.04)0.5]=1−e−2=1−0.135=0.865 \begin{array}{r l} P (X \leq 1. 5) & = F (1. 5) \\ & = 1 - \exp \left[ - \left(\frac {1 . 5 - 1 . 34}{0 . 04}\right) ^ {0. 5} \right] \\ & = 1 - e^{- 2} = 1 - 0. 135 = 0. 865 \end{array}

Therefore, the probability that an aircraft will require more than 1.5 minutes to land and clear the runway is 0.135.

4.7 Triangular distribution

A random variable X has a triangular distribution if its pdf is given by

f(x)={2(x−a)(b−a)(c−a),a≤x≤b2(c−x)(c−b)(c−a),b<x≤c0,elsewhere(51) f (x) = \left\{\begin{array}{l l} \frac {2 (x - a)}{(b - a) (c - a)}, & a \leq x \leq b \\ \frac {2 (c - x)}{(c - b) (c - a)}, & b < x \leq c \\ 0, & \text{elsewhere} \end{array} \right.\tag{51}

where a≤b≤c.a \leq b \leq c .. The mode occurs at x=b.x = b .. A triangular pdf is shown in Figure 21. The parameters (a,b,c)( a , b , c ) can be related to other measures, such as the mean and the mode, as follows:

E(X)=a+b+c3(52) E (X) = \frac {a + b + c}{3}\tag{52}

Figure 21 pdf of the triangular distribution.

From Equation (52) the mode can be determined as

Mode=b=3E(X)−(a+c)(53) \text{Mode} = b = 3 E (X) - (a + c)\tag{53}

Because a≤b≤c,a \leq b \leq c ,

2a+c3≤E(X)≤a+2c3 \frac {2 a + c}{3} \leq E (X) \leq \frac {a + 2 c}{3}

The mode is used more often than the mean to characterize the triangular distribution. As is shown in Figure 21, its height is 2/(c−a)2 / ( c - a ) above the x axis. The variance,V(X)V ( X ), of the triangular distribution is left as an exercise for the student. The cdf for the triangular distribution is given by

F(x)={0,x≤a(x−a)2(b−a)(c−a),a<x≤b1−(c−x)2(c−b)(c−a),b<x≤c1,x>c(54) F (x) = \left\{\begin{array}{l l} 0, & x \leq a \\ \frac {(x - a) ^ {2}}{(b - a) (c - a)}, & a < x \leq b \\ 1 - \frac {(c - x) ^ {2}}{(c - b) (c - a)}, & b < x \leq c \\ 1, & x > c \end{array} \right.\tag{54}

Example 27

The central processing unit requirements, for programs that will execute, have a triangular distribution with a=0.05a = 0 . 05 milliseconds,b=1.1b = 1 . 1 milliseconds, and c=6.5c = 6 . 5 milliseconds. Find the probability that the CPU requirement for a random program is 2.5 milliseconds or less. The value of F(2.5) is from the portion of the cdf in the interval [0.05, 1.1] plus that portion in the interval [1.1, 2.5]. By using Equation (54), both portions can be addressed at one time, to yield

F(2.5)=1−(6.5−2.5)2(6.5−0.05)(6.5−1.1)=0.541 F (2. 5) = 1 - \frac {(6 . 5 - 2 . 5) ^ {2}}{(6 . 5 - 0 . 05) (6 . 5 - 1 . 1)} = 0. 541

Thus, the probability is 0.541 that the CPU requirement is 2.5 milliseconds or less.

Example 28

An electronic sensor evaluates the quality of memory chips, rejecting those that fail. Upon demand, the sensor will give the minimum and maximum number of rejects during each hour of production over the past 24 hours. The mean is also given. Without further information, the quality contro department has assumed that the number of rejected chips can be approximated by a triangular distribution. The current dump of data indicates that the minimum number of rejected chips during any hour was 0, the maximum was 10, and the mean was 4. Given that a=0,c=10.a = 0 , c = 10 ., and E(X)=4,E ( X ) = 4 , the value of b can be found from Equation (53):

b=3(4)−(0+10)=2 b = 3 (4) - (0 + 10) = 2

The height of the mode is 2/(10−0)=0.2.2 / ( 10 - 0 ) = 0 . 2 .. Thus, Figure 22 can be drawn.

The median is the point at which 0.5 of the area is to the left and 0.5 is to the right. The median in this example is 3.7, also shown on Figure 22. Finding the median of the triangular distribution requires an initial location of the value to the left or to the right of the mode. The area to the left of the mode is computed from Equation (54) as

F(2)=2220=0.2 F (2) = \frac {2^{2}}{20} = 0. 2

Thus, the median is between b and c. Setting F(x)=0.5F ( x ) = 0 . 5 in Equation (54) and solving for x median yields

0.5=1−(10−x)2(10)(8) 0. 5 = 1 - \frac {(10 - x) ^ {2}}{(10) (8)}

with

x=3.7 x = 3. 7

This example clearly shows that the mean, mode, and median are not necessarily equal.

Figure 22 Mode, median, and mean for triangular distribution.

4.8 Lognormal distribution

A random variable X has a lognormal distribution if its pdf is given by

f(x)={12πσxexp⁡[−(ln⁡x−μ)22σ2],x>00,otherwise(55) f (x) = \left\{\begin{array}{l l} \frac {1}{\sqrt {2 \pi} \sigma x} \exp \left[ - \frac {(\ln x - \mu) ^ {2}}{2 \sigma^{2}} \right], & x > 0 \\ 0, & \text{otherwise} \end{array} \right.\tag{55}

where σ2>0\sigma^{2} > 0. The mean and variance of a lognormal random variable are

E(X)=eμ+σ2/2(56) E (X) = e ^ {\mu + \sigma^{2} / 2}\tag{56} V(X)=e2μ+σ2(eσ2−1)(57) V (X) = e ^ {2 \mu + \sigma^{2}} (e ^ {\sigma^{2}} - 1)\tag{57}

Three lognormal pdfs, all having mean 1, but variances 1/2,1 / 2 ,, 1, and 2, are shown in Figure 23.

Notice that the parameters μ\mu and σ2\sigma^{2} are not the mean and variance of the lognormal. These parameters come from the fact that when Y has a N(μ,σ2)N ( \mu , \sigma^{2} )) distribution then X=eYX = e^{Y} has a lognorma distribution with parameters μ\mu and σ2\sigma^{2}. If the mean and variance of the lognormal are known to be μL\mu_{L} and σL2.\sigma_{L} ^ {2} ., respectively, then the parameters μ\mu and σ2\sigma^{2} are given by

μ=ln⁡(μL2μL2+σL2)(58) \mu = \ln \left(\frac {\mu_{L} ^ {2}}{\sqrt {\mu_{L} ^ {2} + \sigma_{L} ^ {2}}}\right)\tag{58} σ2=ln⁡(μL2+σL2μL2)(59) \sigma^{2} = \ln \left(\frac {\mu_{L} ^ {2} + \sigma_{L} ^ {2}}{\mu_{L} ^ {2}}\right)\tag{59}

Figure 23 pdf of the lognormal distribution.

Example 29

The rate of return on a volatile investment is modeled as having a lognormal distribution with mean 20% and standard deviation 5%. Compute the parameters for the lognormal distribution. From the information given, we have μL=20\mu_{L} = 20 and σL2=52\sigma_{L} ^ {2} = 5^{2}. Thus, from Equations (58) and (59),

μ=ln⁡(202202+52)≐2.9654 \mu = \ln \left(\frac {20^{2}}{\sqrt {20^{2} + 5^{2}}}\right) \doteq 2. 9654 σ2=ln⁡(202+52202)≐0.06 \sigma^{2} = \ln \left(\frac {20^{2} + 5^{2}}{20^{2}}\right) \doteq 0. 06

4.9 Beta distribution

A random variable X is beta distributed with parameters β1>0\beta_{1} > 0 and β2>0\beta_{2} > 0 if its pdf is given by

f(x)={xβ1−1(1−x)β2−1B(β1,β2),0<x<10,otherwise(60) f (x) = \left\{\begin{array}{l l} \frac {x ^ {\beta_{1} - 1} (1 - x) ^ {\beta_{2} - 1}}{B (\beta_{1} , \beta_{2})}, & 0 < x < 1 \\ 0, & \text{otherwise} \end{array} \right.\tag{60}

where B(β1,β2)=Γ(β1)Γ(β2)/Γ(β1+β2)B ( \beta_{1} , \beta_{2} ) = \Gamma ( \beta_{1} ) \Gamma ( \beta_{2} ) / \Gamma ( \beta_{1} + \beta_{2} ). The cdf of the beta does not have a closed form, in general.

The beta distribution is very flexible and has a finite range from 0 to 1, as shown in Figure 24. In practice, we often need a beta distribution defined on a different range, say (a,b)( a , b ), with a<b,a < b ,, rather than (0, 1). This is easily accomplished by defining a new random variable

Y=a+(b−a)X Y = a + (b - a) X

The mean and variance of Y are given by

a+(b−a)(β1β1+β2)(61) a + (b - a) \left(\frac {\beta_{1}}{\beta_{1} + \beta_{2}}\right)\tag{61}

and

(b−a)2(β1β2(β1+β2)2(β1+β2+1))(62) (b - a) ^ {2} \left(\frac {\beta_{1} \beta_{2}}{(\beta_{1} + \beta_{2}) ^ {2} (\beta_{1} + \beta_{2} + 1)}\right)\tag{62}

Figure 24 pdf for several beta distributions.

5 Poisson Process

Consider random events such as the arrival ofjobs at a job shop, the arrival of e-mail to a mail server, the arrival of boats to a dock, the arrival of calls to a call center, the breakdown of machines in a large factory, and so on. These events may be described by a counting function N(t)N ( t ) defined for all t≥0t \geq 0. This counting function will represent the number of events that occurred in [0, t]. Time zero is the point at which the observation began, regardless of whether an arrival occurred at that instant. For each interval [0,t].[ 0 , t ] ., the value N(t)N ( t ) is an observation of a random variable where the only possible values that can be assumed by N(t) are the integers 0,1,2,…0 , 1 , 2 , \ldots The counting process,{N(t),t≥0}\{N ( t ) , t \ge 0 \}, is said to be a Poisson process with mean rate λ if the following assumptions are fulfilled:

a. Arrivals occur one at a time.

b.{N(t),t≥0}\{N ( t ) , t \ge 0 \} has stationary increments: The distribution of the number of arrivals between t and t+st + s depends only on the length of the interval s, not on the starting point t. Thus, arrivals are completely at random without rush or slack periods.

c.{N(t),t≥0}\{N ( t ) , t \ge 0 \} has independent increments: The number of arrivals during nonoverlapping time intervals are independent random variables. Thus, a large or small number of arrivals in one time interval has no effect on the number of arrivals in subsequent time intervals. Future arrivals occur completely at random, independent of the number of arrivals in past time intervals.

If arrivals occur according to a Poisson process, meeting the three preceding assumptions, it can be shown that the probability that N(t)N ( t ) is equal to n is given by

P[N(t)=n]=e−λt(λt)nn!fort≥0andn=0,1,2,…(63) P [ N (t) = n ] = \frac {e^{- \lambda t} (\lambda t) ^ {n}}{n !} \quad \text{for} t \geq 0 \text{and} n = 0, 1, 2, \dots\tag{63}

Comparing Equation (63) to Equation (19), it can be seen that N(t)N ( t ) has the Poisson distribution with parameter α=λt\alpha = \lambda t. Thus, its mean and variance are given by

E[N(t)]=α=λt=V[N(t)] E [ N (t) ] = \alpha = \lambda t = V [ N (t) ]

For any times s and t such that s<t,s < t , the assumption of stationary increments implies that the random variable N(t)−N(s)N ( t ) - N ( s ), representing the number of arrivals in the interval from s to t, is also Poisson-distributed with mean λ(t−s)\lambda ( t - s ). Thus,

P[N(t)−N(s)=n]=e−λ(t−s)[λ(t−s)]nn!forn=0,1,2,… P [ N (t) - N (s) = n ] = \frac {e^{- \lambda (t - s)} [ \lambda (t - s) ] ^ {n}}{n !} \quad \text{for} n = 0, 1, 2, \dots

and

E[N(t)−N(s)]=λ(t−s)=V[N(t)−N(s)] E [ N (t) - N (s) ] = \lambda (t - s) = V [ N (t) - N (s) ]

Now, consider the time at which arrivals occur in a Poisson process. Let the first arrival occur at time A1A_{1}, the second occur at time A1+A2A_{1} + A_{2}, and so on, as shown in Figure 25.

Thus,A1,A2,…A_{1} , A_{2} , \ldots. are successive interarrival times. The first arrival occurs after time t if and only if there are no arrivals in the interval [0, t], so it is seen that

{A1>t}={N(t)=0} \{A_{1} > t \} = \{N (t) = 0 \}

and, therefore,

P(A1>t)=P[N(t)=0]=e−λt P (A_{1} > t) = P [ N (t) = 0 ] = e^{- \lambda t}

the last equality following from Equation (63). Thus, the probability that the first arrival will occur in [0, t] is given by

P(A1≤t)=1−e−λt P (A_{1} \leq t) = 1 - e^{- \lambda t}

which is the cdf for an exponential distribution with parameter λ. Hence,A1A_{1} is distributed exponentially with mean E(A1)=1/λE ( A_{1} ) = 1 / \lambda. It can also be shown that all interarrival times,A1,A2,…,A_{1} , A_{2} , \ldots , are

Figure 25 Arrival process.

exponentially distributed and independent with mean 1/λ1 / \lambda. As an alternative definition of a Poisson process, it can be shown that, if interarrival times are distributed exponentially and independently, then the number of arrivals by time t, say N(t)N ( t ), meets the three previously mentioned assumptions and, therefore, is a Poisson process.

Recall that the exponential distribution is memoryless—that is, the probability of a future arriva in a time interval of length s is independent of the time of the last arrival. The probability of the arrival depends only on the length of the time interval s. Thus, the memoryless property is related to the properties of independent and stationary increments of the Poisson process.

Additional readings concerning the Poisson process may be obtained from many sources, including Parzen [1999], Feller [1968], and Ross [2002].

Example 30

The jobs at a machine shop arrive according to a Poisson process with a mean of λ=2\lambda = 2 jobs per hour. Therefore, the interarrival times are distributed exponentially, with the expected time between arrivals being E(A)=1/λ=12\begin{array} {r} {E ( A ) = 1 / \lambda = \frac {1} {2}} \end{array} hour.

5.1 Properties of a Poisson Process

Several properties of the Poisson process, discussed by Ross [2002] and others, are useful in discretesystem simulation. The first ofthese properties concerns random splitting. Consider a Poisson process {N(t),t≥0}\{N ( t ) , t \ge 0 \} having rate λ, as represented by the left side of Figure 26.

Suppose that, each time an event occurs, it is classified as either a type I or a type II event. Suppose further that each event is classified as a type I event with probability pp and type II event with probability 1−p.1 - p ., independently of all other events.

Let N1(t)N_{1} ( t ) and N2(t)N_{2} ( t ) be random variables that denote, respectively, the number of type I and type II events occurring in [0, t]. Note that N(t)=N1(t)+N2(t)N ( t ) = N_{1} ( t ) + N_{2} ( t )). It can be shown that N1(t)N_{1} ( t ) and N2(t)N_{2} ( t ) are both Poisson processes having rates λp\lambda p and λ(1−p)\lambda ( 1 - p ), as shown in Figure 26. Furthermore, it can be shown that the two processes are independent.

Figure 26 Random splitting.

Example 31: Random Splitting

Suppose thatjobs arrive at a shop in accordance with a Poisson process having rate λ. Suppose further that each arrival is marked “high priority” with probability 1/3 and “low priority” with probability 2/3. Then a type I event would correspond to a high-priority arrival and a type II event would correspond to a low-priority arrival. If N1(t)N_{1} ( t ) and N2(t)N_{2} ( t ) are as just defined, both variables follow the Poisson process, with rates λ/3\lambda / 3 and 2λ/3,2 \lambda / 3 ,, respectively.

Example 32

The rate in Example 31 is λ=3\lambda = 3 per hour. The probability that no high-priority jobs will arrive in a 2-hour period is given by the Poisson distribution with parameter α=λpt=2\alpha = \lambda p t = 2. Thus,

P(0)=e−2200!=0.135 P (0) = \frac {e^{- 2} 2^{0}}{0 !} = 0. 135

Now, consider the opposite situation from random splitting, namely the pooling of two arrival streams. The process of interest is illustrated in Figure 27. It can be shown that, if Ni(t)N_{i} ( t ) are random variables representing independent Poisson processes with rates λi.\lambda_{i} ., for i=1i = 1 and 2, then N(t)=N ( t ) =N1(t)+N2(t){N} _ {1} ( t ) + {N} _ {2} ( t ) is a Poisson process with rate λ1+λ2\lambda_{1} + \lambda_{2} Figure 27 Pooled process.

Example 33: Pooled Process

A Poisson arrival stream with λ1=10\lambda_{1} = 10 arrivals per hour is combined (or pooled) with a Poisson arrival stream with λ2 = 17\lambda_{2} ~ = ~ 17 arrivals per hour. The combined process is a Poisson process with λ=27\lambda = 27 arrivals per hour.

5.2 Nonstationary Poisson Process

If we keep the Poisson Assumptions 1 and 3 (Section 5), but drop Assumption 2 (stationary increments) then we have a nonstationary Poisson process (NSPP), which is characterized by λ(t)\lambda ( t ), the arrival rate at time t. The NSPP is useful for situations in which the arrival rate varies during the period of interest, including meal times for restaurants, phone calls during business hours, and orders for pizza delivery around 6 P.M.

The key to working with an NSPP is the expected number of arrivals by time t, denoted by

Λ(t)=∫0tλ(s)ds \Lambda (t) = \int_{0} ^ {t} \lambda (s) d s

To be useful as an arrival-rate function, λ(t) must be nonnegative and integrable. For a stationary Poisson process with rate λ we have Λ(t)=λt,\Lambda ( t ) = \lambda t ,, as expected.

Let T1,T2,…T_{1} , T_{2} , \ldots. be the arrival times of stationary Poisson process N(t)N ( t ) with λ=1\lambda = 1, and let T1,T2,…\mathcal {T} _ {1} , \mathcal {T} _ {2} , \ldots. be the arrival times for an NSPP N(t)\mathcal {N} ( t ) with arrival rate λ(t)\lambda ( t )). The fundamental relationship for working with NSPPs is the following:

Ti=Λ(Ti)Ti=Λ−1(Ti) \begin{array}{l} {T_{i} = \Lambda (\mathcal {T} _ {i})} \\ {\mathcal {T} _ {i} = \Lambda^{- 1} (T_{i})} \end{array}

In other words, an NSPP can be transformed into a stationary Poisson process with arrival rate 1, and a stationary Poisson process with arrival rate 1 can be transformed into an NSPP with rate λ(t), and the transformation in both cases is related to Λ(t)\Lambda ( t )

Example 34

Suppose that arrivals to a post office occur at a rate of 2 per minute from 8 A.M. until 12 P.M., then drop to 1 every 2 minutes until the day ends at 4 P.M. What is the probability distribution of the number of arrivals between 11 A.M. and 2 P.M?

Let time t=0t = 0 correspond to 8 A.M. Then this situation could be modeled as an NSPP N(t)\mathcal {N} ( t ) with rate function

λ(t)={2,0≤t<412,4≤t≤8 \lambda (t) = \left\{\begin{array}{l l} 2, & 0 \leq t < 4 \\ \frac {1}{2}, & 4 \leq t \leq 8 \end{array} \right.

The expected number of arrivals by time t is therefore

Λ(t)={2t,0≤t<4t2+6,4≤t≤8 \Lambda (t) = \left\{\begin{array}{l l} 2 t, & 0 \leq t < 4 \\ \frac {t}{2} + 6, & 4 \leq t \leq 8 \end{array} \right.

Notice that computing the expected number of arrivals for 4 ≤t≤8\leq t \leq 8 requires that the integration be done in two parts:

Λ(t)=∫0tλ(s)ds=∫042ds+∫4t12ds=t2+6 \Lambda (t) = \int_{0} ^ {t} \lambda (s) d s = \int_{0} ^ {4} 2 d s + \int_{4} ^ {t} \frac {1}{2} d s = \frac {t}{2} + 6

Since 2 P.M. and 11 A.M. correspond to times 6 and 3, respectively, we have

P[N(6)−N(3)=k]=P[N(Λ(6))−N(Λ(3))=k]=P[N(9)−N(6)=k]=e9−6(9−6)kk!=e3(3)kk! \begin{array}{r l} P [ \mathcal {N} (6) - \mathcal {N} (3) = k ] & = P [ N (\Lambda (6)) - N (\Lambda (3)) = k ] \\ & = P [ N (9) - N (6) = k ] \\ & = \frac {e^{9 - 6} (9 - 6) ^ {k}}{k !} \\ & = \frac {e^{3} (3) ^ {k}}{k !} \end{array}

where N(t)N ( t ) is a stationary Poisson process with arrival rate 1.

6 Empirical Distributions

An empirical distribution, which may be either discrete or continuous in form, is a distribution whose parameters are the observed values in a sample of data. This is in contrast to parametric distribution families (such as the exponential, normal, or Poisson), which are characterized by specifying a smal number of parameters such as the mean and variance. An empirical distribution may be used when i is impossible or unnecessary to establish that a random variable has any particular parametric distribution. One advantage of an empirical distribution is that nothing is assumed beyond the observed values in the sample; however, this is also a disadvantage because the sample might not cover the entire range of possible values.

Example 35: Discrete

Customers at a local restaurant arrive at lunchtime in groups of one to eight people. The number of people per party in the last 300 groups has been observed; the results are summarized in Table 3. The relative frequencies appear in Table 3 and again in Figure 28, which provides a histogram of the data that were gathered. Figure 29 provides a cdf of the data. The cdf in Figure 29 is called the empirica distribution of the given data.

Table 3 Arrivals per Party Distribution

Arrivals per PartyFrequencyRelative FrequencyCumulative Relative Frequency
1300.100.10
21100.370.47
3450.150.62
4710.240.86
5120.040.90
6130.040.94
770.020.96
8120.041.00

Figure 28 Histogram of party size.

Figure 29 Empirical cdf of party size.

Example 36: Continuous

The time required to repair a conveyor system that has suffered a failure has been collected for the last 100 instances; the results are shown in Table 4. There were 21 instances in which the repair took between 0 and 0.5 hour, and so on. The empirical cdf is shown in Figure 30. A piecewise linear curve is formed by the connection of the points of the form [x, F(x)]. The points are connected by a straigh line. The first connected pair is (0, 0) and (0.5, 0.21); then the points (0.5, 0.21) and (1.0, 0.33) are connected; and so on.

Table 4 Repair Times for Conveyor

Interval (hours)FrequencyRelative FrequencyCumulative Frequency
0 < x ≤ 0.5210.210.21
0.5 < x ≤ 1.0120.120.33
1.0 < x ≤ 1.5290.290.62
1.5 < x ≤ 2.0190.190.81
2.0 < x ≤ 2.580.080.89
2.5 < x ≤ 3.0110.111.00

Figure 30 Empirical cdf for repair times.

7 Summary

In many instances, the world the simulation analyst sees is probabilistic rather than deterministic. The purposes of this chapter were to review several important probability distributions, to familiarize the reader with the notation used in the remainder of the text, and to show applications of the probability distributions in a simulation context.

A major task in simulation is the collection and analysis of input data. One of the first steps in this task is hypothesizing a distributional form for the input data. This is accomplished by comparing the shape of the probability density function or mass function to a histogram of the data and by an understanding that certain physical processes give rise to specific distributions. (Computer software is available to assist in this effort.) This chapter was intended to reinforce the properties of various distributions and to give insight into how these distributions arise in practice. In addition, probabilistic models of input data are used in generating random events in a simulation.

Several features that should have made a strong impression on the reader include the differences between discrete, continuous, and empirical distributions; the Poisson process and its properties; and the versatility of the gamma and the Weibull distributions.

REFERENCES

BANKS, J., AND R. G. HEIKES [1984], Handbook of Tables and Graphs for the Industrial Engineer and Manager, Reston Publishing, Reston, VA.

DEVORE, J. L. [1999], Probability and Statisticsfor Engineers and the Sciences, 5th ed., Brooks/Cole, Pacific Grove, CA.

FELLER, W. [1968], An Introduction to Probability Theory and Its Applications, Vol. I, 3d ed., Wiley, NewYork.

GORDON, G. [1975], The Application of GPSS V to Discrete System Simulation, Prentice-Hall, Englewood Cliffs, NJ.

HADLEY, G., AND T. M. WHITIN [1963], Analysis ofInventory Systems, Prentice-Hall, Englewood Cliffs, NJ.

HINES, W. W.,AND D. C. MONTGOMERY [1990], Probability and Statistics in Engineering andManagement Science, 3d ed., Wiley, New York.

LAW, A. M., AND W. D. KELTON [2000], Simulation Modeling & Analysis, 3d ed., McGraw-Hill, New York.

PAPOULIS, A. [1990], Probability and Statistics, Prentice Hall, Englewood Cliffs, NJ.

PARZEN, E. [1999], Stochastic Process, Classics in Applied Mathematics, 24, Society for Industrial & Applied Mathematics, Philadelphia, PA.

PEGDEN, C. D., R. E. SHANNON, AND R. P. SADOWSKI [1995], Introduction to Simulation Using SIMAN, 2d ed., McGraw-Hill, New York

ROSS, S. M. [2002], Introduction to Probability Models, 8th ed., Academic Press, New York.

WALPOLE, R. E., AND R. H. MYERS [2002], Probability and Statisticsfor Engineers and Scientists, 7th ed., Prentice Hall, Upper Saddle River, NJ.

EXERCISES

  1. A production process manufactures alternators for outboard engines used in recreational boating. On the average, 1% of the alternators will not perform up to the required standards when tested at the engine assembly plant. When a large shipment of alternators is received at the plant, 100 are tested, and, if more than two are nonconforming, the shipment is returned to the alternator manufacturer. What is the probability of returning a shipment?

  2. An industrial chemical that will retard the spread of fire in paint has been developed. The loca sales representative has estimated, from past experience, that 48% of the sales calls will resul in an order.

(a) What is the probability that the first order will come on the fourth sales call of the day?

(b) If eight sales calls are made in a day, what is the probability of receiving exactly six orders?

(c) If four sales calls are made before lunch, what is the probability that one or fewer results in an order?

  1. A recent survey indicated that 82% of single women aged 25 years old will be married in their lifetime. Using the binomial distribution, find the probability that two or three women in a sample of twenty will never be married.

  2. The Hawks are currently winning 0.55 of their games. There are 5 games in the next two weeks. What is the probability that they will win more games than they lose?

  3. Joe Coledge is the third-string quarterback for the University of Lower Alatoona. The probability that Joe gets into any game is 0.40.

(a) What is the probability that the first game Joe enters is the fourth game of the season?

(b) What is the probability that Joe plays in no more than two of the first five games?

  1. For the random variables X1X_{1} and X2X_{2}, which are exponentially distributed with parameter λ=1\lambda = 1 compute P(X1+X2>2)P ( X_{1} + X_{2} > 2 )7. Show that the geometric distribution is memoryless.

  2. The number of hurricanes hitting the coast of Florida annually has a Poisson distribution with a mean of 0.8.

(a) What is the probability that more than two hurricanes will hit the Florida coast in a year?

(b) What is the probability that exactly one hurricane will hit the coast of Florida in a year?

  1. Arrivals at a bank teller’s drive-through window are Poisson-distributed at the rate of 1.2 per minute.

(a) What is the probability of zero arrivals in the next minute?

(b) What is the probability of zero arrivals in the next 2 minutes?

  1. Records indicate that 1.8% of the entering students at a large state university drop out of schoo by midterm. What is the probability that three or fewer students will drop out of a random group of 200 entering students?

  2. Lane Braintwain is quite a popular student. Lane receives, on the average, four phone calls a night (Poisson-distributed). What is the probability that, tomorrow night, the number of calls received will exceed the average by more than one standard deviation?

  3. Lead-time demand for condenser units is Poisson-distributed with a mean of 6 units. Prepare a table for the inventory manager that will indicate the order level to achieve protection of the following levels: 50%, 80%, 90%, 95%, 97%, 97.5%, 99%, 99.5%, and 99.9%.

  4. A random variable X that has pmf given by p(x)=1/(n+1)p ( x ) = 1 / ( n + 1 )) over the range RX={0,1,2,…,n}R_{X} = \{0 , 1 , 2 , \ldots , n \} is said to have a discrete uniform distribution.

(a) Find the mean and variance of this distribution. Hint:

∑i=1ni=n(n+1)2and∑i=1ni2=n(n+1)(2n+1)6 \sum_{i = 1} ^ {n} i = \frac {n (n + 1)}{2} \text{and} \sum_{i = 1} ^ {n} i^{2} = \frac {n (n + 1) (2 n + 1)}{6}

(b) If RX={a,a+1,a+2,…,b}R_{X} = \{a , a + 1 , a + 2 , \ldots , b \}, compute the mean and variance of X.X ..

  1. The lifetime, in years, of a satellite placed in orbit is given by the following pdf:
f(x)={0.4e−0.4x,x≥00,otherwise f (x) = \left\{\begin{array}{l l} 0. 4 e^{- 0. 4 x}, & x \geq 0 \\ 0, & \text{otherwise} \end{array} \right.

(a) What is the probability that this satellite is still “alive” after 5 years?

(b) What is the probability that the satellite dies between 3 and 6 years from the time it is placed in orbit?

  1. A mainframe computer crashes in accordance with a Poisson process, with a mean rate of one crash every 36 hours. Determine the probability that the next crash will occur between 24 and 48 hours after the last crash.

  2. (The Poisson distribution can be used to approximate the binomial distribution when n is large and p is small—say, p less than 0.1. In utilizing the Poisson approximation, let λ=np.)\lambda = n p . ) In the production of ball bearings, bubbles or depressions occur, rendering the ball bearing unfit for sale. It has been noted that, on the average, one in every 800 of the ball bearings has one or more of these defects. What is the probability that a random sample of 4000 will yield fewer than three ball bearings with bubbles or depressions?

  3. For an exponentially distributed random variable X, find the value of λ that satisfies the following relationship:

P(X≤3)=0.9P(X≤4) P (X \leq 3) = 0. 9 P (X \leq 4)
  1. Accidents at an industrial site occur one at a time, independently, and completely at random, at a mean rate of one per week. What is the probability that no accidents occur in the next three weeks?

  2. A component has an exponential time-to-failure distribution with mean of 10,000 hours.

(a) The component has already been in operation for its mean life. What is the probability that it will fail by 15,000 hours?

(b) At 15,000 hours, the component is still in operation. What is the probability that it wil operate for another 5000 hours?

  1. Suppose that a Die-Hardly-Ever battery has an exponential time-to-failure distribution with a mean of 48 months. At 60 months, the battery is still operating.

(a) What is the probability that this battery is going to die in the next 12 months?

(b) What is the probability that the battery dies in an odd year of its life?

(c) If the battery is operating at 60 months, compute the expected additional months of life.

  1. The time to service customers at a bank teller’s drive-through window is exponentially distributed with a mean of 50 seconds.

(a) What is the probability that the two customers in front of an arriving customer will each take less than 60 seconds to complete their transactions?

(b) What is the probability that the two customers in front will finish their transactions so tha an arriving customer can reach the teller’s window within 2 minutes?

  1. Determine the variance V(X) of the triangular distribution.

  2. The daily use of water, in thousands of liters, at the Hardscrabble Tool and Die Works follows a gamma distribution having shape parameter 2 and scale parameter 1/4. What is the probability that the demand exceeds 4000 liters on any given day?

  3. When Admiral Byrd went to the North Pole, he wore battery-powered thermal underwear. The batteries failed instantaneously rather than gradually. The batteries had a life that was exponentially distributed, with a mean of 12 days. The trip took 30 days. Admiral Byrd packed three batteries. What is the probability that three batteries would be a number sufficient to keep the Admiral warm?

  4. The time intervals between hits on a web page from remote computers are exponentially distributed, with a mean of 15 seconds. Find the probability that the third hit connection occurs after 30 seconds have elapsed.

  5. The rail shuttle cars at theAtlanta airport have a dual electrical braking system.A rail car switches to the standby system automatically if the first system fails. If both systems fail, there will be a crash! Assume that the life of a single electrical braking system is exponentially distributed, with a mean of 4000 operating hours. If the systems are inspected every 5000 operating hours, what is the probability that a rail car will not crash before that time?

  6. Suppose that cars arriving at a toll booth follow a Poisson process with a mean interarrival time of 15 seconds. What is the probability that up to one minute will elapse until three cars have arrived?

  7. Suppose that an average of 30 customers per hour arrive at the Sticky Donut Shop in accordance with a Poisson process. What is the probability that more than 5 minutes will elapse before both of the next two customers walk through the door?

  8. Professor Dipsy Doodle gives six problems on each exam. Each problem requires an average of 30 minutes grading time for the entire class of 15 students. The grading time for each problem is exponentially distributed, and the problems are independent of each other.

(a) What is the probability that the Professor will finish the grading in 2.5 hours or less?

(b) What is the most likely grading time?

(c) What is the expected grading time?

  1. An aircraft has dual hydraulic systems. The aircraft switches to the standby system automatically if the first system fails. If both systems fail, the plane will crash. Assume that the life of a hydraulic system is exponentially distributed, with a mean of 2000 air hours.

(a) If the hydraulic systems are inspected every 2500 hours, what is the probability that an aircraft will crash before that time?

(b) What danger would there be in moving the inspection point to 3000 hours?

  1. A random variable X is beta distributed if its pdf is given by
f(x)={(α+β+1)!α!β!xα(1−x)β,0<x<10,otherwise f (x) = \left\{\begin{array}{l l} \frac {(\alpha + \beta + 1) !}{\alpha ! \beta !} x^{\alpha} (1 - x) ^ {\beta}, & 0 < x < 1 \\ 0, & \text{otherwise} \end{array} \right.

Show that the beta distribution becomes the uniform distribution over the unit interval when β1=β2=1\beta_{1} = \beta_{2} = 132. Lead time is gamma distributed in 100s of units, with the shape parameter 3 and the scale parameter 1. What is the probability that the lead time exceeds 2 (hundred) units during an upcoming cycle?

  1. Lifetime of an inexpensive video card for a PC, in months, denoted by the random variable X, is gamma distributed with β=4\beta = 4 and θ=1/16\theta = 1 / 16. What is the probability that the card will last for at least 2 years?

  2. Many states have license plates that conform to the following format:

letter letter letter number number number

The numbers are at random, ranging from 100 to 999.

(a) What is the probability that the next two plates seen (at random) will have numbers of 500 or higher?

(b) What is the probability that the sum of the next two plates seen (at random) will have a tota of 1000 or higher? [Hint: Approximate the discrete uniform distribution with a continuous uniform distribution. The sum of two independent uniform distributions is a triangular distribution.]

  1. Let X be a random variable that is normally distributed, with mean 10 and variance 4. Find the values a and b such that $ P ( a < X < b ) = 0 . 90 {\mathrm{~ a n d ~}} | \mu - a | = | \mu - b |$# Statistical Models in Simulation

  2. Given the following distributions:

Normal (10, 4)

Triangular (4, 10, 16)

Uniform (4, 16)

find the probability that 6<X<86 < X < 8 for each of the distributions.

  1. Lead time for an item is approximated by a normal distribution with a mean of 20 days and a variance of 4 days^2. Find values of lead time that will be exceeded only 1%, 5%, and 10% of the time.

  2. IQ scores are normally distributed throughout society, with mean 100 and standard deviation 15.

(a) A person with an IQ of 140 or higher is called a “genius.” What proportion of society is in the genius category?

(b) What proportion of society will miss the genius category by 5 or less points?

(c) Suppose that an IQ of 110 or higher is required to make it through an accredited college or university. What proportion of society could be eliminated from completing a higher education by having a low IQ score?

  1. Three shafts are made and assembled into a linkage. The length of each shaft, in centimeters, is distributed as follows:

Shaft 1: N(60, 0.09)

Shaft 2: N(40, 0.05)

Shaft 3: N(50, 0.11)

(a) What is the distribution of the length of the linkage?

(b) What is the probability that the linkage will be longer than 150.2 centimeters?

(c) The tolerance limits for the assembly are (149.83, 150.21). What proportion of assemblies are within the tolerance limits? [Hint: If {Xi}\{X_{i} \} are n independent normal random variables, and if XiX_{i} has mean μi\mu_{i} and variance σi2\sigma_{i} ^ {2}, then the sum

Y=X1+X2+⋯+Xn Y = X_{1} + X_{2} + \dots + X_{n}

is normal with mean ∑i=1nμi\textstyle \sum_{i = 1} ^ {n} \mu_{i} and variance ∑i=1nσi2.]\textstyle \sum_{i = 1} ^ {n} \sigma_{i} ^ {2} . ]40. The circumferences of battery posts in a nickel-cadmium battery are Weibull-distributed with ν=3.25\nu = 3 . 25 centimeters,α=0.005\alpha = 0 . 005 centimeters, and β=1/3\beta = 1 / 3(a) Find the probability that a battery post chosen at random will have a circumference larger than 3.40 centimeters.

(b) If battery posts are larger than 3.50 centimeters, they will not go through the hole provided; if they are smaller than 3.30 centimeters, the clamp will not tighten sufficiently. Wha proportion of posts will have to be scrapped for one of these reasons?

  1. The time to failure of a nickel-cadmium battery is Weibull-distributed with parameters ν 0, α 1/2 years, and β=1/4\beta = 1 / 4(a) Find the fraction of batteries that are expected to fail prior to 1.5 years.

(b) What fraction of batteries are expected to last longer than the mean life?

(c) What fraction of batteries are expected to fail between 1.5 and 2.5 years?

  1. Demand for electricity at Gipgip Pig Farm for the merry merry month of May has a triangular distribution, with a 100 kwh and c 1800 kwh. The median kwh is 1425. Compute the modal value of kwh for the month.

  2. The time to failure on an electronic subassembly can be modeled by a Weibull distribution whose location parameter is 0, α 1000 hours, and β=1/2\beta = 1 / 2(a) What is the mean time to failure?

(b) What fraction of these subassemblies will fail by 3000 hours?

  1. The gross weight of three-axle trucks that have been checked at the Hahira Inspection Station on Interstate Highway 85 follows a Weibull distribution with parameters ν 6.8 tons, α 1/2 ton, and β = 1.5. Determine the appropriate weight limit such that 0.01 of the trucks will be cited for traveling overweight.

  2. The current reading on Sag Revas’s gas-mileage indicator is an average of 25.3 miles per gallon. Assume that gas mileage on Sag’s car follows a triangular distribution with a minimum value o zero and a maximum value of 50 miles per gallon. What is the value of the median?

  3. A postal letter carrier has a route consisting of five segments with the time in minutes to complete each segment being normally distributed, with means and variances as shown:

Tennyson PlaceN(38, 16)
Windsor ParkwayN(99, 29)
Knob Hill ApartmentsN(85, 25)
Evergreen DriveN(73, 20)
Chastain Shopping CenterN(52, 12)

In addition to the times just mentioned, the letter carrier must organize the mail at the central office, which activity requires a time that is distributed by N(90, 25). The drive to the starting point of the route requires a time that is distributed N(10, 4). The return from the route requires a time that is distributed N(15, 4). The letter carrier then performs administrative tasks with a time that is distributed N(30, 9).

(a) What is the expected length of the letter carrier’s work day?

(b) Overtime occurs after eight hours of work on a given day. What is the probability that the letter carrier works overtime on any given day?

(c) What is the probability that the letter carrier works overtime on two or more days in a six-day week?

(d) What is the probability that the route will be completed within 24 minutes of eight hours on any given day? [Hint: See Exercise 39.]

  1. The time to failure of a WD-1 computer chip is known to be Weibull-distributed with parameters ν=0,α=400days,\nu = 0 , \alpha = 400 \mathrm{d a y s} ,, and β=1/2\beta = 1 / 2. Find the fraction expected to survive 600 days.

  2. The TV sets on display at Schocker’s Department Store are hooked up such that, when one fails, a model exactly like the one that failed will switch on. Three such units are hooked up in this series arrangement. The lives of these TVs are independent of one another. Each TV has a life which is exponentially distributed, with a mean of 10,000 hours. Find the probability that the combined life of the system is greater than 32,000 hours.

  3. High temperature in Biloxi, Mississippi on July 21, denoted by the random variable X, has the following probability density function, where X is in degrees F.

f(x)={2(x−85)119,85≤x≤922(102−x)170,92<x≤1020,otherwise f (x) = \left\{\begin{array}{l l} \frac {2 (x - 85)}{119}, & 85 \leq x \leq 92 \\ \frac {2 (102 - x)}{170}, & 92 < x \leq 102 \\ 0, & \text{otherwise} \end{array} \right.

(a) What is the variance of the temperature V(X)? [Hint: If you worked Exercise 22, this is quite easy.]

(b) What is the median temperature?

(c) What is the modal temperature?

  1. The time to failure of Eastinghome light bulbs is Weibull-distributed with ν=1.8×103\nu = 1 . 8 \times 10^{3} hours,α=1/3×103\alpha = 1 / 3 \times 10^{3} hours, and β=1/2\beta = 1 / 2(a) What fraction of bulbs are expected to last longer than the mean lifetime?

(b) What is the median lifetime of a light bulb?

  1. Lead-time demand is gamma distributed in 100s of units, with shape parameter 2 and scale parameter 1/4. What is the probability that the lead time exceeds 4 (hundred) units during an upcoming cycle?

  2. Let time t=0t = 0 correspond to 6 A.M., and suppose that the arrival rate (in arrivals per hour) of customers to a breakfast restaurant that is open from 6 to 9 A.M. is

λ(t)={30,0≤t<145,1≤t<220,2≤t≤4 \lambda (t) = \left\{\begin{array}{l l} 30, & 0 \leq t < 1 \\ 45, & 1 \leq t < 2 \\ 20, & 2 \leq t \leq 4 \end{array} \right.

Assuming an NSPP model is appropriate, do the following: (a) Derive (t). (b) Compute the expected number of arrivals between 6:30 and 8:30 A.M. (c) Compute the probability that there are fewer than 60 arrivals between 6:30 and 8:30 A.M.

6 Queueing Models

Simulation is often used in the analysis of queueing models. In a simple but typical queueing model, shown in Figure 1, customers arrive from time to time and join a queue (waiting line), are eventually served, and finally leave the system. The term customer refers to any type of entity that can be viewed as requesting service from a system. Therefore, many service facilities, production systems, repair and maintenance facilities, communications and computer systems, and transport and material-handling systems can be viewed as queueing systems.

Queueing models, whether solved mathematically or analyzed through simulation, provide the analyst with a powerful tool for designing and evaluating the performance of queueing systems. Typical measures of system performance include server utilization (percentage of time a server is busy), length of waiting lines, and delays of customers. Quite often, when designing or attempting to improve a queueing system, the analyst (or decision maker) is involved in tradeoffs between server utilization and customer satisfaction in terms of line lengths and delays. Queueing theory and simulation analysis are used to predict these measures of system performance as a function of the input parameters. The input parameters include the arrival rate of customers, the service demands of customers, the rate at which a server works, and the number and arrangement of servers. To a certain degree, some of the input parameters are under management’s direct control. Consequently, the performance measures could be under their indirect control, provided that the relationship between the performance measures and the input parameters is adequately understood for the given system.

Figure 1 Simple queueing model.

For relatively simple systems, these performance measures can be computed mathematically—at great savings in time and expense as compared with the use of a simulation model—but, for realistic models of complex systems, simulation is usually required. Nevertheless, analytically tractable models, although usually requiring many simplifying assumptions, are valuable for rough-cut estimates of system performance. These rough-cut estimates may then be refined by use of a detailed and more realistic simulation model while also providing a way to verify that the simulation model has been programmed correctly. Simple models are also useful for developing an understanding of the dynamic behavior of queueing systems and the relationships between various performance measures. This chapter will not develop the mathematical theory of queues but instead will discuss some of the well-known models. For an elementary treatment of queueing theory, the reader is referred to the survey chapters in Hillier and Lieberman [2005] or Winston [2004]. More extensive treatments with a view toward applications are given by Cooper [1990], Gross and Harris [1997], Hall [1991] and Nelson [1995]. The latter two texts especially emphasize engineering and management applications.

This chapter discusses the general characteristics of queues, the meanings and relationships of the important performance measures, estimation of the mean measures of performance from a simulation, the effect of varying the input parameters, and the mathematical solution of a smal number of important and basic queueing models.

1 Characteristics of Queueing Systems

The key elements of a queueing system are the customers and servers. The term customer can refer to people, machines, trucks, mechanics, patients, pallets, airplanes, e-mail, cases, orders, or dirty clothes—anything that arrives at a facility and requires service. The term server might refer to receptionists, repair personnel, mechanics, medical personnel, automatic storage and retrieva machines (e.g., cranes), runways at an airport, automatic packers, order pickers, CPUs in a computer, or washing machines—any resource (person, machine, etc.) that provides the requested service. Although the terminology employed will be that of a customer arriving at a service facility, sometimes the server moves to the customer; for example, a repair person moving to a broken machine. This in no way invalidates the models but is merely a matter of terminology. Table 1 lists a number of different systems together with a subsystem consisting of arriving customers and one or more servers. The remainder of this section describes the elements of a queueing system in more detail.

Table 1 Examples of Queueing Systems

SystemCustomersServer(s)
Reception deskPeopleReceptionist
Repair facilityMachinesRepair person
GarageTrucksMechanic
Airport securityPassengersBaggage x-ray
HospitalPatientsNurses
WarehousePalletsFork-lift Truck
AirportAirplanesRunway
Production lineCasesCase-packer
WarehouseOrdersOrder-picker
Road networkCarsTraffic light
GroceryShoppersCheckout station
LaundryDirty linenWashing machines/dryers
Job shopJobsMachines/workers
LumberyardTrucksOverhead crane
SawmillLogsSaws
ComputerEmailCPU, disk
TelephoneCallsExchange
Ticket officeFootball fansClerk
Mass transitRidersBuses, trains

1.1 The Calling Population

The population of potential customers, referred to as the calling population, may be assumed to be finite or infinite. For example, consider the personal computers of the employees of a small company that are supported by an IT staff of three technicians. When a computer fails, needs new software, etc., it is attended by one of the IT staff. The computers are customers who arrive at the instant they need attention. The IT staff are the servers who provide repairs, software updates, etc. The calling population is finite and consists of the personal computers at the company.

In systems with a large population of potential customers, the calling population is usually assumed to be infinite. For such systems, this assumption is usually innocuous and, furthermore, it might simplify the model. Examples of infinite populations include the potential customers of a restaurant, bank, or other similar service facility and also the personal computers of the employees o a very large company. Even though the actual population could be finite but large, it is generally safe to use infinite population models, provided that the number of customers being served or waiting for service at any given time is a small proportion of the population of potential customers.

The main difference between finite and infinite population models is how the arrival rate is defined. In an infinite population model, the arrival rate (i.e., the average number of arrivals per uni of time) is not affected by the number of customers who have left the calling population andjoined the queueing system. When the arrival process is homogeneous over time (e.g., there are no rush hours), the arrival rate is usually assumed to be constant. On the other hand, for finite calling-population models, the arrival rate to the queueing system does depend on the number of customers being served and waiting. To take an extreme case, suppose that the calling population has one member, for example, a corporate jet. When the corporate jet is being serviced by the team of mechanics who are on duty 24 hours per day, the arrival rate is zero, because there are no other potential customers (jets) who can arrive at the service facility (team of mechanics). A more typical example is five hospita patients assigned to a single nurse. When all patients are resting and the nurse is idle, the arrival rate is at its maximum since any of the patients could call the nurse for assistance in the next instant. A those times when all five patients have called for the nurse (four are waiting for the nurse and one is being served) the arrival rate is zero; that is, no arrival is possible until the nurse finishes with a patient, in which case the patient returns to the calling population and becomes a potential arrival. It may seem odd that the arrival rate is at its maximum when all five patients are resting. But the arrival rate is defined as the expected number of arrivals in the next unit of time, so this expectation is largest when all patients could potentially call in the next unit of time.

1.2 System Capacity

In many queueing systems, there is a limit to the number of customers that may be in the waiting line or system. For example, an automatic car wash might have room for only 10 cars to wait in line to enter the mechanism. It might be too dangerous (or illegal) for cars to wait in the street. An arriving customer who finds the system full does not enter but returns immediately to the calling population. Some systems, such as in-person concert ticket sales for students, may be considered as having unlimited capacity, since there are no limits on the number of students allowed to wai to purchase tickets. As will be seen later, when a system has limited capacity, a distinction is made between the arrival rate (i.e., the number of arrivals per time unit) and the effective arrival rate (i.e., the number who arrive and enter the system per time unit).

1.3 The Arrival Process

The arrival process for infinite-population models is usually characterized in terms of interarrival times of successive customers. Arrivals may occur at scheduled times or at random times. When at random times, the interarrival times are usually characterized by a probability distribution. In addition, customers may arrive one at a time or in batches. The batch may be of constant size or o random size.

The most important model for random arrivals is the Poisson arrival process. If AnA_{n} represents the interarrival time between customer n 1 and customer n (A1( A_{1} is the actual arrival time of the firs customer), then, for a Poisson arrival process,AnA_{n} is exponentially distributed with mean 1/λ1 / \lambda time units. The arrival rate is λ customers per time unit. The number of arrivals in a time interval of length t, say N(t), has the Poisson distribution with mean λt customers.

The Poisson arrival process has been employed successfully as a model of the arrival of people to restaurants, drive-in banks, and other service facilities; the arrival of telephone calls to a call center; the arrival of demands, or orders for a service or product; and the arrival of failed components or machines to a repair facility. Typically, the Poisson arrival process is used to describe a large calling population from which customers make independent decisions about when to arrive.

A second important class of arrivals is scheduled arrivals, such as patients to a physician’s office or scheduled airline flight arrivals to an airport. In this case it is usually easier to model the positive or negative deviations from the scheduled arrival time, rather than the interarrival times.

A third situation occurs when at least one customer is assumed to always be present in the queue, so that the server is never idle because of a lack of customers. For example, the customers may represent raw material for a product, and sufficient raw material is assumed to be always available.

For finite-population models, the arrival process is characterized in a completely different fashion. Define a customer as pending when that customer is outside the queueing system and a member of the potential calling population. For example, a hospital patient is pending when they are resting, and becomes not pending the instant they call for the nurse. Define a runtime of a given customer as the length of time from departure from the queueing system until that customer’s next arrival to the queue. Let A1(i),A2(i),...A_{1} ^ {( i )} , A_{2} ^ {( i )} , . . .. be the successive runtimes of customer i; let S1(i),S2(i),…S_{1} ^ {( i )} , S_{2} ^ {( i )} , \ldots. be the corresponding successive service times; and let WQ1(i),WQ2(i),...W_{Q 1} ^ {( i )} , W_{Q 2} ^ {( i )} , . . .. be the corresponding waiting times for service to begin on each visit to the queueing system. Thus,Wn(i)=WOn(i)+Sn(i)W_{n} ^ {( i )} = W_{O n} ^ {( i )} + S_{n} ^ {( i )} is the total time spent in system by customer i during the nth visit. Figure 2 illustrates these concepts for patient 3 in the hospital example. The total arrival process is the superposition of the arrival times of all customers. Figure 2 shows the first and second arrival of patient 3, but these two times are not necessarily two successive arrivals to the system. For instance, if it is assumed that all patients are pending at time 0, the first arrival to the system occurs at time A1=min⁡{A1(1),A1(2),A1(3),A1(4),A1(5)}.IfˉA1=A1(2)A_{1} = \operatorname* {m i n} \{A_{1} ^ {( 1 )} , A_{1} ^ {( 2 )} , A_{1} ^ {( 3 )} , A_{1} ^ {( 4 )} , A_{1} ^ {( 5 )} \} . \mathrm {{\bar {I f}}} {A_{1}} = A_{1} ^ {( 2 )}, then patient 2 is the first arrival (i.e., the first to call for the nurse) after time 0. As discussed earlier, the arrival rate is not constant but is a function of the number of pending customers.

One important application of finite-population models is the machine-repair problem. The machines are the customers, and a runtime is also called time to failure. When a machine fails, it arrives at the queueing system (the repair facility) and remains there until it is served (repaired). Times to failure for a given class of machine have been characterized by the exponential, the Weibull, and the gamma distributions. Models with an exponential runtime are sometimes analytically tractable; an example is given in Section 5. Successive times to failure are usually assumed to be statistically independent, but they could depend on other factors, such as the age of a machine since its last major overhaul.

Patient 3 Status: Figure 2 Arrival process for a finite-population model.

1.4 Queue Behavior and Queue Discipline

Queue behavior refers to the actions of customers while in a queue waiting for service to begin. In some situations, there is a possibility that incoming customers will balk (leave when they see tha the line is too long), renege (leave after being in the line when they see that the line is moving too slowly), or jockey (move from one line to another if they think they have chosen a slow line).

Queue discipline refers to the logical ordering of customers in a queue and determines which customer will be chosen for service when a server becomes free. Common queue disciplines include first-in-first-out (FIFO), last-in-first-out (LIFO), service in random order (SIRO), shortest processing time first (SPT), and service according to priority (PR). In a manufacturing system, queue disciplines are sometimes based on due dates and on expected processing time for a given type ofjob. Notice tha a FIFO queue discipline implies that services begin in the same order as arrivals. but that customers could leave the system in a different order because of different-length service times.

1.5 Service Times and the Service Mechanism

The service times of successive arrivals are denoted by S1,S2,S3,...S_{1} , S_{2} , S_{3} , . . .. They may be constant or of random duration. In the latter case,{S1,S2,S3,…}\{S_{1} , S_{2} , S_{3} , \ldots \} is usually characterized as a sequence of independent and identically distributed random variables. The exponential, Weibull, gamma, lognormal, and truncated normal distributions have all been used successfully as models of service times in different situations. Sometimes services are identically distributed for all customers of a given type or class or priority, whereas customers of different types might have completely different servicetime distributions. In addition, in some systems, service times depend upon the time of day or upon the length of the waiting line. For example, servers might work faster than usual when the waiting line is long, thus effectively reducing the service times.

A queueing system consists of a number of service centers and interconnecting queues. Each service center consists of some number of servers, c, working in parallel; that is, upon getting to the head of the line, a customer takes the first available server. Parallel service mechanisms are either single server (c=1)( c = 1 ), multiple server (1<c<∞)( 1 < c < \infty ), or unlimited servers (c ). A self-service facility is usually characterized as having an unlimited number of servers.

Example 1

Consider a discount warehouse where customers may either serve themselves or wait for one of three clerks, then finally leave after paying a single cashier. The system is represented by the flow diagram in Figure 3. The subsystem, consisting of queue 2 and service center 2, is shown in more detail in Figure 4. Other variations of service mechanisms include batch service (a server serving several customers simultaneously) and a customer requiring several servers simultaneously. In the discount warehouse, a clerk might pick several small orders at the same time, but it may take two of the clerks to handle one heavy item.

Figure 3 Discount warehouse with three service centers.

Figure 4 Service center 2, with c 3 parallel servers.

Example 2

A candy manufacturer has a production line that consists of three machines separated by inventoryin-process buffers. The first machine makes and wraps the individual pieces of candy, the second packs 50 pieces in a box, and the third machine seals and wraps the box. The two inventory buffers have capacities of 1000 boxes each. As illustrated by Figure 5, the system is modeled as having three service centers, each center having c 1 server (a machine), with queue capacity constraints between machines. It is assumed that a sufficient supply of raw material is always available at the first queue. Because of the queue capacity constraints, machine 1 shuts down whenever its inventory buffer (queue 2) fills to capacity, and machine 2 shuts down whenever its buffer empties. In brief, the system consists of three single-server queues in series with queue capacity constraints and a continuous arrival stream at the first queue.

Figure 5 Candy-production line.

2 Queueing Notation

Recognizing the diversity of queueing systems, Kendall [1953] proposed a notational system for parallel server systems which has been widely adopted. An abridged version of this convention is based on the format A/B/c/N/KA / B / c / N / K. These letters represent the following system characteristics:

A represents the interarrival-time distribution.

B represents the service-time distribution.

c represents the number of parallel servers.

N represents the system capacity.

K represents the size of the calling population.

Common symbols for A and B include M (exponential or Markov), D (constant or deterministic),EkE_{k}(Erlang of order k), PH (phase-type), H (hyperexponential), G (arbitrary or general), and GI (genera independent).

For example,M/M/1/∞/∞M / M / 1 / {\infty} / {\infty} indicates a single-server system that has unlimited queue capacity and an infinite population of potential arrivals. The interarrival times and service times are exponentially distributed. When N and K are infinite, they may be dropped from the notation. For example,M/M/1/∞/∞M / M / 1 / {\infty} / {\infty} is often shortened to M/M/1M / M / 1. The nurse attending 5 hospital patients might be represented by M/M/1/5/5M / M / 1 / 5 / 5 Additional notation used throughout the remainder of this chapter for parallel server systems is listed in Table 2. The meanings may vary slightly from system to system. All systems will be assumed to have a FIFO queue discipline.

Table 2 Queueing Notation for Parallel Server Systems

PnP_nSteady-state probability of having n customers in system
Pn(t)P_n(t)Probability of n customers in system at time t
λ\lambdaArrival rate
λe\lambda_eEffective arrival rate
μ\muService rate of one server
ρ\rhoServer utilization
AnA_nInterarrival time between customers n - 1 and n
SnS_nService time of the nth arriving customer
WnW_nTotal time spent in system by the nth arriving customer
WnQW_n^QTotal time spent waiting in queue by customer n
L(t)L(t)The number of customers in system at time t
LQ(t)L_Q(t)The number of customers in queue at time t
LLong-run time-average number of customers in system
LQL_QLong-run time-average number of customers in queue
wLong-run average time spent in system per customer
wQw_QLong-run average time spent in queue per customer

3 Long-Run Measures of Performance of Queueing Systems

The primary long-run measures of performance of queueing systems are the long-run time-average number of customers in the system (L) and in the queue (LQ)( L_{Q} ), the long-run average time spent in system (w) and in the queue (wQ)( w_{Q} ) per customer, and the server utilization, or proportion of time tha a server is busy (ρ). The term system usually refers to the waiting line plus the service mechanism, but, in general, can refer to any subsystem of the queueing system; on the other hand, the term queue refers to the waiting line alone. Other measures of performance of interest include the long-run proportion of customers who are delayed in queue longer than t0t_{0} time units, the long-run proportion of customers turned away because of capacity constraints, and the long-run proportion of time the waiting line contains more than k0k_{0} customers.

This section defines the major measures of performance for a general G/G/c/N/KG / G / c / N / K queueing system, discusses their relationships, and shows how they can be estimated from a simulation run. There are two types of estimators: an ordinary sample average, and a time-integrated (or timeweighted) sample average.

3.1 Time-Average Number in System L

Consider a queueing system over a period of time T,T ,, and let L(t)L ( t ) denote the number of customers in the system at time t. A simulation of such a system is shown in Figure 6.^ {6 .} Let TiT_{i} denote the total time during [0, T] in which the system contained exactly i customers. In Figure 6,^ {6 ,} it is seen that T0=3,T1=12,T2=4T_{0} = 3 , T_{1} = 12 , T_{2} = 4, and T3=1T_{3} = 1. (The line segments whose lengths tota

Figure 6 Number in system, L(t), at time t.T1=12T_{1} = 12 are labeled "T1"" T_{1} " in Figure 6, etc.) In general,∑i=0∞Ti=T\textstyle \sum_{i = 0} ^ {\infty} T_{i} = T. The time-weighted-average number in a system is defined by

L^=1T∑i=0∞iTi=∑i=0∞i(TiT)(1) \widehat {L} = \frac {1}{T} \sum_{i = 0} ^ {\infty} i T_{i} = \sum_{i = 0} ^ {\infty} i \left(\frac {T_{i}}{T}\right)\tag{1}

For Figure 6,L^=[0(3)+1(12)+2(4)+3(1)]/20=23/20=1.156 , \widehat {L} = [ 0 ( 3 ) + 1 ( 12 ) + 2 ( 4 ) + 3 ( 1 ) ] / 20 = 23 / 20 = 1 . 15 customers. Notice that Ti/TT_{i} / Tis the proportion of time the system contains exactly i customers. The estimator L^\widehat {L} is an example of a time-weighted average.

By considering Figure 6,^ {6 ,} it can be seen that the total area under the function L(t)L ( t ) can be decomposed into rectangles of height i and length TiT_{i}. For example, the rectangle of area 3×T33 \times T_{3} has base running from t=7tot=8t = 7 \mathrm{t o} t = 8(thus T3=1);T_{3} = 1 ) ; however, most of the rectangles are broken into parts, such as the rectangle of area 2×T22 \times T_{2} which has part of its base between t=5t = 5 and t=7t = 7 and the remainder from t=8t = 8 to t=10t = 10(thus T2=2+2=4)T_{2} = 2 + 2 = 4 ). It follows that the total area is given by ∑i=0∞iTi=∫0TL(t)dt\textstyle \sum_{i = 0} ^ {\infty} i T_{i} = \int_{0} ^ {T} L ( t ) d t, and, therefore, that

L^=1T∑i=0∞iTi=1T∫0TL(t)dt(2) \widehat {L} = \frac {1}{T} \sum_{i = 0} ^ {\infty} i T_{i} = \frac {1}{T} \int_{0} ^ {T} L (t) d t\tag{2}

The expressions in Equations (1) and (2) are always equal for any queueing system, regardless of the number of servers, the queue discipline, or any other special circumstances. Equation (2) justifies the terminology time-integrated average.

Many queueing systems exhibit a certain kind of long-run stability in terms of their average performance. For such systems, as time TT gets large, the observed time-average number in the system L^\widehat {L} approaches a limiting value, say L,L , which is called the long-run time-average number in system—that is, with probability 1,

L^=1T∫0TL(t)dt⟶LasT⟶∞(3) \widehat {L} = \frac {1}{T} \int_{0} ^ {T} L (t) d t \longrightarrow L \text{as} T \longrightarrow \infty\tag{3}

The estimator L^\widehat {L} is said to be strongly consistent for L. If simulation run length T is sufficiently long, the estimator L^\widehat {L} becomes arbitrarily close to L. Unfortunately, for T<∞,L^T < \infty , \widehat {L} depends on the initia conditions at time 0.

Equations (2) and (3) can be applied to any subsystem of a queueing system as well as to the whole system. If LQ(t)L_{Q} ( t ) denotes the number of customers waiting in queue, and TiQT_{i} ^ {Q} denotes the tota time during [0,T][ 0 , T ] in which exactly i customers are waiting in queue, then

L^Q=1T∑i=0∞iTiQ=1T∫0TLQ(t)dt⟶LQasT⟶∞(4) \widehat {L} _ {Q} = \frac {1}{T} \sum_{i = 0} ^ {\infty} i T_{i} ^ {Q} = \frac {1}{T} \int_{0} ^ {T} L_{Q} (t) d t \longrightarrow L_{Q} \text{as} T \longrightarrow \infty\tag{4}

where L^Q\widehat {L} _ {Q} is the observed time-average number of customers waiting in queue from time 0 to time T and LQL_{Q}is the long-run time-average number waiting in queue.

Example 3

Suppose that Figure 6 represents a single-server queue—that is, a G/G/1/N/KG / G / 1 / N / K queueing system (N≥3,K≥3)( N \geq 3 , K \geq 3 ). Then the number of customers waiting in queue is given by LQ(t)L_{Q} ( t ), defined by

LQ(t)={0if L(t) = 0L(t)−1if L(t)≥1 L_{Q} (t) = \left\{\begin{array}{l l} 0 & \text{if L(t) = 0} \\ L (t) - 1 & \text{if }L(t)\geq 1 \end{array} \right.

and shown in Figure 7. Thus,T0Q=5+10=15,T1Q=2+2=4,T_{0} ^ {Q} = 5 + 10 = 15 , T_{1} ^ {Q} = 2 + 2 = 4 ,, and T2Q=1T_{2} ^ {Q} = 1. Therefore,

L^Q=0(15)+1(4)+2(1)20=0.3customers \widehat {L} _ {Q} = \frac {0 (15) + 1 (4) + 2 (1)}{20} = 0. 3 \text{customers}

3.2 Average Time Spent in System Per Customer w

If we simulate a queueing system for some period of time, say, T, then we can record the time each customer spends in the system during [0, T], say W1,W2,…,WNW_{1} , W_{2} , \ldots , W_{N}, where N is the number of arrivals during [0, T]. The average time spent in system per customer, called the average system time, is given by the ordinary sample average

w^=1N∑i=1NWi(5) \widehat {w} = \frac {1}{N} \sum_{i = 1} ^ {N} W_{i}\tag{5}

For stable systems, as N⟶∞N \longrightarrow \infty

w^⟶w(6) \widehat {w} \longrightarrow w\tag{6}

with probability 1, where w is called the long-run average system time.

Figure 7 Number waiting in queue,LQ(t)L_{Q} ( t ), at time t.

If the system under consideration is the queue alone, Equations (5) and (6) are written as

w^Q=1N∑i=1NWiQ⟶wQasN⟶∞(7) \widehat {w} _ {Q} = \frac {1}{N} \sum_{i = 1} ^ {N} W_{i} ^ {Q} \longrightarrow w_{Q} \mathrm{as} N \longrightarrow \infty\tag{7}

where WiQ{W} _ {i} ^ {Q} is the total time customer i spends waiting in queue,w^Q\widehat {w} _ {Q} is the observed average time spent in queue (called delay), and wQw_{Q}is the long-run average delay per customer. The estimators w and w^Q\widehat {w} _ {Q} are influenced by initial conditions at time 0 and the run length T, analogously to L^.\widehat {L} .

Example 4

For the system history shown in Figure 6,N=5N = 5 customers arrive,W1=2W_{1} = 2, and W5=20−16=4.W_{5} = 20 - 16 = 4 . but W2,W3W_{2} , W_{3}, and W4W_{4} cannot be computed unless more is known about the system. Assume that the system has a single server and a FIFO queue discipline. This implies that customers will depart from the system in the same order in which they arrived. Each jump upward of L(t)L ( t ) in Figure 6 represents an arrival. Arrivals occur at times 0, 3, 5, 7, and 16. Similarly, departures occur at times 2, 8, 10, and 14. (A departure may or may not have occurred at time 20.) Under these assumptions, it is apparen that W2=8−3=5,W3=10−5=5,W4=14−7=7W_{2} = 8 - 3 = 5 , W_{3} = 10 - 5 = 5 , W_{4} = 14 - 7 = 7, and therefore

w^=2+5+5+7+45=235=4.6time units \widehat {w} = \frac {2 + 5 + 5 + 7 + 4}{5} = \frac {23}{5} = 4. 6 \text{time units}

Thus, on the average, these customers spent 4.6 time units in the system. As for time spent in the waiting line, it can be computed that W1Q=0,W2Q=0,W3Q=8−5=3,W4Q=10−7=3W_{1} ^ {Q} = 0 , W_{2} ^ {Q} = 0 , W_{3} ^ {Q} = 8 - 5 = 3 , W_{4} ^ {Q} = 10 - 7 = 3, and W5Q=0;{\cal W} _ {5} ^ {Q} = 0 ; thus,

w^Q=0+0+3+3+05=1.2timeunits \widehat {w} _ {Q} = \frac {0 + 0 + 3 + 3 + 0}{5} = 1. 2 \mathrm{timeunits}

Equation (8) can also be derived by reconsidering Figure 6 in the following manner: Figure 8 shows system history,L(t)L ( t ), exactly as in Figure 6, with each customer’s time in the system,WiW_{i} represented by a rectangle. This representation again assumes a single-server system with a FIFO queue discipline. The rectangles for the third and fourth customers are in two and three separate pieces, respectively. The ith rectangle has height 1 and length WiW_{i} for each i=1,2,…,Ni = 1 , 2 , \dots , N. It follows that the total system time of all customers is given by the total area under the number-in-system function, L(t); that is,

∑i=1NWi=∫0TL(t)dt(10) \sum_{i = 1} ^ {N} W_{i} = \int_{0} ^ {T} L (t) d t\tag{10}

Therefore, by combining Equations (2) and (5) with λ^=N/T\widehat {\lambda} = N / T, it follows that

L^=1T∫0TL(t)dt=NT1N∑i=1NWi=λ^w^ \widehat {L} = \frac {1}{T} \int_{0} ^ {T} L (t) d t = \frac {N}{T} \frac {1}{N} \sum_{i = 1} ^ {N} W_{i} = \widehat {\lambda} \widehat {w}

which is Little’s equation (8). The intuitive and informal derivation presented here depended on the single-server FIFO assumptions, but these assumptions are not necessary. In fact, Equation (10), which was the key to the derivation, holds (at least approximately) in great generality, and thus so do Equations (8) and (9). Exercises 14 and 15 ask the reader to derive Equations (10) and (8) under different assumptions.

Figure 8 System times WiW_{i} for single-server FIFO system.

Technical note: If WiW_{i} is the system time for customer i during [0, T], then Equation (10) and hence Equation (8) hold exactly. Some authors choose to define WiW_{i} as total system time for customer i; this change will affect the value of WiW_{i} only for those customers i who arrive before time T bu do not depart until after time T (possibly customer 5 in Figure 8). With this change in definition, Equations (10) and (8) hold only approximately. Nevertheless, as T⟶∞andN⟶∞.T \longrightarrow \infty \mathrm{a n d} N \longrightarrow \infty ., the error in Equation (8) decreases to zero, and, therefore, the conservation equation (9) for long-run measures of performance—namely, L λw—holds exactly.

3.4 Server Utilization

Server utilization is defined as the proportion of time that a server is busy. Observed server utilization, denoted by ρ^,{\widehat {\rho}} , is defined over a specified time interval [0, T]. Long-run server utilization is denoted by ρ.\rho .For systems that exhibit long-run stability,

ρ^⟶ρasT⟶∞ \widehat {\rho} \longrightarrow \rho \text{as} T \longrightarrow \infty

Example 5

Per Figure 6 or 8, and assuming that the system has a single server, it can be seen that the server utilization is ρ^=\widehat {\rho} =(total busy time) /T=(∑i=1∞Ti)/T=(T−T0)/T=17/20\textstyle / T = ( \sum_{i = 1} ^ {\infty} T_{i} ) / T = ( T - T_{0} ) / T = 17 / 20

Server utilization in G/G/1/∞/∞ queues

Consider any single-server queueing system with average arrival rate λ customers per time unit, average service time E(S)=1/μE ( S ) = 1 / \mu time units, and infinite queue capacity and calling population. Notice that E(S)=1/μE ( S ) = 1 / \mu implies that, when busy, the server is working at the rate μ\mu customers per time unit, on the average;μ\mu is called the service rate. The server alone is a subsystem that can be considered as a queueing system in itself; hence, the conservation Equation (9),L=λwL = \lambda w, can be applied to the server. For stable systems, the average arrival rate to the server, say λs.\lambda_{s} ., must be identical to the average arrival rate to the system, λ (certainly λs≤λ−cu\lambda_{s} \le \lambda - \mathtt {c u} stomers cannot be served faster than they arrive—but, if λs < λ.\lambda_{s} ~ < ~ \lambda ., then the waiting line would tend to grow in length at an average rate of λ−λs\lambda - \lambda_{s} customers per time unit, and so we would have an unstable system). For the server subsystem, the average system time is w=E(S)=μ−1w = E ( S ) = \mu^{- 1}. The actual number of customers in the server subsystem is either 0 or 1, as shown in Figure 9 for the system represented by Figure 6. Hence, the average number in the server subsystem,L^s.\widehat {L} _ {s} ., is given by

L^s=1T∫0T(L(t)−LQ(t))dt=T−T0T \widehat {L} _ {s} = \frac {1}{T} \int_{0} ^ {T} (L (t) - L_{Q} (t)) d t = \frac {T - T_{0}}{T}

In this case,L^s=17/20=ρ^.\widehat {L} _ {s} = 17 / 20 = \widehat {\rho} . In general, for a single-server queue, the average number of customers being served at an arbitrary point in time is equal to server utilization. As T⟶∞,L^s=T \longrightarrow \infty , {\widehat {L}} _ {s} =ρ^⟶Ls=ρ\widehat {\rho} \longrightarrow L_{s} = \rho. Combining these results into L=λwL = \lambda w for the server subsystem yields

ρ=λE(S)=λμ(11) \rho = \lambda E (S) = \frac {\lambda}{\mu}\tag{11}

Figure 9 Number being served,L(t)−LQ(t)L ( t ) - L_{Q} ( t ), at time t.

that is,{\mathrm{i s}} , the long-run server utilization in a single-server queue is equal to the average arrival rate divided by the average service rate. For a single-server queue to be stable, the arrival rate λ must be less than the service rate μ:\mu {:}

λ<μ \lambda < \mu

or

ρ=λμ<1(12) \rho = \frac {\lambda}{\mu} < 1\tag{12}

If the arrival rate is greater than the service rate (λ>μ)( \lambda > \mu ), the server will eventually get further and further behind. After a time, the server will always be busy, and the waiting line will tend to grow in length at an average rate of (λ−μ)( \lambda - \mu ) customers per time unit, because departures will be occurring at rate μ\mu per time unit. For stable single-server systems (λ<μorρ<1)( \lambda < \mu \mathrm{o r} \rho < 1 ), long-run measures o performance such as average queue length LQL_{Q}(and also L,w,L , w ,, and wQ)w_{Q} ) are well defined and have meaning. For unstable systems (λ>μ)( \lambda > \mu ), long-run server utilization is 1, and long-run average queue length is infinite; that is,

1T∫0TLQ(t)dt⟶+∞asT⟶∞ \frac {1}{T} \int_{0} ^ {T} L_{Q} (t) d t \longrightarrow + \infty \text{as} T \longrightarrow \infty

Similarly,L=w=wQ=∞L = w = w_{Q} = \infty. Therefore these long-run measures of performance are meaningless for unstable queues. The quantity λ/μ\lambda / \mu is also called the offered load and is a measure of the workload imposed on the system.

Server utilization in G/G/c/ / queues

Consider a queueing system with c identical servers in parallel. If an arriving customer finds more than one server idle, the customer chooses a server without favoring any particular server. (For example, the choice of server might be made at random.) Arrivals occur at rate λ from an infinite calling population, and each server works at rate μ\mu customers per time unit. From Equation (9),L=λwL = \lambda w, applied to the server subsystem alone, an argument similar to the one given for a single server leads to the result that, for systems in statistical equilibrium, the average number of busy servers, say Ls.L_{s} ., is given by

Ls=λE(S)=λμ(13) L_{s} = \lambda E (S) = \frac {\lambda}{\mu}\tag{13}

Clearly,0≤Ls≤c.0 \leq L_{s} \leq c .. The long-run average server utilization is defined by

ρ=Lsc=λcμ(14) \rho = \frac {L_{s}}{c} = \frac {\lambda}{c \mu}\tag{14}

and so 0≤ρ≤10 \leq \rho \leq 1. The utilization ρ\rho can be interpreted as the proportion of time an arbitrary server is busy in the long run.

The maximum service rate of the G/G/c/∞/∞G / G / c / {\infty} / {\infty} system is cμc \mu, which occurs when all servers are busy. For the system to be stable, the average arrival rate λ must be less than the maximum service rate cμ;c \mu ; that is, the system is stable if and only if

λ<cμ(15) \lambda < c \mu\tag{15}

or, equivalently, if the offered load λ/μ\lambda / \mu is less than the number of servers c.If⁡λ>cμ\operatorname{I f} \lambda > c \mu, then arrivals are occurring, on the average, faster than the system can handle them, all servers will be continuously busy, and the waiting line will grow in length at an average rate of (λ−cμ)( \lambda - c \mu ) customers per time unit. Such a system is unstable, and the long-run performance measures (L,LQ,w( L , L_{Q} , w, and wQ)w_{Q} ) are again meaningless for such systems.

Notice that Condition (15) generalizes Condition (12), and the equation for utilization for stable systems, Equation (14), generalizes Equation (11).

Equations (13) and (14) can also be applied when some servers work more than others; for example, when customers favor one server over others, or when certain servers serve customers only if all other servers are busy. In this case, the LsL_{s} given by Equation (13) is still the average number o busy servers, but ρ,\rho , as given by Equation (14), cannot be applied to an individual server. Instead,ρ\rho must be interpreted as the average utilization of all servers.

Example 6

Customers arrive at random to a license bureau at a rate of λ=50\lambda = 50 customers per hour. Currently, there are 20 clerks, each serving μ=5\mu = 5 customers per hour on the average. Therefore the long-run, or steady-state, average utilization of a server, given by Equation (14), is

ρ=λcμ=5020(5)=0.5 \rho = \frac {\lambda}{c \mu} = \frac {50}{20 (5)} = 0. 5

and the average number of busy servers is

Ls=λμ=505=10 L_{s} = \frac {\lambda}{\mu} = \frac {50}{5} = 10

Thus, in the long run, a typical clerk is busy serving customers only 50% of the time. The office manager asks whether the number of servers can be decreased. By Equation (15), it follows that, for the system to be stable, it is necessary for the number of servers to satisfy

c>λμ c > \frac {\lambda}{\mu}

or c>50/5=10c > 50 / 5 = 10. Thus, possibilities for the manager to consider include c=11,orc=12.c = 11 , \mathrm{o r} c = 12 . or c=13,…c = 13 , \ldots. Notice that c≥11c \geq 11 guarantees long-run stability only in the sense that all servers, when busy, can handle the incoming work load (i.e.,cμ>λ)( \mathrm{i} . \mathrm{e} . , c \mu > \lambda ) on average. The office manager could well desire to have more than the minimum number of servers (c=11)( c = 11 ) because of other factors, such as customer delays and length of the waiting line. A stable queue can still have very long lines on average.

Figure 10 Deterministic queue (D/D/1)( D / D / 1 )

Server utilization and system performance

As will be illustrated here and in later sections, system performance can vary widely for a given value of utilization,ρ.\rho .. Consider a G/G/1/∞/∞G / G / 1 / {\infty} / {\infty} queue, that is, a single-server queue with arrival rate λ\lambda, service rate μ,\mu ,, and utilization ρ=λ/μ<1\rho = \lambda / \mu < 1 At one extreme, consider the D/D/1D / D / 1 queue, which has deterministic arrival and service times. Then all interarrival times {A1,A2,…}\left\{A_{1} , A_{2} , \ldots \right\} are equal to E(A)=1/λE ( A ) = 1 / \lambda, and all service times {S1,S2,…}\{S_{1} , S_{2} , \ldots \} are equal to E(S)=1/μ.AE ( S ) = 1 / \mu . \mathrm{A} ssuming that a customer arrives to an empty system at time 0, the system evolves in a completely deterministic and predictable fashion, as shown in Figure 10. Observe tha L=ρ=λ/μ,w=E(S)=μ−1L = \rho = \lambda / \mu , w = E ( S ) = \mu^{- 1}, and LQ=wQ=0L _ {\mathcal {Q}} = w _ {\mathcal {Q}} = 0. By varying λ\lambda and μ,\mu , server utilization can assume any value between 0 and 1, yet there is never any line whatsoever. What, then, causes lines to build, if not a high server utilization? In general, it is the variability of interarrival and service times that causes lines to fluctuate in length.

Example 7

Consider a physician who schedules patients every 10 minutes and who spends SiS_{i} minutes with the ith patient, where

Si={9minutes with probability0.912minutes with probability0.1 S_{i} = \left\{\begin{array}{l l} 9 \text{minutes with probability} 0. 9 \\ 12 \text{minutes with probability} 0. 1 \end{array} \right.

Thus, arrivals are deterministic (A1=A2=⋅⋅⋅=λ−1=10)( A_{1} = A_{2} = \cdot \cdot \cdot = \lambda^{- 1} = 10 ) but services are stochastic (or probabilistic), with mean and variance given by

E(Si)=9(0.9)+12(0.1)=9.3minutes E (S_{i}) = 9 (0. 9) + 12 (0. 1) = 9. 3 \mathrm{minutes}

Figure 11 Number of patients in the doctor’s office at time t.

and

V(Si)=E(Si2)−[E(Si)]2=92(0.9)+122(0.1)−(9.3)2=0.81minutes2 \begin{array}{r l} V (S_{i}) & = E (S_{i} ^ {2}) - [ E (S_{i}) ] ^ {2} \\ & = 9^{2} (0. 9) + 12^{2} (0. 1) - (9. 3) ^ {2} \\ & = 0. 81 \text{minutes} ^ {2} \end{array}

Here,ρ=λ/μ=E(S)/E(A)=9.3/10=0.93<1\rho = \lambda / \mu = E ( S ) / E ( A ) = 9 . 3 / 10 = 0 . 93 < 1, the system is stable, and the physician wil be busy 93% of the time in the long run. In the short run, lines will not build up as long as patients require only 9 minutes of service, but, because of the variability in the service times, 10% of the patients will require 12 minutes, which in turn will cause a temporary line to form.

Suppose the system is simulated with service times,S1=9,S2=12,S3=9,S4=9,S5=S_{1} = 9 , S_{2} = 12 , S_{3} = 9 , S_{4} = 9 , S_{5} =9, . . . . Assuming that at time 0 a patient arrived to find the doctor idle and subsequent patients arrived precisely at times 10, 20, 30, . . . , the system evolves as in Figure 11. The delays in queue are W1Q=W2Q=0,W3Q=22−20=2,W4Q=31−30=1,W5Q=0W_{1} ^ {Q} = W_{2} ^ {Q} = 0 , W_{3} ^ {Q} = 22 - 20 = 2 , W_{4} ^ {Q} = 31 - 30 = 1 , W_{5} ^ {Q} = 0. The occurrence of a relatively long service time (here S2=12)S_{2} = 12 ) caused a waiting line to form temporarily. In general, because of the variability of the interarrival and service distributions, relatively small interarrival times and relatively large service times occasionally do occur, and these in turn cause lines to lengthen. Conversely, the occurrence of a large interarrival time or a small service time will tend to shorten an existing waiting line. The relationship between utilization, service and interarrival variability, and system performance will be explored in more detail in Section 4.

3.5 Costs in Queueing Problems

In many queueing situations, costs can be associated with various aspects of the waiting line or servers. Suppose that the system incurs a cost for each customer in the queue, say, at a rate of $10 per hour per customer. If customerj spends WiQW_{i} ^ {\boldsymbol {Q}} hours in the queue, then ∑˙j=1N(S10˙⋅WjQ)\begin{array} {r} {\dot {\sum} _ {j = 1} ^ {N} ( \mathbb {S} 1 \dot {0} \cdot W_{j} ^ {Q} )} \end{array} is the tota cost of the N customers who arrive during the simulation. Thus, the average cost per customer is

∑j=1NS10⋅WjQN=S10⋅w^Q \sum_{j = 1} ^ {N} \frac {\mathbb {S} 10 \cdot W_{j} ^ {Q}}{N} = \mathbb {S} 10 \cdot \widehat {w} _ {Q}

by Equation (7). If λ^\widehat {\lambda} customers per hour arrive (on the average), the average cost per hour is

(λ^customershour)(10⋅w^Qcustomer)=10⋅λ^w^Q=10⋅L^Q/hour \left(\widehat {\lambda} \frac {\text{customers}}{\text{hour}}\right) \left(\frac {10 \cdot \widehat {w} _ {Q}}{\text{customer}}\right) = 10 \cdot \widehat {\lambda} \widehat {w} _ {Q} = 10 \cdot \widehat {L} _ {Q} / \text{hour}

the last equality following by Equation (8). An alternative way to derive the average cost per hour is to consider Equation (2). If T˙iQ˙\dot {T} _ {i} ^ {\dot {Q}} is the total time over the interval [0, T] that the system contains exactly i customers, then $10 iTiQi T_{i} ^ {Q} is the cost incurred by the system during the time exactly i customers are present. Thus, the total cost is ∑i=1∞(S10⋅iTiQ)\scriptstyle \sum_{i = 1} ^ {\infty} ( \mathbb {S} 10 \cdot i T_{i} ^ {Q} )), and the average cost per hour is

∑i=1∞10⋅iTiQT=10⋅L^Q/hour \sum_{i = 1} ^ {\infty} \frac {10 \cdot i T_{i} ^ {Q}}{T} = 10 \cdot \widehat {L} _ {Q} / \text{hour}

by Equation (2). In these cost expressions,L^Q\widehat {L} _ {Q} may be replaced by LQL_{Q}(if the long-run number in queue is known), or by L or L^\widehat {L}(if costs are incurred while the customer is being served in addition to being delayed).

The server may also impose costs on the system. If a group of c parallel servers (1≤c<∞)( 1 \leq c < \infty ) have utilization ρ,\rho , and each server imposes a cost of $5 per hour while busy, the total server cost per hour is

$5⋅cρ \$5 \cdot c \rho

because cρc \rho is the average number of busy servers. If server cost is imposed only when the servers are idle, then the server cost per hour would be

$5⋅c(1−ρ) \$5 \cdot c (1 - \rho)

because c(1−ρ)=c−cρc ( 1 - \rho ) = c - c \rho is the average number of idle servers. In many problems, two or more of these various costs are combined into a total cost. Such problems are illustrated by Exercises 1,8,12,8 , 12 ,, and 19. In most cases, the objective is to minimize total costs (given certain constraints) by varying those parameters that are under management’s control, such as the number of servers, the arrival rate, the service rate, and the system capacity.

4 Steady-State Behavior of Infinite-Population Markovian Models

This section presents steady-state results for a number of queueing models that can be solved mathematically. For the infinite-population models, the arrivals are assumed to follow a Poisson process with rate λ arrivals per time unit—that is, the interarrival times are assumed to be exponentially distributed with mean 1/λ1 / \lambda. Service times may be exponentially distributed (M) or arbitrarily (G). The queue discipline will be FIFO. Because of the exponential distribution assumptions on the arriva process, these models are called Markovian models.

A queueing system is said to be in statistical equilibrium, or steady state, if the probability that the system is in a given state is not time-dependent—that is,

P(L(t)=n)=Pn(t)=Pn P (L (t) = n) = P_{n} (t) = P_{n}

is independent of time t. Two properties—approaching statistical equilibrium from any starting state, and remaining in statistical equilibrium once it is reached—are characteristic of many stochastic models and, in particular, of all the systems studied in the following subsections. On the other hand, if an analyst were interested in the transient behavior of a queue over a relatively short period of time and were given some specific initial conditions (such as idle and empty), the results to be presented here would be inappropriate. A transient mathematical analysis or, more likely, a simulation mode would be the chosen tool of analysis.

The mathematical models whose solutions are shown in the following subsections can be used to obtain approximate results even when the assumptions of the model do not strictly hold. These results may be considered as a rough guide to the behavior of the system. A simulation may then be used for a more refined analysis. However, it should be remembered that a mathematical analysis (when it is applicable) provides the true value of the model parameter (e.g., L), whereas a simulation analysis delivers a statistical estimate (e.g., L^)( \mathrm{e . g . ,} \ \widehat {L} ) of the parameter. On the other hand, for complex systems, a simulation model is often a more faithful representation than a mathematical model.

For the simple models studied here, the steady-state parameter LiL_{i}, the time-average number of customers in the system, can be computed as

L=∑n=0∞nPn(16) L = \sum_{n = 0} ^ {\infty} n P_{n}\tag{16}

where {Pn}\{P_{n} \} are the steady-state probabilities of finding n customers in the system (as defined in Table 2). As was discussed in Section 3 and was expressed in Equation (3), L can also be interpreted as a long-run measure ofperformance ofthe system. Once L is given, the other steady-state parameters can be computed readily from Little’s equation (9) applied to the whole system and to the queue alone:

w=LλwQ=w−1μLQ=λwQ(17) \begin{array}{c} w = \frac {L}{\lambda} \\ w_{Q} = w - \frac {1}{\mu} \\ L_{Q} = \lambda w_{Q} \end{array}\tag{17}

where λ\lambda is the arrival rate and μ\mu is the service rate per server.

For the M/G/c/∞/∞M / G / c / {\infty} / {\infty} queues considered in this section to have a statistical equilibrium, a necessary and sufficient condition is that λ/(cμ)<1\lambda / ( c \mu ) < 1, where λ is the arrival rate,μ\mu is the service rate of one server, and c is the number of parallel servers. For these unlimited capacity, infinite-callingpopulation models, it is assumed that the theoretical server utilization,ρ=λ/(cμ)\rho = \lambda / ( c \mu )), satisfies ρ<1\rho < 1 For models with finite system capacity or finite calling population, the quantity λ/(cμ)\lambda / ( c \mu ) may assume any positive value.

Table 3 Steady-State Parameters of the M/G/1M / G / 1 Queue

ρλμLρ+λ2(1/μ2+σ2)2(1−ρ)=ρ+ρ2(1+σ2μ2)2(1−ρ)w1μ+λ(1/μ2+σ2)2(1−ρ)wQλ(1/μ2+σ2)2(1−ρ)LQλ2(1/μ2+σ2)2(1−ρ)=ρ2(1+σ2μ2)2(1−ρ)P01−ρ \begin{array}{l l} \hline \rho & \frac {\lambda}{\mu} \\ L & \rho + \frac {\lambda^{2} (1 / \mu^{2} + \sigma^{2})}{2 (1 - \rho)} = \rho + \frac {\rho^{2} (1 + \sigma^{2} \mu^{2})}{2 (1 - \rho)} \\ w & \frac {1}{\mu} + \frac {\lambda (1 / \mu^{2} + \sigma^{2})}{2 (1 - \rho)} \\ w_{Q} & \frac {\lambda (1 / \mu^{2} + \sigma^{2})}{2 (1 - \rho)} \\ L_{Q} & \frac {\lambda^{2} (1 / \mu^{2} + \sigma^{2})}{2 (1 - \rho)} = \frac {\rho^{2} (1 + \sigma^{2} \mu^{2})}{2 (1 - \rho)} \\ P_{0} & 1 - \rho \\ \hline \end{array}

Example 8

Customers arrive at a walk-in shoe repair shop apparently at random. It is assumed that arrivals occur according to a Poisson process at the rate λ=1.5\lambda = 1 . 5 per hour. Observation over several months has found that shoe repair times by the single worker take an average time of 30 minutes, with a standard deviation of 20 minutes. Thus the mean service time 1/μ=1/21 / \mu = 1 / 2 hour, the service rate is μ=2\mu = 2 per hour and σ2=(20)2\sigma^{2} = ( 20 ) ^ {2} minutes^2 1/9 hour^2. The “customers” are the people needing shoe repair, and the appropriate model is the M/G/1M / G / 1 queue, because only the mean and variance of service times are

known, not their distribution. The proportion of time the worker is busy is ρ=λ/μ=1.5/2=0.75\rho = \lambda / \mu = 1 . 5 / 2 = 0 . 75 and, by Table 3, the steady-state time average number of customers in the shop is

L=0.75+(1.5)2[(0.5)2+1/9]2(1−0.75)=0.75+1.625=2.375customers \begin{array}{r l} L & = 0. 75 + \frac {(1 . 5) ^ {2} [ (0 . 5) ^ {2} + 1 / 9 ]}{2 (1 - 0 . 75)} \\ & = 0. 75 + 1. 625 = 2. 375 \text{customers} \end{array}

Thus, an observer who notes the state of the shoe repair system at arbitrary times would find an average of 2.375 customers (over the long run).

A closer look at the formulas in Table 3 reveals the source of the waiting lines and delays in an M/G/1M / G / 1 queue. For example,LQL_{Q} may be rewritten as

LQ=ρ22(1−ρ)+λ2σ22(1−ρ) L_{Q} = \frac {\rho^{2}}{2 (1 - \rho)} + \frac {\lambda^{2} \sigma^{2}}{2 (1 - \rho)}

The first term involves only the ratio of the mean arrival rate λ to the mean service rate μ\mu. As shown by the second term, if λ and μ\mu are held constant, the average length of the waiting line (LQ)( L_{Q} ) depends on the variability,σ2\sigma^{2}, of the service times. If two systems have identical mean service times and mean interarrival times, the one with the more variable service times (larger σ2)\sigma^{2} ) will tend to have longer lines on the average. Intuitively, if service times are highly variable, then there is a high probability that a large service time will occur (say, much larger than the mean service time), and, when large service times do occur, there is a higher-than-usual tendency for lines to form and delays of customers to increase. (The reader should not confuse “steady state” with low variability or shor lines; a system in steady-state or statistical equilibrium can be highly variable and can have long waiting lines.)

Example 9

There are two workers competing for a job. Able claims an average service time that is faster than Baker’s, but Baker claims to be more consistent, even if not as fast. The arrivals occur according to a Poisson process at the rate λ=2\lambda = 2 per hour (1/30 per minute). Able’s service statistics are an average service time of 24 minutes with a standard deviation of 20 minutes. Baker’s service statistics are an average service time of 25 minutes, but a standard deviation of only 2 minutes. If the average length of the queue is the criterion for hiring, which worker should be hired? For Able,λ=1/30\lambda = 1 / 30 per minute,1/μ=241 / \mu = 24 minutes,σ2=202=400^\sigma^{2} = 20^{2} = \hat {400} minutes^2,ρ=λ/μ=24/30=4/5\rho = \lambda / \mu = 24 / 30 = 4 / 5, and the average queue length is computed as

LQ=(1/30)2[242+400]2(1−4/5)=2.711customers L_{Q} = \frac {(1 / 30) ^ {2} [ 24^{2} + 400 ]}{2 (1 - 4 / 5)} = 2. 711 \text{customers}

For Baker,λ=1/30\lambda = 1 / 30 per minute,1/μ=251 / \mu = 25 minutes,σ2=22=4\sigma^{2} = 2^{2} = 4 minutes^2,ρ=25/30=5/6\rho = 25 / 30 = 5 / 6 and the average queue length is

LQ=(1/30)2[252+4]2(1−5/6)=2.097customers L_{Q} = \frac {(1 / 30) ^ {2} [ 25^{2} + 4 ]}{2 (1 - 5 / 6)} = 2. 097 \text{customers}

Although working faster on the average, Able’s greater service variability results in an average queue length about 30% greater than Baker’s. On the basis of average queue length,LQ,L_{Q} ,, Baker wins. On the other hand, the proportion of arrivals who would find Able idle and thus experience no delay is P0=1−ρ=1/5=20%P_{0} = 1 - \rho = 1 / 5 = 20 \%, but the proportion who would find Baker idle and thus experience no delay is P0=1−ρ=1/6=16.7%P_{0} = 1 - \rho = 1 / 6 = 16 . 7 \% One case of the M/G/1M / G / 1 queue that is of special note occurs when service times are exponential, which we describe next.

The M/M/1 queue. Suppose that service times in an M/G/1M / G / 1 queue are exponentially distributed, with mean 1/μ;1 / \mu ; then the variance as given by Equation E(X)=1λ\begin{array} {r} {E ( X ) = \frac {1} {\lambda}} \end{array} and V(X)=1λ2isσ2=1/μ2\begin{array} {r} {V ( X ) = \frac {1} {\lambda^{2}} \mathrm {{i s}} \sigma^{2} = 1 / \mu^{2}} \end{array} The mean and standard deviation of the exponential distribution are equal, so the M¨/M/1\ddot {M} / M / 1 queue will often be a useful approximate model when service times have standard deviations approximately equal to their means. The steady-state parameters, given in Table 4, may be computed by substituting σ2^=1/μ2\sigma ^ {\hat {2}} = 1 / \mu^{2} into the formulas in Table 3. Alternatively, L may be computed by Equation (16) from the steady-state probabilities PnP_{n} given in Table 4, and then w,wQ.w_{Q} ., and LQL_{Q} may be computed from the equation in (17). The student can show that the two expressions for each parameter are equivalen by substituting ρ=λ/μ\rho = \lambda / \mu into the right-hand side of each equation in Table 4.

Table 4 Steady-State Parameters of the M/M/1M / M / 1 Queue

Lλμ−λ=ρ1−ρ L \quad \frac {\lambda}{\mu - \lambda} = \frac {\rho}{1 - \rho} w1μ−λ=1μ(1−ρ) w \quad \frac {1}{\mu - \lambda} = \frac {1}{\mu (1 - \rho)} wQλμ(μ−λ)=ρμ(1−ρ) w_{Q} \frac {\lambda}{\mu (\mu - \lambda)} = \frac {\rho}{\mu (1 - \rho)} LQλ2μ(μ−λ)=ρ21−ρ L_{Q} \frac {\lambda^{2}}{\mu (\mu - \lambda)} = \frac {\rho^{2}}{1 - \rho} Pn(1−λμ)(λμ)n=(1−ρ)ρn P_{n} \left(1 - \frac {\lambda}{\mu}\right) \left(\frac {\lambda}{\mu}\right) ^ {n} = (1 - \rho) \rho^{n}

Example 10

Suppose that the interarrival times and service times at a single-chair unisex hair-styling shop have been shown to be exponentially distributed. The values of λ and μ\mu are 2 per hour and 3 per hour, respectively—that is, the time between arrivals averages 1/21 / 2 hour, exponentially distributed, and the service time averages 20 minutes, also exponentially distributed. The server utilization and the probabilities for 0,1,2,3,0 , 1 , 2 , 3 ,, and 4 or more customers in the shop are computed as follows:

ρ=λμ=23 \rho = \frac {\lambda}{\mu} = \frac {2}{3} P0=1−λμ=13 P_{0} = 1 - \frac {\lambda}{\mu} = \frac {1}{3} P1=(13)(23)=29 P_{1} = \left(\frac {1}{3}\right) \left(\frac {2}{3}\right) = \frac {2}{9} P2=(13)(23)2=427 P_{2} = \left(\frac {1}{3}\right) \left(\frac {2}{3}\right) ^ {2} = \frac {4}{27} P3=(13)(23)3=881 P_{3} = \left(\frac {1}{3}\right) \left(\frac {2}{3}\right) ^ {3} = \frac {8}{81} P≥4=1−∑n=03Pn=1−13−29−427−881=1681 P_{\geq 4} = 1 - \sum_{n = 0} ^ {3} P_{n} = 1 - \frac {1}{3} - \frac {2}{9} - \frac {4}{27} - \frac {8}{81} = \frac {16}{81}

From the calculations, the probability that the hair stylist is busy is 1−P0=ρ=0.671 - P_{0} = \rho = 0 . 67; thus, the probability that the hair stylist is idle is 0.33. The time-average number of customers in the system is given by Table 4 as

L=λμ−λ=23−2=2customers L = \frac {\lambda}{\mu - \lambda} = \frac {2}{3 - 2} = 2 \text{customers}

The average time an arrival spends in the system can be obtained from Table 4 or Equation (17) as

w=Lλ=22=1hour w = \frac {L}{\lambda} = \frac {2}{2} = 1 \text{hour}

The average time the customer spends in the queue can be obtained from Equation (17) as

wQ=w−1μ=1−13=23hour w_{Q} = w - \frac {1}{\mu} = 1 - \frac {1}{3} = \frac {2}{3} \mathrm{hour}

From Table 4, the time-average number in the queue is given by

LQ=λ2μ(μ−λ)=43(1)=43customers L_{Q} = \frac {\lambda^{2}}{\mu (\mu - \lambda)} = \frac {4}{3 (1)} = \frac {4}{3} \mathrm{customers}

Finally, notice that multiplying w=wQ+1/μw = w_{Q} + 1 / \mu through by λ\lambda and using Little’s equation (9) yields

L=LQ+λμ=43+23=2customers L = L_{Q} + \frac {\lambda}{\mu} = \frac {4}{3} + \frac {2}{3} = 2 \text{customers}

Example 11

For the M/M/1M / M / 1 queue with service rate μ=10\mu = 10 customers per hour, consider how L and w increase as the arrival rate λ increases from 5 to 8.64 by increments of 20%, and then to λ=10\lambda = 10|λ\lambda| 5.0 | 6.0 | 7.2 | 8.64 | 10.0 |

ρ\rho0.5000.6000.7200.8641.0
LL1.001.502.576.35∞\infty
ww0.200.250.360.73∞\infty

For any M/G/1M / G / 1 queue, if λ/μ≥1\lambda / \mu \geq 1, waiting lines tend to continually grow in length; the long-run measures of performance,L,L , w,wQ,w_{Q} , and LQL_{Q} are all infinite (L=w=wO=LO=∞)( L = w = w_{O} = L_{O} = \infty ); and a steadystate probability distribution does not exist. As is shown here for λ<μ,\lambda < \mu ,, if ρ\rho is close to 1, waiting lines and delays will tend to be long. Notice that the increase in average system time w and average number in system L is highly nonlinear as a function of ρ.\rho .. For example, as λ increases by 20%, L increases first by 50% (from 1.00 to 1.50), then by 71% (to 2.57), and then by 147% (to 6.35).

Example 12

If arrivals are occurring at rate λ=10\lambda = 10 per hour, and management has a choice of two servers, one who works at rate μ1=11\mu_{1} = 11 customers per hour and the second at rate μ2=12\mu_{2} = 12 customers per hour, the respective utilizations are ρ1=λ/μ1=10/11=0.909\rho_{1} = \lambda / \mu_{1} = 10 / 11 = 0 . 909 and ρ2=λ/μ2=10/12=0.833\rho_{2} = \lambda / \mu_{2} = 10 / 12 = 0 . 833. If the M/M/1M / M / 1 queue is used as an approximate model, then, with the first server, the average number in the system would be, by Table 4,

L1=ρ11−ρ1=10 L_{1} = \frac {\rho_{1}}{1 - \rho_{1}} = 10

and, with the second server, the average number in the system would be

L2=ρ21−ρ2=5 L_{2} = \frac {\rho_{2}}{1 - \rho_{2}} = 5

Thus, an increase in service rate from 11 to 12 customers per hour, a mere 9.1% increase, would result in a decrease in average number in system from 10 to 5, which is a 50% decrease!

The effect of utilization and service variability

For any M/G/1M / G / 1 queue, if lines are too long, they can be reduced by decreasing the server utilization ρ\rho or by decreasing the service time variability σ2.\sigma^{2} .. These remarks hold for almost all queues, notjust the M/G/1M / G / 1 queue. The utilization factor ρ\rho can be reduced by decreasing the arrival rate λ,\lambda ,, by increasing the service rate μ,\mu , or by increasing the number of servers, because, in general,ρ=λ/(cμ)\rho = \lambda / ( c \mu )), where c is the number of parallel servers. The effect of additional servers will be studied in the following subsections.

The squared coefficient of variation (cv) of a positive random variable X is defined as

(cv)2=V(X)[E(X)]2 (\mathrm{cv}) ^ {2} = \frac {V (X)}{[ E (X) ] ^ {2}}

It is a measure of the variability of a distribution. The larger its value, the more variable is the distribution relative to its expected value. For deterministic service times,V(X)=0V ( X ) = 0, so cv⁡=0\operatorname{c v} = 0. For Erlang service times of order k,V(X)=1/(kμ2)k , V ( X ) = 1 / ( k \mu^{2} ) and E(X)=1/μE ( X ) = 1 / \mu, so cv=1/k\mathrm{c v} = 1 / \sqrt {k}. For exponentia service times at service rate μ.\mu ., the mean service time is E(X)=1/μE ( X ) = 1 / \mu and the variance is V(X)=1/μ2V ( X ) = 1 / \mu^{2} so cv=1\mathbf{c} \mathbf{v} = 1. If service times have standard deviation greater than their mean (i.e.,ifcv>1)( \mathrm{i . e . , i f cv > 1} )), then the hyperexponential distribution, which can achieve any desired coefficient of variation greater than 1, provides a good model. One occasion where it arises is given in Exercise 16.

The formula for LQL_{Q} for any M/G/1M / G / 1 queue can be rewritten in terms of the coefficient of variation by noticing that (cv)2=σ2/(1/μ)2=σ2μ2\mathrm{( c v )} ^ {2} = \sigma^{2} / ( 1 / \mu ) ^ {2} = \sigma^{2} \mu^{2}. Therefore,

LQ=ρ2(1+σ2μ2)2(1−ρ)=ρ2(1+(cv)2)2(1−ρ)=(ρ21−ρ)(1+(cv)22)(18) \begin{array}{r l} L_{Q} & = \frac {\rho^{2} (1 + \sigma^{2} \mu^{2})}{2 (1 - \rho)} \\ & = \frac {\rho^{2} (1 + (\mathrm{cv}) ^ {2})}{2 (1 - \rho)} \\ & = \left(\frac {\rho^{2}}{1 - \rho}\right) \left(\frac {1 + (\mathrm{cv}) ^ {2}}{2}\right) \end{array}\tag{18}

The first term,ρ2/(1−ρ)\rho^{2} / ( 1 - \rho ), is LQL_{Q} for an M/M/1M / M / 1 queue. The second term,(1+(cv)2)/2\left( 1 + ( \mathrm{c v} ) ^ {2} \right) / 2, corrects the M/M/1M / M / 1 formula to account for a nonexponential service-time distribution. The formula for wQw_{Q} can be obtained from the corresponding M/M/1M / M / 1 formula by applying the same correction factor. These factors,ρ2/(1−ρ)\rho^{2} / ( 1 - \rho ) and (1+(cv)2)/2\left( 1 + \left( \mathrm{c v} \right) ^ {2} \right) / 2, provide some insight into the relative impact of server utilization and server variability on queue congestion:LQL_{Q} explodes as ρ → 1\rho \ \to \ 1 while increasing linearly in (cv)2( \mathbf{c} \mathbf{v} ) ^ {2} for fixed ρ.\rho .

4.2 Multiserver Queue: M/M/c/ /

Suppose that there are c channels operating in parallel. Each of these channels has an independent and identical exponential service-time distribution, with mean 1/μ1 / \mu. The arrival process is Poisson with rate λ. Arrivals will join a single queue and enter the first available service channel. The queueing system is shown in Figure 12. If the number in system is n<c,n < c ,, an arrival will enter an available channel. However, when n≥c.n \geq c ., a queue will build if arrivals occur.

The offered load is defined by λ/μ. H λ≥cμ\lambda / \mu . \mathrm{~ H ~} \lambda \ge c \mu, the arrival rate is greater than or equal to the maximum service rate of the system (the service rate when all servers are busy); thus, the system cannot handle the load put upon it, and therefore it has no statistical equilibrium. If λ>cμ\lambda > c \mu, the waiting line grows in length at the rate λ−cμ\lambda - c \mu customers per time unit, on the average. Customers are entering the system at rate λ\lambda per time unit but are leaving the system at a maximum rate of cμc \mu per time unit.

For the M/M/cM / M / c queue to have statistical equilibrium, the offered load must satisfy λ/μ<c\lambda / \mu < c, in which case λ/(cμ)=ρ;\lambda / ( c \mu ) = \rho_{;}, the server utilization. The steady-state parameters are listed in Table 5. Most of the measures of performance can be expressed fairly simply in terms of P0P_{0}, the probability that the system is empty,or⁡∑n=c∞Pn.\textstyle \operatorname{o r} \sum_{n = c} ^ {\infty} P_{n} ., the probability that all servers are busy, denoted by P(L(∞)≥c)P ( L ( \infty ) \geq c ), where L(∞)L ( \infty ) is a random variable representing the number in system in statistical equilibrium (after a very long time). Thus,P(L(∞)=n)=Pn,n=0,1,2,….P ( L ( \infty ) = n ) = P_{n} , n = 0 , 1 , 2 , \ldots . The value of P0P_{0} is necessary for computing all the measures of performance, and the equation for P0P_{0} is somewhat more complex than in the previous cases. However, the spreadsheet QueueingTools.xls available at www.bcnn.net performs these calculations for this and all queueing models described in the chapter.

Figure 12 Multiserver queueing system.

Table 5 Steady-State Parameters for the M/M/cM / M / c Queue

ρλ/cμ
P0{[∑n=0c-1/(λ/μ)n/n! ] + [ (λ/μ)c(1/c!) (cμ/cμ-λ)]}-1
= {[∑n=0c-1/(cρ)n/n! ] + [ (cρ)c(1/c!) 1/1-ρ]}-1
P(L(∞)≥c)(λ/μ)cP0/c!(1-λ/cμ) = (cρ)cP0/c!(1-ρ)
Lcρ + (cρ)c+1P0/c(c!(1-ρ)2) = cρ + ρP(L(∞)≥c)/1-ρ
wL/λ
wQw - 1/μ
LQλwQ = (cρ)c+1P0/c(c!(1-ρ)2) = ρP(L(∞)≥c)/1-ρ
L - LQλ/μ = cρ

The results in Table 5 simplify to those in Table 4 when c=1c = 1, the case of a single server. Notice that the average number of busy servers, or the average number of customers being served, is given by the simple expression L−LQ=λ/μ=cρL - L_{Q} = \lambda / \mu = c \rho

Example 13

Many early examples of queueing theory applied to practical problems concerning tool cribs. Attendants manage the tool cribs as mechanics, assumed to be from an infinite calling population, arrive for service. However, this example could as easily be customers arriving to the ticket counter at a movie theater. Assume Poisson arrivals at rate 2 mechanics per minute and exponentially distributed service times with mean 40 seconds.

Now,λ=2\lambda = 2 per minute, and μ=60/40=3/2\mu = 60 / 40 = 3 / 2 per minute. The offered load is greater than 1:

λμ=23/2=43>1 \frac {\lambda}{\mu} = \frac {2}{3 / 2} = \frac {4}{3} > 1

so more than one server is needed if the system is to have a statistical equilibrium. The requirement for steady state is that c>λ/μ=4/3c > \lambda / \mu = 4 / 3. Thus at least c=2c = 2 attendants are needed. The quantity 4/3 is the expected number of busy servers, and for c≥2,ρ=4/(3c)c \geq 2 , \rho = 4 / ( 3 c ) is the long-run proportion of time each server is busy. (What would happen if there were only c=1c = 1 server?)

Let there be c=2c = 2 attendants. First,P0P_{0} is calculated as

P0={∑n=01(4/3)nn!+(43)2(12!)[2(3/2)2(3/2)−2]}−1={1+43+(169)(12)(3)}−1=(153)−1=15=0.2 \begin{array}{l} P_{0} = \left\{\sum_{n = 0} ^ {1} \frac {(4 / 3) ^ {n}}{n !} + \left(\frac {4}{3}\right) ^ {2} \left(\frac {1}{2 !}\right) \left[ \frac {2 (3 / 2)}{2 (3 / 2) - 2} \right] \right\} ^ {- 1} \\ = \left\{1 + \frac {4}{3} + \left(\frac {16}{9}\right) \left(\frac {1}{2}\right) (3) \right\} ^ {- 1} = \left(\frac {15}{3}\right) ^ {- 1} = \frac {1}{5} = 0. 2 \end{array}

Next, the probability that all servers are busy is computed as

P(L(∞)≥2)=(4/3)22!(1−2/3)(15)=(83)(15)=815=0.533 P (L (\infty) \geq 2) = \frac {(4 / 3) ^ {2}}{2 ! (1 - 2 / 3)} \left(\frac {1}{5}\right) = \left(\frac {8}{3}\right) \left(\frac {1}{5}\right) = \frac {8}{15} = 0. 533

Thus, the time-average length of the waiting line of mechanics is

LQ=(2/3)(8/15)1−2/3=1.07mechanics L_{Q} = \frac {(2 / 3) (8 / 15)}{1 - 2 / 3} = 1. 07 \mathrm{mechanics}

and the time-average number in system is given by

L=LQ+λμ=1615+43=125=2.4mechanics L = L_{Q} + \frac {\lambda}{\mu} = \frac {16}{15} + \frac {4}{3} = \frac {12}{5} = 2. 4 \text{mechanics}

From Little’s relationships, the average time a mechanic spends at the tool crib is

w=Lλ=2.42=1.2minutes w = \frac {L}{\lambda} = \frac {2 . 4}{2} = 1. 2 \text{minutes}

and the average time spent waiting for an attendant is

wQ=w−1μ=1.2−23=0.533minute w_{Q} = w - \frac {1}{\mu} = 1. 2 - \frac {2}{3} = 0. 533 \mathrm{minute}

An Approximation for the M/G/c/∞ Queue

Recall that formulas for LQL_{Q} and wQw_{Q} for the M/G/1M / G / 1 queue can be obtained from the corresponding M/M/1M / M / 1 formulas by multiplying them by the correction factor (1+(cv)2)/2\left( 1 + ( \mathrm{c v} ) ^ {2} \right) / 2, as in Equation (18). Approximate formulas for the M/G/cM / G / c queue can be obtained by applying the same correction factor to the M/M/cM / M / c formulas for LQL_{Q} and wQw_{Q}(no exact formula exists for 1<c<∞)1 < c < \infty ). The nearer the cv is to 1, the better the approximation.

Example 14

Recall Example 13. Suppose that the service times for the mechanics at the tool crib are not exponentially distributed, but are known to have a standard deviation of 30 seconds. Then we have an M/G/cM / G / c model, rather than an M/M/cM / M / c. The mean service time is 40 seconds, so the coefficient o variation of the service time is

cv=3040=34<1 \mathrm{cv} = \frac {30}{40} = \frac {3}{4} < 1

Therefore, the accuracy of LQL_{Q} and wQw_{Q} can be improved by the correction factor

1+(cv)22=1+(3/4)22=2532=0.78 \frac {1 + (\mathrm{cv}) ^ {2}}{2} = \frac {1 + (3 / 4) ^ {2}}{2} = \frac {25}{32} = 0. 78

For example, when there are c=2c = 2 attendants,

LQ=(0.78)(1.07)=0.83mechanics L_{Q} = (0. 78) (1. 07) = 0. 83 \text{mechanics}

Notice that, because the coefficient of variation of the service time is less than 1, the congestion in the system, as measured by LQL_{Q}, is less than in the corresponding M/M/2M / M / 2 model.

The correction factor applies only to the formulas for LQL_{Q} and wQ.w_{Q} .. Little’s formula can then be used to calculate L and w. Unfortunately, there is no general method for correcting the steady-state probabilities,PnP_{n}

  1. when each customer is its own server—in other words, in a self-service system;

  2. when service capacity far exceeds service demand, as in a so-called ample-server system; and

  3. when we want to know how many servers are required so that customers will rarely be delayed.

The steady-state parameters for the M/G/∞M / G / \infty queue are listed in Table 6. In the table, λ is the arrival rate of the Poisson arrival process, and 1/μ1 / \mu is the expected service time of the general service-time distribution (including exponential, constant, or any other).

Table 6 Steady-State Parameters for the M/G/∞M / G / \infty Queue

P0P_0e−λ/μe^{-\lambda/\mu}
ww1μ\frac{1}{\mu}
wQw_Q0
LLλμ\frac{\lambda}{\mu}
LQL_Q0
PnP_ne−λ/μ(λ/μ)nn!,n=0,1,…\frac{e^{-\lambda/\mu}(\lambda/\mu)^n}{n!}, n=0,1,\ldots

Example 15

Prior to introducing their new, subscriber-only, online computer information service, The Connection must plan their system capacity in terms of the number of users that can be logged on simultaneously. If the service is successful, customers are expected to log on at a rate of λ=500\lambda = 500 per hour, according to a Poisson process, and stay connected for an average of 1/μ=1801 / \mu = 180 minutes (or 3 hours). In the real system, there will be an upper limit on simultaneous users, but, for planning purposes, The Connection can pretend that the number of simultaneous users is infinite. An M/G/∞M / G / \infty model of the system implies that the expected number of simultaneous users is L=λ/μ=500(3)=1500L = \lambda / \mu = 500 ( 3 ) = 1500, so a capacity greater than 1500 is certainly required. To ensure providing adequate capacity 95% of the time, The Connection could allow the number of simultaneous users to be the smallest value c such that

P(L(∞)≤c)=∑n=0cPn=∑n=0ce−1500(1500)nn!≥0.95 P (L (\infty) \leq c) = \sum_{n = 0} ^ {c} P_{n} = \sum_{n = 0} ^ {c} \frac {e^{- 1500} (1500) ^ {n}}{n !} \geq 0. 95

The capacity c=1564c = 1564 simultaneous users satisfies this requirement.

Table 7 Steady-State Parameters for the M/M/c/NM / M / c / N Queue

(N=System Capacity,a=λ/μ,ρ=λ/(cμ))P0[1+∑n=1cann!+acc!∑n=c+1Nρn−c]−1PNaNc!cN−cP0LQP0acρc!(1−ρ)2[1−ρN−c−(N−c)ρN−c(1−ρ)]λeλ(1−PN)wQLQλewwQ+1μLλew \begin{array}{l l} (N = \text{System Capacity}, a = \lambda / \mu , \rho = \lambda / (c \mu)) \\ \hline P_{0} & \left[ 1 + \sum_{n = 1} ^ {c} \frac {a^{n}}{n !} + \frac {a^{c}}{c !} \sum_{n = c + 1} ^ {N} \rho^{n - c} \right] ^ {- 1} \\ P_{N} & \frac {a^{N}}{c ! c^{N - c}} P_{0} \\ L_{Q} & \frac {P_{0} a^{c} \rho}{c ! (1 - \rho) ^ {2}} \left[ 1 - \rho^{N - c} - (N - c) \rho^{N - c} (1 - \rho) \right] \\ \lambda_{e} & \lambda (1 - P_{N}) \\ w_{Q} & \frac {L_{Q}}{\lambda_{e}} \\ w & w_{Q} + \frac {1}{\mu} \\ L & \lambda_{e} w \end{array}

The effective arrival rate λe\lambda_{e} is defined as the mean number of arrivals per time unit who enter and remain in the system. For all systems,λe≤λ:\lambda_{e} \leq \lambda _ {\mathrm{:}}; for the unlimited-capacity systems,λe=λ;\lambda_{e} = \lambda ;; but, for systems such as the present one, which turn customers away when full,λe < λ\lambda_{e} \ < \ \lambda. The effective arrival rate is computed by

λe=λ(1−PN) \lambda_{e} = \lambda (1 - P_{N})

because 1−PN1 - P_{N} is the probability that a customer, upon arrival, will find space and be able to enter the system. When one is using Little’s equations (17) to compute mean time spent in system w and in queue wQ,w_{Q} ,, λ must be replaced by λe\lambda_{e}

Example 16

The unisex hair-styling shop described in Example 10 can hold only three customers: one in service, and two waiting. Additional customers are turned away when the system is full. The offered load is as previously determined, namely λ/μ=2/3\lambda / \mu = 2 / 3 To calculate the performance measures, first compute P0:P_{0} \mathrm {{:}}

P0=[1+23+23∑n=23(23)n−1]−1=0.415 P_{0} = \left[ 1 + \frac {2}{3} + \frac {2}{3} \sum_{n = 2} ^ {3} \left(\frac {2}{3}\right) ^ {n - 1} \right] ^ {- 1} = 0. 415

The probability that there are three customers in the system (the system is full) is

PN=P3=(2/3)31!12P0=865=0.123 P_{N} = P_{3} = \frac {(2 / 3) ^ {3}}{1 ! 1^{2}} P_{0} = \frac {8}{65} = 0. 123

Then, the average length of the queue (customers waiting for a haircut) is given by

LQ=(27/65)(2/3)(2/3)(1−2/3)2[1−(2/3)2−2(2/3)2(1−2/3)]=0.431customer L_{Q} = \frac {(27 / 65) (2 / 3) (2 / 3)}{(1 - 2 / 3) ^ {2}} \left[ 1 - (2 / 3) ^ {2} - 2 (2 / 3) ^ {2} (1 - 2 / 3) \right] = 0. 431 \text{customer}

Now, the effective arrival rate λe\lambda_{e} is given by

λe=2(1−865)=11465=1.754customers per hour \lambda_{e} = 2 \left(1 - \frac {8}{65}\right) = \frac {114}{65} = 1. 754 \text{customers per hour}

Therefore, from Little’s equation, the expected time spent waiting in queue is

wQ=LQλe=28114=0.246hour w_{Q} = \frac {L_{Q}}{\lambda_{e}} = \frac {28}{114} = 0. 246 \mathrm{hour}

and the expected total time in the shop is

w=wQ+1μ=66114=0.579hour w = w_{Q} + \frac {1}{\mu} = \frac {66}{114} = 0. 579 \mathrm{hour}

One last application of Little’s equation gives the expected number of customers in the shop (in queue and getting a haircut) as

L=λew=6665=1.015customers L = \lambda_{e} w = \frac {66}{65} = 1. 015 \text{customers}

Notice that 1−P0=0.5851 - P_{0} = 0 . 585 is the average number of customers being served or, equivalently, the probability that the single server is busy. Thus, the server utilization, or proportion of time the server is busy in the long run, is given by

1−P0=λeμ=0.585 1 - P_{0} = \frac {\lambda_{e}}{\mu} = 0. 585

The reader should compare these results to those of the unisex hair-styling shop before the capacity constraint was placed on the system. Specifically, in systems with limited capacity, the offered load λ/μ\lambda / \mu can assume any positive value and no longer equals the server utilization ρ=\rho =λe/μ\lambda_{e} / \mu. Notice that server utilization decreases from 67% to 58.5% when the system imposes a capacity constraint.

Consider a finite-calling-population model with K customers. The time between the end of one service visit and the next call for service for each member of the population is assumed to be exponentially distributed with mean 1/λ1 / \lambda time units; service times are also exponentially distributed, with mean 1/μ1 / \mu time units; there are c parallel servers, and system capacity is K, so that all arrivals remain for service. Such a system is depicted in Figure 13.

The steady-state parameters for this model are listed in Table 8. An electronic spreadsheet or a symbolic calculation program is useful for evaluating these complex formulas. For example, Figure 14 is a procedure written for the symbolic calculation program MATLAB to calculate the steady-state probabilities for the M/M/c/K/KM / M / c / K / K queue. The spreadsheet QueueingTools.xls available at www.bcnn.net also performs these calculations.

Figure 13 Finite-population queueing model.

Table 8 Steady-State Parameters for the M/M/c/K/KM / M / c / K / K Queue

[∑n=0c−1(Kn)(λμ)n+∑n=cKK!(K−n)!c!cn−c(λμ)n]−1 \left[ \sum_{n = 0} ^ {c - 1} \binom {K} {n} \left(\frac {\lambda}{\mu}\right) ^ {n} + \sum_{n = c} ^ {K} \frac {K !}{(K - n) ! c ! c^{n - c}} \left(\frac {\lambda}{\mu}\right) ^ {n} \right] ^ {- 1} Pn{(Kn)(λμ)nP0,n=0,1,…,c−1K!(K−n)!c!cn−c(λμ)nP0,n=c,c+1,…,K P_{n} \qquad \left\{\begin{array}{l l} \binom {K} {n} \left(\frac {\lambda}{\mu}\right) ^ {n} P_{0}, & n = 0, 1, \ldots , c - 1 \\ \frac {K !}{(K - n) ! c ! c^{n - c}} \left(\frac {\lambda}{\mu}\right) ^ {n} P_{0}, & n = c, c + 1, \ldots , K \end{array} \right. L∑n=0KKnPn L\qquad \sum_{\substack{n = 0\\ K}}^{K}nP_{n} LQ∑n=c+1KK(n−c)Pn L_{Q}\qquad \sum_{\substack{n = c + 1\\ K}}^{K}(n - c)P_{n} λe∑n=0K(K−n)λPn \lambda_{e} \quad \sum_{n = 0} ^ {K} (K - n) \lambda P_{n} wL/λe w \qquad L / \lambda_{e} wQLQ/λe w_{Q} \qquad L_{Q} / \lambda_{e} ρL−LQc=λecμ \rho \qquad \frac {L - L_{Q}}{c} = \frac {\lambda_{e}}{c \mu}

The effective arrival rate λe\lambda_{e} has several valid interpretations:

λ long-run effective arrival rate of customers to the queue

long-run effective arrival rate of customers entering service

long-run rate at which customers exit from service

long-run rate at which customers enter the calling population (and begin a new runtime)

long-run rate at which customers exit from the calling population

Example 17

There are two workers who are responsible for 10 milling machines. The machines run on the average for 20 minutes, then require an average 5-minute service period, both times exponentially distributed. Therefore,λ=1/20\lambda = 1 / 20 and μ=1/5\mu = 1 / 5. Compute the various measures of performance for this system.

All of the performance measures depend on P0,P_{0} ,, which is

[∑n=02−1(10n)(520)n+∑n=c1010!(10−n)!2!2n−2(520)n]−1=0.065 \left[ \sum_{n = 0} ^ {2 - 1} \binom {10} {n} \left(\frac {5}{20}\right) ^ {n} + \sum_{n = c} ^ {10} \frac {10 !}{(10 - n) ! 2 ! 2^{n - 2}} \left(\frac {5}{20}\right) ^ {n} \right] ^ {- 1} = 0. 065
p = zeros(K+1,1);
% Note:
% p(1) = lim_t->infty Pr{N(t)=0}
% p(n+1) = lim_t->infty Pr{N(t)=n}, for n=1,2,...,K-1
% p(K+1) = lim_t->infty Pr{N(t)=K}
crho = lambda/mu;
Kfac = factorial(K);
cfac = factorial(c);
% get p(1)
for n=0:c-1
    p(1)=p(1) + (Kfac/(factorial(n)*factorial(K-n)))*(crho^n);
end
for n=c:K
    p(1)=p(1) + (Kfac/((c^(n-c))*factorial(K-n)*cfac))*(crho^n);
end
p(1)=1/p(1);
% get p(n+1), 0 < n < c
for n=1:c-1
    p(n+1)=p(1) * (Kfac/(factorial(n)*factorial(K-n)))*(crho^n);
end
% get p(n+1), c <= n <= K
for n=c:K
    p(n+1)=p(1) * (Kfac/((c^(n-c))*factorial(K-n)*cfac))*(crho^n);
end
% return probability vector
mmcKK = p;

Figure 14 MATLAB procedure to calculate PnP_{n} for the M/M/c/K/KM / M / c / K / K queue.

From P0,P_{0} , we can obtain the other PnP_{n}, from which we can compute the average number of machines waiting for service,

LQ=∑n=310(n−2)Pn=1.46machines L_{Q} = \sum_{n = 3} ^ {10} (n - 2) P_{n} = 1. 46 \text{machines}

the effective arrival rate,

λe=∑n=010(10−n)(120)Pn=0.342machines / minute \lambda_{e} = \sum_{n = 0} ^ {10} (10 - n) \left(\frac {1}{20}\right) P_{n} = 0. 342 \text{machines / minute}

and the average waiting time in the queue,

wQ=LQ/λe=4.27minutes w_{Q} = L_{Q} / \lambda_{e} = 4. 27 \mathrm{minutes}

Similarly, we can compute the expected number of machines being serviced or waiting to be serviced,

L=∑n=010nPn=3.17machines L = \sum_{n = 0} ^ {10} n P_{n} = 3. 17 \text{machines}

The average number of machines being serviced is given by

L−LQ=3.17−1.46=1.71machines L - L_{Q} = 3. 17 - 1. 46 = 1. 71 \mathrm{machines}

Each machine must be running, waiting to be serviced, or in service, so the average number of running machines is given by

K−L=10−3.17=6.83machines K - L = 10 - 3. 17 = 6. 83 \mathrm{machines}

A question frequently asked is this: What will happen if the number of servers is increased or decreased? If the number of workers in this example increases to three (c 3), then the time-average number of running machines increases to

K−L=7.74machines K - L = 7. 74 \mathrm{machines}

an increase of 0.91 machine, on the average.

Conversely, what happens if the number of servers decreases to one? Then the time-average number of running machines decreases to

K−L=3.98machines K - L = 3. 98 \mathrm{machines}

The decrease from two servers to one has resulted in a drop of nearly three machines running, on the average. Exercise 17 asks the reader to examine the effect on server utilization of adding or deleting one server.

Example 17 illustrates several general relationships that have been found to hold for almost al queues. If the number of servers is decreased, then delays, server utilization, and the probability o an arrival having to wait to begin service all increase.

6 Networks of Queues

In this chapter, we have emphasized the study of single queues of the G/G/c/N/KG / G / c / N / K type. However, many systems are naturally modeled as networks of single queues in which customers departing from one queue may be routed to another. Example 1 (see, in particular, Figure 3) and Example 2 (see Figure 5) are illustrations.

The study of mathematical models of networks of queues is beyond the scope of this chapter; see, for instance, Gross and Harris [1997], Nelson [1995], and Kleinrock [1976], However, a few

fundamental principles are very useful for rough-cut modeling, perhaps prior to a simulation study. The following results assume a stable system with an infinite calling population and no limit on system capacity:

  1. Provided that no customers are created or destroyed in the queue, then the departure rate out of a queue is the same as the arrival rate into the queue, over the long run.

  2. If customers arrive to queue i at rate λi.\lambda_{i} ., and a fraction 0≤pij≤10 \leq p_{i j} \leq 1 of them are routed to queue j upon departure, then the arrival rate from queue i to queue j is λipijj \ \mathrm{i s} \ \lambda_{i} p_{i j}, over the long run.

  3. The overall arrival rate into queue j,λjj , \lambda_{j}, is the sum of the arrival rate from all sources. If customers arrive from outside the network at rate aj,a_{j} , then

λj=aj+∑alliλipij \lambda_{j} = a_{j} + \sum_ {\text{all} i} \lambda_{i} p_{i j}
  1. If queue j has cj<∞c_{j} < \infty parallel servers, each working at rate μj\mu_{j}, then the long-run utilization of each server is
ρj=λjcjμj \rho_{j} = \frac {\lambda_{j}}{c_{j} \mu_{j}}

and ρj<1\rho_{j} < 1 is required for the queue to be stable.

  1. If, for each queuej, arrivals from outside the network form a Poisson process with rate aj,a_{j} , and if there are cjc_{j} identical servers delivering exponentially distributed service times with mean 1/μj1 / \mu_{j}(where cjc_{j} may be ∞)\infty ), then, in steady state, queuej behaves like an M/M/cjM / M / c_{j} queue with arrival rate λj=aj+∑all iλipij\lambda_{j} = a_{j} + \textstyle \sum _ {\mathrm{a l l} ~ i} \lambda_{i} p_{i j}

Example 18

Consider again the discount store described in Example 1 and shown in Figure 3. Suppose that customers arrive at the rate of 80 per hour and that, of those arrivals, 40% choose self-service; then, the arrival rate to service center 1 is λ1=(80)(0.40)=32\lambda_{1} = ( 80 ) ( 0 . 40 ) = 32 per hour, and the arrival rate to service center 2 is λ2=(80)(0.6)=48\lambda_{2} = ( 80 ) ( 0 . 6 ) = 48 per hour. Suppose that each of the c2=3c_{2} = 3 clerks at service center 2 works at the rate μ2=20\mu_{2} = 20 customers per hour. Then the long-run utilization of the clerks is

ρ2=48(3)(20)=0.8 \rho_{2} = \frac {48}{(3) (20)} = 0. 8

All customers must see the cashier at service center 3. The overall arrival rate to service center 3 is λ3=λ1+λ2=80\lambda_{3} = \lambda_{1} + \lambda_{2} = 80 per hour, regardless of the service rate at service center 1, because, over the long run, the departure rate out of each service center must be equal to the arrival rate into it. If the cashier works at rate μ3=90\mu_{3} = 90 per hour, then the utilization of the cashier is

ρ3=8090=0.89 \rho_{3} = \frac {80}{90} = 0. 89

7 Rough-cut Modeling: An Illustration

In this section we show how the tools described in this chapter can be used to do a rough-cut analysis prior to undertaking a more detailed simulation. Rough-cut modeling is useful in a number of ways: In some cases, the results of the rough-cut analysis are so compelling that there is no longer a need for the detailed simulation, saving a great deal of time and money. More typically, the rough-cut model provides the analyst with a better understanding of the system to be modeled—a kind of dress rehearsal prior to constructing a detailed and often complex simulation model. Further, the performance measures obtained at the rough-cut stage provide a sanity check on the simulation outputs, potentially averting erroneous conclusions due simply to mistakes in programming the simulation.

Example 19

At a driver’s license branch office the manager receives many complaints about the long delays to renew licenses. To obtain quantitative support for more staff she brings in an operations analyst. A diagram of the facility is shown in Figure 15.

The branch is open from 8 A.M. to 4 P.M., with an historical average of 464 drivers per day being processed. All arrivals must first check in with one of two clerks. The manager has some time-study data collected on the clerks over several days and finds an average check-in time of 2 minutes with a standard deviation of about 0.4 minutes. After check in, 15% of the drivers need to take a written tes that lasts approximately 20 minutes; good data are available on test time because the exams are time stamped when they are issued and returned. These multiple-choice tests are graded nearly instantly by an optical scanner. All arrivals must wait to have their picture taken and their license produced; this station can process about 60 drivers per hour, but the individual times are highly variable as some pictures have to be retaken.

The branch manager wants to know the relative impact on customer delay of adding a check-in clerk or adding a new photo station, and whether either of these changes will impact the number of chairs needed for drivers taking the written test (the 20 chairs she currently has have always been adequate).

This is an ideal application for simulation, but the analyst hired by the manager feels a quick queueing approximation could provide useful insight, as well as a check on the simulation model.

Figure 15 Customer flow in the driver’s license branch office.

To do a rough-cut analysis, the analyst represents the license branch as a network of queues, with the check-in clerks being queue 1 (with c1=2c_{1} = 2 servers, each working at rate μ1=30\mu_{1} = 30 drivers per hour =0.5= 0 . 5 drivers per minute), the written test station being queue 2 (with c2=∞c_{2} = \infty servers, because any number of people can be taking the written test simultaneously, and mean service time 1/μ2=201 / \mu_{2} = 20 minutes), and with the photo station being queue 3 (with c3=1c_{3} = 1 server working at rate μ3=1\mu_{3} = 1 driver per minute). The analyst chooses to ignore the optical scanning of the tests because it happens so quickly. Although the branch manager says that arrivals are heavier around noon, for the purpose of a rough-cut analysis the analyst models the arrival rate as 464/8=58464 / 8 = 58 arrivals per hour throughou the day.

The arrival rates to each queue are as follows:

λ1=a1+∑i=13pi1λi=58drivers per hour \lambda_{1} = a_{1} + \sum_{i = 1} ^ {3} p_{i 1} \lambda_{i} = 58 \text{drivers per hour} λ2=a2+∑i=13pi2λi=(0.15)λ1drivers per hour \lambda_{2} = a_{2} + \sum_{i = 1} ^ {3} p_{i 2} \lambda_{i} = (0. 15) \lambda_{1} \text{drivers per hour} λ3=a3+∑i=13pi3λi=(1)λ2+(0.85)λ1drivers per hour \lambda_{3} = a_{3} + \sum_{i = 1} ^ {3} p_{i 3} \lambda_{i} = (1) \lambda_{2} + (0. 85) \lambda_{1} \text{drivers per hour}

Notice that arrivals from outside the network occur only at queue 1, so a1=50a_{1} = 50 and a2=a3=0a_{2} = a_{3} = 0 Solving this system of equations gives λ1=λ3=58\lambda_{1} = \lambda_{3} = 58 and λ2=8.7\lambda_{2} = 8 . 7. The analyst chooses to work in minutes, and so converts these to λ1=λ3=0.97\lambda_{1} = \lambda_{3} = 0 . 97 per minute and λ2=0.15\lambda_{2} = 0 . 15 per minute.

The analyst approximates the arrival process as Poisson—which is justified by the large population of potential customers who make (largely) independent decisions about when to arrive—and the service times at each queue as exponentially distributed. The service-time approximation is reasonable for queue 3,^ {3 ,}, since the manager believes the picture-taking times are quite variable, and harmless for queue 2 because the results for infinite-server M/G/∞M / G / \infty queues depend only on the service rate, not the distribution. However, the coefficient of variation of the check-in time is cv=0.4/2=0.2<1\mathrm{c v} = 0 . 4 / 2 = 0 . 2 < 1 so the analyst decides to also apply the correction (1+cv2)/2=0.52( 1 + \mathbf{c} \mathbf{v} ^ {2} ) / 2 = 0 . 52 to the check-in results.

The analyst now has the necessary information to approximate each station in the license branch as an independent queue (another approximation, since in reality they are not independent). The check-in clerks are approximated as an M/G/c1M / G / c_{1} queue, the testing station as an M/G/∞M / G / \infty queue, and the photo station as an M/M/c3M / M / c_{3} queue. Thus, under the current set-up, the check-in station is an M/G/2M / G / 2; using the formulas in Table 5 and multiplying by 0.52 gives wQ=16.5w_{Q} = 16 . 5 minutes. If a third clerk is added, the waiting time in queue drops to 0.4 minute, a huge savings.

The current photo station can be modeled as an M/M/1M / M / 1 queue, giving wQ=32.3w_{Q} = 32 . 3 minutes; adding a second photo station (M/M/2)\left( M / M / 2 \right) causes the time in queue to drop to 0.3 minutes, a savings even larger than adding a clerk.

If desired, the testing station can be analyzed by using the results for an M/G/∞M / G / \infty queue in Table 6. For instance, the expected number of people taking the test at any time is L=λ2/μ2=L = \lambda_{2} / \mu_{2} =0.15/(1/20)=30 . 15 / ( 1 / 20 ) = 3, which will be unaffected by changes in the number of clerks or photo stations, since they do not change λ2\lambda_{2} or μ2\mu_{2}

Should the manager expect to see precisely these results if either or both of the changes are implemented? No, because the model is rough in a number of ways: The queueing results are steady state, while the actual license facility is open only 8 hours per day, and does not have a constant arrival rate. The system was simplified by leaving out test scoring, employee breaks, etc. However, these results do provide a compelling case for the addition of one or more staff, and provide a baseline against which to check a detailed simulation model that includes all of the relevant features.

8 Summary

Queueing models have found widespread use in the analysis of service facilities, production and material-handling systems, telephone and communications systems, and many other situations where congestion or competition for scarce resources can occur. This chapter has introduced the basic concepts of queueing models and shown how simulation, and in some cases a mathematical analysis, can be used to estimate the performance measures of a system.

A simulation may be used to generate one or more artificial histories of a complex system. This simulation-generated data may, in turn, be used to estimate desired performance measures of the system. Commonly used performance measures, including L,LQ,L , L_{Q} ,, w,wQ,ρw_{Q} , \rho, and λe,\lambda_{e} ,, were introduced, and formulas were given for their estimation from data.

When simulating any system that evolves over time, the analyst must decide whether transient behavior or steady-state performance is to be studied. Simple formulas exist for the steadystate behavior of some queues, but estimating steady-state performance measures from simulationgenerated data requires recognizing and dealing with the possibly deleterious effect of the initia conditions on the estimators of steady-state performance. These estimators could be severely biased (either high or low) if the initial conditions are unrepresentative of steady state or if the simulation run length is too short.

Whether the analyst is interested in transient or in steady-state performance of a system, it should be recognized that the estimates obtained from a simulation of a stochastic queue are exactly that— estimates. Every such estimate contains random error, and a proper statistical analysis is required to assess the accuracy of the estimate.

In the last three sections of this chapter, it was shown that a number of simple models can be solved mathematically. Although the assumptions behind such models might not be met exactly in a practical application, these models can still be useful in providing a rough estimate of a performance measure. In many cases, models with exponentially distributed interarrival and service times wil provide a conservative estimate of system behavior. For example, if the model predicts that average waiting time w will be 12.7 minutes, then average waiting time in the real system is likely to be less than 12.7 minutes. The conservative nature of exponential models arises because (a) performance measures, such as w and L,L , are generally increasing functions of the variance of interarrival times and service times (recall the M/G/1M / G / 1 queue), and (b) the exponential distribution is fairly highly variable, having its standard deviation always equal to its mean. Thus, if the arrival process or service mechanism of the real system is less variable than exponentially distributed interarrival or service times, it is likely that the average number in the system,L,L , and the average time spent in

system, w, will be less than what is predicted by the exponential model. Of course, if the interarriva and service times are more variable than exponential random variables, then the M/M queueing models could underestimate congestion.

An important application of mathematical queueing models is determining the minimum number of servers needed at a work station or service center. Quite often, if the arrival rate λ and the service rate µ are known or can be estimated, then the simple inequality λ/(cμ)<1\lambda / ( c \mu ) < 1 can be used to provide an initial estimate for the number of servers, c, at a work station. For a large system with many work stations, it could be quite time consuming to have to simulate every possibility (c1,c2,…)( c_{1} , c_{2} , \ldots ) for the number of servers,ci,c_{i} , at work station i. Thus, rough estimates from a bit of analysis could save a great deal of computer time and analysts’ time.

Finally, the qualitative behavior of the simple exponential models of queueing carries over to more complex systems. In general, it is the variability of service times and the variability of the arriva process that causes waiting lines to build up and congestion to occur. For most systems, if the arriva rate increases, or if the service rate decreases, or if the variance of service times or interarrival times increases, then the system will become more congested. Congestion can be decreased by adding more servers or by reducing the mean and variability of service times. Simple queueing models can be a great aid in quantifying these relationships and in evaluating alternative system designs.

REFERENCES

COOPER, R. B. [1990], Introduction to Queueing Theory, 3d ed., George Washington University, Washington, DC.

DESCLOUX, A. [1962], Delay Tablesfor Finite- and Infinite-Source Systems, McGraw-Hill, New York.

GROSS, D., AND C. HARRIS [1997], Fundamentals ofQueueing Theory, 3d ed., Wiley, New York.

HALL, R. W. [1991], Queueing Methods: For Services and Manufacturing, Prentice Hall, Englewood Cliffs, NJ.

HILLIER, F. S., AND G. J. LIEBERMAN [2005], Introduction to Operations Research, 8th ed., McGraw-Hill, New York.

KENDALL, D. G. [1953], “Stochastic Processes Occurring in the Theory of Queues and Their Analysis by the Method of Imbedded Markov Chains,” Annals ofMathematical Statistics, Vol. 24, pp. 338–354.

KLEINROCK, L. [1976], Queueing Systems, Vol. 2: Computer Applications, Wiley, New York.

LITTLE, J. D. C. [1961], “A Proof for the Queueing Formula L=λw,∗L = \lambda w , ^ {\ast} Operations Research, Vol. 16, pp. 651– 665.

NELSON, B. L. [1995], Stochastic Modeling: Analysis & Simulation, Dover Publications, Mineola, NY.

WINSTON, W. L. [2004], Operations Research: Applications and Algorithms, 4th Edition, Duxbury Press, Pacific Grove, CA.

EXERCISES

  1. A tool crib has exponential interarrival and service times and serves a very large group of mechanics. The mean time between arrivals is 4 minutes. It takes 3 minutes on the average for a tool-crib attendant to service a mechanic. The attendant is paid $10 per hour and the mechanic is paid $15 per hour. Would it be advisable to have a second tool-crib attendant?

  2. A two-runway (one runway for landing, one runway for taking off) airport is being designed for propeller-driven aircraft. The time to land an airplane is known to be exponentially distributed, with a mean of 1.5 minutes. If airplane arrivals are assumed to occur at random, what arriva rate can be tolerated if the average wait in the sky is not to exceed 3 minutes?

  3. The Port of Trop can service only one ship at a time. However, there is mooring space for three more ships. Trop is a favorite port of call, but, if no mooring space is available, the ships have to go to the Port of Poop. An average of seven ships arrive each week, according to a Poisson process. The Port ofTrop has the capacity to handle an average of eight ships a week, with service times exponentially distributed. What is the expected number of ships waiting or in service at the Port of Trop?

  4. At Metropolis City Hall, two workers “pull strings” (make deals) every day. Strings arrive to be pulled on an average of one every 10 minutes throughout the day. It takes an average of 15 minutes to pull a string. Both times between arrivals and service times are exponentially distributed. What is the probability that there are no strings to be pulled in the system at a random point in time? What is the expected number of strings waiting to be pulled? What is the probability that both string-pullers are busy? What is the effect on performance if a third string-puller, working at the same speed as the first two, is added to the system?

  5. At Tony and Cleo’s bakery, one kind of birthday cake is offered. It takes 15 minutes to decorate this particular cake, and the job is performed by one particular baker. In fact, it is all this baker does. What mean time between arrivals (exponentially distributed) can be accepted if the mean length of the queue for decorating is not to exceed five cakes?

  6. Patients arrive for a physical examination according to a Poisson process at the rate 1 per hour. The physical examination requires three stages, each one independently exponentially distributed, with a service time of 15 minutes. A patient must go through all three stages before the nex patient is admitted to the treatment facility. Compute the average number of delayed patients,LQ,L_{Q} , for this system. [Hint: The variance of the sum of independent random variables is the sum of the variance.]

  7. Suppose that mechanics arrive randomly at a tool crib according to a Poisson process with rate λ 10 per hour. It is known that the single tool clerk serves a mechanic in 4 minutes on the average, with a standard deviation of approximately 2 minutes. Suppose that mechanics make $15.00 per hour. Estimate the steady-state average cost per hour of mechanics waiting for tools.

  8. Arrivals to an airport are all directed to the same runway. At a certain time of the day, these arrivals form a Poisson process with rate 30 per hour. The time to land an aircraft is a constant 90 seconds. Determine L , w , L, and w for this airport. If a delayed aircraft burns $5000 worth of fuel per hour on the average, determine the average cost per aircraft of delay in waiting to land.

  9. A machine shop repairs small electric motors, which arrive according to a Poisson process at the rate of 12 per week (5-day, 40-hour workweek). An analysis of past data indicates that engines can be repaired, on the average, in 2.5 hours, with a variance of 1 hour^2. How many working hours should a customer expect to leave a motor at the repair shop (not knowing the status o the system)? If the variance of the repair time could be controlled, what variance would reduce the expected waiting time to 6.5 hours?

  10. Arrivals to a self-service gasoline pump occur in a Poisson fashion at the rate 12 per hour. Service time has a distribution that averages 4 minutes, with a standard deviation of one and a third minutes. What is the expected number of vehicles in the system?

  11. Classic Car Care has one worker who washes cars in a four-step method—soap, rinse, dry, vacuum. The time to complete each step is exponentially distributed, with mean 9 minutes. Every car goes through every step before another car begins the process. On the average, one car every 45 minutes arrives for a wash job, according to a Poisson process. What is the average time a car waits to begin the wash job? What is the average number of cars in the car wash system? What is the average time required to wash a car?

  12. A room has 10 cotton spinning looms. Once the looms are set up, they run automatically. The setup time is exponentially distributed, with mean 10 minutes. The machines run for an average of 40 minutes, also exponentially distributed. Loom operators are paid $10 an hour, and looms not running incur a cost of $40 an hour. How many loom operators should be employed to minimize the total cost of the loom room? If the objective becomes “on the average, no loom should wait more than 1 minute for an operator,” how many people should be employed? How many operators should be employed to ensure that, on average, at least 7.5 looms are running at all times?

  13. Consider the following information for a finite calling population problem with exponentially distributed runtimes and service times:

K=101μ=151λ=82c=2 \begin{array}{c} {K = 10} \\ {\frac {1}{\mu} = 15} \\ {\frac {1}{\lambda} = 82} \\ {c = 2} \end{array}

Compute LQL_{Q} and wQ.w_{Q} .. Find the value of λ such that LQ=L/2L_{Q} = L / 214. Suppose that Figure 6 represents the number in system for a last-in-first-out (LIFO) single-server system. Customers are not preempted (i.e., kicked out of service), but, upon service completion, the most recent arrival next begins service. For this LIFO system, apportion the total area under L(t) to each individual customer, as was done in Figure 8 for the FIFO system. Using the figure, show that Equations (10) and (8) hold for the single-server LIFO system.

  1. Repeat Exercise 14, but assuming that

(a) Figure 6 represents a FIFO system with c=2c = 2 servers.

(b) Figure 6 represents a LIFO system with c=2c = 2 servers.

  1. Consider an M/G/1M / G / 1 queue with the following type of service distribution: Customers request one of two types of service, in the proportions pp and 1−p.1 - p .. Type-i service is exponentially distributed at rate μi,i=1,2\mu_{i} , i = 1 , 2. Let XiX_{i} denote a type-i service time and X an arbitrary service time. Then E(Xi)=1/μi,V(Xi)=1/μi2E ( X_{i} ) = 1 / \mu_{i} , V ( X_{i} ) = 1 / \mu_{i} ^ {2} and
X={X1with probability pX2with probability (1 - p) X = \left\{\begin{array}{l l} X_{1} & \text{with probability p} \\ X_{2} & \text{with probability (1 - p)} \end{array} \right.

The random variable X is said to have a hyperexponential distribution with parameters (μ1,μ2,p)( \mu_{1} , \mu_{2} , p )(a) Show that E(X)=p/μ1+(1−p)/μ2 and E(X2)=2p/μ12+2(1−p)/μ22.E ( X ) = p / \mu_{1} + ( 1 - p ) / \mu_{2} {\mathrm{~ a n d ~}} E ( X^{2} ) = 2 p / \mu_{1} ^ {2} + 2 ( 1 - p ) / \mu_{2} ^ {2} .(b) Use V(X)=E(X2)−[E(X)]2V ( X ) = E ( X^{2} ) - [ E ( X ) ] ^ {2} to show V(X)=2p/μ12+2(1−p)/μ22−[p/μ1+(1−p)/μ2]2 /V ( X ) = 2 p / \mu_{1} ^ {2} + 2 ( 1 - p ) / \mu_{2} ^ {2} - [ p / \mu_{1} + ( 1 - p ) / \mu_{2} ] ^ {2} \ /(c) For any hyperexponential random variable, if μ1 ≠ μ2\mu_{1} \ \ne \ \mu_{2} and 0 < p < 10 ~ < ~ p ~ < ~ 1, show that its coefficient of variation is greater than 1; that is,(cv)2=V(X)/[E(X)]2>1( \mathbf{c} \mathbf{v} ) ^ {2} = V ( X ) / [ E ( X ) ] ^ {2} > 1. Thus, the hyperexponential distribution provides a family ofstatistical models for service times that are more variable than exponentially distributed service times. [Hint: The algebraic expression for (cv)2.( \mathbf{c} \mathbf{v} ) ^ {2} ., by using parts (a) and (b), can be manipulated into the form (cv)2=2p(1−( \mathrm{c v} ) ^ {2} = 2 p ( 1 -p)(1/μ1−1/μ2)2/[E(X)]2+1.]p ) ( 1 / \mu_{1} - 1 / \mu_{2} ) ^ {2} / [ E ( X ) ] ^ {2} + 1 . ](d) Many choices of μ1,μ2\mu_{1} , \mu_{2}, andp lead to the same overall mean E(X)E ( X ) and (cv)2( \mathbf{c} \mathbf{v} ) ^ {2}. If a distribution with mean E(X)=1E ( X ) = 1 and coefficient of variation cv⁡=2\operatorname{c v} = 2 is desired, find values of μ1,μ2\mu_{1} , \mu_{2} and pp to achieve this. [Hint: Choose p=1/4p = 1 / 4 arbitrarily; then solve the following equations for μ1\mu_{1} and μ2.\mu_{2} .]

14μ1+34μ2=1 \frac {1}{4 \mu_{1}} + \frac {3}{4 \mu_{2}} = 1 38(1μ1−1μ2)2+1=4 \frac {3}{8} \left(\frac {1}{\mu_{1}} - \frac {1}{\mu_{2}}\right) ^ {2} + 1 = 4
  1. In Example 17,^ {17 ,} compare the systems with c=1,c=2,c = 1 , c = 2 ,, and c=3c = 3 servers on the basis of server utilization ρ\rho(the proportion of time a typical server is busy).

  2. In Example 17, increase the number of machines by 2, then compare the systems with c=1c = 1c=2.c = 2 ., and c=3c = 3 servers on the basis of server utilization ρ\rho(the proportion of time a typical server is busy).

  3. A small lumberyard is supplied by a fleet of 10 trucks. One overhead crane is available to unload the long logs from the trucks. It takes an average of 1 hour to unload a truck. After unloading, a truck takes an average of 3 hours to get the next load of logs and return to the lumberyard.

(a) Certain distributional assumptions are needed to analyze this problem with the models of this chapter. State them and discuss their reasonableness.

(b) With one crane, what is the average number of trucks waiting to be unloaded? On average, how many trucks arrive at the yard each hour? What percentage of trucks upon arrival find the crane busy? Is this the same as the long-run proportion of time the crane is busy?

(c) Suppose that a second crane is installed at the lumberyard. Answer the same questions as in part (b). Make a chart comparing one crane to two cranes.

(d) If the value of the logs brought to the yard is approximately $200 per truck load and if long-run crane costs are $50 per hour per crane (whether busy or idle), compute an optima number of cranes on the basis of cost per hour.

(e) In addition to the costs in part (d), if management decides to consider the cost of idle trucks and drivers, what is the optimal number of cranes? A truck and its driver together are estimated to cost approximately $40 per hour and are considered to be idle when they are waiting for a crane.

  1. A tool crib with one attendant serves a group of 10 mechanics. Mechanics work for an exponentially distributed amount of time with mean 20 minutes, then go to the crib to request a specia tool. Service times by the attendant are exponentially distributed, with mean 3 minutes. If the attendant is paid $6 per hour and the mechanic is paid $10 per hour, would it be advisable to have a second attendant? [Hint: Compare with Exercise 1.]

  2. This problem is based on Case 8.1 in Nelson [1995]. A large consumer shopping mall is to be constructed. During busy times, on average, the arrival rate of cars is expected to be 1000 per hour, and studies at other malls suggest that customers will spend 3 hours shopping. The mal designers would like to have sufficient parking so that there are enough spaces 99.9% of the time. How many spaces should they have? [Hint: Model the system as an M/G/ queue, where the spaces are servers, and find out how many spaces are adequate with probability 0.999.]

  3. In Example 18, suppose that the overall arrival rate is expected to increase to 160 per hour. I the service rates do not change, how many clerks will be needed at service centers 2 and 3, jus to keep up with the customer load?

  4. A small copy shop has a self-service copier. Currently there is room for only 4 people to line up for the machine (including the person using the machine); when there are more than 4 people, the additional people must line up outside the shop. The owners would like to avoid having people line up outside the shop, as much as possible. For that reason, they are thinking about adding a second self-service copier. Self-service customers have been observed to arrive at the rate of 24 per hour, and they use the machine for 2 minutes, on average. Assess the impact of adding another copier. Carefully state any assumptions or approximations you make.

  5. A self-service car wash has 4 washing stalls. When in a stall, a customer may choose from among three options: rinse only; wash and rinse; and wash, rinse, and wax. Each option has a fixed time to complete: rinse only, 3 minutes; wash and rinse, 7 minutes; wash, rinse, and wax, 12 minutes. The owners have observed that 20% of customers choose rinse only; 70% wash and rinse; and 10% wash, rinse, and wax. There are no scheduled appointments, and customers arrive at a rate of about 34 cars per hour. There is room for only 3 cars to wait in the parking lot, so, currently, many customers are lost. The owners wants to know how much more business they will do if they add another stall. Adding a stall will take away one space in the parking lot.

Develop a queueing model of the system. Estimate the rate at which customers will be lost in the current and proposed system. Carefully state any assumptions or approximations you make.

  1. Find examples of queueing models used in real applications. A good source is the journal Interfaces.

  2. Study the effect ofpooling servers (having multiple servers draw from a single queue, rather than each having its own queue) by comparing the performance measures for two M/M/1 queues, each with arrival rate λ and service rate µ, to an M/M/2M / M / 2 queue with arrival rate 2λ and service rate µ for each server.

  3. A repair and inspection facility consists of two stations: a repair station with two technicians, and an inspection station with 1 inspector. Each repair technician works at the rate of 3 items per hour; the inspector can inspect 8 items per hour. Approximately 10% of all items fail inspection and are sent back to the repair station. (This percentage holds even for items that have been repaired two or more times.) If items arrive at the rate of 5 per hour, what is the long-run expected delay that items experience at each of the two stations, assuming a Poisson arriva process and exponentially distributed service times? What is the maximum arrival rate that the system can handle without adding personnel?

  4. Parts arrive to the first stage of an assembly system at a rate of 50 per hour, then proceed through four additional stages before the product is complete. At each stage there is a 2% scrap rate, which means that 2% of the products at each stage are declared defective and discarded.

(a) What is the arrival rate in parts per hour to the fifth assembly station?

(b) If the mean assembly times for the five stations are different, does is make sense to order the stations from smallest to largest processing time, or vice versa? Why?

  1. A call center answers questions about financial tracking, personal productivity, and contact management software. Calls arrive at a rate of 1 per minute, and historically 25% of calls are about financial products, 34% for productivity products, and 41% for contact managemen products. It takes 5 minutes on average to answer a caller’s question. The number of customers who can be connected at any one time is essentially unlimited, but each product line has its own operators (2 for financial, 2 for productivity, and 3 for contact management). If an appropriate operator is available then the call is immediately routed to the operator; otherwise, the caller is placed in a hold queue. The company is hoping to reduce the total number of operators they need

by cross-training operators so that they can answer calls for any product line. Since the operators will not be experts across all products, this is expected to increase the time to process a call by about 10%. How many cross-trained operators are needed to provide service at the same leve as the current system? Answer the question by approximating the current and proposed system.

List of Materials Available on www.bcnn.net

QueueingTools.xls

7 Random-Number Generation

Random numbers are a necessary basic ingredient in the simulation of almost all discrete systems. Most computer languages have a subroutine, object, or function that will generate a random number. Random numbers are used to generate event times and other random variables in simulation languages. In this chapter, the generation of random numbers and their subsequent testing for randomness is described.

1 Properties of Random Numbers

A sequence ofrandom numbers,R1,R2,…,R_{1} , R_{2} , \ldots ,, must have two important statistical properties: uniformity and independence. Each random number RiR_{i} must be an independent sample drawn from a continuous uniform distribution between zero and 1—that is, the pdf is given by

f(x)={1,0≤x≤10,otherwise f (x) = \left\{\begin{array}{l l} 1, & 0 \leq x \leq 1 \\ 0, & \text{otherwise} \end{array} \right.

This density function is shown in Figure 1. The expected value of each RiR_{i} is given by

E(R)=∫01xdx=x22∣01=12 E (R) = \int_{0} ^ {1} x d x = \left. \frac {x^{2}}{2} \right| _ {0} ^ {1} = \frac {1}{2}

Figure 1 pdf for random numbers.

and the variance is given by

V(R)=∫01x2dx−[E(R)]2=x33∣01−(12)2=13−14=112 V (R) = \int_{0} ^ {1} x^{2} d x - [ E (R) ] ^ {2} = \left. \frac {x^{3}}{3} \right| _ {0} ^ {1} - \left(\frac {1}{2}\right) ^ {2} = \frac {1}{3} - \frac {1}{4} = \frac {1}{12}

Some consequences of the uniformity and independence properties are the following:

  1. If the interval [0, 1] is divided into n classes, or subintervals of equal length, the expected number of observations in each interval is N/n,N / n , where N is the total number of observations.

  2. The probability of observing a value in a particular interval is independent of the previous values drawn.

In the next section we describe desirable properties of methods that produce random numbers to drive simulations.

2 Generation of Pseudo-Random Numbers

Notice that the title of this section has the word “pseudo” in it. “Pseudo” means false, so false random numbers are being generated! In this instance, “pseudo” is used to imply that the very act of generating random numbers by a known method removes the potential for true randomness. I the method is known, the set of random numbers can be repeated. Then an argument can be made that the numbers are not truly random. The goal of any generation scheme, however, is to produce a sequence of numbers between 0 and 1 that simulates, or imitates, the ideal properties of uniform distribution and independence as closely as possible.

To be sure, in the generation of pseudo-random numbers, certain problems or errors can occur. These errors, or departures from ideal randomness, are all related to the properties stated previously in Section 1. Some examples of such departures include the following:

  1. The generated numbers might not be uniformly distributed.

  2. The generated numbers might be discrete-valued instead of continuous-valued.

  3. The mean of the generated numbers might be too high or too low.

  4. The variance of the generated numbers might be too high or too low.

  5. There might be dependence as measured, for instance, by autocorrelation.

Departures from uniformity and independence for a particular generation scheme often can be detected by tests such as those described in Section 4. If departures are detected, the generation scheme should be dropped in favor of an acceptable generator. Generators that pass the tests in Section 4, and tests even more stringent, have been developed; thus, there is no excuse for using a generator that has been found to be defective.

Usually, random numbers are generated by a digital computer as part of the simulation. There are numerous methods that can be used to generate the values. Before we describe some of these methods, there are several important considerations that we should mention:

  1. The method should be fast. Individual computations are inexpensive, but simulation could require many millions of random numbers. The total cost can be managed by selecting a computationally efficient method of random-number generation.

  2. The method should be portable to different computers—and, ideally, to different programming languages. This is desirable so that the simulation program will produce the same results wherever it is executed.

  3. The method should have a sufficiently long cycle. The cycle length, or period, represents the length of the random number sequence before previous numbers begin to repeat themselves in an earlier order. Thus, if 10,000 events are to be generated, the period should be many times that long.

A special case of cycling is degenerating. A method degenerates when the same random numbers appear repeatedly. Such an occurrence is certainly unacceptable. This can happen rapidly with some methods.

  1. The random numbers should be repeatable. Given the starting point (or conditions) it should be possible to generate the same set ofrandom numbers, completely independent ofthe system that is being simulated. This is helpful for debugging purposes and facilitates comparisons between systems. For the same reasons, it should be possible to easily specify differen starting points, widely separated, within the sequence.

  2. Most important, the generated random numbers should closely approximate the ideal statistical properties of uniformity and independence.

Inventing techniques that seem to generate random numbers is easy; inventing techniques tha really do produce sequences that appear to be independent, uniformly distributed random numbers is incredibly difficult. There is now a vast literature and rich theory on the topic, and many hours of testing have been devoted to establishing the properties of various generators. Even when a technique is known to be theoretically sound, it is seldom easy to implement it in a way that will be fast and portable. The goal of this chapter is to make the reader aware of the central issues in random-number generation, to enhance understanding, and to show some of the techniques that are used by those working in this area.

3 Techniques for Generating Random Numbers

The linear congruential method of Section 3.1 is the most widely used technique for generating random numbers, so we describe it in detail. We also report on an extension of this method that yields sequences with a longer period. Many other methods have been proposed, and they are reviewed in Bratley, Fox, and Schrage [1996], Law [2007], and Ripley [1987].

3.1 Linear Congruential Method

The linear congruential method, initially proposed by Lehmer [1951], first produces a sequence of integers,X1,X2,...X_{1} , X_{2} , . . .. between zero and m−1m - 1 by following a recursive relationship:

Xi+1=(aXi+c) mod m,i=0,1,2,…(1) X_{i + 1} = (a X_{i} + c) \bmod m, \quad i = 0, 1, 2, \dots\tag{1}

The initial value X0X_{0} is called the seed, a is called the multiplier, c is the increment, and m is the modulus. If c≠0c \neq 0 in Equation (1), then the form is called the mixed congruential method. When c=0,c = 0 ,, the form is known as the multiplicative congruential method. The selection of the values for a,c,m,a , c , m ,, and X0X_{0} drastically affects the statistical properties and the cycle length. Variations of Equation (1) are quite common in the computer generation of random numbers.

Notice that random integers are being generated rather than random numbers. These random integers should appear to be uniformly distributed on the integers zero to m.m .. Random numbers RiR_{i} between zero and 1 can then be generated by setting

Ri=Xim,i=1,2,…(2) R_{i} = \frac {X_{i}}{m}, \quad i = 1, 2, \ldots\tag{2}

An example will illustrate how this technique operates.

Example 1

Use the linear congruential method to generate a sequence of random numbers with X0=27,a=17X_{0} = 27 , a = 17c=43c = 43, and m=100m = 100 The sequence of seeds XiX_{i} and subsequent random numbers RiR_{i}, is computed as follows:

X0=27 X_{0} = 27 X1=(17⋅27+43) mod 100=502 mod 100=2 X_{1} = (17 \cdot 27 + 43) \bmod 100 = 502 \bmod 100 = 2 R1=2100=0.02 R_{1} = \frac {2}{100} = 0. 02 X2=(17⋅2+43) mod 100=77 mod 100=77 X_{2} = (17 \cdot 2 + 43) \bmod 100 = 77 \bmod 100 = 77 R2=77100=0.77 R_{2} = \frac {77}{100} = 0. 77 X3=(17⋅77+43) mod 100=1352 mod 100=52 X_{3} = (17 \cdot 77 + 43) \bmod 100 = 1352 \bmod 100 = 52 R3=52100=0.52 R_{3} = \frac {52}{100} = 0. 52

Recall that a=ba = b mod m provided that b−ab - a is divisible by m with no remainder; otherwise, the mod operation returns the remainder of b/mb / m. Thus,X1=502X_{1} = 502 mod 100=2100 = 2 because 502/100 equals 5 with a remainder of 2.

The ultimate test of the linear congruential method, as of any generation scheme, is how closely the generated numbers R1,R2,…R_{1} , R_{2} , \ldots. approximate uniformity and independence. There are, however, several secondary properties that must be considered. These include maximum density and maximum period.

First, notice that the numbers generated from Equation (2) assume values only from the set I={0,1/m,2/m,…,(m−1)/m}I = \{0 , 1 / m , 2 / m , \ldots , ( m - 1 ) / m \}, because each X is an integer in the set {0,1,2,…,m−1}\{0 , 1 , 2 , \ldots , m - 1 \}. Thus, each RiR_{i} is discrete on I, instead of continuous on the interval [0, 1]. This approximation appears to be of little consequence if the modulus m is a very large integer. (Values such as m=231−1m = 2^{31} - 1 and m=248m = 2^{48} are in common use in generators appearing in many simulation languages.) By maximum density is meant that the values assumed by Ri,i=1,2,…R_{i} , i = 1 , 2 , \ldots, leave no large gaps on [0, 1].

Second, to help achieve maximum density, and to avoid cycling in practical applications (i.e., recurrence ofthe same sequence ofgenerated numbers), the generator should have the largest possible period. Maximal period can be achieved by the proper choice of a,c,m.a , c , m ., and X0X_{0}[Law 2007].

For m a power of 2,^ {2 ,}, say m=2bm = 2^{b}, and c≠0.c \neq 0 ., the longest possible period is P=m=2bP = m = 2^{b} which is achieved whenever c is relatively prime to m (that is, the greatest common factor of c and m is 1) and a=1+4ka = 1 + 4 k, where k is an integer.

For m a power of 2,say⁡m=2b2 , \operatorname{s a y} m = 2^{b}, and c=0c = 0, the longest possible period is P=m/4=2b−2P = m / 4 = 2^{b - 2} which is achieved if the seed X0X_{0} is odd and if the multiplier a is given by a=3+8ka = 3 + 8 k or a=5+8ka = 5 + 8 k, for some k=0,k = 0 ,, 1, . . . .

For m a prime number and c=0.c = 0 ., the longest possible period is P=m−1P = m - 1, which is achieved whenever the multiplier a has the property that the smallest integer k such that ak−1a^{k} - 1 is divisible by m is k=m−1k = m - 1

Example 2

Using the multiplicative congruential method, find the period of the generator for a=13,m=26=a = 13 , m = 2^{6} =64, and X0=1,2,3X_{0} = 1 , 2 , 3, and 4. The solution is given in Table 1. When the seed is 1 or 3, the sequence has period 16. However, a period of length 8 is achieved when the seed is 2 and a period of length 4 occurs when the seed is 4.

In Example 2,m=26=64m = 2^{6} = 64 and c=0c = 0. The maximal period is therefore P=m/4=16.P = m / 4 = 16 .. Notice that this period is achieved by using odd seeds,X0=1X_{0} = 1 and X0=3;X_{0} = 3 ;; even seeds,X0=2X_{0} = 2 and X0=4X_{0} = 4 yield the periods 8 and 4, respectively, both less than the maximum. Notice that a=13a = 13 is of the form 5+8k5 + 8 k with k=1k = 1, as is required to achieve maximal period.

When X0=1X_{0} = 1, the generated sequence assumes values from the set {1,5,9,13,…,53,57,61}\{1 , 5 , 9 , 13 , \dots , 53 , 57 , 61 \} The gaps in the sequence of generated random numbers RiR_{i} are quite large (i.e., the gap is 5/64−1/645 / 64 - 1 / 64 or 0.0625). Such a gap gives rise to concern about the density of the generated sequence.

The generator in Example 2 is not viable for any application—its period is too short and its density is insufficient. However, the example shows the importance of properly choosing a,c,m,a , c , m , and X0X_{0} Table 1 Period Determination Using Various Seeds

iXiX_iXiX_iXiX_iXiX_i
01234
113263952
241185936
321426320
41734514
5295823
6575043
7371047
833235
9457
10927
115331
124919
136155
142511
15515
1613

Speed and efficiency in using the generator on a digital computer is also a selection consideration. Speed and efficiency are aided by use of a modulus, m, which is either a power of 2 or close to a power of 2. Since most digital computers use a binary representation of numbers, the modulo, or remaindering, operation of Equation (1) can be conducted efficiently when the modulo is a power of 2(i.e.,m=2b)2 ( {\mathrm{i . e . ,}} m = 2^{b} ). After ordinary arithmetic yields a value for aXi+c,Xi+1a X_{i} + c , X_{i + 1} is obtained by dropping the leftmost binary digits in aXi+ca X_{i} + c and then using only the b rightmost binary digits. The following example illustrates, by analogy, this operation using m=10bm = 10^{b}, because most human beings think in decimal representation.

Let X0=63,a=19,c=0,andm=102=100X_{0} = 63 , a = 19 , c = 0 , \mathrm{a n d} m = 10^{2} = 100, and generate a sequence of random integers using Equation (1).

X0=63X1=(19)(63) mod 100=1197 mod 100=97X2=(19)(97) mod 100=1843 mod 100=43X3=(19)(43) mod 100=817 mod 100=17⋮ \begin{array}{l} X_{0} = 63 \\ X_{1} = (19) (63) \bmod 100 = 1197 \bmod 100 = 97 \\ X_{2} = (19) (97) \bmod 100 = 1843 \bmod 100 = 43 \\ X_{3} = (19) (43) \bmod 100 = 817 \bmod 100 = 17 \\ \vdots \end{array}

When m is a power of 10, say m=10b.m = 10^{b} ., the modulo operation is accomplished by saving the b rightmost (decimal) digits. By analogy, the modulo operation is most efficient for binary computers when m=2bm = 2^{b} for some b>0,b > 0 ,

Example 4

The last example in this section is in actual use. It has been extensively tested [Learmonth and Lewis, 1973; Lewis et al..a l . ., 1969]. The values for a,c,a , c , and m have been selected to ensure that the characteristics desired in a generator are most likely to be achieved.

Let a=75=16,807,c=0a = 7^{5} = 16 {,} 807 , c = 0, and m=231−1=2,147,483,647m = 2^{31} - 1 = 2 , 147 , 483 , 647(a prime number). These choices satisfy the conditions that ensure a period of P=m−1P = m - 1(well over 2 billion). Further, specify the seed X0=123,457X_{0} = 123 , 457. The first few numbers generated are as follows:

X1=75(123,457) mod (231−1)=2,074,941,799 mod (231−1)X1=2,074,941,799R1=X1231=0.9662X2=75(2,074,941,799) mod (231−1)=559,872,160R2=X2231=0.2607X3=75(559,872,160) mod (231−1)=1,645,535,613R3=X3231=0.7662⋮ \begin{array}{l} X_{1} = 7^{5} (123, 457) \bmod (2^{31} - 1) = 2, 074, 941, 799 \bmod (2^{31} - 1) \\ X_{1} = 2, 074, 941, 799 \\ R_{1} = \frac {X_{1}}{2^{31}} = 0. 9662 \\ X_{2} = 7^{5} (2, 074, 941, 799) \bmod (2^{31} - 1) = 559, 872, 160 \\ R_{2} = \frac {X_{2}}{2^{31}} = 0. 2607 \\ X_{3} = 7^{5} (559, 872, 160) \bmod (2^{31} - 1) = 1, 645, 535, 613 \\ R_{3} = \frac {X_{3}}{2^{31}} = 0. 7662 \\ \vdots \end{array}

Notice that this method divides by m+1m + 1 instead of m;m ; however, for such a large value of m,m , the effect is negligible.

3.2 Combined Linear Congruential Generators

As computing power has increased, the complexity ofthe systems that we are able to simulate has also increased. A random-number generator with period 231−1⋅≈2×1092^{31} - \overset {\cdot} {1} \approx 2 \times 10^{9}, such as the popular generator described in Example 4, is no longer adequate for all applications. Examples include the simulation of highly reliable systems, in which hundreds of thousands of elementary events must be simulated in order to observe even a single failure event, and the simulation of complex computer networks, in which thousands of users are executing hundreds of programs. An area of current research is deriving generators with substantially longer periods.

One fruitful approach is to combine two or more multiplicative congruential generators in such a way that the combined generator has good statistical properties and a longer period. The following result from L’Ecuyer [1988] suggests how this can be done:

If Wi,1,Wi,2,…,Wi,kW_{i , 1} , W_{i , 2} , \ldots , W_{i , k} are any independent, discrete-valued random variables (not necessarily identically distributed), but one of them, say Wi,1W_{i , 1}, is uniformly distributed on the integers from 0 to m1−2m_{1} - 2 then

Wi=(∑j=1kWi,j) mod m1−1 W_{i} = \left(\sum_{j = 1} ^ {k} W_{i, j}\right) \bmod m_{1} - 1

is uniformly distributed on the integers from 0 to m1−2.m_{1} - 2 . To see how this result can be used to form combined generators, let Xi,1,Xi,2,…,Xi,kX_{i , 1} , X_{i , 2} , \ldots , X_{i , k} be the ith output from k different multiplicative congruential generators, where thejth generator has prime modulus mjm_{j} and the multiplier aja_{j} is chosen so that the period is mj−1m_{j} - 1. Then the jth generator is producing integers Xi,jX_{i , j} that are approximately uniformly distributed on the integers from 1 to mj−1m_{j} - 1 and Wi,j=Xi,j−1W_{i , j} = X_{i , j} - 1 is approximately uniformly distributed on the integers from 0 to mj−2.m_{j} - 2 .. L’Ecuyer therefore suggests combined generators of the form

Xi=(∑j=1k(−1)j−1Xi,j) mod m1−1 X_{i} = \left(\sum_{j = 1} ^ {k} (- 1) ^ {j - 1} X_{i, j}\right) \bmod m_{1} - 1

with

Ri={Xim1,Xi>0m1−1m1,Xi=0 R_{i} = \left\{\begin{array}{l l} \frac {X_{i}}{m_{1}}, & X_{i} > 0 \\ \frac {m_{1} - 1}{m_{1}}, & X_{i} = 0 \end{array} \right.

Notice that the 66(−1)j−1,5^ {66} ( - 1 ) ^ {j - 1 , 5} coefficient implicitly performs the subtraction Xi,1−1;X_{i , 1} - 1 ; for example, if k=2k = 2 then (−1)0(Xi,1−1)−(−1)1(Xi,2−1)=∑i=12(−1)j−1Xi,j\begin{array} {r} {( - 1 ) ^ {0} ( X_{i , 1} - 1 ) - ( - 1 ) ^ {1} ( X_{i , 2} - 1 ) = \sum_{i = 1} ^ {2} ( - 1 ) ^ {j - 1} X_{i , j}} \end{array} The maximum possible period for such a generator is

P=(m1−1)(m2−1)⋯(mk−1)2k−1 P = \frac {(m_{1} - 1) (m_{2} - 1) \cdots (m_{k} - 1)}{2^{k - 1}}

which is achieved by the generator described in the next example.

Example 5

For 32-bit computers, L’Ecuyer [1988] suggests combining k=2k = 2 generators with a1=40,014,a_{1} = 40 , 014 ,m1=2,147,483,563,a2=40,692m_{1} = 2 , 147 , 483 , 563 , a_{2} = 40 , 692, and m2=2,147,483,399m_{2} = 2 , 147 , 483 , 399. This leads to the following algorithm:

  1. Select seed X1,0X_{1 , 0} in the range [1, 2,147,483,562] for the first generator, and seed X2,0X_{2 , 0} in the range [1, 2,147,483,398] for the second.
j=0 j = 0
  1. Evaluate each individual generator.
X1,j+1=40,014X1,j mod 2,147,483,563 X_{1, j + 1} = 40, 014 X_{1, j} \bmod 2, 147, 483, 563 X2,j+1=40,692X2,j mod 2,147,483,399 X_{2, j + 1} = 40, 692 X_{2, j} \bmod 2, 147, 483, 399
  1. Set.
Xj+1=(X1,j+1−X2,j+1) mod 2,147,483,562 X_{j + 1} = \left(X_{1, j + 1} - X_{2, j + 1}\right) \bmod 2, 147, 483, 562
  1. Return.
Rj+1={Xj+12,147,483,563,Xj+1>02,147,483,5622,147,483,563,Xj+1=0 R_{j + 1} = \left\{\begin{array}{l l} \frac {X_{j + 1}}{2 , 147 , 483 , 563}, & X_{j + 1} > 0 \\ \frac {2 , 147 , 483 , 562}{2 , 147 , 483 , 563}, & X_{j + 1} = 0 \end{array} \right.
  1. Set j=j+1j = j + 1 and go to Step 2.

This combined generator has period (m1−1)(m2−1)/2≈2×1018( m_{1} - 1 ) ( m_{2} - 1 ) / 2 \approx 2 \times 10^{18}. Perhaps surprisingly, even such a long period might not be adequate for all applications. See L’Ecuyer [1996, 1999] and L’Ecuyer et al. [2002] for combined generators with periods as long as 2I9ˉ1≈3×10572 ^ {\mathsf {I} \mathsf {\bar {9}} 1} \approx 3 \times 10^{57}. One of these generators has been translated into Visual Basic for Applications and can be found in the spreadsheet RandomNumberTools.xls at www.bcnn.net.

3.3 Random-Number Streams

The initial seed for a linear congruential random-number generator (initial seeds, in the case of a combined linear congruential generator) is the integer value X0X_{0} that initializes the random-number sequence. Since the sequence of integers X ,X1,…,XP,X0,X1,… .X_{1} , \dots , X_{P} , X_{0} , X_{1} , \dots . produced by a generator repeats, any value in the sequence could be used to “seed” the generator.

For a linear congruential generator, a random-number stream is nothing more than a convenien way to refer to a starting seed taken from the sequence X0,X1,…,XPX_{0} , X_{1} , \ldots , X_{P}(for a combined generator, the stream is a reference to the starting seeds for all of the basic generators); typically these starting seeds are far apart in the sequence. For instance, if the streams are b values apart, then stream i could be defined by starting seed

Si=Xb(i−1) S_{i} = X_{b (i - 1)}

for i=1,2,…,⌊P/b⌋i = 1 , 2 , \dots , \lfloor P / b \rfloor. Values of b=100,000b = 100 , 000 were common in older generators, but values as large as b=1037b = 10^{37} are in use in modern combined linear congruential generators. (See, for instance, L’Ecuyer et al. [2002] for the implementation of such a generator.) Thus, a single random-number generator with k streams acts like k distinct virtual random-number generators, provided that the current value of seed for each stream is maintained. Exercise 21 illustrates one way to create streams that are widely separated in the random-number sequence.

There is the problem of comparing two or more alternative systems via simulation; there are advantages to dedicating portions of the pseudo-random number sequence to the same purpose in each of the simulated systems. For instance, in comparing the efficiency of several queueing systems, a fairer comparison will be achieved if all of the simulated systems experience exactly the same sequence of customer arrivals. Such synchronization can be achieved by assigning a specific stream to generate arrivals in each of the queueing simulations. If the starting seeds for these streams are

spaced far enough apart, then this has the same effect as having a distinct random-number generator whose only purpose is to generate customer arrivals.

4 Tests for Random Numbers

The desirable properties of random numbers—uniformity and independence—were discussed in Section 1. To check on whether these desirable properties have been achieved, a number of tests can be performed. (Fortunately, the appropriate tests have already been conducted for most commercia simulation software.) The tests can be placed in two categories, according to the properties of interest: uniformity and independence. A brief description of two types of tests is given in this section:

  1. Frequency test. Uses the Kolmogorov–Smirnov or the chi-square test to compare the distribution of the set of numbers generated to a uniform distribution.

  2. Autocorrelation test. Tests the correlation between numbers and compares the sample correlation to the desired correlation, zero

In testing for uniformity, the hypotheses are as follows:

H0 ⁣:Ri∼Uniform[0,1]H1 ⁣:Ri≁Uniform[0,1] \begin{array}{l l} H_{0} \colon & R_{i} \sim \text{Uniform[0,1]} \\ H_{1} \colon & R_{i} \not \sim \text{Uniform[0,1]} \end{array}

The null hypothesis,H0,H_{0} ,, reads that the numbers are distributed uniformly on the interval [0, 1]. Failure to reject the null hypothesis means that evidence of nonuniformity has not been detected by this test. This does not imply that further testing of the generator for uniformity is unnecessary.

In testing for independence, the hypotheses are as follows:

H0:Ri∼independentlyH1:Ri≁independently \begin{array}{l l} H_{0}: & R_{i} \sim \text{independently} \\ H_{1}: & R_{i} \not \sim \text{independently} \end{array}

This null hypothesis,H0,H_{0} ,, reads that the numbers are independent. Failure to reject the null hypothesis means that evidence of dependence has not been detected by this test. This does not imply that further testing of the generator for independence is unnecessary.

For each test, a level of significance α must be stated. The level α is the probability of rejecting the null hypothesis when the null hypothesis is true:

α=P(rejectH0∣H0true) \alpha = P (\text{reject} H_{0} | H_{0} \text{true})

The decision maker sets the value of α for any test. Frequently, α is set to 0.01 or 0.05.

If several tests are conducted on the same set of numbers, the probability of rejecting the nul hypothesis on at least one test, by chance alone (i.e., making a Type I (α) error), increases. Say that α=0.05\alpha = 0 . 05 and that five different tests are conducted on a sequence of numbers. The probability o rejecting the null hypothesis on at least one test, by chance alone, could be as large as 0.25.

Similarly, if one test is conducted on many sets of numbers from a generator, the probability of rejecting the null hypothesis on at least one test by chance alone (i.e., making a Type I (α) error), increases as more sets of numbers are tested. For instance, if 100 sets of numbers were subjected to the test, with α=0.05\alpha = 0 . 05, it would be expected that five of those tests would be rejected by chance alone. If the number of rejections in 100 tests is close to 100α, then there is no compelling reason to discard the generator. The concept discussed in this and the preceding paragraph is discussed further at the conclusion of Example 8.

If one of the well-known simulation languages or random-number generators is used, it is probably unnecessary to apply the tests just mentioned or those described in Sections 4.1 and 4.2. However, random-number generators frequently are added to software that is not specifically developed for simulation, such as spreadsheet programs, symbolic/numerical calculators, and programming languages. If the generator that is at hand is not explicitly known or documented, then the tests in this chapter should be applied to many samples of numbers from the generator. Some additiona tests that are commonly used, but are not covered here, are Good’s serial test for sampling numbers [1953, 1967], the median-spectrum test [Cox and Lewis, 1966; Durbin, 1967], the runs test [Law 2007], and a variance heterogeneity test [Cox and Lewis, 1966]. Even if a set of numbers passes al the tests, there is no guarantee of randomness; it is always possible that some underlying pattern has gone undetected.

In this text, we emphasize empirical tests that are applied to actual sequences of numbers produced by a generator. Because of the extremely long period of modern pseudo-random-number generators, as described in Section 3.2, it is no longer possible to apply these tests to a significan portion of the period of such generators. The tests can be used as a check if one encounters a generator with completely unknown properties (perhaps one that is undocumented and buried deep in a software package), but they cannot be used to establish the quality of a generator throughou its period. Fortunately, there are also families of theoretical tests that evaluate the choices for m, a, and c without actually generating any numbers, the most common being the spectral test. Many o these tests assess how k-tuples of random numbers fill up a k-dimensional unit cube. These tests are beyond the scope of this text; see, for instance, Ripley [1987].

In the examples of tests that follow, the hypotheses are not restated. The hypotheses are as indicated in the foregoing paragraphs. Although few simulation analysts will need to perform these tests, every simulation user should be aware of the qualities of a good random-number generator.

4.1 Frequency Tests

A basic test that should always be performed to validate a new generator is the test of uniformity. Two different methods of testing are the Kolmogorov–Smirnov and the chi-square test. Both of these tests measure the degree of agreement between the distribution of a sample of generated random numbers and the theoretical uniform distribution. Both tests are based on the null hypothesis of no significant difference between the sample distribution and the theoretical distribution.

  1. The Kolmogorov–Smirnov test. This test compares the continuous cdf F(x)F ( x ) of the uniform distribution with the empirical cdf SN(x)S_{N} ( x ) of the sample of N observations. By definition,
F(x)=x,0≤x≤1 F (x) = x, \quad 0 \leq x \leq 1

If the sample from the random-number generator is R1,R2,…,RNR_{1} , R_{2} , \ldots , R_{N}, then the empirical cdf SN(x)S_{N} ( x ) is defined by

SN(x)=number ofR1,R2,…,RNwhich are≤xN S_{N} (x) = \frac {\text{number of} R_{1} , R_{2} , \dots , R_{N} \text{which are} \leq x}{N}

As N becomes larger,SN(x)S_{N} ( x ) should become a better approximation to F(x)F ( x ), provided that the null hypothesis is true.

The cdf of an empirical distribution is a step function with jumps at each observed value.

The Kolmogorov–Smirnov test is based on the largest absolute deviation between F(x)F ( x ) and SN(x)S_{N} ( x ) over the range of the random variable—that is,{\mathrm{i s}} , it is based on the statistic

D=max⁡∣F(x)−SN(x)∣(3) D = \max | F (x) - S_{N} (x) |\tag{3}

The sampling distribution of D is known; it is tabulated as a function of N in Table A.8. For testing against a uniform cdf, the test procedure follows these steps:

Step 1. Rank the data from smallest to largest. Let R(i)R_{( i )} denote the ith smallest observation, so that

R(1)≤R(2)≤⋯≤R(N) R_{(1)} \leq R_{(2)} \leq \dots \leq R_{(N)}

Step 2. Compute

D+=max⁡1≤i≤N{iN−R(i)} D^{+} = \max_{1 \leq i \leq N} \left\{\frac {i}{N} - R_{(i)} \right\} D−=max⁡1≤i≤N{R(i)−i−1N} D^{-} = \max_{1 \leq i \leq N} \left\{R_{(i)} - \frac {i - 1}{N} \right\}

Step 3. Compute D=max⁡(D+,D−)D = \operatorname* {m a x} ( D^{+} , D^{-} ) Step 4. Locate the critical value DαD_{\alpha} in Table A.8 for the specified significance level α and the given sample size N.

Step 5. If the sample statistic D is greater than the critical value Dα.D_{\alpha} ., the null hypothesis that the data are a sample from a uniform distribution is rejected. I :D≤Dα: D \le D_{\alpha}, conclude that no difference has been detected between the true distribution of {R1,R2,…,RN}\{R_{1} , R_{2} , \ldots , R_{N} \} and the uniform distribution.

Example 6

Suppose that the five numbers 0.44, 0.81, 0.14, 0.05, 0.93 were generated, and it is desired to perform a test for uniformity by using the Kolmogorov–Smirnov test with the level of significance α=0.05\alpha = 0 . 05 First, the numbers must be sorted from smallest to largest. The calculations can be facilitated by use of Table 2. The top row lists the numbers from smallest (R(1))( R_{( 1 )} ) to largest (R(5))( R_{( 5 )} ). The computations for D+D^{+}, namely i/N−R(i)i / N - R_{( i )}, and for D−D^{-}, namely R(i)−(i−1)/NR_{( i )} - ( i - 1 ) / N, are easily accomplished by using Table 2. The statistics are computed as D+=0.26D^{+} = 0 . 26 and D−=0.21D^{-} = 0 . 21. Therefore,D=max⁡{0.26,0.21}=0.26D = \operatorname* {m a x} \{0 . 26 , 0 . 21 \} = 0 . 26 Table 2 Calculations for Kolmogorov–Smirnov Test

R(i)R_{(i)}0.050.140.440.810.93
i/Ni/N0.200.400.600.801.00
i/N−R(i)i/N - R_{(i)}0.150.260.16—0.07
R(i)−(i−1)/NR_{(i)} - (i-1)/N0.05—0.040.210.13

The critical value of D,D , obtained from Table A.8 in the Appendix for α=0.05\alpha = 0 . 05 and N=5,N = 5 ,, is 0.565. Since the computed value, 0.26, is less than the tabulated critical value, 0.565, the hypothesis tha the distribution of the generated numbers is the uniform distribution is not rejected.

The calculations in Table 2 are illustrated in Figure 2, where the empirical cdf SN(x)S_{N} ( x ) is compared to the uniform cdf F(x)F ( x ). It can be seen that D+D^{+} is the largest deviation of SN(x)S_{N} ( x ) above F(x)F ( x )), and that D−D^{-} is the largest deviation of SN(x)S_{N} ( x ) below F(x)F ( x ). For example, at R(3)R_{( 3 )}, the value of D+D^{+} is given by 3/5−R(3)=0.60−0.44=0.16.3 / 5 - R_{( 3 )} = 0 . 60 - 0 . 44 = 0 . 16 {\mathrm{.}}, and that of D−D^{-} is given by R(3)−2/5=0.44−0.40=0.04R_{( 3 )} - 2 / 5 = 0 . 44 - 0 . 40 = 0 . 04 Although the test statistic D is defined by Equation (3) as the maximum deviation over all x, it can be seen from Figure 2 that the maximum deviation will always occur at one of the jump points R(1),R(2),…,R(N);R_{( 1 )} , R_{( 2 )} , \ldots , R_{( N )} ;; thus, the deviation at other values of x need not be considered.

  1. The chi-square test. The chi-square test uses the sample statistic
χ02=∑i=1n(Oi−Ei)2Ei \chi_{0} ^ {2} = \sum_{i = 1} ^ {n} \frac {(O_{i} - E_{i}) ^ {2}}{E_{i}}

where OiO_{i} is the observed number in the ith class,EiE_{i} is the expected number in the ith class, and n is the number of classes. For the uniform distribution Ei,E_{i} ,, the expected number in each class is given by

Ei=Nn E_{i} = \frac {N}{n}

for equally spaced classes, where N is the total number of observations. It can be shown that the sampling distribution of χ02\chi_{0} ^ {2} is approximately the chi-square distribution with n 1 degrees offreedom.

Example 7

Use the chi-square test with α=0.05\alpha = 0 . 05 to test for whether the data shown next are uniformly distributed. Table 3 contains the essential computations. The test uses n=10n = 10 intervals of equal length, namely [0,0.1),[0.1,0.2),…,[0.9,1.0)[ 0 , 0 . 1 ) , [ 0 . 1 , 0 . 2 ) , \ldots , [ 0 . 9 , 1 . 0 ). The value of χ02\chi_{0} ^ {2} is 3.4. This is compared with the critical value χ0.05,92=16.9\chi_{0 . 05 , 9} ^ {2} = 16 . 9 from Table A.6. Since χ02\chi_{0} ^ {2} is much smaller than the tabulated value of χ0.05,92\chi_{0 . 05 , 9} ^ {2}, the null hypothesis of a uniform distribution is not rejected.

Figure 2 Comparison of F(x) and SN(x)S_{N} ( x )| 0.34 | 0.90 | 0.25 | 0.89 | 0.87 | 0.44 | 0.12 | 0.21 | 0.46 | 0.67 |

0.830.760.790.640.700.810.940.740.220.74
0.960.990.770.670.560.410.520.730.990.02
0.470.300.170.820.560.050.450.310.780.05
0.790.710.230.190.820.930.650.370.390.42
0.990.170.990.460.050.660.100.420.180.49
0.370.510.540.010.810.280.690.340.750.49
0.720.430.560.970.300.940.960.580.730.05
0.060.390.840.240.400.640.400.190.790.62
0.180.260.970.880.640.470.600.110.290.78

Different authors have offered considerations concerning the application of the chi-square test. In the application to a data set the size of that in Example 7, the considerations do not apply—that is, if 100 values are in the sample and from 5 to 10 intervals of equal length are used, the test will be acceptable. In general, it is recommended that n and N be chosen so that each Ei≥5E_{i} \geq 5 Both the Kolmogorov–Smirnov test and the chi-square test are acceptable for testing the uniformity of a sample of data, provided that the sample size is large. However, the Kolmogorov–Smirnov test is the more powerful of the two and is recommended. Furthermore, the Kolmogorov–Smirnov test can be applied to small sample sizes, whereas the chi-square is valid only for large samples, say N≥50N \geq 50 Table 3 Computations for Chi-Square Test

IntervalOiO_iEiE_iOi−EiO_i - E_i(Oi−Ei)2(O_i - E_i)^2(Oi−Ei)2Ei\frac{(O_i - E_i)^2}{E_i}
1810-240.4
2810-240.4
31010000.0
4910-110.1
51210240.4
6810-240.4
71010000.0
814104161.6
91010000.0
101110110.1
10010003.4

Imagine a set of 100 numbers that are being tested for independence, one where the first 10 values are in the range 0.01–0.10, the second 10 values are in the range 0.11–0.20, and so on. This set of numbers would pass the frequency tests with ease, but the ordering of the numbers produced by the generator would not be random. The test in the next section of this chapter is concerned with the independence of random numbers that are generated.

4.2 Tests for Autocorrelation

The tests for autocorrelation are concerned with the dependence between numbers in a sequence. As an example, consider the following sequence of numbers, read from left to right:

0.120.010.230.280.890.310.640.280.830.93
0.990.150.330.350.910.410.600.270.750.88
0.680.490.050.430.950.580.190.360.690.87

From a visual inspection, these numbers appear random, and they would probably pass all the tests presented to this point. However, an examination of the 5th, 10th, 15th (every five numbers beginning with the fifth), and so on, indicates a very large number in that position. Now, 30 numbers is a rather small sample size on which to reject a random number generator, but the notion is that numbers in the sequence might be related. In this particular section, a method for discovering whether such a relationship exists is described. The relationship would not have to be all high numbers. It is possible to have all low numbers in the locations being examined, or the numbers could alternate from very high to very low.

The test to be described shortly requires the computation of the autocorrelation between every  numbers ( is also known as the lag),l a g ) ,, starting with the ith number. Thus, the autocorrelation ρiℓ\rho_{i \ell} between the following numbers would be of interest:Ri,Ri+ℓ,Ri+2ℓ,…,Ri+(M+1)ℓR_{i} , R_{i + \ell} , R_{i + 2 \ell} , \ldots , R_{i + ( M + 1 ) \ell}. The value M is the largest integer such that i+(M+1)ℓ≤Ni + ( M + 1 ) \ell \leq N, where N is the total number of values in the sequence. (Thus, a subsequence of length M+2M + 2 is being tested.)

Figure 3 Failure to reject hypothesis.

A nonzero autocorrelation implies a lack of independence, so the following two-tailed test is appropriate:

H0:ρiℓ=0H1:ρiℓ≠0 \begin{array}{r l} {H_{0}:} & {\rho_{i \ell} = 0} \\ {H_{1}:} & {\rho_{i \ell} \neq 0} \end{array}

For large values of M, the distribution of the estimator of ρiℓ\rho_{i \ell}, denoted ρ^iℓ\widehat {\rho} _ {i \ell}, is approximately normal if the values Ri,Ri+ℓ,Ri+2ℓ,…,Ri+(M+1)ℓR_{i} , R_{i + \ell} , R_{i + 2 \ell} , \ldots , R_{i + ( M + 1 ) \ell} are uncorrelated. Then the test statistic can be formed as follows:

Z0=ρ^iℓσρ^iℓ Z_{0} = \frac {\widehat {\rho} _ {i \ell}}{\sigma_ {\widehat {\rho} _ {i \ell}}}

which is distributed normally with a mean of zero and a variance of 1, under the assumption of independence, for large M.

The formula for ρ^iℓ\widehat {\rho} _ {i \ell}, in a slightly different form, and the standard deviation of the estimator σρ^iℓ\sigma _ {\hat {\rho} _ {i \ell}} are given by Schmidt and Taylor [1970] as follows:

ρ^iℓ=1M+1[∑k=0MRi+kℓRi+(k+1)ℓ]−0.25 \widehat {\rho} _ {i \ell} = \frac {1}{M + 1} \left[ \sum_{k = 0} ^ {M} R_{i + k \ell} R_{i + (k + 1) \ell} \right] - 0. 25

and

σρ^iℓ=13M+712(M+1) \sigma_ {\hat {\rho} _ {i \ell}} = \frac {\sqrt {13 M + 7}}{12 (M + 1)}

After computing Z0,Z_{0} , do not reject the null hypothesis of independence if−zα/2≤Z0≤zα/2\mathrm{i f} - z_{\alpha / 2} \le Z_{0} \le z_{\alpha / 2} where α is the level of significance and zα/2z_{\alpha / 2} is obtained from Table A.3. Figure 3 illustrates this test.

If ρiℓ>0.\rho_{i \ell} > 0 ., the subsequence is said to exhibit positive autocorrelation. In this case, successive values at lag  have a higher probability than expected of being close in value (i.e.( \mathrm{i . e .}, high random numbers in the subsequence followed by high, and low followed by low). On the other hand, if ρiℓ<0\rho_{i \ell} < 0 the subsequence is exhibiting negative autocorrelation, which means that low random numbers tend

to be followed by high ones, and vice versa. The desired property, independence (which implies zero autocorrelation), means that there is no discernible relationship of the nature discussed here between successive random numbers at lag .

Example 8

Test for whether the 3rd, 8th, 13th, and so on, numbers in the sequence at the beginning of this section are autocorrelated using α=0.05\alpha = 0 . 05. Here, i 3 (beginning with the third number),ℓ=5\ell = 5(every five numbers),N=30N = 30(30 numbers in the sequence), and M=4M = 4(largest integer such tha 3+(M+1)5≤30)3 + ( M + 1 ) 5 \le 30 ). Then,

ρ^35=14+1[(0.23)(0.28)+(0.28)(0.33)+(0.33)(0.27)+(0.27)(0.05)+(0.05)(0.36)]−0.25=−0.1945 \begin{array}{r l} \widehat {\rho} _ {35} & = \frac {1}{4 + 1} [ (0. 23) (0. 28) + (0. 28) (0. 33) + (0. 33) (0. 27) + (0. 27) (0. 05) \\ & \quad + (0. 05) (0. 36) ] - 0. 25 \\ & = - 0. 1945 \end{array}

and

σρ^35=13(4)+712(4+1)=0.1280 \sigma_ {\hat {\rho} _ {35}} = \frac {\sqrt {13 (4) + 7}}{12 (4 + 1)} = 0. 1280

Then, the test statistic assumes the value

Z0=−0.19450.1280=−1.516 Z_{0} = - \frac {0 . 1945}{0 . 1280} = - 1. 516

Now, the critical value from Table A.3 is

z0.025=1.96 z_{0. 025} = 1. 96

Therefore, the hypothesis of independence cannot be rejected on the basis of this test.

It can be observed that this test is not very sensitive for small values of M, particularly when the numbers being tested are on the low side. Imagine what would happen if each of the entries in the foregoing computation of ρ^iℓ\widehat {\rho} _ {i \ell} were equal to zero. Then ρ^iℓ\widehat {\rho} _ {i \ell} would be equal to 0.25 and the calculated Z would have the value of 1.95, not quite enough to reject the hypothesis of independence.

There are many sequences that can be formed in a set of data, given a large value of N. For example, beginning with the first number in the sequence, possibilities include (a) the sequence of all numbers, (b) the sequence formed from the first, third, fifth, . . . , numbers, (c) the sequence formed from the first, fourth, . . . , numbers, and so on. If α=0.05\alpha = 0 . 05, there is a probability of 0.05 of rejecting a true hypothesis. If 10 independent sequences are examined, the probability of finding no significan autocorrelation, by chance alone, is (0.95)10( 0 . 95 ) ^ {10} or 0.60. Thus, 40% of the time significant autocorrelation would be detected when it does not exist. If α is 0.10 and 10 tests are conducted, there is a 65% chance of finding autocorrelation by chance alone. In conclusion, in “fishing” for autocorrelation by performing numerous tests, autocorrelation might eventually be detected, perhaps by chance alone, even when there is no autocorrelation present.

5 Summary

This chapter described the generation of random numbers and the subsequent testing of the generated numbers for uniformity and independence. Random numbers are used to generate random variates.

Of the many types of random-number generators available, ones based on the linear congruentia method are the most widely used, but they are being replaced by combined linear congruentia generators. Of the many types of statistical tests that are used in testing random-number generators, two different types are described: one testing for uniformity and one testing for independence.

The simulation analyst might never work directly with a random-number generator or with the testing of random numbers from a generator. Most computers and simulation languages have methods that generate a random number, or streams of random numbers, for the asking. But even generators that have been used for years, some of which are still in use, have been found to be inadequate. So this chapter calls the simulation analyst’s attention to such possibilities, with a warning to investigate and confirm that the generator has been tested thoroughly. Some researchers have attained sophisticated expertise in developing methods for generating and testing random numbers and the subsequent application of these methods. This chapter provides only a basic introduction to the subject matter; more depth and breadth are required for the reader to become a specialist in the area. An importan foundational reference is Knuth [1998]; see also the reviews in Bratley, Fox, and Schrage [1996], Law [2007], L’Ecuyer [1998], and Ripley [1987].

One final caution is due. Even if generated numbers pass all the tests (those covered in this chapter and those mentioned in the chapter), some underlying pattern might have gone undetected without the generator’s having been rejected as faulty. However, the generators available in widely used simulation languages have been extensively tested and validated.

REFERENCES

BRATLEY, P., B. L. FOX, AND L. E. SCHRAGE [1996], A Guide to Simulation, 2d ed., Springer-Verlag, New York.

COX, D. R., AND P. A. W. LEWIS [1966], The Statistical Analysis ofSeries ofEvents, Methuen, London.

DURBIN, J. [1967], “Tests of Serial Independence Based on the Cumulated Periodogram,” Bulletin of the International Institute ofStatistics, vol. 42, pp. 1039–1049.

GOOD, I. J. [1953], “The Serial Test for Sampling Numbers and Other Tests of Randomness,” Proceedings of the Cambridge Philosophical Society, Vol. 49, pp. 276–284.

GOOD, I. J. [1967], “The Generalized Serial Test and the Binary Expansion of 4,” Journal ofthe Royal Statistical Society, Ser. A, Vol. 30, No. 1, pp. 102–107.

KNUTH, D. W. [1998], TheArt ofComputer Programming:Vol. 2, Semi-numericalAlgorithms, 2d ed.,Addison– Wesley, Reading, MA.

LAW, A. M. [2007], Simulation Modeling and Analysis, 4th ed., McGraw-Hill, New York.

LEARMONTH, G. P., AND P. A. W. LEWIS [1973], “Statistical Tests of Some Widely Used and Recently Proposed Uniform Random Number Generators,” Proceedings ofthe Conference on Computer Science and Statistics: Seventh Annual Symposium on the Interface, Western Publishing, North Hollywood, CA, pp. 163–171.

L’ECUYER, P. [1988], “Efficient and Portable Combined Random Number Generators,” Communications of the ACM, Vol. 31, pp. 742–749, 774.

L’ECUYER, P. [1996], “Combined Multiple Recursive Random Number Generators,” Operations Research, Vol. 44, pp. 816–822.

L’ECUYER, P. [1998], “Random Number Generation,” Chapter 4 in Handbook of Simulation, J. Banks, ed., pp. 93–137. Wiley, New York.

L’ECUYER, P. [1999], “Good Parameters and Implementations for Combined Multiple Recursive Random Number Generators,” Operations Research, Vol. 47, pp. 159–164.

L’ECUYER, P., R. SIMARD, E. J. CHEN,AND W. D. KELTON [2002], “An Object-Oriented Random-Number Package with Many Long Streams and Substreams,” Operations Research, Vol. 50, pp. 1073–1075.

LEHMER, D. H. [1951], “Mathematical Methods in large-Scale Computing Units,” Proceedings ofthe Second Symposium on Large-Scale Digital Calculating Machinery, Harvard University Press, Cambridge, MA, pp. 141–146.

LEWIS, P. A. W., A. S. GOODMAN, AND J. M. MILLER [1969], “A Pseudo-Random Number Generator for the System/360,” IBM Systems Journal, Vol. 8, pp. 136–145.

RIPLEY, B. D. [1987], Stochastic Simulation, Wiley, New York.

SCHMIDT, J. W., and R. E. TAYLOR [1970], Simulation and Analysis of Industrial Systems, Irwin, Home wood, IL.

EXERCISES

  1. Describe a procedure to physically generate random numbers on the interval [0, 1] with 2-digit accuracy. [Hint: Consider drawing something out of a hat.]

  2. List applications, other than systems simulation, for pseudo-random numbers—for example, video gambling games.

  3. How could random numbers that are uniform on the interval [0, 1] be transformed into random numbers that are uniform on the interval [ 11, 17]?

  4. Use the linear congruential method to generate a sequence of three two-digit random integers and corresponding random numbers. Let X 27, a 8, c 47, and m 100.

  5. Do we encounter a problem in the previous exercise if X0=0?X_{0} = 0 ?6. Use the multiplicative congruential method to generate a sequence of four three-digit random integers and corresponding random numbers. Let X0=117X_{0} = 117, a 43, and m 1000.

  6. The sequence ofnumbers 0.54, 0.73, 0.98, 0.11, and 0.68 has been generated. Use the Kolmogorov– Smirnov test with α=0.05\alpha = 0 . 05 to learn whether the hypothesis that the numbers are uniformly distributed on the interval [0, 1] can be rejected.

  7. Reverse the 100 two-digit random numbers in Example 7 to get a new set of random numbers. Thus, the first random number in the new set will be 0.43. Use the chi-square test, with α=0.05\alpha = 0 . 05 to learn whether the hypothesis that the numbers are uniformly distributed on the interval [0, 1] can be rejected.

  8. Figure out whether these linear congruential generators can achieve a maximum period; also, state restrictions on X0X_{0} to obtain this period:

(a) the mixed congruential method with

a=2,814,749,767,109c=59,482,661,568,307m=248 \begin{array}{l} a = 2, 814, 749, 767, 109 \\ c = 59, 482, 661, 568, 307 \\ m = 2^{48} \end{array}

(b) the multiplicative congruential generator with

a=69,069c=0m=232 \begin{array}{l} {a = 69, 069} \\ {c = 0} \\ {m = 2^{32}} \end{array}

(c) the mixed congruential generator with

a=4951c=247m=256 \begin{array}{c} {a = 4951} \\ {c = 247} \\ {m = 256} \end{array}

(d) the multiplicative congruential generator with

a=6507c=0m=1024 \begin{array}{c} {a = 6507} \\ {c = 0} \\ {m = 1024} \end{array}
  1. Use the mixed congruential method to generate a sequence of three two-digit random integers and corresponding random numbers with X0=37,a=7,c=29X_{0} = 37 , a = 7 , c = 29, and m=100m = 10011. Use the mixed congruential method to generate a sequence of three two-digit random integers between 0 and 24 and corresponding random numbers with X0=13,a=9X_{0} = 13 , a = 9, and c=35c = 3512. Write a computer program that will generate four-digit random numbers, using the multiplicative congruential method. Allow the user to input values of X0,a,c.X_{0} , a , c ., and m.m .13. If X0=3579X_{0} = 3579 in Exercise 9(c).9 ( \mathrm{c} ) ., generate the first random number in the sequence. Compute the random number to four-place accuracy.

  2. Investigate the random-number generator in a spreadsheet program on a computer to which you have access. In many spreadsheets, random numbers are generated by a function called RAND or @RAND.

(a) Check the user’s manual to see whether it describes how the random numbers are generated.

(b) Write macros to conduct each of the tests described in this chapter. Generate 100 sets o random numbers, each set containing 1000 random numbers. Perform each test on each set of random numbers. Draw conclusions.

  1. Consider the multiplicative congruential generator under the following circumstances:

(a) X0=7,a=11,m=16X_{0} = 7 , a = 11 , m = 16(b) X0=8,a=11,m=16X_{0} = 8 , a = 11 , m = 16(c) X0=7,a=7,m=16X_{0} = 7 , a = 7 , m = 16

(d)X0=8,a=7,m=16 \mathrm{(d)} X_{0} = 8, a = 7, m = 16

Generate enough values in each case to complete a cycle. What inferences can be drawn? Is maximum period achieved?

  1. L’Ecuyer [1988] provides a generator that combines three multiplicative generators, with a1=a_{1} =157,m1=32,363,a2=146,m2=31,727,a3=142m_{1} = 32 , 363 , a_{2} = 146 , m_{2} = 31 , 727 , a_{3} = 142, and m3=31,657m_{3} = 31 , 657. The period of this generator is approximately 8×10128 \times 10^{12}. Generate 5 random numbers with the combined generator, using the initial seeds X1,0=100,X2,0=300X_{1 , 0} = 100 , X_{2 , 0} = 300 and X3,0=500X_{3 , 0} = 500, for the individual generators.

  2. Apply the tests described in this chapter to the generator given in the previous exercise.

  3. Use the principles described in this chapter to develop your own linear congruential randomnumber generator.

  4. Use the principles described in this chapter to develop your own combined linear congruentia random-number generator.

  5. Test the following sequence of numbers for uniformity and independence, using procedures you learned in this chapter: 0.594, 0.928, 0.515, 0.055, 0.507, 0.351, 0.262, 0.797, 0.788, 0.442, 0.097, 0.798, 0.227, 0.127, 0.474, 0.825, 0.007, 0.182, 0.929, 0.852.

  6. In some applications, it is useful to be able to quickly skip ahead in a pseudo-random number sequence without actually generating all of the intermediate values.

(a) For a linear congruential generator with c=0.c = 0 ., show that Xi+n=(anXi)X_{i + n} = ( a^{n} X_{i} ) mod m.m ..

(b) Next, show that (anXi)( a^{n} X_{i} ) mod m=(anm = ( a^{n} mod m)Xim ) X_{i} mod m (this result is useful because ana^{n} mod m can be precomputed, making it easy to skip ahead n random numbers from any point in the sequence).

(c) In Example 3, use this result to compute X5,X_{5} ,, starting with X0=63X_{0} = 63. Check your answer by computing X5X_{5} in the usual way.

  1. Producing good pseudo-random-number generators is much more difficult than it seems. For instance, mathematical genius John Von Neumann proposed the middle-square method. To generate, say, six-digit pseudo-random numbers by the middle-square method, begin with a six-digit integer as the seed. Square the number and extract the middle six digits as the next number in the sequence. Continue the process by repeatedly squaring the current number and extracting the middle six digits as the next number. To obtain numbers between 0 and 1, a decimal point can be placed in front of the six digits. Try a few examples to show how this method can fail spectacularly. (Von Neumann was aware of these problems.)

List of Materials Available on www.bcnn.net

RandomNumberTools.xls

8 Random-Variate Generation

This chapter deals with procedures for sampling from a variety ofwidely used continuous and discrete distributions. Previous discussions and examples indicated the usefulness of probability distributions in modeling activities that are generally unpredictable or uncertain. For example, interarrival times and service times at queues and demands for a product are quite often unpredictable in nature, a least to a certain extent. Usually, such variables are modeled as random variables with some specified probability distribution, and standard statistical procedures exist for estimating the parameters of the hypothesized distribution and for testing the validity of the assumed statistical model.

In this chapter, it is assumed that a distribution has been completely specified, and ways are sough to generate samples from this distribution to be used as input to a simulation model. The purpose of the chapter is to explain and illustrate some widely used techniques for generating random variates, not to give a state-of-the-art survey of the most efficient techniques. In practice, most simulation modelers will use either existing routines available in programming libraries or the routines built into a simulation language. However, some programming languages do not have built-in routines for all of the regularly used distributions, and some computer installations do not have random-variategeneration libraries; in such cases the modeler must construct an acceptable routine. Even though the chance of this happening is small, it is nevertheless worthwhile to understand how random-variate generation occurs.

This chapter discusses the inverse-transform technique and, more briefly, the acceptance-rejection technique and special properties. Another technique, the composition method, is discussed by Devroye [1986], Dagpunar [1988], and Law [2007]. All the techniques in this chapter assume that a source of uniform [0,1] random numbers,R1,R2,…R_{1} , R_{2} , \ldots. is readily available, where each RiR_{i} has pdf

fR(x)={1,0≤x≤10,otherwise f_{R} (x) = \left\{\begin{array}{l l} 1, & 0 \leq x \leq 1 \\ 0, & \text{otherwise} \end{array} \right.

and cdf

FR(x)={0,x<0x,0≤x≤11,x>1 F_{R} (x) = \left\{\begin{array}{l l} 0, & x < 0 \\ x, & 0 \leq x \leq 1 \\ 1, & x > 1 \end{array} \right.

Throughout this chapter R and R1,R2,…R_{1} , R_{2} , \ldots. represent random numbers uniformly distributed on [0,1] and generated by random-number generation techniques or taken from a random number table, such as Table A.1 in the Appendix. Many of the algorithms in this chapter have been translated into Visual Basic for Applications and can be found in the spreadsheet RandomNumberTools.xls at www.bcnn.net.

1 Inverse-Transform Technique

The inverse-transform technique can be used to sample from the exponential, uniform, Weibull, and triangular distributions, and from empirical distributions. Additionally, it is the underlying principle for sampling from a wide variety of discrete distributions. The technique will be explained in detai for the exponential distribution and then applied to other distributions. Computationally, it is the most straightforward, but not always the most efficient, technique.

1.1 Exponential Distribution

The exponential distribution has the probability density function (pdf)

f(x)={λe−λx,x≥00,x<0 f (x) = \left\{\begin{array}{l l} \lambda e^{- \lambda x}, & x \geq 0 \\ 0, & x < 0 \end{array} \right.

and the cumulative distribution function (cdf)

F(x)=∫−∞xf(t)dt={1−e−λx,x≥00,x<0 F (x) = \int_{- \infty} ^ {x} f (t) d t = \left\{\begin{array}{l l} 1 - e^{- \lambda x}, & x \geq 0 \\ 0, & x < 0 \end{array} \right.

The parameter λ can be interpreted as the mean number of occurrences per time unit. For example, if interarrival times X1,X2,X3,...X_{1} , X_{2} , X_{3} , . . .. had an exponential distribution with rate λ, then λ could be interpreted as the mean number of arrivals per time unit, or the arrival rate. Notice that, for any i,

E(Xi)=1λ E (X_{i}) = \frac {1}{\lambda}

and so 1/λ1 / \lambda is the mean interarrival time. The goal here is to develop a procedure for generating values X1,X2,X3,...X_{1} , X_{2} , X_{3} , . . .. that have an exponential distribution.

The inverse-transform technique can be utilized, at least in principle, for any distribution, but it is most useful when the cdf,F(x)F ( x )), is of a form so simple that its inverse,F−1F^{- 1}, can be computed easily. (The notation F−1F^{- 1} denotes the solution of the equation r=F(x)r = F ( {\boldsymbol {x}} ) for x; it does not denote 1/F.)1 / F . ) One step-by-step procedure for the inverse-transform technique, illustrated by the exponentia distribution, is shown here:

Step 1. Compute the cdf of the desired random variable XX For the exponential distribution, the cdf is F(x)=1−e−λx,x≥0F ( x ) = 1 - e^{- \lambda x} , x \geq 0 Step 2. Set F(X)=RF ( X ) = R on the range of X.

For the exponential distribution, it becomes 1−e−λX=R1 - e^{- \lambda X} = R on the range X≥0X \geq 0 X is a random variable (with the exponential distribution in this case), so 1−e−λX1 - e^{- \lambda X} is also a random variable, here called R. As will be shown later, R has a uniform distribution over the interval [0, 1].

Step 3. Solve the equation F(X)=RF ( X ) = R for X in terms of R.

For the exponential distribution, the solution proceeds as follows:

1−e−λX=Re−λX=1−R−λX=ln⁡(1−R)X=−1λln⁡(1−R)(1) \begin{array}{c} 1 - e^{- \lambda X} = R \\ e^{- \lambda X} = 1 - R \\ - \lambda X = \ln (1 - R) \\ X = - \frac {1}{\lambda} \ln (1 - R) \end{array}\tag{1}

Equation (1) is called a random-variate generator for the exponential distribution. In general, Equation (1) is written as X=F−1(R)X = F^{- 1} ( R ). Generating a sequence of values is accomplished through Step 4.

Step 4. Generate (as needed) uniform random numbers R1,R2,R3,...R_{1} , R_{2} , R_{3} , . . .. and compute the desired random variates by

Xi=F−1(Ri) X_{i} = F^{- 1} (R_{i})

For the exponential case,F−1(R)=(−1/λ)ln⁡(1−R)F^{- 1} ( R ) = ( - 1 / \lambda ) \ln ( 1 - R ) by Equation (1), so

Xi=−1λln⁡(1−Ri)(2) X_{i} = - \frac {1}{\lambda} \ln (1 - R_{i})\tag{2}

for i=1,2,3,…i = 1 , 2 , 3 , \dots. One simplification that is usually employed in Equation (2) is to replace 1−Ri1 - R_{i} by RiR_{i} to yield

Xi=−1λln⁡Ri(3) X_{i} = - \frac {1}{\lambda} \ln R_{i}\tag{3}

This alternative is justified by the fact that both RiR_{i} and 1−Ri1 - R_{i} are uniformly distributed on [0,1].

Example 1

Table 1 gives a sequence of random numbers from Table A.1 and the computed exponential variates,Xi,X_{i} ,, given by Equation (2) with the value λ=1\lambda = 1. Figure 1(a) is a histogram of 200 values,R1,R2,…,R200R_{1} , R_{2} , \ldots , R_{200} from the uniform distribution, and Figure 1(b) is a histogram of the 200 values,X1,X2,…,X200X_{1} , X_{2} , \ldots , X_{200}, computed by Equation (2). Compare these empirical histograms with the theoretical density functions in Figure 1(c) and (d). As illustrated here, a histogram is an estimate of the underlying density function.

Table 1 Generation of Exponential Variates XiX_{i} with Mean 1, given Random Numbers RiR_{i}| i | 1 | 2 | 3 | 4 | 5 |

RiR_i0.13060.04220.65970.79650.7696
XiX_i0.14000.04311.0781.5921.468

Figure 2 gives a graphical interpretation of the inverse-transform technique. The cdf shown is F(x)=1−e−xF ( x ) = 1 - e^{- x}, an exponential distribution with rate λ=1\lambda = 1. To generate a value X1X_{1} with cdf F(x)F ( x ) a random number R1R_{1} between 0 and 1 is generated, then a horizontal line is drawn from R1R_{1} to the graph of the cdf, then a vertical line is dropped to the x axis to obtain X1X_{1}, the desired result. Notice the inverse relation between R1R_{1} and X1X_{1}, namely

R1=1−e−X1 R_{1} = 1 - e ^ {- X_{1}}

and

X1=−ln⁡(1−R1) X_{1} = - \ln (1 - R_{1})

In general, the relation is written as

R1=F(X1) R_{1} = F (X_{1})

and

X1=F−1(R1) X_{1} = F^{- 1} (R_{1})

Why does the random variable X1X_{1} generated by this procedure have the desired distribution? Pick a value x0x_{0} and compute the cumulative probability

P(X1≤x0)=P(R1≤F(x0))=F(x0)(4) P (X_{1} \leq x_{0}) = P (R_{1} \leq F (x_{0})) = F (x_{0})\tag{4}

To see the first equality in Equation (4), refer to Figure 2, where the fixed numbers x0x_{0} and F(x0)F ( x_{0} ) are drawn on their respective axes. It can be seen that X1≤x0X_{1} \leq x_{0} when and only when R1≤F(x0)R_{1} \leq F ( x_{0} )). Since 0≤F(x0)≤10 \leq F ( x_{0} ) \leq 1, the second equality in Equation (4) follows immediately from the fact that R1R_{1} is uniformly distributed on [0,1]. Equation (4) shows that the cdf of X1X_{1} is F;F ; hence,X1X_{1} has the desired distribution.

Figure 1 (a) Empirical histogram of 200 uniform random numbers; (b) empirical histogram of 200 exponential variates; (c) theoretical uniform density on [0,1]; (d) theoretical exponentia density with mean 1.

1.2 Uniform Distribution

Consider a random variable X that is uniformly distributed on the interval [a, b]. A reasonable guess for generating X is given by

X=a+(b−a)R(5) X = a + (b - a) R\tag{5}

Figure 2 Graphical view of the inverse-transform technique.

(Recall that R is always a random number on [0, 1].) The pdf of X is given by

f(x)={1b−a,a≤x≤b0,otherwise f (x) = \left\{\begin{array}{l l} \frac {1}{b - a}, & a \leq x \leq b \\ 0, & \text{otherwise} \end{array} \right.

The derivation of Equation (5) follows Steps 1 through 3 of Section 1.1:

Step 1. The cdf is given by

F(x)={0,x<ax−ab−a,a≤x≤b1,x>b F (x) = \left\{\begin{array}{l l} 0, & x < a \\ \frac {x - a}{b - a}, & a \leq x \leq b \\ 1, & x > b \end{array} \right.

Step 2. Set F(X)=(X−a)/(b−a)=RF ( X ) = ( X - a ) / ( b - a ) = R Step 3. Solving for X in terms of R yields X=a+(b−a)R,X = a + ( b - a ) R ,, which agrees with Equation (5).

1.3 Weibull Distribution

The Weibull distribution was introduced as a model for time to failure for machines or electronic components. When the location parameter ν is set to 0:

f(x)={βαβxβ−1e−(x/α)β,x≥00,otherwise f (x) = \left\{\begin{array}{l l} \frac {\beta}{\alpha^{\beta}} x^{\beta - 1} e ^ {- (x / \alpha) ^ {\beta}}, & x \geq 0 \\ 0, & \text{otherwise} \end{array} \right.

where α>0\alpha > 0 and β>0\beta > 0 are the scale and shape parameters of the distribution. To generate a Weibul variate, follow Steps 1 through 3 of Section 1.1:

Step 1. The cdf is given by F(X)=1−e−(x/α)β,x≥0F ( X ) = 1 - e ^ {- ( x / \alpha ) ^ {\beta}} , x \geq 0 Step 2. Set F(X)=1−e−(X/α)β=R.F ( X ) = 1 - e ^ {- ( X / \alpha ) ^ {\beta}} = R . Step 3. Solving for X in terms of R yields

X=α[−ln⁡(1−R)]1/β(6) X = \alpha [ - \ln (1 - R) ] ^ {1 / \beta}\tag{6}

The derivation of Equation (6) is left as Exercise 10 for the reader. By comparing Equations (6) and (1), it can be seen that, if X is a Weibull variate, then XβX^{\beta} is an exponential variate with mean αβ\alpha^{\beta} Conversely, if Y is an exponential variate with mean μ,\mu ,, then Y1/βY^{1 / \beta} is a Weibull variate with shape parameter β\beta and scale parameter α=μ1/β\alpha = \mu^{1 / \beta}

1.4 Triangular Distribution

Consider a random variable X that has pdf

f(x)={x,0≤x≤12−x,1<x≤20,otherwise f (x) = \left\{\begin{array}{l l} x, & 0 \leq x \leq 1 \\ 2 - x, & 1 < x \leq 2 \\ 0, & \text{otherwise} \end{array} \right.

as shown in Figure 3. This distribution is called a triangular distribution with endpoints (0,2)( 0 , 2 ) and mode at 1. Its cdf is given by

F(x)={0,x≤0x22,0<x≤11−(2−x)22,1<x≤21,x>2 F (x) = \left\{\begin{array}{l l} 0, & x \leq 0 \\ \frac {x^{2}}{2}, & 0 < x \leq 1 \\ 1 - \frac {(2 - x) ^ {2}}{2}, & 1 < x \leq 2 \\ 1, & x > 2 \end{array} \right.

For 0≤X≤10 \leq X \leq 1

R=X22(7) R = \frac {X^{2}}{2}\tag{7}

Figure 3 Density function for a particular triangular distribution.

and for 1≤X≤21 \leq X \leq 2

R=1−(2−X)22(8) R = 1 - \frac {(2 - X) ^ {2}}{2}\tag{8}

In Equation (7),0≤X≤1( 7 ) , 0 \leq X \leq 1 implies that 0≤R≤12\begin{array} {r} {0 \leq R \leq \frac {1} {2}} \end{array}, in which case X=2RX = {\sqrt {2 R}}. By Equation (8),1≤X≤21 \leq X \leq 2 implies that 12≤R≤1\begin{array} {r} {\frac {1} {2} \leq R \leq 1} \end{array}, in which case X=2−2(1−R)X = 2 - \sqrt {2 ( 1 - R )}. Thus, X is generated by

X={2R,0≤R≤122−2(1−R),12<R≤1(9) X = \left\{\begin{array}{l l} \sqrt {2 R}, & 0 \leq R \leq \frac {1}{2} \\ 2 - \sqrt {2 (1 - R)}, & \frac {1}{2} < R \leq 1 \end{array} \right.\tag{9}

Exercises 2, 3, and 4 give the student practice in dealing with other triangular distributions. Notice that, if the pdf and cdf of the random variable X come in parts (i.e., require different formulas over different parts of the range of X), then the application of the inverse-transform technique for generating X will result in separate formulas over different parts of the range of R, as in Equation (9).

1.5 Empirical Continuous Distributions

If the modeler has been unable to find a theoretical distribution that provides a good model for the input data, then it may be necessary to use the empirical distribution of the data. One possibility is to simply resample the observed data itself. This is known as using the empirical distribution, and it makes particularly good sense when the input process is known to take on a finite number of values. See Section 1.7 for an example of this type of situation and for a method for generating random inputs.

On the other hand, if the data are drawn from what is believed to be a continuous-valued inpu process, then it makes sense to interpolate between the observed data points to fill in the gaps. This section describes a method for defining and generating data from a continuous empirical distribution.

Five observations of fire-crew response times (in minutes) to incoming alarms have been collected to be used in a simulation investigating possible alternative staffing and crew-scheduling policies. The data are

2.761.830.801.451.24 \begin{array}{c c c c c} 2. 76 & 1. 83 & 0. 80 & 1. 45 & 1. 24 \end{array}

Before collecting more data, it is desired to develop a preliminary simulation model that uses a response-time distribution based on these five observations. Thus, a method for generating random variates from the response-time distribution is needed. Initially, it will be assumed that response times X have a range 0≤X≤c.0 \leq X \leq c ., where c is unknown, but will be estimated by c^=max⁡{Xi:i=\widehat {c} = \operatorname* {m a x} \{X_{i} : i =1,…,n}=2.761 , \ldots , n \} = 2 . 76 \quad, where {Xi,i=1,…,n}\{X_{i} , i = 1 , \dots , n \} are the raw data and n=5n = 5 is the number of observations.

Arrange the data from smallest to largest and let x(1)≤x(2)≤⋅⋅⋅≤x(n)x_{( 1 )} \leq x_{( 2 )} \leq \cdot \cdot \cdot \leq x_{( n )} denote these sorted values. The smallest possible value is believed to be 0, so define x(0)=0x_{( 0 )} = 0. Assign the probability 1/n=1/51 / n = 1 / 5 to each interval x(i−1)<x≤x(i)x_{( i - 1 )} < x \leq x_{( i )}, as shown in Table 2. The resulting empirical cdf,F^(x)\widehat F ( x ) is illustrated in Figure 4. The slope of the ith line segment is given by

ai=x(i)−x(i−1)i/n−(i−1)/n=x(i)−x(i−1)1/n a_{i} = \frac {x_{(i)} - x_{(i - 1)}}{i / n - (i - 1) / n} = \frac {x_{(i)} - x_{(i - 1)}}{1 / n}

The inverse cdf is calculated by

X=F^−1(R)=x(i−1)+ai(R−(i−1)n)(10) X = \widehat {F} ^ {- 1} (R) = x_{(i - 1)} + a_{i} \left(R - \frac {(i - 1)}{n}\right)\tag{10}

when (i−1)/n<R≤i/n.( i - 1 ) / n < R \leq i / n . For example, if a random number R1=0.71R_{1} = 0 . 71 is generated, then R1R_{1} is seen to lie in the fourth interval (between 3/5=0.603 / 5 = 0 . 60 and 4/5=0.80)4 / 5 = 0 . 80 ); so, by Equation (10),

X1=x(4−1)+a4(R1−(4−1)/n)=1.45+1.90(0.71−0.60)=1.66 \begin{array}{r l} X_{1} & = x_{(4 - 1)} + a_{4} (R_{1} - (4 - 1) / n) \\ & = 1. 45 + 1. 90 (0. 71 - 0. 60) = 1. 66 \end{array}

The reader is referred to Figure 4 for a graphical view of the generation procedure.

Table 2 Summary of Fire-Crew Response-Time Data

iInterval x(i−1)<x≤x(i)x_{(i-1)} < x \leq x_{(i)}Probability 1/n1/nCumulative Probability, i/nSlope aia_i
10.0<x≤0.800.0 < x \leq 0.800.20.24.00
20.80<x≤1.240.80 < x \leq 1.240.20.42.20
31.24<x≤1.451.24 < x \leq 1.450.20.61.05
41.45<x≤1.831.45 < x \leq 1.830.20.81.90
51.83<x≤2.761.83 < x \leq 2.760.21.04.65

Figure 4 Empirical cdf of fire-crew response times.

In Example 2, each data point was represented in the empirical cdf. If a large sample of data is available (and sample sizes from several hundred to tens of thousands are possible with automated data collection), then it might be more convenient (and computationally efficient) to first summarize the data into a frequency distribution with a much smaller number ofintervals and then fit a continuous empirical cdf to the frequency distribution. Only a slight generalization of Equation (10) is required to accomplish this. Now the slope of the ith line segment is given by:

ai=x(i)−x(i−1)ci−ci−1 a_{i} = \frac {x_{(i)} - x_{(i - 1)}}{c_{i} - c_{i - 1}}

where cic_{i} is the cumulative probability of the first i intervals of the frequency distribution and x(i−1)<x_{( i - 1 )} <x≤x(i)x \leq x_{( i )} is the ith interval. The inverse cdf is calculated as

X=F^−1(R)=x(i−1)+ai(R−ci−1)(11) X = \widehat {F} ^ {- 1} (R) = x_{(i - 1)} + a_{i} (R - c_{i - 1})\tag{11}

when ci−1<R≤cic_{i - 1} < R \leq c_{i} Suppose that 100 machine repair times have been collected. The data are summarized in Table 3 in terms of the number of observations in various intervals. For example, there were 31 observations between 0 and 0.5 hour, 10 between 0.5 and 1 hour, and so on. Suppose it is known that all repairs take at least 15 minutes, so that X≥0.25X \geq 0 . 25 hours always. Then we set x(0)=0.25x_{( 0 )} = 0 . 25, as shown in Table 3 and Figure 5.

Table 3 Summary of Repair-Time Data

iInterval (Hours)FrequencyRelative FrequencyCumulative Frequency,cic_iSlope aia_i
10.25 ≤ x ≤ 0.5310.310.310.81
20.5 < x ≤ 1.0100.100.415.0
31.0 < x ≤ 1.5250.250.662.0
41.5 < x ≤ 2.0340.341.001.47

Figure 5 Generating variates from the empirical distribution function for repair-time data (X≥0.25)( X \geq 0 . 25 ) For example, suppose the first random number generated is R1=0.83R_{1} = 0 . 83. Then, since R1R_{1} is between c3=0.66c_{3} = 0 . 66 and c4=1.00c_{4} = 1 . 00

X1=x(4−1)+a4(R1−c4−1)=1.5+1.47(0.83−0.66)=1.75(12) X_{1} = x_{(4 - 1)} + a_{4} \left(R_{1} - c_{4 - 1}\right) = 1. 5 + 1. 47 (0. 83 - 0. 66) = 1. 75\tag{12}

As another illustration, suppose that R2=0.33R_{2} = 0 . 33. Since c1=0.31<R2≤0.41=c2c_{1} = 0 . 31 < R_{2} \leq 0 . 41 = c_{2}

X2=x(1)+a2(R2−c1)=0.5+5.0(0.33−0.31)=0.6 \begin{array}{r l} X_{2} & = x_{(1)} + a_{2} (R_{2} - c_{1}) \\ & = 0. 5 + 5. 0 (0. 33 - 0. 31) \\ & = 0. 6 \end{array}

The point (R2=0.33,X2=0.6)( R_{2} = 0 . 33 , X_{2} = 0 . 6 ) is also shown in Figure 5.

Now reconsider the data of Table 3. The data are restricted in the range 0.25≤X≤2.00 . 25 \leq X \leq 2 . 0 but the underlying distribution might have a wider range. This provides one important reason for attempting to find a theoretical probability distribution (such as the gamma or Weibull) for the data: that these distributions do allow a wider range—namely,0≤X<∞0 \leq X < \infty. On the other hand, an empirica distribution adheres closely to what is present in the data itself, and the data are often the best source of information available.

When data are summarized in terms of frequency intervals, it is recommended that relatively short intervals be used, for doing so results in a more accurate portrayal of the underlying cdf. For example, for the repair-time data of Table 3, for which there were n=100n = 100 observations, a much more accurate estimate could have been obtained by using 10 to 20 intervals, certainly not an excessive number, rather than the four fairly wide intervals actually used here for purposes of illustration.

Several comments are in order:

  1. A computerized version of this procedure will become inefficient as the number of intervals n increases. A systematic computerized version is often called a table-lookup generation scheme, because, given a value of R, the computer program must search an array of cic_{i} values to find the interval i in which R lies, namely the interval i satisfying
ci−1<R≤ci c_{i - 1} < R \leq c_{i}

The more intervals there are, the longer, on average, the search will take if it is implemented in the crude way described here. The analyst should consider this tradeoff between accuracy of the estimating cdf and computational efficiency when programming the procedure. If a large number of observations are available, the analyst may well decide to group the observations into intervals from 20 to 50, say, and then use the procedure of Example 3—or a more efficient table-lookup procedure could be used, such as the one described in Law [2007].

  1. In Example 2, it was assumed that response times X satisfied 0≤X≤2.760 \leq X \leq 2 . 76. This assumption led to the inclusion of the points x(0)=0x_{( 0 )} = 0 and x(5)=2.76x_{( 5 )} = 2 . 76 in Figure 4 and Table 2. If it is known a priori that X falls in some other range—for example, if it is known that response times are always between 15 seconds and 3 minutes, that is,
0.25≤X≤3.0 0. 25 \leq X \leq 3. 0

—then the points x(0)=0.25x_{( 0 )} = 0 . 25 and x(6)=3.0x_{( 6 )} = 3 . 0 would be used to estimate the empirical cdf of response times. Notice that, because of inclusion of the new point x(6)x_{( 6 )}, there are now six intervals instead of five, and each interval is assigned probability 1/6=0.1671 / 6 = 0 . 167. Exercise 12 illustrates the use of these additional assumptions.

1.6 Continuous Distributions without a Closed-Form Inverse

A number of useful continuous distributions do not have a closed form expression for their cdf or its inverse; examples include the normal, gamma, and beta distributions. For this reason, it is often stated that the inverse-transform technique for random-variate generation is not available for these distributions. It can, in effect, become available if we are willing to approximate the inverse cdf, or numerically integrate and search the cdf. Although this approach sounds inaccurate, notice that even a closed-form inverse requires approximation to evaluate it on a computer. For example, generating exponentially distributed random variates via the inverse cdf X=F−1(R)=−ln⁡(1−R)/λX = F^{- 1} ( R ) = - \ln ( 1 - R ) / \lambda requires a numerical approximation for the logarithm function. Thus, there is no essential difference between using an approximate inverse cdf and approximately evaluating a closed-form inverse. The problem with using approximate inverse cdfs is that some of them are computationally slow to evaluate.

To illustrate the idea, consider a simple approximation to the inverse cdf of the standard normal distribution, proposed by Schmeiser [1979]:

X=F−1(R)≈R0.135−(1−R)0.1350.1975 X = F^{- 1} (R) \approx \frac {R^{0 . 135} - (1 - R) ^ {0 . 135}}{0 . 1975}

This approximation gives at least one-decimal-place accuracy for 0.0013499≤R≤0.99865010 . 0013499 \leq R \leq 0 . 9986501 Table 4 compares the approximation with exact values (to four decimal places) obtained by numerical integration for several values of R. Much more accurate approximations exist that are only slightly more complicated. A good source of these approximations for a number of distributions is Bratley, Fox, and Schrage [1996].

Table 4 Comparison of Approximate Inverse with Exact Values (to four decimal places) for the Standard Normal Distribution

RApproximate InverseExact Inverse
0.01-2.3263-2.3373
0.10-1.2816-1.2813
0.25-0.6745-0.6713
0.500.00000.0000
0.750.67450.6713
0.901.28161.2813
0.992.32632.3373

1.7 Discrete Distributions

All discrete distributions can be generated via the inverse-transform technique, either numerically through a table-lookup procedure or, in some cases, algebraically, the final generation scheme being in terms of a formula. Other techniques are sometimes used for certain distributions, such as the convolution technique for the binomial distribution. Some of these methods are discussed in later sections. This subsection gives examples covering both empirical distributions and two of the standard discrete distributions, the (discrete) uniform and the geometric. Highly efficient table-lookup procedures for these and other distributions are found in Bratley, Fox, and Schrage [1996] and in Ripley [1987].

Example 4: An Empirical Discrete Distribution

At the end of any day, the number of shipments on the loading dock of the IHW Company is either 0, 1, or 2, with observed relative frequency of occurrence of 0.50, 0.30, and 0.20, respectively. Interna consultants have been asked to develop a model to improve the efficiency of the loading and hauling operations; as part of this model, they will need to be able to generate values X to represent the number of shipments on the loading dock at the end of each day. The consultants decide to model X as a discrete random variable with the distribution given in Table 5 and shown in Figure 6.

Table 5 Distribution of Number of Shipments X

xp(x)F(x)
00.500.50
10.300.80
20.201.00

The probability mass function (pmf), p(x), is given by

p(0)=P(X=0)=0.50p(1)=P(X=1)=0.30p(2)=P(X=2)=0.20 \begin{array}{l} p (0) = P (X = 0) = 0. 50 \\ p (1) = P (X = 1) = 0. 30 \\ p (2) = P (X = 2) = 0. 20 \end{array}

and the cdf,F(x)=P(X≤x)F ( x ) = P ( X \leq x ), is given by

F(x)={0x<00.50≤x<10.81≤x<21.02≤x F (x) = \left\{\begin{array}{l l} 0 & x < 0 \\ 0. 5 & 0 \leq x < 1 \\ 0. 8 & 1 \leq x < 2 \\ 1. 0 & 2 \leq x \end{array} \right.

Recall that the cdf of a discrete random variable always consists of horizontal line segments with jumps of size p(x) at those points, x, that the random variable can assume. For example, in Figure 6, there is a jump of size p(0)=0.5atx=0.p ( 0 ) = 0 . 5 \mathrm{a t} x = 0 ., of size p(1)=0.3atx=1p ( 1 ) = 0 . 3 \mathrm{a t} x = 1, and of size p(2)=0.2p ( 2 ) = 0 . 2 at x=2x = 2 Figure 6 Cdf of number of shipments X.

For generating discrete random variables, the inverse-transform technique becomes a tablelookup procedure, but, unlike in the case of continuous variables, interpolation is not required. To illustrate the procedure, suppose that R1=0.73R_{1} = 0 . 73 is generated. Graphically, as illustrated in Figure 6,^ {6 ,} first locate R1=0.73R_{1} = 0 . 73 on the vertical axis, next draw a horizontal line segment until it hits a j¨ump,∗\mathrm {\bf {\ddot {j} u m p}} ^ {, \mathrm{*}} in the cdf, and then drop a perpendicular to the horizontal axis to get the generated variate. Here R1=0.73R_{1} = 0 . 73 is transformed to X1=1X_{1} = 1. This procedure is analogous to the procedure used for empirica continuous distributions in Section 1.5 and illustrated in Figure 4, except that the final step, linear interpolation, is eliminated.

The table-lookup procedure is facilitated by construction of a table such as Table 6. When R1=0.73R_{1} = 0 . 73 is generated, first find the interval in which R1R_{1} lies. In general, for R=R1R = R_{1}, if

F(xi−1)=ri−1<R≤ri=F(xi)(13) F (x_{i - 1}) = r_{i - 1} < R \leq r_{i} = F (x_{i})\tag{13}

then set X1=xiX_{1} = x_{i}. Here,r0=0;x0=−∞;x1,x2,…,xnr_{0} = 0 ; x_{0} = - \infty ; x_{1} , x_{2} , \ldots , x_{n} are the possible values of the random variable; and rk=p(x1)+⋅⋅⋅+p(xk),k=1,2,⋅⋅⋅,n.r_{k} = p ( x_{1} ) + \cdot \cdot \cdot + p ( x_{k} ) , k = 1 , 2 , \cdot \cdot \cdot , n . For this example,n=3,x1=0,x2=1n = 3 , x_{1} = 0 , x_{2} = 1, and x3=2;x_{3} = 2 ; hence,r1=0.5,r2=0.8r_{1} = 0 . 5 , r_{2} = 0 . 8, and r3=1.0r_{3} = 1 . 0. (Notice that rn=1.0r_{n} = 1 . 0 in all cases.)

Table 6 Table for Generating the Discrete Variate X

Input,rir_iOutput,xix_i
10.500
20.801
31.002

Since r1=0.5<R1=0.73≤r2=0.8r_{1} = 0 . 5 < R_{1} = 0 . 73 \leq r_{2} = 0 . 8, set X1=x2=1X_{1} = x_{2} = 1. The generation scheme is summarized as follows:

X={0,R≤0.51,0.5<R≤0.82,0.8<R≤1.0 X = \left\{\begin{array}{l l} 0, & R \leq 0. 5 \\ 1, & 0. 5 < R \leq 0. 8 \\ 2, & 0. 8 < R \leq 1. 0 \end{array} \right.

Example 4 illustrated the table-lookup procedure; the next example illustrates an algebraic approach that can be used for certain distributions.

Example 5: A Discrete Uniform Distribution

Consider the discrete uniform distribution on {1,2,…,k}\{1 , 2 , \ldots , k \} with pmf and cdf given by

p(x)=1k,x=1,2,…,k p (x) = \frac {1}{k}, \quad x = 1, 2, \ldots , k

and

F(x)={0,x<11k,1≤x<22k,2≤x<3⋮⋮k−1k,k−1≤x<k1,k≤x F (x) = \left\{\begin{array}{l l} 0, & x < 1 \\ \frac {1}{k}, & 1 \leq x < 2 \\ \frac {2}{k}, & 2 \leq x < 3 \\ \vdots & \vdots \\ \frac {k - 1}{k}, & k - 1 \leq x < k \\ 1, & k \leq x \end{array} \right.

Let xi=ix_{i} = i and ri=p(1)+⋅⋅⋅+p(xi)=F(xi)=i/k for i=1,2,…,kr_{i} = p ( 1 ) + \cdot \cdot \cdot + p ( x_{i} ) = F ( x_{i} ) = i / k {\mathrm{~ f o r ~}} i = 1 , 2 , \dots , k. Then, from Inequality (13), it can be seen that, if the generated random number R satisfies

ri−1=i−1k<R≤ri=ik(14) r_{i - 1} = \frac {i - 1}{k} < R \leq r_{i} = \frac {i}{k}\tag{14}

then XX is generated by setting X=iX = i. Now Inequality (14) can be solved for i:

i−1<Rk≤iRk≤i<Rk+1(15) \begin{array}{c} i - 1 < R k \leq i \\R k \leq i < R k + 1 \end{array}\tag{15}

Let y denote the smallest integer ≥y\geq y. For example,⌈7.82⌉=8,⌈5.13⌉=6\left\lceil 7 . 82 \right\rceil = 8 , \left\lceil 5 . 13 \right\rceil = 6, and ⌈−1.32⌉=−1\lceil - 1 . 32 \rceil = - 1 For y≥0,⌈y⌉y \ge 0 , \lceil y \rceil is a function that rounds up. This notation and Inequality (15) yield a formula for generating X, namely

X=⌈Rk⌉(16) X = \lceil R k \rceil\tag{16}

For example, consider the generating of a random variate X that is uniformly distributed on {1,2,…,10}\{1 , 2 , \ldots , 10 \}. The variate X might represent the number of pallets to be loaded onto a truck. Using Table A.1 as a source of random numbers R and using Equation (16) with k=10k = 10 yields

R1=0.78X1=⌈7.8⌉=8R2=0.03X2=⌈0.3⌉=1R3=0.23X3=⌈2.3⌉=3R4=0.97X4=⌈9.7⌉=10 \begin{array}{l l} R_{1} = 0. 78 & X_{1} = \lceil 7. 8 \rceil = 8 \\ R_{2} = 0. 03 & X_{2} = \lceil 0. 3 \rceil = 1 \\ R_{3} = 0. 23 & X_{3} = \lceil 2. 3 \rceil = 3 \\ R_{4} = 0. 97 & X_{4} = \lceil 9. 7 \rceil = 10 \end{array}

The procedure discussed here can be modified to generate a discrete uniform random variate with any range consisting of consecutive integers. Exercise 13 asks the student to devise a procedure for one such case.

Example 6: The Geometric Distribution

Consider the geometric distribution with pmf

p(x)=p(1−p)x,x=0,1,2,… p (x) = p (1 - p) ^ {x}, \quad x = 0, 1, 2, \dots

where 0<p<10 < p < 1. Its cdf is given by

F(x)=∑j=0xp(1−p)j=p{1−(1−p)x+1}1−(1−p)=1−(1−p)x+1 \begin{array}{l} F (x) = \sum_{j = 0} ^ {x} p (1 - p) ^ {j} \\ = \frac {p \{1 - (1 - p) ^ {x + 1} \}}{1 - (1 - p)} \\ = 1 - (1 - p) ^ {x + 1} \end{array}

for x=0,1,2,...x = 0 , 1 , 2 , . . .. Using the inverse-transform technique [i.e., Inequality (13)], recall that a geometric random variable X will assume the value x whenever

F(x−1)=1−(1−p)x<R≤1−(1−p)x+1=F(x)(17) F (x - 1) = 1 - (1 - p) ^ {x} < R \leq 1 - (1 - p) ^ {x + 1} = F (x)\tag{17}

where R is a generated random number assumed 0<R<10 < R < 1. Solving Inequality (17) for x proceeds as follows:

(1−p)x+1≤1−R<(1−p)x(x+1)ln⁡(1−p)≤ln⁡(1−R)<xln⁡(1−p) \begin{array}{c} (1 - p) ^ {x + 1} \leq 1 - R < (1 - p) ^ {x} \\ (x + 1) \ln (1 - p) \leq \ln (1 - R) < x \ln (1 - p) \end{array}

But 1−p<11 - p < 1 implies that ln (1−p)<0\left( 1 - p \right) < 0, so that

ln⁡(1−R)ln⁡(1−p)−1≤x<ln⁡(1−R)ln⁡(1−p)(18) \frac {\ln (1 - R)}{\ln (1 - p)} - 1 \leq x < \frac {\ln (1 - R)}{\ln (1 - p)}\tag{18}

Thus,X=xX = x for that integer value of x satisfying Inequality (18). In brief, and using the round-up function , we have

X=⌈ln⁡(1−R)ln⁡(1−p)−1⌉(19) X = \left\lceil \frac {\ln (1 - R)}{\ln (1 - p)} - 1 \right\rceil\tag{19}

Since pp is a fixed parameter, let β=−1/ln⁡(1−p)\beta = - 1 / \ln ( 1 - p ). Then β>0\beta > 0 and, by Equation (19),X=X =⌈−βln⁡(1−R)−1⌉\lceil - \beta \ln ( 1 - R ) - 1 \rceil. By Equation (1),−βln⁡(1−R)( 1 ) , - \beta \ln ( 1 - R ) is an exponentially distributed random variable with mean β;\beta ; so one way of generating a geometric variate with parameter pp is to generate (by any method) an exponential variate with parameter β−1=−ln⁡(1−p)\beta^{- 1} = - \ln ( 1 - p ), subtract one, and round up.

Occasionally, there is needed a geometric variate X that can assume values q ,q+1,q+2,…}, q + 1 , q + 2 , \ldots \} with pm Σ′p(x)=p(1−p)x−q(x=q,q+1,…){\mathrm{\Sigma}} ^ {\prime} p ( x ) = p ( 1 - p ) ^ {x - q} ( x = q , q + 1 , \ldots ). Such a variate X can be generated, via Equation (19), by

X=q+⌈ln⁡(1−R)ln⁡(1−p)−1⌉(20) X = q + \left\lceil \frac {\ln (1 - R)}{\ln (1 - p)} - 1 \right\rceil\tag{20}

One of the most common cases is q=1q = 1

Example 7

Generate three values from a geometric distribution on the range {X≥1}\{X \ge 1 \} with mean 2. Such a geometric distribution has pmf p(x)=p(1−p)x−1(x=1,2,… )\begin{array} {r} {\boldsymbol {p} ( \boldsymbol {x} ) = p ( 1 - p ) ^ {x - 1} ( \boldsymbol {x} = 1 , 2 , \dots )} \end{array} with mean 1/p=2,orp=1/21 / p = 2 , \mathrm{o r} p = 1 / 2 Thus, X can be generated by Equation (20) with q=1,p=1/2q = 1 , p = 1 / 2, and 1/ln⁡(1−p)=−1.4431 / \ln ( 1 - p ) = - 1 . 443. Using Table A.1,R1=0.932,R2=0.105\mathrm{A} . 1 , R_{1} = 0 . 932 , R_{2} = 0 . 105, and R3=0.687R_{3} = 0 . 687 yields

X1=1+⌈−1.443ln⁡(1−0.932)−1⌉=1+⌈3.878−1⌉=4 \begin{array}{r l} X_{1} & = 1 + \lceil - 1. 443 \ln (1 - 0. 932) - 1 \rceil \\ & = 1 + \lceil 3. 878 - 1 \rceil = 4 \end{array} X2=1+⌈−1.443ln⁡(1−0.105)−1⌉=1 X_{2} = 1 + \lceil - 1. 443 \ln (1 - 0. 105) - 1 \rceil = 1 X3=1+⌈−1.443ln⁡(1−0.687)−1⌉=2 X_{3} = 1 + \lceil - 1. 443 \ln (1 - 0. 687) - 1 \rceil = 2

Exercise 15 deals with an application of the geometric distribution.

2 Acceptance-Rejection Technique

Suppose that an analyst needed to devise a method for generating random variates, X, uniformly distributed between 1/4 and 1. One way to proceed would be to follow these steps:

Step 1. Generate a random number R.

Step 2a. If R≥1/4⋅R \ge 1 / 4_{\cdot}, accept X=RX = R, then go to Step 3.

Step 2b. I ⌈R<1/4\lceil R < 1 / 4, reject R, and return to Step 1.

Step 3. If another uniform random variate on [1/4, 1] is needed, repeat the procedure beginning at Step 1. If not, stop.

Each time Step 1 is executed, a new random number R must be generated. Step 2a is an “acceptance” and Step 2b is a “rejection” in this acceptance-rejection technique. To summarize the technique, random variates R with some distribution (here uniform on [0, 1]) are generated until some condition (here R>1/4)R > 1 / 4 ) is satisfied. When the condition is finally satisfied, the desired random variate X (here uniform on [1/4,1])[ 1 / 4 , 1 ] ) can be computed (X=R)( X = R ). This procedure can be shown to be correct by recognizing that the accepted values of R are conditioned values; that is, R itself does not have the desired distribution, but R conditioned on the event {R≥1/4}\{R \ge 1 / 4 \} does have the desired distribution. To show this, take 1/4≤a<b≤1;1 / 4 \leq a < b \leq 1 ;; then

P(a<R≤b∣1/4≤R≤1)=P(a<R≤b)P(1/4≤R≤1)=b−a3/4(21) P (a < R \leq b | 1 / 4 \leq R \leq 1) = \frac {P (a < R \leq b)}{P (1 / 4 \leq R \leq 1)} = \frac {b - a}{3 / 4}\tag{21}

which is the correct probability for a uniform distribution on [1/4, 1]. Equation (21) says that the probability distribution of R, given that R is between 1/4 and 1 (all other values of R are thrown out), is the desired distribution. Therefore, if 1/4≤R≤11 / 4 \le R \le 1, set X=RX = R The efficiency of an acceptance-rejection technique depends heavily on being able to minimize the number of rejections. In this example, the probability of a rejection is P(R<1/4)=1/4,P ( R < 1 / 4 ) = 1 / 4 ,, so that the number of rejections is a geometrically distributed random variable with probability of “success” being p=3/4p = 3 / 4 and mean number of rejections (1/p−1)=4/3−1=1/3( 1 / p - 1 ) = 4 / 3 - 1 = 1 / 3. (Example 6 discussed the geometric distribution.) The mean number of random numbers R required to generate one variate X is one more than the number of rejections; hence, it is 4/3=1.33.4 / 3 = 1 . 33 .. In other words, to generate 1000 values of X would require approximately 1333 random numbers R.

In the present situation, an alternative procedure exists for generating a uniform variate on [1/4, 1]—namely, Equation (5), which reduces to X=1/4+(3/4)RX = 1 / 4 + ( 3 / 4 ) R. Whether the acceptancerejection technique or an alternative procedure, such as the inverse-transform technique [Equation (5)], is the more efficient depends on several considerations. The computer being used, the skills of the programmer, and the relative inefficiency of generating the additional (rejected) random numbers needed by acceptance-rejection should be compared to the computations required by the alternative procedure. In practice, concern with generation efficiency is left to specialists who conduct extensive tests comparing alternative methods (i.e., until a simulation model begins to require excessive computer runtime due to the generator being used).

For the uniform distribution on [1/4, 1], the inverse-transform technique of Equation (5) is undoubtedly much easier to apply and more efficient than the acceptance-rejection technique. The main purpose of this example was to explain and motivate the basic concept of the acceptancerejection technique. However, for some important distributions, such as the normal, gamma and beta, the inverse cdf does not exist in closed form and therefore the inverse-transform technique is difficult. These more advanced techniques are summarized by Bratley, Fox, and Schrage [1996], and Law [2007].

In the following subsections, the acceptance-rejection technique is illustrated for the generation of random variates for the Poisson, nonstationary Poisson, and gamma distributions.

2.1 Poisson Distribution

A Poisson random variable N with mean α>0\alpha > 0 has pmf

p(n)=P(N=n)=e−ααnn!,n=0,1,2,… p (n) = P (N = n) = \frac {e^{- \alpha} \alpha^{n}}{n !}, n = 0, 1, 2, \dots

More important, however, is that N can be interpreted as the number of arrivals from a Poisson arrival process in one unit of time. The interarrival times,A1,A2,…A_{1} , A_{2} , \ldots. of successive customers are exponentially distributed with rate α (i.e., α is the mean number of arrivals per unit time); in addition, an exponential variate can be generated by Equation (3). Thus, there is a relationship between the (discrete) Poisson distribution and the (continuous) exponential distribution:

N=n(22) N = n\tag{22}

if and only if

A1+A2+⋯+An≤1<A1+⋯+An+An+1(23) A_{1} + A_{2} + \dots + A_{n} \leq 1 < A_{1} + \dots + A_{n} + A_{n + 1}\tag{23}

Equation (22),N=n,N = n ,, says there were exactly n arrivals during one unit of time; but Inequality (23) says that the nth arrival occurred before time 1 while the (n+1)st( n + 1 ) \mathrm {{s t}} t arrival occurred after time 1. Clearly, these two statements are equivalent. Proceed now by generating exponential interarriva times until some arrival, say n+1n + 1, occurs after time 1; then set N=nN = n For efficient generation purposes, Inequality (23) is usually simplified by first using Equation (3),Ai=(−1/α)A_{i} = ( - 1 / \alpha ) ln R , to obtain

∑i=1n−1αln⁡Ri≤1<∑i=1n+1−1αln⁡Ri \sum_{i = 1} ^ {n} - \frac {1}{\alpha} \ln R_{i} \leq 1 < \sum_{i = 1} ^ {n + 1} - \frac {1}{\alpha} \ln R_{i}

Next multiply through by−α\boldsymbol {\mathsf {b y}} - \boldsymbol {\alpha}, which reverses the sign of the inequality, and use the fact that a sum of logarithms is the logarithm of a product, to get

ln⁡∏i=1nRi=∑i=1nln⁡Ri≥−α>∑i=1n+1ln⁡Ri=ln⁡∏i=1n+1Ri \ln \prod_{i = 1} ^ {n} R_{i} = \sum_{i = 1} ^ {n} \ln R_{i} \geq - \alpha > \sum_{i = 1} ^ {n + 1} \ln R_{i} = \ln \prod_{i = 1} ^ {n + 1} R_{i}

Finally, use the relation eln⁡x=xe^{\ln x} = x for any number x to obtain

∏i=1nRi≥e−α>∏i=1n+1Ri(24) \prod_{i = 1} ^ {n} R_{i} \geq e^{- \alpha} > \prod_{i = 1} ^ {n + 1} R_{i}\tag{24}

which is equivalent to Inequality (23). The procedure for generating a Poisson random variate, N, is given by the following steps:

Step 1. Set n=0,P=1n = 0 , P = 1

Step 2. Generate a random number Rn+1R_{n + 1}, and replace P by P⋅Rn+1P \cdot R_{n + 1} Step 3. If P<e−α\textit {P} < \textit {e} ^ {- \alpha}, then accept N=nN = n. Otherwise, reject the current n, increase n by one, and return to step 2.

Notice that, upon completion of Step 2, P is equal to the rightmost expression in Inequality (24). The basic idea of a rejection technique is again exhibited; if P≥e−αP \ge e^{- \alpha} in Step 3, then n is rejected and the generation process must proceed through at least one more trial.

How many random numbers will be required, on the average, to generate one Poisson variate N? If N n, then n 1 random numbers are required, so the average number is given by

E(N+1)=α+1 E (N + 1) = \alpha + 1

which is quite large if the mean α of the Poisson distribution is large.

Example 8

Generate three Poisson variates with mean α=0.2\alpha = 0 . 2. First, compute e−α=e−0.2=0.8187e^{- \alpha} = e^{- 0 . 2} = 0 . 8187. Next, get a sequence of random numbers R from Table A.1 and follow the previously described Steps 1 to 3:

Step 1.Setn=0,P=1\mathrm{S e t} n = 0 , P = 1 Step 2.R1=0.4357,P=1⋅R1=0.4357R_{1} = 0 . 4357 , P = 1 \cdot R_{1} = 0 . 4357 Step 3. Since P=0.4357<e−α=0.8187P = 0 . 4357 < e^{- \alpha} = 0 . 8187, accept N 0.

Step 1–3.(R1=0.4146leadstoN=0.)( R_{1} = 0 . 4146 \mathrm{l e a d s t o} N = 0 . ) Step 1. Set n=0,P=1n = 0 , P = 1 Step 2.R1=0.8353,P=1⋅R1=0.8353.R_{1} = 0 . 8353 , P = 1 \cdot R_{1} = 0 . 8353 . Step 3. Since P≥e−αP \ge e^{- \alpha}, reject n 0 and return to Step 2 with n 1.

Step 2.R2=0.9952,P=R1R2=0.8313.R_{2} = 0 . 9952 , P = R_{1} R_{2} = 0 . 8313 . Step 3. Since P≥e−αP \ge e^{- \alpha}, reject n 1 and return to Step 2 with n 2.

Step 2.R3=0.8004,P=R1R2R3=0.6654.R_{3} = 0 . 8004 , P = R_{1} R_{2} R_{3} = 0 . 6654 . Step 3. Since P<e−αP < e^{- \alpha}, accept N 2.

The calculations required for the generation of these three Poisson random variates are summarized as follows:

nRn+1R_{n+1}PAccept/RejectResult
00.43570.4357P<e−αP < e^{-\alpha}(accept)N=0
00.41460.4146P<e−αP < e^{-\alpha}(accept)N=0
00.83530.8353P≥e−αP \geq e^{-\alpha}(reject)
10.99520.8313P≥e−αP \geq e^{-\alpha}(reject)
20.80040.6654P<e−αP < e^{-\alpha}(accept)N=2

It took five random numbers R to generate three Poisson variates here (N=0,N=0( N = 0 , N = 0, and N=2)N = 2 ) but in the long run, to generate, say, 1000 Poisson variates with mean α=0.2\alpha = 0 . 2, it would require approximately 1000(α+1)1000 ( \alpha + 1 ) or 1200 random numbers.

Example 9

Buses arrive at the bus stop at Peachtree and North Avenue according to a Poisson process with a mean of one bus per 15 minutes. Generate a random variate N which represents the number o arriving buses during a 1-hour time slot.Now⁡,\operatorname{N o w} , N is Poisson distributed with a mean of four buses per hour. First, compute e−α=e−4=0.0183e^{- \alpha} = e^{- 4} = 0 . 0183. Using a sequence of 12 random numbers from Table A.1 yields the following summarized results:

nRn+1R_{n+1}PAccept/RejectResult
00.43570.4357P≥e−αP \ge e^{-\alpha}(reject)
10.41460.1806P≥e−αP \ge e^{-\alpha}(reject)
20.83530.1508P≥e−αP \ge e^{-\alpha}(reject)
30.99520.1502P≥e−αP \ge e^{-\alpha}(reject)
40.80040.1202P≥e−αP \ge e^{-\alpha}(reject)
50.79450.0955P≥e−αP \ge e^{-\alpha}(reject)
60.15300.0146P<e−αP < e^{-\alpha}(accept)N = 6

It is immediately seen that a larger value of α (here α=4)\alpha = 4 ) usually requires more random numbers; if 1000 Poisson variates were desired, approximately 1000(α+1)=50001000 ( \alpha + 1 ) = 5000 random numbers would be required.

When α is large, say,α≥15\alpha \geq 15, the rejection technique outlined here becomes quite expensive, but fortunately an approximate technique based on the normal distribution works quite well. When the mean α is large, then

Z=N−αα Z = \frac {N - \alpha}{\sqrt {\alpha}}

is approximately normally distributed with mean zero and variance 1; this observation suggests an approximate technique. First, generate a standard normal variate Z, by Equation (28) in Section 3.1, then generate the desired Poisson variate N by

N=⌈α+αZ−0.5⌉(25) N = \lceil \alpha + \sqrt {\alpha} Z - 0. 5 \rceil\tag{25}

where is the round-up function described in Section 1.7.If⁡α+αZ−0.5<0\operatorname{I f} \alpha + {\sqrt {\alpha}} Z - 0 . 5 < 0, then set N=0.)N = 0 . ) The "0.5′" 0 . 5 ' used in the formula makes the round-up function become a “round to the nearest integer” function. Equation (25) is not an acceptance-rejection technique, but, when used as an alternative to the acceptance-rejection method, it provides a fairly efficient and accurate method for generating Poisson variates with a large mean.

2.2 Nonstationary Poisson Process

Another type of acceptance-rejection method (which is called thinning) can be used to generate interarrival times from a nonstationary Poisson process (NSPP) with arrival rate λ(t),0≤t≤T\lambda ( t ) , 0 \leq t \leq T. An NSPP is an arrival process with an arrival rate that varies with time.

Consider, for instance, the arrival-rate function given in Table 7 that changes every hour. The idea behind thinning is to generate a stationary Poisson arrival process at the fastest rate (1/5( 1 / 5 customer per minute in the example), but “accept” or admit only a portion of the arrivals, thinning out jus enough to get the desired time-varying rate. Next we give the generic algorithm, which generates Ti\boldsymbol {\mathcal {T}} _ {i} as the time of the ith arrival. Remember that, in a stationary Poisson arrival process, the times between arrivals are exponentially distributed.

Step 1. Let λ∗=max⁡0≤t≤Tλ(t)1.\begin{array} {l} {{\lambda^{*} = \operatorname* {m a x} _ {0 \leq t \leq T} \lambda ( t )}} \\ {{1 .}} \end{array} be the maximum of the arrival rate function and set t=0t = 0 and i=1i = 1 Step 2. Generate E from the exponential distribution with rate λ∗\lambda^{*} and let t=t+Et = t + E(this is the arrival time of the stationary Poisson process).

Step 3. Generate random number R from the U(0,1)U ( 0 , 1 ) distribution. If R≤λ(t)/λ∗R \leq \lambda ( t ) / \lambda^{*} then Ti=t\mathcal {T} _ {i} = t and i=i+1.i = i + 1 . Step 4. Go to Step 2.

The thinning algorithm can be inefficient if there are large differences between the typical and the maximum arrival rate. However, thinning has the advantage that it works for any integrable arriva rate function, not just a piecewise-constant function, as in this example.

Table 7 Arrival Rate for NSPP Example

t (min)Mean Time between Arrivals (min)Arrival Rate λ(t) (arrivals/min)
0151/15
60121/12
12071/7
18051/5
24081/8
300101/10
360151/15
420201/20
480201/20

Example 10

For the arrival-rate function in Table 7, generate the first two arrival times.

Step 1.λ∗=max⁡0≤t≤Tλ(t)=1/5,t=0andi=1\begin{array} {r} {\lambda^{*} = \operatorname* {m a x} _ {0 \leq t \leq T} \lambda ( t ) = 1 / 5 , t = 0 \mathrm{a n d} i = 1} \end{array} Step 2. For random number R 0.2130, E 5 ln(0.213) 13.13 and t 0 13.13 13.13.

Step 3. Generate R=0.8830R = 0 . 8830. Since R=0.8830≢λ(13.13)/λ∗=(1/15)/(1/5)=1/3R = 0 . 8830 \not \equiv \lambda ( 13 . 13 ) / \lambda^{*} = ( 1 / 15 ) / ( 1 / 5 ) = 1 / 3, do not generate the arrival.

Step 4. Go to Step 2.

Step 2. For random number R=0.5530,E=−5ln⁡(0.553)=2.96andt=13.13+2.96=16.09R = 0 . 5530 , E = - 5 \ln ( 0 . 553 ) = 2 . 96 \mathrm{a n d} t = 13 . 13 + 2 . 96 = 16 . 09 Step 3. Generate R=0.0240. Since R=0.0240≤λ(16.09)/λ∗=(1/15)/(1/5)=1/3, set R = 0 . 0240 . \mathrm{~ S i n c e ~} R = 0 . 0240 \leq \lambda ( 16 . 09 ) / \lambda^{*} = ( 1 / 15 ) / ( 1 / 5 ) = 1 / 3 , \mathrm{~ s e t ~} t 16.09 and i i 12.

Step 4. Go to Step 2.

Step 2. For random number R=0.0001,E=−5ln⁡(0.0001)=46.05andt=16.09+46.05=R = 0 . 0001 , E = - 5 \ln ( 0 . 0001 ) = 46 . 05 \mathrm{a n d} t = 16 . 09 + 46 . 05 =62.14.

Step 3. Generate R=0.1443R = 0 . 1443. Since R=0.1443≤λ(62.14)/λ∗=(1/12)/(1/5)=5/12R = 0 . 1443 \leq \lambda ( 62 . 14 ) / \lambda^{*} = ( 1 / 12 ) / ( 1 / 5 ) = 5 / 12, set t 62.14 and i i 13.

Step 4. Go to Step 2.

2.3 Gamma Distribution

Several acceptance-rejection techniques for generating gamma random variates have been developed. (See Bratley, Fox, and Schrage [1996] and Law [2007].) One ofthe more efficient is by Cheng [1977]; the mean number of trials is between 1.13 and 1.47 for any value of the shape parameter β≥1\beta \geq 1 If the shape parameter β\beta is an integer, say,β=k,\beta = k ,, one possibility is to use the convolution technique in Example 12, because the Erlang distribution is a special case of the more genera gamma distribution. On the other hand, the acceptance-rejection technique described here would be a highly efficient method for the Erlang distribution, especially if β=k\beta = k were large. The routine generates gamma random variates with scale parameter θ and shape parameter β⋅\beta \mathrm{\cdot}—that is, with mean 1/θ1 / \theta and variance 1/βθ21 / \beta \theta^{2} The steps are as follows

Step 1. Compute a=1/(2β−1)1/2,b=β−ln⁡4a = 1 / ( 2 \beta - 1 ) ^ {1 / 2} , b = \beta - \ln 4 Step 2. Generate R1R_{1} and R2R_{2}. Set V=R1/(1−R1)V = R_{1} / ( 1 - R_{1} ) Step 3. Compute X=βVaX = \beta V^{a} Step 4a. If X>b+(βa+1)ln⁡(V)−ln⁡(R12R2)\begin{array} {r} {X > b + ( \beta a + 1 ) \ln ( V ) - \ln ( R_{1} ^ {2} R_{2} )} \end{array}), reject X and return to Step 2.

Step 4b. If X≤b+(βa+1)ln⁡(V)−ln⁡(R12R2)X \le b + ( \beta a + 1 ) \ln ( V ) - \ln ( R_{1} ^ {2} R_{2} ), use X as the desired variate.

The generated variates from Step 4b will have mean and variance both equal to β.\beta .. If it is desired to have mean 1/θ1 / \theta and variance 1/βθ21 / \beta \theta^{2}, then include Step 5.

(Step 5. Replace X by X/(βθ).X / ( \beta \theta ) .)

The basic idea of all acceptance-rejection methods is again illustrated here, but the proof of this example is beyond the scope of this text. In Step 3,X=βVa=β[R1/(1−R1)]aX = \beta V^{a} = \beta [ R_{1} / ( 1 - R_{1} ) ] ^ {a} is not gamma distributed, but rejection of certain values of X in Step 4a guarantees that the accepted values in Step 4b do have the gamma distribution.

Example 11

Downtimes for a high-production candy-making machine have been found to be gamma distributed with mean 2.2 minutes and variance 2.10 minutes^2. Thus,1/θ=2.21 / \theta = 2 . 2 and 1/βθ2=2.101 / \beta \theta^{2} = 2 . 10, which together imply that β 2.30 and θ 0.4545.

Step 1. a 0.53, b 0.91.

Step 2. Generate R 0.832, R 0.021. Set V 0.832/(10.832) 4.952.

Step 3. Compute X 2.3(4.952)0.53 5.37.

Step 4. X 5.37 > 0.91 [2.3(0.53) 1] ln(4.952) ln[(0.832)^20.021] 8.68, so reject X and return to Step 2.

Step 2. Generate R1=0.434,R2=0.716.SetV=0.434/(1−0.434)=0.767.R_{1} = 0 . 434 , R_{2} = 0 . 716 . \mathrm {{S e t}} V = 0 . 434 / ( 1 - 0 . 434 ) = 0 . 767 . Step 3. Compute X 2.3(0.767)0.53 2.00.

Step 4. Since X 2.000.91 [2.3(0.53) 1] ln(0.767) ln[(0.434)^20.716] 2.32, accept X.

Step 5. Divide X by βθ 1.045 to get X 1.91.

This example took two trials (i.e., one rejection) to generate an acceptable gamma-distributed random variate, but, on the average, to generate, say, 1000 gamma variates, the method will require between 1130 and 1470 trials, or equivalently, between 2260 and 2940 random numbers. The method is somewhat cumbersome for hand calculations, but is easy to program on the computer and is one of the most efficient gamma generators known.

3 Special Properties

“Special properties” are just as the name implies: They are variate-generation techniques that are based on features of a particular family of probability distributions, rather than being general-purpose techniques like the inverse-transform or acceptance-rejection techniques.

3.1 Direct Transformation for the Normal and Lognormal Distributions

Many methods have been developed for generating normally distributed random variates. The inversetransform technique cannot easily be applied, however, because the inverse cdf cannot be written in closed form. The standard normal cdf is given by

Φ(x)=∫−∞x12πe−t2/2dt,−∞<x<∞ \Phi (x) = \int_{- \infty} ^ {x} \frac {1}{\sqrt {2 \pi}} e ^ {- t^{2} / 2} d t, - \infty < x < \infty

This section describes an intuitively appealing direct transformation that produces an independen pair of standard normal variates with mean zero and variance 1. The method is due to Box and Muller [1958]. Although not as efficient as many more modern techniques, it is easy to program in a scientific language, such as FORTRAN, C, C , Visual Basic, or Java. We then show how to transform a standard normal variate into a normal variate with mean μ\mu and variance σ2\sigma^{2}. Once we have a method (this or any other) for generating XX from an N(μ,σ2)N ( \mu , \sigma^{2} ) distribution, then we can generate a lognorma random variate YY with parameters μ\mu and σ2\sigma^{2} by using the direct transformation Y=eXY = e^{X}. (Recall that μ\mu and σ2\sigma^{2} are not the mean and variance of the lognormal.)

Consider two standard normal random variables,Z1Z_{1} and Z2Z_{2}, plotted as a point in the plane as shown in Figure 7 and represented in polar coordinates as

Z1=Bcos⁡θZ2=Bsin⁡θ(26) \begin{array}{l} {Z_{1} = B \cos \theta} \\ {Z_{2} = B \sin \theta} \end{array}\tag{26}

Figure 7 Polar representation of a pair of standard normal variables.

It is known that B2=Z12+Z22B^{2} = Z_{1} ^ {2} + Z_{2} ^ {2} has the chi-square distribution with 2 degrees of freedom, which is equivalent to an exponential distribution with mean 2. Thus, the radius B can be generated by use of Equation (3):

B=(−2ln⁡R)1/2(27) B = (- 2 \ln R) ^ {1 / 2}\tag{27}

By the symmetry of the normal distribution, it seems reasonable to suppose, and indeed it is the case, that the angle is uniformly distributed between 0 and 2π radians. In addition, the radius B and the angle θ\theta are mutually independent. Combining Equations (26) and (27) gives a direct method for generating two independent standard normal variates.Z1Z_{1} and Z2.Z_{2} ., from two independent random numbers,R1R_{1} and R2:R_{2} {\mathrm{:}}

Z1=(−2ln⁡R1)1/2cos⁡(2πR2)Z2=(−2ln⁡R1)1/2sin⁡(2πR2)(28) \begin{array}{r l} {Z_{1} =} & {(- 2 \ln R_{1}) ^ {1 / 2} \cos (2 \pi R_{2})} \\ {Z_{2} =} & {(- 2 \ln R_{1}) ^ {1 / 2} \sin (2 \pi R_{2})} \end{array}\tag{28}

To illustrate the generation scheme, consider Equation (28) with R1=0.1758R_{1} = 0 . 1758 and R2=0.1489R_{2} = 0 . 1489 Two standard normal random variates are generated as follows:

Z1=[−2ln⁡(0.1758)]1/2cos⁡(2π0.1489)=1.11Z2=[−2ln⁡(0.1758)]1/2sin⁡(2π0.1489)=1.50 \begin{array}{l} Z_{1} = [ - 2 \ln (0. 1758) ] ^ {1 / 2} \cos (2 \pi 0. 1489) = 1. 11 \\ Z_{2} = [ - 2 \ln (0. 1758) ] ^ {1 / 2} \sin (2 \pi 0. 1489) = 1. 50 \end{array}

To obtain normal variates X_i with mean μ\mu and variance σ2\sigma^{2}, we then apply the transformation

Xi=μ+σZi(29) X_{i} = \mu + \sigma Z_{i}\tag{29}

to the standard normal variates. For example, to transform the two standard normal variates into normal variates with mean μ=10\mu = 10 and variance σ2=4\sigma^{2} = 4, we compute

X1=10+2(1.11)=12.22X2=10+2(1.50)=13.00 \begin{array}{l} X_{1} = 10 + 2 (1. 11) = 12. 22 \\ X_{2} = 10 + 2 (1. 50) = 13. 00 \end{array}

Recall that to obtain a lognormal variate Y from a normal variate X we set Y=eXY = e^{X}. Also recal that the mean and variance of the lognormal Y is not the same as the normal X.

3.2 Convolution Method

The probability distribution of a sum of two or more independent random variables is called a convolution of the distributions of the original variables. The convolution method thus refers to adding together two or more random variables to obtain a new random variable with the desired distribution. This technique can be applied to obtain Erlang variates and binomial variates. What is important is not the cdf of the desired random variable, but rather its relation to other variates more easily generated.

Example 12: Erlang Distribution

An Erlang random variable X with parameters (k,θ)( k , \theta ) can be shown to be the sum of k independen exponential random variables,Xi,i=1,2,…,k,X_{i} , i = 1 , 2 , \ldots , k ,, each having mean 1/kθ⋅1 / k \theta \cdot—that is,

X=∑i=1kXi X = \sum_{i = 1} ^ {k} X_{i}

The convolution approach is to generate X1,X2,…,XkX_{1} , X_{2} , \ldots , X_{k}, then sum them to get X. In the case of the Erlang, each X can be generated by Equation (3) with 1/λ=1/kθ1 / \lambda = 1 / k \theta. Therefore, an Erlang variate can be generated by

X=∑i=1k−1kθln⁡Ri X = \sum_{i = 1} ^ {k} - \frac {1}{k \theta} \ln R_{i} =−1kθln⁡(∏i=1kRi)(30) = - \frac {1}{k \theta} \ln \left(\prod_{i = 1} ^ {k} R_{i}\right)\tag{30}

It is more efficient computationally to multiply all the random numbers first and then to compute only one logarithm.

Example 13

Trucks arrive at a large warehouse in a completely random fashion that is modeled as a Poisson process with arrival rate λ=10\lambda = 10 trucks per hour. The guard at the entrance sends trucks alternately to the north and south docks. An analyst has developed a model to study the loading/unloading process at the south docks and needs a model of the arrival process at the south docks alone. An interarrival time X between successive truck arrivals at the south docks is equal to the sum of two interarrival times at the entrance and thus it is the sum of two exponential random variables, each having mean 0.1 hour, or 6 minutes. Thus, X has the Erlang distribution with k=2k = 2 and mean 1/θ=2/λ=0.21 / \theta = 2 / \lambda = 0 . 2 hour. To generate the variate X,X , first obtain k=2k = 2 random numbers from Table A.1, say R1=0.937R_{1} = 0 . 937 and R2=0.217R_{2} = 0 . 217. Then, by Equation (30),

X=−0.1ln⁡[(0.937)(0.217)]=0.159hour=9.56minutes \begin{array}{r l} X & = - 0. 1 \ln [ (0. 937) (0. 217) ] \\ & = 0. 159 \text{hour} = 9. 56 \text{minutes} \end{array}

In general, Equation (30) implies that k uniform random numbers are needed for each Erlang variate generated. If k is large, it is more efficient to generate Erlang variates by other techniques, such as one of the many acceptance-rejection techniques for the gamma distribution given in Section 2.3, or by Bratley, Fox and Schrage [1996] and Law [2007].

3.3 More Special Properties

There are many relationships among probability distributions that can be exploited for random-variate generation. The convolution method in the Section 3.2 is one example. Another particularly usefu example is the relationship between the beta distribution and the gamma distribution.

Suppose that X1X_{1} has a gamma distribution with shape parameter β1\beta_{1} and scale parameter θ1=\theta_{1} =1/β11 / \beta_{1}, while X2X_{2} has a gamma distribution with shape parameter β2\beta_{2} and scale parameter θ2=1/β2\theta_{2} = 1 / \beta_{2} and that these two random variables are independent. Then

Y=X1X1+X2 Y = \frac {X_{1}}{X_{1} + X_{2}}

has a beta distribution with parameters β1\beta_{1} and β2\beta_{2} on the interval [0, 1]. If, instead, we want YY to be defined on the interval [a,b][ a , b ], then set

Y=a+(b−a)(X1X1+X2) Y = a + (b - a) \left(\frac {X_{1}}{X_{1} + X_{2}}\right)

Thus, using the acceptance-rejection technique for gamma variates defined in the previous section, we can generate beta variates, with two gamma variates required for each beta

Although this method of beta generation is convenient, there are faster methods based on acceptance-rejection ideas. See, for instance, Devroye [1986] or Dagpunar [1988].

4 Summary

The basic principles ofrandom-variate generation via the inverse-transform technique, the acceptancerejection technique, and special properties have been introduced and illustrated by examples. Methods for generating many of the important continuous and discrete distributions, plus all empirical distributions, have been given. See Schmeiser [1980] for an excellent survey; for advanced treatments the reader is referred to Devroye [1986] or Dagpunar [1988].

REFERENCES

BRATLEY, P., B. L. FOX, AND L. E. SCHRAGE [1996], A Guide to Simulation, 2d ed., Springer-Verlag, New York.

BOX, G. E. P., AND M. F. MULLER [1958], “A Note on the Generation of Random Normal Deviates,” Annals ofMathematical Statistics, Vol. 29, pp. 610–611.

CHENG, R. C. H. [1977], “The Generation of Gamma Variables with Nonintegral Shape Parameter,” Applied Statistics, Vol. 26, No. 1, pp. 71–75.

DAGPUNAR, J. [1988], Principles ofRandom Variate Generation, Clarendon Press, Oxford.

DEVROYE, L. [1986], Non-Uniform Random Variate Generation, Springer-Verlag, New York.

LAW, A. M. [2007], Simulation Modeling and Analysis, 4th ed., McGraw-Hill, New York.

RIPLEY, B. D. [1987], Stochastic Simulation, Wiley, New York.

SCHMEISER, B. W. [1979], “Approximations to the Inverse Cumulative Normal Function for Use on Hand Calculators,” Applied Statistics, Vol. 28, pp. 175–176.

SCHMEISER, B. W. [1980], “Random Variate Generation: A Survey,” in Simulation with Discrete Models: A State ofthe Art View, T. I. Oren, C. M. Shub, and P. F. Roth, eds., IEEE, NY, pp. 79–104.¨

EXERCISES

Many of the exercises in this section ask the reader to develop a generation scheme for a given distribution and generate values. The results should be implemented in a programming language or spreadsheet so that large numbers of variates can be generated.

  1. Develop a random-variate generator for a random variable X with the pdf
f(x)={e2x,−∞<x≤0e−2x,0<x<∞ f (x) = \left\{\begin{array}{l l} e^{2 x}, & - \infty < x \leq 0 \\ e^{- 2 x}, & 0 < x < \infty \end{array} \right.
  1. Develop a generation scheme for the triangular distribution with pdf
f(x)={12(x−2),2≤x≤312(2−x3),3<x≤60,otherwise f (x) = \left\{\begin{array}{l l} \frac {1}{2} (x - 2), & 2 \leq x \leq 3 \\ \frac {1}{2} \left(2 - \frac {x}{3}\right), & 3 < x \leq 6 \\ 0, & \text{otherwise} \end{array} \right.

Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution.

  1. Develop a generator for a triangular distribution with range (1, 10) and mode at x=4.x = 4 . Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution.

  2. Develop a generator for a triangular distribution with range (1, 10) and a mean of 4. Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution.

  3. Given the following cdf for a continuous variable with range from 3 to 4, develop a generator for the variable, generate 1000 values, and plot a histogram.

F(x)={0,x≤−312+x6,−3<x≤012+x232,0<x≤41,x>4 F (x) = \left\{\begin{array}{l l} 0, & x \leq - 3 \\ \frac {1}{2} + \frac {x}{6}, & - 3 < x \leq 0 \\ \frac {1}{2} + \frac {x^{2}}{32}, & 0 < x \leq 4 \\ 1, & x > 4 \end{array} \right.
  1. Given the cdf F(x)=x4/16on0≤x≤2F ( x ) = x^{4} / 16 \mathrm{o n} 0 \leq x \leq 2, develop a generator for this distribution. Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution.

  2. Given the pdf f(x)=x2/9 on 0≤x≤3f ( x ) = x^{2} / 9 \ \mathrm{o n} \ 0 \leq x \leq 3, develop a generator for this distribution. Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution.

  3. Develop a generator for a random variable whose pdf is

f(x)={13,0≤x≤2124,2<x≤100,otherwise f (x) = \left\{\begin{array}{l l} \frac {1}{3}, & 0 \leq x \leq 2 \\ \frac {1}{24}, & 2 < x \leq 10 \\ 0, & \text{otherwise} \end{array} \right.

Generate 1000 values and plot a histogram.

  1. The cdf of a discrete random variable X is given by
F(x)=x(x+1)(2x+1)n(n+1)(2n+1),x=1,2,…,n F (x) = \frac {x (x + 1) (2 x + 1)}{n (n + 1) (2 n + 1)}, x = 1, 2, \dots , n

When n=4n = 4, generate three values of X, using R1=0.83,R2=0.24.R_{1} = 0 . 83 , R_{2} = 0 . 24 ., and R3=0.57R_{3} = 0 . 5710. Times to failure for an automated production process have been found to be randomly distributed with a Weibull distribution with parameters β=2\beta = 2 and α=10\alpha = 10. Derive Equation (6), and then use it to generate five values from this Weibull distribution, using five random numbers taken from Table A.1.

  1. Data have been collected on service times at a drive-in bank window at the Shady Lane National Bank. This data are summarized into intervals as follows:
Interval (Seconds)Frequency
15–3010
30–4520
45–6025
60–9035
90–12030
120–18020
180–30010

Set up a table like Table 3 for generating service times by the table-lookup method, and generate five values of service time, using four-digit random numbers from Table A.1.

  1. In Example 2, assume that fire-crew response times satisfy 0.25≤x≤30 . 25 \leq x \leq 3. Modify Table 2 to accommodate this assumption. Then generate five values of response time, using four-digi uniform random numbers from Table A.1.

  2. For a preliminary version of a simulation model, the number of pallets X to be loaded onto a truck at a loading dock was assumed to be uniformly distributed between 8 and 24. Devise a method for generating X, assuming that the loads on successive trucks are independent. Use the technique of Example 5 for discrete uniform distributions. Finally, generate loads for 10 successive trucks by using four-digit random numbers from Table A.1.

  3. Develop a method for generating values from a negative binomial distribution with parameters p and k. Generate 3 values when p=0.8p = 0 . 8 and k=2k = 2. [Hint: Think about the definition of the negative binomial as the number of Bernoulli trials until the kth success.]

  4. The weekly demand X for a slow-moving item has been found to be approximated well by a geometric distribution on the range {0,1,2,…}\{0 , 1 , 2 , \ldots \} with mean weekly demand of 2.5 items. Generate 10 values of X demand per week, using random numbers from Table A.1. [Hint: For a geometric distribution on the range {q,q+1,…}\{q , q + 1 , \ldots \} with parameter p, the mean is 1/p+q−1.]1 / p + q - 1 . ]16. In Exercise 15, suppose that the demand has been found to have a Poisson distribution with mean 2.5 items per week. Generate 10 values of X demand per week, using random numbers from Table A.1. Discuss the differences between the geometric and the Poisson distributions.

  5. Lead times have been found to be exponentially distributed with mean 3.7 days. Generate five random lead times from this distribution.

  6. Regular maintenance of a production routine has been found to vary and has been modeled as a normally distributed random variable with mean 33 minutes and variance 4 minutes^2. Generate five random maintenance times from the given distribution.

  7. A machine is taken out of production either if it fails or after 5 hours, whichever comes first. By running similar machines until failure, it has been found that time to failure X has the Weibull distribution with α=8,β=0.75\alpha = 8 , \beta = 0 . 75, and ν 0. Thus, the time until the machine is taken out of production can be represented as Y=min⁡(X,5)Y = \operatorname* {m i n} ( X , 5 ). Develop a step-by-step procedure for generating Y.

  8. The time until a component is taken out of service is uniformly distributed on from 0 to 8 hours. Two such independent components are put in series, and the whole system goes down when one of the components goes down. If Xi (i=1,2)X_{i} ~ ( i = 1 , 2 ) represents the component runtimes, then Y=min⁡(X1,X2)Y = \operatorname* {m i n} ( X_{1} , X_{2} ) represents the system lifetime. Devise two distinct ways to generate Y. [Hint: One way is relatively straightforward. For a second method, first compute the cdf of Y :FY(y)=F_{Y} ( y ) =P(Y≤y)=1−P(Y>y)P ( Y \leq y ) = 1 - P ( Y > y ), for 0≤y≤8.0 \leq y \leq 8 .. Use the equivalence {Y>y}={X1>y\{Y > y \} = \{X_{1} > y and X2 > y}X_{2} ~ > ~ y \} and the independence of X1X_{1}, and X2X_{2}. After finding FY(y)F_{Y} ( y )), proceed with the inversetransform technique.]

  9. In Exercise 20, component lifetimes are exponentially distributed, one with mean 2 hours and the other with mean 6 hours. Rework Exercise 20 under this new assumption. Discuss the relative efficiency of the two generation schemes devised.

  10. Develop a technique for generating a binomial random variable X via the convolution technique. [Hint: X can be represented as the number of successes in n independent Bernoulli trials, each success having probabilityp. Thus,X=∑i=1nXi\textstyle X = \sum_{i = 1} ^ {n} X_{i}, where P(Xi=1)=pP ( X_{i} = 1 ) = p and P(Xi=0)=1−p.]P ( X_{i} = 0 ) = 1 {-} p . ]23. Develop an acceptance-rejection technique for generating a geometric random variable X with parameter p on the range {0,1,2,…}\{0 , 1 , 2 , \ldots \}. [Hint: X can be thought of as the number of failures before the first success occurs in a sequence of independent Bernoulli trials.]

  11. Write a computer routine to generate standard normal variates by the exact method discussed in this chapter. Use it to generate 10,000 values. Compare the true probability,Φ(z).\Phi ( z ) ., that a value lies in (−∞,z)( - \infty , z ) to the actual observed relative frequency that values were ≤z,for z=\leq z , {\mathrm{f o r ~}} z =−4,−3,−2,−1,0,1,2,3- 4 , - 3 , - 2 , - 1 , 0 , 1 , 2 , 3, and 4.

  12. Write a computer routine to generate gamma variates with shape parameter β\beta and scale parameter θ. Generate 1000 values with β=2.5\beta = 2 . 5 and θ=0.2\theta = 0 . 2 and compare the true mean,1/θ=5 /1 / \theta = 5 \ /, to the sample mean.

  13. Write a computer routine to generate 2000 values from one of the variates in Exercises 1 to 23. Make a histogram of the 2000 values and compare it to the theoretical density function (or probability mass function for discrete random variables).

  14. Many spreadsheet, symbolic-calculation, and statistical-analysis programs have built-in routines for generating random variates from standard distributions. Try to find out what variate-generation methods are used in one of these packages by looking at the documentation. Should you trust a variate generator if the method is not documented?

  15. Suppose that, somehow, we have available a source of exponentially distributed random variates with mean 1. Write an algorithm to generate random variates with a triangular distribution by transforming the exponentially distributed random variates. [Hint: First, transform to obtain uniformly distributed random variates.]

  16. Let time t 0 correspond to 6 A.M., and suppose that the arrival rate (in arrivals per hour) of customers to a breakfast restaurant that is open 6–9 A.M. is

λ(t)={30,0≤t<145,1≤t<220,2≤t≤4 \lambda (t) = \left\{\begin{array}{l l} 30, & 0 \leq t < 1 \\ 45, & 1 \leq t < 2 \\ 20, & 2 \leq t \leq 4 \end{array} \right.

Derive a thinning algorithm for generating arrivals from this NSPP and generate the first 100 arrival times.

  1. Generate 10 values from a beta distribution on the interval [0, 1] with parameters β1=1.47\beta_{1} = 1 . 47 and β2=2.16\beta_{2} = 2 . 16. Next transform them to be on the interval [ 10, 20]

  2. Suppose that a discrete distribution can take values ν1,ν2,…,νk\nu_{1} , \nu_{2} , \dots , \nu_{k}. These values are equally likely, but are not 1,2,…,k1 , 2 , \ldots , k. Come up with a generation scheme that exploits the idea in Example 5. [Hint: Consider storing the values in an array, then generating a random array index.]

  3. Suppose that the arrival rate of hits to a web site is λ(t)=1000+50sin⁡(2πt/24)\lambda ( t ) = 1000 + 50 \sin ( 2 \pi t / 24 ) hits per hour. Derive a thinning algorithm for generating arrivals from this NSPP.

List of Materials Available on www.bcnn.net

RandomNumberTools.xls

9 Input Modeling

Input models provide the driving force for a simulation. In the simulation ofa queueing system, typica input models are the distributions of time between arrivals and of service times. For a supply-chain simulation, input models include the distributions of demand and of lead time. For the simulation of a reliability problem, the distribution of time to failure of a component is an example of an input model.

In real-world simulation applications, choosing appropriate distributions for input data is a major task from the standpoint of time and resource requirements. Regardless of the sophistication of the analyst, faulty models of the inputs will lead to outputs whose interpretation could give rise to misleading recommendations.

There are four steps in the development of a useful model of input data:

  1. Collect data from the real system of interest. This often requires a substantial time and resource commitment. Unfortunately, in some situations it is not possible to collect data (for example, when time is extremely limited, when the input process does not yet exist, or when laws or rules prohibit the collection of data). When data are not available, expert opinion and knowledge of the process must be used to make educated guesses.

  2. Identify a probability distribution to represent the input process. When data are available, this step typically begins with the development of a histogram of the data. Given the histogram and a structural knowledge of the process, a family of distributions is chosen. Fortunately,

several well-known distributions often provide good approximations in practice.

  1. Choose parameters that determine a specific instance of the distribution family. When data are available, these parameters may be estimated from the data.

  2. Evaluate the chosen distribution and the associated parameters for goodness of fit. Goodness of fit may be evaluated informally, via graphical methods, or formally, via statistical tests. The chi-square and the Kolmogorov–Smirnov tests are standard goodness-of-fit tests. If not satisfied that the chosen distribution is a good approximation of the data, then the analyst returns to the second step, chooses a different family of distributions, and repeats the procedure. If several iterations of this procedure fail to yield a fit between an assumed distributiona form and the collected data, the empirical form of the distribution may be used.

Each of these steps is discussed in this chapter. Although software is now widely available to accomplish Steps 2, 3, and 4—including such stand-alone programs as ExpertFit® and Stat::Fit®\mathrm{S t a t} {: :} \mathrm{F i t} ^ {\circledR} and such integrated programs as Arena’s Input Processor and @Risk’s BestFit®—it is still important to understand what the software does, so that it can be used appropriately. Unfortunately, software is not as readily available for input modeling when there is a relationship between two or more variables of interest or when no data are available. These two topics are discussed toward the end of the chapter.

1 Data Collection

Problems are found at the end of each chapter, as exercises for the reader, in textbooks about mathematics, physics, chemistry, and other technical subjects. Years and years of working these problems could give the reader the impression that data are readily available. Nothing could be further from the truth. Data collection is one of the biggest tasks in solving a real problem and it is one of the most important and difficult problems in simulation.

The focus of input modeling is on the statistical aspects of fitting probability distributions to data, distributions that will later provide the driving inputs to the simulation. However, before “fitting” can occur there needs to be accurate and relevant input data available (or collectible), and the properties o the data need to be well understood. Too often data are handed to input modeling software, which wil always fit some probability model to the data, whether it is justified or not. The following examples illustrate common pitfalls of this approach:

Example 1: Stale Data

A simulation study will investigate ways to reduce the time patients spend in a cancer screening clinic. One part of the screening protocol involves a nurse obtaining the patient’s history. In a 2002 study of nursing activities, observations of nurses taking patient histories were collected by a consulting firm. The hospital still has this data. Should it be used for input modeling in the current project?

In this case the answer is probably no, because deeper investigation by the engineers on the current project discovered that in 2008 the nurses stopped recording screening notes on a paper char and began entering them directly into a laptop computer. Therefore, the 2002 data are of a different history-taking process and may significantly misrepresent the current process. If current data canno

be collected, either due to the time required or the expense, then it would be better to use estimates provided by the nurses themselves rather than rely on the out-of-date study. Section 6 describes methods for converting expert opinion into probability distributions. The engineers might then check the nurses’ estimates by volunteering to have their own histories taken and timing the process to get a few actual data points.

Example 2: Unexpected Data

For security purposes people who enter a government building are required to pass through a security screening that includes a metal detector. Before new security protocols are implemented a simulation study will be conducted to assess their impact. To facilitate the study, 1000 observations of the time, in minutes, required to pass through the metal detector station were collected. The average value o these data was about 1/2 minute, with standard deviation almost the same. This suggests that a good input model for the time to pass through the metal detector is the exponential distribution, since its mean and standard deviation are always the same and exponential distributions are often used to model service times in queueing systems.

However, the analyst is uncomfortable with this input model because in her experience it only takes a few seconds to pass through a metal detector. She creates a histogram of the data, shown in Figure 1, which makes it immediately apparent that the time to pass through metal detection consists of two distinct distributions. Thinking carefully, she realizes that some people pass through the detector without incident, but others trigger the alarm and have to remove remaining meta

Figure 1 Histogram of 1000 observations of time through the metal detector measured in minutes.

objects and try again, in some cases even requiring a personal inspection. Therefore, three distinc input models are required for this data: one for the time to pass through without setting off the detector (the 764 left-most observations in the histogram); one for the time to pass through when the alarm does go off (the 236 right-most observations in the histogram); and a model for the chance tha a person sets off the alarm. While an exponential distribution could certainly match the summary statistics from the data (mean and standard deviation). the fitted exponential distribution would have missed a key feature of security screening, almost certainly leading to an inaccurate simulation.

Unfortunately, inspecting the data carefully the analyst spots an additional complication: The histogram in Figure 1 shows negative values in the sample (nine total). A negative time to pass through metal detection is clearly impossible, so what should the analyst do? It may be that the observations were recorded correctly but a mistake was made in calculating the times; if that is the case then the analyst may be able to reconstruct the correct values. If not, then the nine negative values should be discarded before fitting the distribution. But should they also be discarded when estimating the probability that someone sets off the alarm? That is, should the estimate be 236/1000 or 236/991? If the analyst can convince herself that the 9 negative values were actually small times that were misrecorded, then she might want to retain them for estimating this probability. If she is unsure, then the simulation should be run with both estimates to see if there is a substantial impact.

Example 3: Time-varying Data

A computer manufacturer provides a customer support center where owners of the product may cal with questions or concerns. The call center is staffed from 8A.M. to 8 P.M. Eastern Time.A simulation study is planned to help set staffing levels, since staff salaries and benefits are the primary costs. The call center has extensive records on daily call volume showing that, on average, they receive 12,277 calls per day. The number of random events in a fixed amount of time or space is often well modeled by a Poisson distributions, so a Poisson distribution is fit to the data (using methods described later in the chapter) and appears to fit well. When the number of arrivals is Poisson, then the time between arrivals—which is what we need to simulate calls—must be exponentially distributed. The natura estimate of the arrival rate for this exponential distribution is 12,277 arrivals per 12-hour day, bu since a “day” is a pretty large time unit, it is converted to 17 calls per minute.

The analysis in the previous paragraph seems to be sound, and the choice ofa Poisson distribution (implying exponential time between arrivals) was even supported by data. However, the level of data aggregation, a 12-hour day, masked a very important feature of call centers: The arrival rate of calls can, and typically does, vary substantially by time of day, day of week, and even time of the year (e.g., right after the holiday gift-giving season). We often assume that the process of interest is stationary, meaning that its basic properties do not change over time. However, if trends exist then accounting for them can be far more important than the choice of probability distribution to represent the remaining uncertainty in the system. In Section 5 we describe a method for fitting a nonstationary Poisson process, which is likely more appropriate for this call center.

Example 4: Dependent Data

Monthly demands for a particular brand of sports drink by a large retailer have been extracted from an orders database to use in a supply chain simulation. A simple input model for this data is that monthly demands are independent and identically distributed (i.i.d.), and this chapter describes methods for fitting a distribution to such data and evaluating the fit. But it is important to evaluate the “i.i.d.” assumption also.

Figure 2 Time-lagged demand data.

One informal way to check that these data are identically distributed is to plot the demands in time order to look for trends (e.g., demands are decreasing over time) or seasonality (there is a regular cycle of demand, for instance, high demand each summer followed by low demand each winter). Data with trends or seasonality should typically be “de-trended” first (usually by fitting a model to the trend or seasonal pattern) and then a distribution can be fit to any remaining variation.

Independence can be checked via time-lagged scatter plots. Figure 2 is a scatter plot of each month’s demand for the sports drink plotted against the following month’s demand (e.g., January’s demand vs. February’s demand). Clearly there is a strong negative correlation, which means large demands in one month tend to be followed by low demands in the next month, and vice versa. This feature might be the result of the retailer overstocking in one month, and then ordering less the following month so as to work off the excess inventory. Time lags greater than one month can also be examined. By blindly making the standard assumption of i.i.d. inputs this important phenomenon would be missed, leading to less effective supply chain management. In Section 7 we present methods for modeling dependent input data.

As these examples illustrate, simply having data is not enough to support effective input modeling. Data can be out of date or “dirty” (containing errors). Sometimes the effort or cost to transform data into a usable form, or “clean” it of errors, can be as significant as that required to obtain it. Inpu modeling nearly always requires the analyst to use their judgment as well as to apply appropriate statistical tools. Understanding which input models are the most and least reliable is important for judging the reliability of the conclusions drawn from the simulation study. And since uncertainty about the correctness of the input models can never be entirely eliminated, it is sensible to run the simulation with several plausible input models to see if the conclusions are robust or highly sensitive to the choices.

Many lessons can be learned from an actual experience at data collection. The first five exercises at the end of this chapter suggest some situations in which the student can gain such experience.

The following suggestions might enhance and facilitate data collection, although they are no all-inclusive.

  1. A useful expenditure of time is in planning. This could begin by a practice or preobserving session. Try to collect data while preobserving. Devise forms for this purpose. It is very likely that these forms will have to be modified several times before the actual data collection begins. Watch for unusual circumstances and consider how they will be handled. When possible, videotape the system and extract the data later by viewing the tape. Planning is important, even if data will be collected automatically (e.g., via computer data collection), to ensure that the appropriate data are available. When data have already been collected by someone else, be sure to allow plenty of time for converting the data into a usable format.

  2. Try to analyze the data as they are being collected. Figure out whether the data being collected are adequate to provide the distributions needed as input to the simulation. Find out whether any data being collected are useless to the simulation. There is no need to collect superfluous data.

  3. Try to combine homogeneous data sets. Check data for homogeneity in successive time periods and during the same time period on successive days. For example, check for homogeneity of data from 2:00 P.M. to 3:00 P.M. and 3:00 P.M. to 4:00 P.M., and check to see whether the data are homogeneous for 2:00 P.M. to 3:00 P.M. on Thursday and Friday. When checking for homogeneity, an initial test is to see whether the means of the distributions (the average interarrival times, for example) are the same. The two-sample t test can be used for this purpose. A more thorough analysis would require a test of the equivalence of the distributions, perhaps via a quantile-quantile plot (described later).

  4. Be aware of the possibility of data censoring, in which a quantity of interest is not observed in its entirety. This problem most often occurs when the analyst is interested in the time required to complete some process (for example, produce a part, treat a patient, or have a component fail), but the process begins prior to, or finishes after the completion of, the observation period. Censoring can result in especially long process times being left out of the data sample.

  5. To discover whether there is a relationship between two variables, build a scatter diagram. Sometimes a look at the scatter diagram will indicate whether there is a relationship between the variables of interest.

  6. Consider the possibility that a sequence of observations that appear to be independent actually has autocorrelation. Autocorrelation can exist in successive time periods or for successive customers.

  7. Keep in mind the difference between input data and output or performance data, and be sure to collect input data. Input data typically represent the uncertain quantities that are largely beyond the control of the system and will not be altered by changes made to improve the system. Output data, on the other hand, represent the performance of the system when

subjected to the inputs, performance that we might be trying to improve. In a queueing simulation, the customer arrival times are usually inputs, whereas the customer delay is an output. Performance data are useful for model validation.

Again, these arejust a few suggestions.As a rule, data collection and analysis must be approached with great care.

2 Identifying the Distribution with Data

In this section, we discuss methods for selecting families ofinput distributions when data are available and are believed to be independent and identically distributed. The specific distribution within a family is specified by estimating its parameters, as described in Section 3. Section 6 takes up the case in which data are unavailable.

2.1 Histograms

A frequency distribution or histogram is useful in identifying the shape of a distribution. A histogram is constructed as follows:

  1. Divide the range of the data into intervals. (Intervals are usually of equal width; however, unequal widths may be used if the heights of the frequencies are adjusted.)

  2. Label the horizontal axis to conform to the intervals selected.

  3. Find the frequency of occurrences within each interval.

  4. Label the vertical axis so that the total occurrences can be plotted for each interval.

  5. Plot the frequencies on the vertical axis.

The number of class intervals depends on the number of observations and on the amount o scatter or dispersion in the data. Hines et al. [2002] state that choosing the number of class intervals approximately equal to the square root of the sample size often works well in practice. If the intervals are too wide, the histogram will be coarse, or blocky, and its shape and other details will not show well. If the intervals are too narrow, the histogram will be ragged and will not smooth the data. Examples of ragged, coarse, and appropriate histograms of the same data are shown in Figure 3. Modern data-analysis software often allows the interval sizes to be changed easily and interactively until a good choice is found.

The histogram for continuous data corresponds to the probability density function of a theoretica distribution. If continuous, a line drawn through the center point of each class interval frequency should result in a shape like that of a pdf.

Histograms for discrete data, where there are a large number of data points, should have a cell for each value in the range of the data. However, if there are few data points, it could be necessary to combine adjacent cells to eliminate the ragged appearance of the histogram. If the histogram is associated with discrete data, it should look like a probability mass function.

Figure 3 Ragged, coarse, and appropriate histograms: (a) original data—too ragged; (b) combining adjacent cells—too coarse; (c) combining adjacent cells—appropriate.

Example 5: Discrete Data

The number of vehicles arriving at the northwest corner of an intersection in a 5-minute period between 7:00 A.M. and 7:05 A.M. was monitored for five workdays over a 20-week period. Table 1 shows the resulting data. The first entry in the table indicates that there were 125-minute periods during which zero vehicles arrived, 10 periods during which one vehicle arrived, and so on.

Table 1 Number of Arrivals in a 5-Minute Period

Arrivals per PeriodFrequencyArrivals per PeriodFrequency
01267
11075
21985
31793
410103
58111

Figure 4 Histogram of number of arrivals per period.

The number of automobiles is a discrete variable, and there are ample data, so the histogram may have a cell for each possible value in the range of the data. The resulting histogram is shown in Figure 4.

Example 6: Continuous Data

Life tests were performed on a random sample of electronic components at 1.5 times the nomina voltage, and their lifetime (or time to failure), in days, was recorded:

79.9193.0810.0621.9615.845
3.0276.5050.0210.0130.123
6.76959.8991.19234.7605.009
18.3870.14143.56524.4200.433
144.6952.66317.9670.0919.003
0.9410.8783.3712.1577.579
0.6245.3803.1487.07823.960
0.5901.9280.3000.0020.543
7.00431.7641.0051.1470.219
3.21714.3821.0082.3364.562

Lifetime, usually considered a continuous variable, is recorded here to three-decimal-place accuracy. The histogram is prepared by placing the data in class intervals. The range of the data is rather large, from 0.002 day to 144.695 days. However, most of the values (30 of 50) are in the zero-to-5-day range. Using intervals of width three results in Table 2. The data of Table 2 are then used to prepare the histogram shown in Figure 5.

Figure 5 Histogram of component life.

2.2 Selecting the Family of Distributions

The purpose of preparing a histogram is to infer a known pdf or pmf. A family of distributions is selected on the basis of what might arise in the context being investigated along with the shape of the histogram. Thus, if interarrival-time data have been collected, and the histogram has a shape similar to an exponential distribution. Similarly, if measurements of the weights of pallets of freigh are being made, and the histogram appears symmetric about the mean, the assumption of a norma distribution would be warranted.

Table 2 Electronic Component Data

Component Life(days)Frequency
0≤xj<30 \leq x_{j} < 323
3≤xj<63 \leq x_{j} < 610
6≤xj<96 \leq x_{j} < 95
9≤xj<129 \leq x_{j} < 121
12≤xj<1512 \leq x_{j} < 151
15≤xj<1815 \leq x_{j} < 182
18≤xj<2118 \leq x_{j} < 210
21≤xj<2421 \leq x_{j} < 241
24≤xj<2724 \leq x_{j} < 271
27≤xj<3027 \leq x_{j} < 300
30≤xj<3330 \leq x_{j} < 331
33≤xj<3633 \leq x_{j} < 361
..
..
..
42≤xj<4542 \leq x_{j} < 451
..
..
..
57≤xj<6057 \leq x_{j} < 601
..
..
..
78≤xj<8178 \leq x_{j} < 811
..
..
..
144≤xj<147144 \leq x_{j} < 1471

The exponential, normal, and Poisson distributions are frequently encountered and are not difficult to analyze from a computational standpoint. Although more difficult to analyze, the beta, gamma, and Weibull distributions provide a wide array of shapes and should not be overlooked during modeling of an underlying probabilistic process. Perhaps an exponential distribution was assumed, but it was found not to fit the data. The next step would be to examine where the lack of fit occurred. If the lack of fit was in one of the tails of the distribution, perhaps a gamma or Weibull distribution would fit the data more adequately.

There are literally hundreds of probability distributions that have been created; many were created with some specific physical process in mind. One aid to selecting distributions is to use the physical basis of the distributions as a guide. Here are some examples:

Binomial: Models the number of successes in n trials, when the trials are independent with common success probability p; for example, the number of defective computer chips found in a lot of n chips.

Negative Binomial (includes the geometric distribution): Models the number of trials required to achieve k successes; for example, the number of computer chips that we must inspect to find 4 defective chips.

Poisson: Models the number of independent events that occur in a fixed amount of time or space; for example, the number of customers that arrive to a store during 1 hour, or the number of defects found in 30 square meters of sheet metal.

Normal: Models the distribution of a process that can be thought of as the sum of a number of component processes; for example, a time to assemble a product that is the sum of the times required for each assembly operation. Notice that the normal distribution admits negative values, which could be impossible for process times.

Lognormal: Models the distribution of a process that can be thought of as the product of (meaning to multiply together) a number of component processes; for example, the rate of return on an investment, when interest is compounded, is the product of the returns for a number of periods.

Exponential: Models the time between independent events, or a process time that is memoryless (knowing how much time has passed gives no information about how much additional time wil pass before the process is complete); for example, the times between the arrivals from a large population of potential customers who act independently of one another. The exponential is a highly variable distribution; it is sometimes overused, because it often leads to mathematically tractable models. Recall that, if the time between events is exponentially distributed, then the number of events in a fixed period of time is Poisson.

Gamma: An extremely flexible distribution used to model nonnegative random variables. The gamma can be shifted away from 0 by adding a constant.

Beta: An extremely flexible distribution used to model bounded (fixed upper and lower limits) random variables. The beta can be shifted away from 0 by adding a constant and can be given a range larger than [0, 1] by multiplying by a constant.

Erlang: Models processes that can be viewed as the sum of several exponentially distributed processes; for example, a computer network fails when a computer and two backup computers fail, and each has a time to failure that is exponentially distributed. The Erlang is a special case of the gamma.

Weibull: Models the time to failure for components; for example, the time to failure for a disk drive. The exponential is a special case of the Weibull.

Discrete or Continuous Uniform: Models complete uncertainty: All outcomes are equally likely. This distribution often is used inappropriately when there are no data.

Triangular: Models a process for which only the minimum, most likely, and maximum values of the distribution are known; for example, the minimum, most likely, and maximum time required to test a product. This model is often a marked improvement over a uniform distribution.

Empirical: Resamples from the actual data collected; often used when no theoretical distribution seems appropriate.

Do not ignore physical characteristics of the process when selecting distributions. Is the process naturally discrete or continuous valued? Is it bounded or is there no natural bound? This knowledge, which does not depend on data, can help narrow the family of distributions from which to choose. And keep in mind that there is no “true” distribution for any stochastic input process. An input mode is an approximation of reality, so the goal is to obtain an approximation that yields useful results from the simulation experiment.

The reader is encouraged to complete Exercises 6 through 11 to learn more about the shapes of the distributions mentioned in this section. Examining the variations in shape as the parameters change is very instructive.

2.3 Quantile-Quantile Plots

The construction of histograms, as discussed in Section 2.1, and the recognition of a distributiona shape, as discussed in Section 2.2, are necessary ingredients for selecting a family of distributions to represent a sample of data. However, a histogram is not as useful for evaluating the ft\mathscr {f} t of the chosen distribution. When there is a small number of data points, say, 30 or fewer, a histogram can be rather ragged. Further, our perception of the fit depends on the widths of the histogram intervals. But, even if the intervals are well chosen, grouping data into cells makes it difficult to compare a histogram to a continuous probability density function. A quantile-quantile (q −q)( q \ - q ) plot is a useful tool for evaluating distribution fit, one that does not suffer from these problems.

If X is a random variable with cdf F, then the q-quantile of X is that value γ\gamma such that F(γ)=F ( \gamma ) =P(X≤γ)=qP ( X \leq \gamma ) = q, for 0<q<10 < q < 1. When F has an inverse, we write γ=F−1(q)\gamma = F^{- 1} ( q ) Now let {xi,i=1,2,…,n}\{x_{i} , i = 1 , 2 , \dots , n \} be a sample of data from X. Order the observations from the smallest to the largest, and denote these as {yj,j=1,2,...n}\{y_{j} , j = 1 , 2 , . . . n \}, where y1≤y2≤⋅⋅⋅≤yny_{1} \leq y_{2} \leq \cdot \cdot \cdot \leq y_{n}. Let j denote the ranking or order number. Therefore,j=1j = 1 for the smallest and j=nj = n for the largest. The q−qq {-} q plot is based on the fact that yjy_{j} is an estimate of the (j−1/2)/n( j - 1 / 2 ) / n quantile of X. In other words,

yjis approximatelyF−1(j−12n) y_{j} \text{is approximately} F^{- 1} \left(\frac {j - \frac {1}{2}}{n}\right)

Now, suppose that we have chosen a distribution with cdf FF as a possible representation of the distribution of X. If FF is a member of an appropriate family of distributions, then a plot of yjy_{j} versus F−1((j−1/2)/n)F^{- 1} ( ( j - 1 / 2 ) / n )) will be approximately a straight line. If F is from an appropriate family of distributions and also has appropriate parameter values, then the line will have slope 1. On the other hand, if the assumed distribution is inappropriate, the points will deviate from a straight line,

usually in a systematic manner. The decision about whether to reject some hypothesized model is subjective.

Example 7: Normal Q-Q Plot

A robot is used to install the doors on automobiles along an assembly line. It was thought that the installation times followed a normal distribution. The robot is capable of measuring installation times accurately. A sample of 20 installation times was automatically taken by the robot, with the following results, where the values are in seconds:

99.7999.56100.17100.33
100.26100.4199.9899.83
100.23100.27100.02100.47
99.5599.6299.6599.82
99.9699.90100.0699.85

The sample mean is 99.99 seconds, and the sample variance is (0.2832)^2 seconds^2. These values can serve as the parameter estimates for the mean and variance of the normal distribution. The observations are now ordered from smallest to largest as follows:

jValuejValuejValuejValue
199.55699.821199.9816100.26
299.56799.8312100.0217100.27
399.62899.8513100.0618100.33
499.65999.9014100.1719100.41
599.791099.9615100.2320100.47

The ordered observations are then plotted versus F−1((j−1/2)/20)F^{- 1} ( ( j - 1 / 2 ) / 20 ), for j=1,2,…,20j = 1 , 2 , \dots , 20, where F is the cdf of the normal distribution with mean 99.99 and variance (0.2832)^2, to obtain a q-q plot. The plotted values are shown in Figure 6, along with a histogram of the data. Notice that it is difficul to tell whether the data are well represented by a normal distribution from looking at the histogram, but the general perception of a straight line is quite clear in the q-q plot and supports the hypothesis of a normal distribution.

In the evaluation of the linearity of a q-q plot, the following should be considered:

a. The observed values will never fall exactly on a straight line.

b. The ordered values are not independent; they have been ranked. Hence, if one point is above a straight line, it is likely that the next point will also lie above the line. And it is unlikely that the points will be evenly scattered about the line.

c. The variances of the extremes (largest and smallest values) are much higher than the variances in the middle of the plot. Greater discrepancies can be accepted at the extremes. The linearity of the points in the middle of the plot is more important than the linearity at the extremes.

Figure 6 A q-q plot and histogram of the installation times.

Modern data-analysis software often includes tools for generating q-q plots, especially for the normal distribution. The q−qq {-} q plot can also be used to compare two samples of data to see whether they can be represented by the same distribution (that is, that they are homogeneous).If⁡x1,x2,…,xn\operatorname{I f} x_{1} , x_{2} , \ldots , x_{n} are a sample of the random variable X,X ,, and z1,z2,…,znz_{1} , z_{2} , \ldots , z_{n} are a sample of the random variable Z,Z , then plotting the ordered values of X versus the ordered values of Z will reveal approximately a straigh line if both samples are well represented by the same distribution (Chambers, Cleveland, and Tukey [1983]).

3 Parameter Estimation

After a family of distributions has been selected, the next step is to estimate the parameters o the distribution. Estimators for many useful distributions are described in this section. In addition, many software packages—some of them integrated into simulation languages—are now available to compute these estimates.

3.1 Preliminary Statistics: Sample Mean and Sample Variance

In a number of instances, the sample mean, or the sample mean and sample variance, are used to estimate the parameters of a hypothesized distribution; see Example 7. In the following paragraphs, three sets of equations are given for computing the sample mean and sample variance. Equations (1) and (2) can be used when discrete or continuous raw data are available. Equations (3) and (4) are used when the data are discrete and have been grouped in a frequency distribution. Equations (5) and (6) are used when the data are discrete or continuous and have been placed in class intervals. Equations (5) and (6) are approximations and should be used only when the raw data are unavailable.

If the observations in a sample of size n are X1,X2,…,XnX_{1} , X_{2} , \ldots , X_{n}, the sample mean Xˉ\bar {X} is defined by

Xˉ=∑i=1nXin(1) \bar {X} = \frac {\sum_{i = 1} ^ {n} X_{i}}{n}\tag{1}

and the sample variance S2S^{2} is defined by

S2=∑i=1nXi2−nXˉ2n−1(2) S^{2} = \frac {\sum_{i = 1} ^ {n} X_{i} ^ {2} - n \bar {X} ^ {2}}{n - 1}\tag{2}

If the data are discrete and have been grouped in a frequency distribution, Equations (1) and (2) can be modified to provide for much greater computational efficiency. The sample mean can be computed as

Xˉ=∑j=1kfjXjn(3) \bar {X} = \frac {\sum_{j = 1} ^ {k} f_{j} X_{j}}{n}\tag{3}

and the sample variance as

S2=∑j=1kfjXj2−nXˉ2n−1(4) S^{2} = \frac {\sum_{j = 1} ^ {k} f_{j} X_{j} ^ {2} - n \bar {X} ^ {2}}{n - 1}\tag{4}

where k is the number of distinct values of X and fjf_{j} is the observed frequency of the value XjX_{j} of X.

Example 8: Grouped Data

The data in Table 1 can be analyzed to obtain n=100,f1=12,X1=0,f2=10,X2=1,…,n = 100 , f_{1} = 12 , X_{1} = 0 , f_{2} = 10 , X_{2} = 1 , \ldots ,∑j=1kfjXj=364\textstyle \sum_{j = 1} ^ {k} f_{j} X_{j} = 364, and ∑j=1k=fjXj2=2080\begin{array} {r} {\sum_{j = 1} ^ {k} = f_{j} X_{j} ^ {2} = 2080} \end{array}. From Equation (3),

Xˉ=364100=3.64 \bar {X} = \frac {364}{100} = 3. 64

and, from Equation (4),

S2=2080−100(3.64)299=7.63 S^{2} = \frac {2080 - 100 (3 . 64) ^ {2}}{99} = 7. 63

The sample standard deviation S is just the square root of the sample variance. In this case,S={\boldsymbol {S}} =7.63=2.76\sqrt {7 . 63} = 2 . 76. Equations (1) and (2) would have yielded exactly the same results for Xˉ\bar {X} and S2S^{2} It is preferable to use the raw data, if possible, when the values are continuous. However, data sometimes are received after having been placed in class intervals. Then it is no longer possible to obtain the exact sample mean and variance. In such cases, the sample mean and sample variance are approximated from the following equations:

Xˉ≐∑j=1cfjmjn(5) \bar {X} \doteq \frac {\sum_{j = 1} ^ {c} f_{j} m_{j}}{n}\tag{5}

and

S2≐∑j=1cfjmj2−nXˉ2n−1(6) S^{2} \doteq \frac {\sum_{j = 1} ^ {c} f_{j} m_{j} ^ {2} - n \bar {X} ^ {2}}{n - 1}\tag{6}

where fjf_{j} is the observed frequency in the jth class interval,mjm_{j} is the midpoint of the jth interval, and c is the number of class intervals.

Example 9: Continuous Data in Class Intervals

Assume that the raw data on component life shown in Example 6 either was discarded or was lost. However, the data shown in Table 2 are still available. To approximate values for X¯ and S2S^{2}, Equations (5) and (6) are used. The following values are created:f1=23,m1=1.5,f2=10 /Ωf_{1} = 23 , m_{1} = 1 . 5 , f_{2} = 10 \ / \mathrm{\Omega}m2=4.5,…,∑j=149fjmj=614m_{2} = 4 . 5 , \ldots , \sum_{j = 1} ^ {49} f_{j} m_{j} = 614 and ∑j=149fjmj2=37,226.5\textstyle \sum_{j = 1} ^ {49} f_{j} m_{j} ^ {2} = 37 , 226 . 5. With n=50n = 50, X is approximated from Equation (5) as

Xˉ≐61450=12.28 \bar {X} \doteq \frac {614}{50} = 12. 28

Then,S2S^{2} is approximated from Equation (6) as

S2≐37,226.5−50(12.28)249=605.849 S^{2} \doteq \frac {37 , 226 . 5 - 50 (12 . 28) ^ {2}}{49} = 605. 849

and

S≐24.614 S \doteq 24. 614

Applying Equations (1) and (2) to the original data in Example 6 results in Xˉ = 11.894\bar {X} \ = \ 11 . 894 and S=24.953S = 24 . 953. Thus, when the raw data are either discarded or lost, inaccuracies could result

Table 3 Suggested Estimators for Distributions Often Used in Simulation

DistributionParameter(s)Suggested Estimator(s)
Poissonα\alphaα^=Xˉ\widehat{\alpha} = \bar{X}
Exponentialλ\lambdaλ^=1Xˉ\widehat{\lambda} = \frac{1}{\bar{X}}
Gammaβ,θ\beta, \thetaβ^\widehat{\beta}(see Table A.9) θ^=1Xˉ\widehat{\theta} = \frac{1}{\bar{X}}
Normalμ,σ2\mu, \sigma^{2}μ^=Xˉ\widehat{\mu} = \bar{X}
σ^2=S2\widehat{\sigma}^{2} = S^{2}(unbiased)
Lognormalμ,σ2\mu, \sigma^{2}μ^=Xˉ\widehat{\mu} = \bar{X}(after taking ln of the data) σ^2=S2\widehat{\sigma}^{2} = S^{2}(after taking ln of the data)
Weibullwith ν=0\nu = 0α,β\alpha, \betaβ^0=XˉS\widehat{\beta}_{0} = \frac{\bar{X}}{S}
β^j=β^j−1−f(β^j−1)f′(β^j−1)\widehat{\beta}_{j} = \widehat{\beta}_{j-1} - \frac{f(\widehat{\beta}_{j-1})}{f'(\widehat{\beta}_{j-1})} See Equations (11) and (14)for f(β^)f(\widehat{\beta}) and f′(β^)f'(\widehat{\beta}) Iterate until convergence α^=(1n∑i=1nXiβ^)1/β^\widehat{\alpha} = \left( \frac{1}{n} \sum_{i=1}^{n} X_{i}^{\widehat{\beta}} \right)^{1/\widehat{\beta}}
Betaβ1,β2\beta_{1}, \beta_{2}Ψ(β^1)+Ψ(β^1−β^2)=ln⁡(G1)\Psi(\widehat{\beta}_{1}) + \Psi(\widehat{\beta}_{1} - \widehat{\beta}_{2}) = \ln(G_{1})
Ψ(β^2)+Ψ(β^1−β^2)=ln⁡(G2)\Psi(\widehat{\beta}_{2}) + \Psi(\widehat{\beta}_{1} - \widehat{\beta}_{2}) = \ln(G_{2}) where Ψ\Psi is the digamma function,G1=(∏i=1nXi)1/nG_{1} = \left( \prod_{i=1}^{n} X_{i} \right)^{1/n} and G2=(∏i=1n(1−Xi))1/nG_{2} = \left( \prod_{i=1}^{n} (1 - X_{i}) \right)^{1/n}

3.2 Suggested Estimators

Numerical estimates of the distribution parameters are needed to reduce the family of distributions to a specific distribution and to test the resulting hypothesis. Table 3 contains suggested estimators for distributions often used in simulation. Except for an adjustment to remove bias in the estimate of σ2\sigma^{2} for the normal distribution, these estimators are the maximum-likelihood estimators based on the raw data. (If the data are in class intervals, these estimators must be modified.) The reader is referred to Fishman [1973] and Law [2007] for parameter estimates for the uniform, binomial, and negative binomial distributions. The triangular distribution is usually employed when no data are available, with the parameters obtained from educated guesses for the minimum, most likely, and maximum possible values; the uniform distribution may also be used in this way if only minimum and maximum values are available.

Examples of the use of the estimators are given in the following paragraphs. The reader should keep in mind that a parameter is an unknown constant, but the estimator is a statistic (or random variable), because it depends on the sample values. To distinguish the two clearly here, if, say, a parameter is denoted by α, the estimator will be denoted by α.

Example 10: Exponential Distribution

We will use the exponential distribution to illustrate the maximum likelihood method for obtaining parameter estimators. The density function of the exponential distribution with rate parameter λ is

f(x)=λe−λx f (x) = \lambda e^{- \lambda x}

for x≥0x \ge 0. If X1,X2,…,XnX_{1} , X_{2} , \ldots , X_{n} are i.i.d., and each have this exponential distribution, then their join distribution is

f(x1,x2,…,xn)=λe−λx1λe−λx2…λe−λxn=λne−λ∑i=1nxi(7) f (x_{1}, x_{2}, \ldots , x_{n}) = \lambda e ^ {- \lambda x_{1}} \lambda e ^ {- \lambda x_{2}} \dots \lambda e ^ {- \lambda x_{n}} = \lambda^{n} e ^ {- \lambda \sum_{i = 1} ^ {n} x_{i}}\tag{7}

The joint distribution represents, roughly, the likelihood of any collection of xix_{i} values.

The maximum likelihood method turns this around in the sense that, if we have a sample of data, say X1,X2,…,XnX_{1} , X_{2} , \ldots , X_{n}, but λ is not known, then the maximum-likelihood estimator (MLE) is the value of λ\lambda that maximizes the likelihood of the sample, as measured by Equation (7). Thus, the MLE of λ for the exponential distribution maximizes the likelihood function

L(λ)=λne−λ∑i=1nXi L (\lambda) = \lambda^{n} e ^ {- \lambda \sum_{i = 1} ^ {n} X_{i}}

Finding the MLE is often a calculus exercise of maximizing the likelihood function with respect to the unknown parameters. Because the likelihood function is a product of density functions and it is positive, it is sometimes easier to maximize the log of the likelihood function, which in this case is

ln⁡L(λ)=nln⁡(λ)−λ∑i=1nXi \ln L (\lambda) = n \ln (\lambda) - \lambda \sum_{i = 1} ^ {n} X_{i}

Taking the derivative with respect to λ\lambda and setting it equal to 0_ 0 we get

nλ−∑i=1nXi=0 \frac {n}{\lambda} - \sum_{i = 1} ^ {n} X_{i} = 0

giving the MLE λ^=n/∑i=1nXi=1/Xˉ\begin{array} {r} {\widehat {\lambda} = n / \sum_{i = 1} ^ {n} X_{i} = 1 / \bar {X}} \end{array} where Xˉ\bar {X} is the sample mean of the observations.

For example, assuming that the data in Example 6 come from an exponential distribution, the MLE of λ is obtained from Xˉ\bar {X} as

λ^=1Xˉ=111.894=0.084per day \widehat {\lambda} = \frac {1}{\bar {X}} = \frac {1}{11 . 894} = 0. 084 \text{per day}

Suppose that a random sample of size n .X1,X2,…,Xn.. X_{1} , X_{2} , \ldots , X_{n} ., has been taken and that the observations are assumed to come from a Weibull distribution. The likelihood function can be shown to be

L(α,β)=βnαβn[∏i=1nXi(β−1)]exp⁡[−∑i=1n(Xiα)β](8) L (\alpha , \beta) = \frac {\beta^{n}}{\alpha^{\beta n}} \left[ \prod_{i = 1} ^ {n} X_{i} ^ {(\beta - 1)} \right] \exp \left[ - \sum_{i = 1} ^ {n} \left(\frac {X_{i}}{\alpha}\right) ^ {\beta} \right]\tag{8}

The maximum-likelihood estimates are those values of α^\widehat {\alpha} and β^\widehat {\beta} that maximize L(α,β)L ( \alpha , \beta ) or, equivalently, maximize ln L(α,β)L ( \alpha , \beta ), denoted by l(α,β)l ( \alpha , \beta ). The maximum value of l(α,β)l ( \alpha , \beta ) is obtained by taking the partial derivatives ∂l(α,β)/∂α\partial l ( \alpha , \beta ) / \partial \alpha and ∂l(α,β)/∂β\partial l ( \alpha , \beta ) / \partial \beta, setting each to zero, and solving the resulting equations, which, after substitution, become

f(β)=0(9) f (\beta) = 0\tag{9}

and

α=(1n∑i=1nXiβ)1/β(10) \alpha = \left(\frac {1}{n} \sum_{i = 1} ^ {n} X_{i} ^ {\beta}\right) ^ {1 / \beta}\tag{10}

where

f(β)=nβ+∑i=1nln⁡Xi−n∑i=1nXiβln⁡Xi∑i=1nXiβ(11) f (\beta) = \frac {n}{\beta} + \sum_{i = 1} ^ {n} \ln X_{i} - \frac {n \sum_{i = 1} ^ {n} X_{i} ^ {\beta} \ln X_{i}}{\sum_{i = 1} ^ {n} X_{i} ^ {\beta}}\tag{11}

The maximum-likelihood estimates,α^\widehat {\alpha} and β^,{\widehat {\beta}} ,, are the solutions of Equations (9) and (10). First,β^\widehat {\beta}is found via the iterative procedure explained below. Then α^\widehat {\alpha} is found from Equation (10), with β=β^\beta = {\widehat {\beta}}Equation (9) is nonlinear, so it is necessary to use a numerical-analysis technique to solve it. In Table 3,^ {3 ,}, a suggested iterative method for computing β^\widehat {\beta} is given as

β^j=β^j−1−f(β^j−1)f′(β^j−1)(12) \widehat {\beta} _ {j} = \widehat {\beta} _ {j - 1} - \frac {f (\widehat {\beta} _ {j - 1})}{f^{\prime} (\widehat {\beta} _ {j - 1})}\tag{12}

Equation (12) employs Newton’s method in reaching β^,{\widehat {\beta}} , where β^j{\widehat {\beta}} _ {j} is thejth iteration, beginning with an initial estimate for β^0{\widehat {\beta}} _ {0}, given in Table 3, as follows:

β^0=XˉS(13) \widehat {\beta} _ {0} = \frac {\bar {X}}{S}\tag{13}

If the initial estimate,β^0.{\widehat {\beta}} _ {0} ., is sufficiently close to the solution β^,{\widehat {\beta}} ,, then β^j{\widehat {\beta}} _ {j} approaches β^as⁡j⟶∞\widehat \beta \operatorname{a s} j \longrightarrow \infty In Newton’s method,β^\widehat {\beta} is approached through increments of size f(β^j−1)/f′(β^j−1)f ( \widehat {\beta} _ {j - 1} ) / f^{\prime} ( \widehat {\beta} _ {j - 1} ). Equation (11) is used to compute f(β^j−1)f ( \widehat {\beta} _ {j - 1} ) and Equation (14) is used to compute f′(β^j−1)f^{\prime} ( \widehat {\beta} _ {j - 1} ), as follows:

f′(β)=−nβ2−n∑i=1nXiβ(ln⁡Xi)2∑i=1nXiβ+n(∑i=1nXiβln⁡Xi)2(∑i=1nXiβ)2(14) f^{\prime} (\beta) = - \frac {n}{\beta^{2}} - \frac {n \sum_{i = 1} ^ {n} X_{i} ^ {\beta} (\ln X_{i}) ^ {2}}{\sum_{i = 1} ^ {n} X_{i} ^ {\beta}} + \frac {n \left(\sum_{i = 1} ^ {n} X_{i} ^ {\beta} \ln X_{i}\right) ^ {2}}{\left(\sum_{i = 1} ^ {n} X_{i} ^ {\beta}\right) ^ {2}}\tag{14}

Equation (14) can be derived from Equation (11) by differentiating f(β)f ( \beta ) with respect to β.\beta .. The iterative process continues until f(β^j)≐0f ( \widehat {\beta} _ {j} ) \doteq 0, that is, unti $| f ( \widehat {\beta} _ {j} ) | \leq 0 . 001 $ Consider the data given in Example 6. These data concern the failure of electronic components and look to come from an exponential distribution. In Example 10, the parameter λ^\widehat {\lambda} was estimated on the hypothesis that the data were from an exponential distribution. If this hypothesis is rejected, an alternative hypothesis is that the data come from a Weibull distribution. The Weibull distribution is suspected because the data pertain to electronic component failures, which occur suddenly.

Equation (13) is used to compute β^0\widehat {\beta} _ {0}. For the data in Example 6,n=50,Xˉ=11.894,Xˉ2=6 , n = 50 , \bar {X} = 11 . 894 , \bar {X} ^ {2} =141.467141 . 467, and ∑i=150Xi2=37,575.850;\begin{array} {r} {\sum_{i = 1} ^ {50} X_{i} ^ {2} = 37 , 575 . 850 ;} \end{array}; so S2S^{2} is found by Equation (2) to be

S2=37,578.850−50(141.467)49=622.650 S^{2} = \frac {37 , 578 . 850 - 50 (141 . 467)}{49} = 622. 650

and S=24.953S = 24 . 953. Thus,

β^0=11.89424.953=0.477 \widehat {\beta} _ {0} = \frac {11 . 894}{24 . 953} = 0. 477

To compute β^1{\widehat {\beta}} _ {1} by using Equation (12) requires the calculation of f(β0^)andf′(β0^)f ( \widehat {\beta_{0}} ) \mathrm{a n d} f^{\prime} ( \widehat {\beta_{0}} ) from Equations (11) and (14). The following additional values are needed:∑i=150Xiβ0^=115.125,∑i=150ln⁡Xi=38.294\textstyle \sum_{i = 1} ^ {50} X_{i} ^ {\widehat {\beta_{0}}} = 115 . 125 , \textstyle \sum_{i = 1} ^ {50} \ln X_{i} = 38 . 294∑i=150Xiβ0^ln⁡Xi=292.629\begin{array} {r} {\sum_{i = 1} ^ {50} X_{i} ^ {\widehat {\beta_{0}}} \ln X_{i} = 292 . 629} \end{array}, and ∑i=150Xiβ0^(ln⁡Xi)2=1057.781\textstyle \sum_{i = 1} ^ {50} X_{i} ^ {\widehat {\beta_{0}}} ( \ln X_{i} ) ^ {2} = 1057 . 781. Thus,

f(β0^)=500.477+38.294−50(292.629)115.125=16.024 f (\widehat {\beta_{0}}) = \frac {50}{0 . 477} + 38. 294 - \frac {50 (292 . 629)}{115 . 125} = 16. 024

and

f′(β0^)=−50(0.477)2−50(1057.781)115.125+50(292.629)2(115.125)2=−356.110 f^{\prime} \left(\widehat {\beta_{0}}\right) = \frac {- 50}{(0 . 477) ^ {2}} - \frac {50 (1057 . 781)}{115 . 125} + \frac {50 (292 . 629) ^ {2}}{(115 . 125) ^ {2}} = - 356. 110

Then, by Equation (12),

β^1=0.477−16.024−356.110=0.522 \widehat {\beta} _ {1} = 0. 477 - \frac {16 . 024}{- 356 . 110} = 0. 522

After four iterations,$| f ( \widehat {\beta} _ {3} ) | \le 0 . 001 $, at which point β^≐β^4=0.525\widehat {\beta} \doteq \widehat {\beta} _ {4} = 0 . 525, is the approximate   solution to Equation (9). Table 4 contains the values needed to complete each iteration.

Now,α^\widehat {\alpha} can be computed from Equation (10) with β=β^=0.525\beta = \widehat {\beta} = 0 . 525, as follows:

α^=[130.60850]1/0.525=6.227 \widehat {\alpha} = \left[ \frac {130 . 608}{50} \right] ^ {1 / 0. 525} = 6. 227

Table 4 Iterative Estimation of Parameters of the Weibull Distribution

jβ^j\widehat{\beta}_{j}∑i=150Xiβ^j\sum_{i=1}^{50} X_{i}^{\widehat{\beta}_{j}}∑i=150Xiβ^jln⁡Xi\sum_{i=1}^{50} X_{i}^{\widehat{\beta}_{j}} \ln X_{i}∑i=150Xiβ^j(ln⁡Xi)2\sum_{i=1}^{50} X_{i}^{\widehat{\beta}_{j}} (\ln X_{i})^{2}f(β^j)f(\widehat{\beta}_{j})f′(β^j)f'(\widehat{\beta}_{j})β^j+1\widehat{\beta}_{j+1}
00.477115.125292.6291057.78116.024-356.1100.522
10.522129.489344.7131254.1111.008-313.5400.525
20.525130.603348.7691269.5470.004-310.8530.525
30.525130.608348.7861269.6140.000-310.8410.525

If β^0{\widehat {\beta}} _ {0} is sufficiently close to β^,{\widehat {\beta}} , the procedure converges quickly, usually in four to five iterations.  However, if the procedure appears to be diverging, try other initial guesses for β^0;{\widehat {\beta}} _ {0} ; for example, one-half the initial estimate or twice the initial estimate.

The difficult task of estimating parameters for the Weibull distribution by hand emphasizes the value of having software support for input modeling.

Example 12: Poisson Distribution

Assume that the arrival data in Table 1 require analysis. An examination of Figure 4 suggests a Poisson distribution assumption with unknown parameter α. From Table 3, the estimator of α is Xˉ,{\bar {X}} , which was found in Example 8. Thus,α^=3.64\widehat {\alpha} = 3 . 64. Recall that the true mean and variance are equal for the Poisson distribution. In Example 8, the sample variance was estimated as S2=7.63S^{2} = 7 . 63. However, it should never be expected that the sample mean and the sample variance will be precisely equal, because each is a random variable.

Example 13: Lognormal Distribution

The rates of return on 10 investments in a portfolio are 18.8, 27.9, 21.0, 6.1, 37.4, 5.0, 22.9, 1.0, 3.1, and 8.3 percent. To estimate the parameters of a lognormal model of these data, we first take the natural log of the data and obtain 2.9, 3.3, 3.0, 1.8, 3.6, 1.6, 3.1, 0, 1.1, and 2.1. Then we set μ^=Xˉ=2.3\widehat {\mu} = \bar {X} = 2 . 3 and σ^2=S2=1.3\widehat {\sigma} ^ {2} = S^{2} = 1 . 3

Example 14: Normal Distribution

The parameters of the normal distribution,μ\mu and σ2\sigma^{2}, are estimated by X¯ and S2S^{2}, as shown in Table 3. The q−qq {-} q plot in Example 7 leads to a distributional assumption that the installation times are normal. From Equations (1) and (2), the data in Example 7 yield μ^=Xˉ=99.9865\widehat {\mu} = \bar {X} = 99 . 9865 and σ^2=S2=(0.2832)2\widehat {\sigma} ^ {2} = S^{2} = ( 0 . 2832 ) ^ {2} seconds^2.

Example 15: Gamma Distribution

The estimator β^\widehat {\beta} for the gamma distribution is chosen by referring to Table A.9. Table A.9 requires the computation of the quantity 1/M1 / M, where

M=ln⁡Xˉ−1n∑i=1nln⁡Xi(15) M = \ln {\bar {X}} - \frac {1}{n} \sum_{i = 1} ^ {n} \ln X_{i}\tag{15}

Also, it can be seen in Table 3 that θ^\widehat {\theta} is given by

θ^=1Xˉ(16) \widehat {\theta} = \frac {1}{\bar {X}}\tag{16}

Lead time is often gamma-distributed. Suppose that the lead times (in days) associated with 20 orders have been accurately measured as follows:

OrderLead Time (days)OrderLead Time (days)
170.2921130.215
210.1071217.137
348.3861344.024
420.4801410.552
513.0531537.298
625.2921616.314
714.7131728.073
839.1661839.019
917.4211932.330
1013.9052036.547

To estimate β^\widehat {\beta} and θ^,{\widehat {\theta}} , it is first necessary to compute M from Equation (15). Here,Xˉ\bar {X} is found, from Equation (1), to be

Xˉ=564.3220=28.22 \bar {X} = \frac {564 . 32}{20} = 28. 22

Then

ln⁡Xˉ=3.34 \ln \bar {X} = 3. 34

Next

∑i=120ln⁡Xi=63.99 \sum_{i = 1} ^ {20} \ln X_{i} = 63. 99

Then

M=3.34−63.9920=0.14 M = 3. 34 - \frac {63 . 99}{20} = 0. 14

and

1/M=7.14 1 / M = 7. 14

By interpolation in Table A.9 in the Appendix,β^=3.728.{\widehat {\beta}} = 3 . 728 .. Finally, Equation (16) results in

θ^=128.22=0.035 \widehat {\theta} = \frac {1}{28 . 22} = 0. 035

Example 16: Beta Distribution

The percentage of customers each month who bring in store coupons must be between 0 and 100 percent. Observations at a store for eight months gave the values 25%, 74%, 20%, 32%, 81%, 47%, 31%, and 8%. To fit a beta distribution to these data, we first need to rescale it to the interval [0, 1] by dividing all the values by 100, which yields 0.25, 0.74, 0.20, 0.32, 0.81, 0.47, 0.31, 0.08.

The maximum-likelihood estimators of the parameters β1,β2\beta_{1} , \beta_{2} solve the system of equations shown in Table 9.3. Such equations can be solved by modern symbolic/numerical calculation programs, such as Maple; a Maple procedure for the beta parameters is shown in Figure 7. In this case, the solutions are β^1=1.47\widehat {\beta} _ {1} = 1 . 47 and β^2=2.16\widehat {\beta} _ {2} = 2 . 16```txt betaMLE := proc(X, n) local G1, G2, beta1, beta2, eqns, solns; G1 := product(X[i], i=1..n)^(1/n); G2 := product(1-X[i], i=1..n)^(1/n); eqns := {Psi(beta1) - Psi(beta1 + beta2) = ln(G1), Psi(beta2) - Psi(beta1 + beta2) = ln(G2)}; solns := fsolve(eqns, {beta1=0..infinity, beta2=0..infinity}); RETURN(solns); end;

Figure 7 Maple procedure to compute the maximum likelihood estimates for the beta distri bution parameters.

## 4 Goodness-of-Fit Tests

In this section, the Kolmogorov–Smirnov test and the chi-square test are applied to hypotheses abou distributional forms of input data.


Goodness-of-fit tests provide helpful guidance for evaluating the suitability of a potential inpu model; however, there is no single correct distribution in a real application, so you should not be a slave to the verdict of such a test. It is especially important to understand the effect of sample size. If very little data are available, then a goodness-of-fit test is unlikely to reject any candidate distribution; but if a lot of data are available, then a goodness-of-fit test will likely reject all candidate distributions. Therefore, failing to reject a candidate distribution should be taken as one piece of evidence in favor of that choice, and rejecting an input model as only one piece of evidence against the choice.

### 4.1 Chi-Square Test

One procedure for testing the hypothesis that a random sample of size n of the random variable X follows a specific distributional form is the chi-square goodness-of-fit test. This test formalizes the intuitive idea of comparing the histogram of the data to the shape of the candidate density or mass function. The test is valid for large sample sizes and for both discrete and continuous distributiona assumptions, when parameters are estimated by maximum likelihood. The test procedure begins by arranging the n observations into a set of k class intervals or cells. The test statistic is given by 

$$
\chi_{0} ^ {2} = \sum_{i = 1} ^ {k} \frac {(O_{i} - E_{i}) ^ {2}}{E_{i}}\tag{17}
$$

 where \(O_{i}\) is the observed frequency in the ith class interval and \(E_{i}\) is the expected frequency in that class interval. The expected frequency for each class interval is computed as \(E_{i} = n p_{i}\), where \(p_{i}\) is the theoretical, hypothesized probability associated with the ith class interval.

It can be shown that \(\chi_{0} ^ {2}\) approximately follows the chi-square distribution with \(k - s - 1\) degrees of freedom, where s represents the number of parameters of the hypothesized distribution estimated by the sample statistics. The hypotheses are the following:\(H_{0} {\mathrm{:}}\) The random variable, X, conforms to the distributional assumption with the parameter(s) given by the parameter estimate(s).\(H_{1} {\mathrm{:}}\): The random variable X does not conform

The critical value \(\chi_{\alpha , k - s - 1} ^ {2}\) is found in Table A.6. The null hypothesis \(H_{0}\) is rejected if \(\chi_{0} ^ {2} > \chi_{\alpha , k - s - 1} ^ {2} .\) When applying the test, if expected frequencies are too small,\(\chi_{0} ^ {2}\) will reflect not only the departure of the observed from the expected frequency, but also the smallness of the expected frequency as well. Although there is no general agreement regarding the minimum size of \(E_{i} ,\) values of \(3 , 4 .\), and 5 have been widely used. If an \(E_{i}\) value is too small, it can be combined with expected frequencies in adjacent class intervals. The corresponding \(O_{i}\) values should also be combined, and k should be reduced by 1 for each cell that is combined.

If the distribution being tested is discrete, each value of the random variable should be a class interval, unless it is necessary to combine adjacent class intervals to meet the minimum-expected cell-frequency requirement. For the discrete case, if combining adjacent cells is not required,

$$
p_{i} = p (x_{i}) = P (X = x_{i})
$$

 Otherwise,\(p_{i}\) is found by summing the probabilities of appropriate adjacent cells.

Table 5 Recommendations for Number of Class Intervals for Continuous Data

| Sample Size n | Number of Class Intervals k |
| --- | --- |
| 20 | Do not use the chi-square test |
| 50 | 5 to 10 |
| 100 | 10 to 20 |
| >100 |\(\sqrt{n}\) to \(n/5\)|

If the distribution being tested is continuous, the class intervals are given by \([ a_{i - 1} , a_{i} )\), where \(a_{i - 1}\) and \(a_{i}\) are the endpoints of the ith class interval. For the continuous case with assumed pdff(x), or assumed cdf \(F ( x ) , p_{i}\) can be computed as 

$$
p_{i} = \int_ {a_{i - 1}} ^ {a_{i}} f (x) d x = F (a_{i}) - F (a_{i - 1})
$$

 For the discrete case, the number of class intervals is determined by the number of cells resulting after combining adjacent cells as necessary. However, for the continuous case, the number of class intervals must be specified. Although there are no general rules to be followed, the recommendations in Table 5 are made to aid in determining the number of class intervals for continuous data.

### Example 17: Chi-Square Test Applied to Poisson Assumption

In Example 12, the vehicle-arrival data presented in Example 5 were analyzed. The histogram of the data, shown in Figure \(^ {4 ,}\) appeared to follow a Poisson distribution; hence the parameter \(\widehat {\alpha} = 3 .\).64 was found. Thus, the following hypotheses are formed:\(H_{0} {\mathrm{:}}\) The random variable is Poisson distributed.\(H_{1}\): The random variable is not Poisson distributed.

The pmf for the Poisson distribution:

$$
p (x) = \left\{\begin{array}{l l} \frac {e^{- \alpha} \alpha^{x}}{x !}, & x = 0, 1, \ldots \\ 0, & \text{otherwise} \end{array} \right.\tag{18}
$$

 For \(\widehat {\alpha} = 3 . 64\), the probabilities associated with various values of x are obtained from Equation (18):

$$
\begin{array}{l l} \mathrm{p(0)=0.026} & \mathrm{p(6)=0.085} \\ \mathrm{p(1)=0.096} & \mathrm{p(7)=0.044} \\ \mathrm{p(2)=0.174} & \mathrm{p(8)=0.020} \\ \mathrm{p(3)=0.211} & \mathrm{p(9)=0.008} \\ \mathrm{p(4)=0.192} & \mathrm{p(10)=0.003} \\ \mathrm{p(5)=0.140} & \mathrm{p(\geq 11) = 0.001} \end{array}
$$

 Table 6 Chi-Square Goodness-of-Fit Test for Example 17

|\(x_i\)| Observed Frequency \(O_i\)| Expected Frequency \(E_i\)|\((O_i - E_i)^2\)\(E_i\)|  |
| --- | --- | --- | --- | --- |
| 0 | 12 | 22 | 2.6 | 7.87 |
| 1 | 10 | 9.6 |  |  |
| 2 | 19 | 17.4 | 0.15 |  |
| 3 | 17 | 21.1 | 0.80 |  |
| 4 | 10 | 19.2 | 4.41 |  |
| 5 | 8 | 14.0 | 2.57 |  |
| 6 | 7 | 8.5 | 0.26 |  |
| 7 | 5 | 17 | 4.4 | 11.62 |
| 8 | 5 | 2.0 |  |  |
| 9 | 3 | 0.8 |  |  |
| 10 | 3 | 0.3 |  |  |
| ≥11 | 1 | 0.1 |  |  |
|  | 100 | 100.0 | 27.68 |  |

From this information, Table 6 is constructed. The value of \(E_{1}\) is given by \(n p_{0} = 100 ( 0 . 026 ) =\)2.6. In a similar manner, the remaining \(E_{i}\) values are computed. Since \(E_{1} = 2 . 6 < 5 , E_{1}\) and \(E_{2}\) are combined. In that case,\(O_{1}\) and \(O_{2}\) are also combined, and k is reduced by one. The last five class intervals are also combined, for the same reason, and k is further reduced by four.

The calculated \(\chi_{0} ^ {2}\) is 27.68. The degrees of freedom for the tabulated value of \(\chi^{2}\) is \(k - s - 1 =\)\(7 - 1 - 1 = 5\). Here,\(s = 1\), since one parameter,\({\widehat {\alpha}} ,\), was estimated from the data. At the 0.05 level of significance, the critical value \(\chi_{0 . 05 , 5} ^ {2}\)is 11.1. Thus,\(H_{0}\) would be rejected at level of significance \(0 . 05\). The analyst, therefore, might want to search for a better-fitting model or use the empirical distribution of the data.

### 4.2 Chi-Square Test with Equal Probabilities

If a continuous distributional assumption is being tested, class intervals that are equal in probability rather than equal in width of interval should be used. This has been recommended by a number of authors [Mann and Wald, 1942; Gumbel, 1943; Law, 2007; Stuart, Ord, and Arnold, 1998]. It should be noted that the procedure is not applicable to data collected in class intervals, where the raw data have been discarded or lost.

Unfortunately, there is no easy method for figuring out the probability associated with each interval that would maximize the power for a test of a given size. (The power of a test is defined as the probability of rejecting a false hypothesis.) However, if using equal probabilities, then \(p_{i} = 1 / k\) We recommend 

$$
E_{i} = n p_{i} \geq 5
$$


so, substituting for \(p_{i}\) yields 

$$
\frac {n}{k} \geq 5
$$

 and solving for k yield 

$$
k \leq \frac {n}{5}\tag{19}
$$

 Equation (19) was used in coming up with the recommendations for maximum number of class intervals in Table 5.

If the assumed distribution is normal, exponential, or Weibull, the method described in this section is straightforward. Example 18 indicates how the procedure is accomplished for the exponential distribution. If the assumed distribution is gamma (but not Erlang) or certain other distributions, then the computation of endpoints for class intervals is complex and could require numerica integration of the density function. Statistical-analysis software is very helpful in such cases.

### Example 18: Chi-Square Test for Exponential Distribution

In Example 10, the failure data presented in Example 6 were analyzed. The histogram of the data, shown in Figure 5, appeared to follow an exponential distribution, so the parameter \(\widehat {\lambda} = 1 / \bar {X} = 0 . 084\) was computed. Thus, the following hypotheses are formed:\(H_{0} {\mathrm{:}}\) The random variable is exponentially distributed.\(H_{1} ;\): The random variable is not exponentially distributed.

In order to perform the chi-square test with intervals of equal probability, the endpoints of the class intervals must be found. Equation (19) indicates that the number of intervals should be less than or equal to \(n / 5 .\). Here,\(n = 50\), and so \(k \leq 10\). In Table 5, it is recommended that 5 to 10 class intervals be used. Let \(k = 8 ;\) then each interval will have probability \(p = 0 . 125\). The endpoints for each interval are computed from the cdf for the exponential distribution, as follows:

$$
F (a_{i}) = 1 - e ^ {- \lambda a_{i}}\tag{20}
$$

 where \(a_{i}\) represents the endpoint of the ith interval,\(i = 1 , 2 , \ldots , k\). Since \(F ( a_{i} )\) is the cumulative area from zero to \(a_{i} , F ( a_{i} ) = i p\), so Equation (20) can be written as 

$$
i p = 1 - e ^ {- \lambda a_{i}}
$$

 or 

$$
e ^ {- \lambda a_{i}} = 1 - i p
$$

 Taking the logarithm of both sides and solving for \(a_{i}\) gives a general result for the endpoints of k equiprobable intervals for the exponential distribution:

$$
a_{i} = - \frac {1}{\lambda} \ln (1 - i p), \quad i = 0, 1, \dots , k\tag{21}
$$

 Table 7 Chi-Square Goodness-of-Fit Test for Example 18

| Class Interval | Observed Frequency \(O_i\)| Expected Frequency \(E_i\)|\((O_i - E_i)^2\)\(E_i\)|
| --- | --- | --- | --- |
| [0, 1.590) | 19 | 6.25 | 26.01 |
| [1.590, 3.425) | 10 | 6.25 | 2.25 |
| [3.425, 5.595) | 3 | 6.25 | 0.81 |
| [5.595, 8.252) | 6 | 6.25 | 0.01 |
| [8.252, 11.677) | 1 | 6.25 | 4.41 |
| [11.677, 16.503) | 1 | 6.25 | 4.41 |
| [16.503, 24.755) | 4 | 6.25 | 0.81 |
| [24.755,∞) | 6 | 6.25 | 0.01 |
|  | 50 | 50 | 39.6 |

Regardless of the value of \(\lambda ,\) Equation (21) will always result in \(a_{0} = 0\) and \(a_{k} = \infty\). With \(\widehat {\lambda} = 0 . 084\) and \(k = 8 , a_{1}\) is computed from Equation (21) as 

$$
a_{1} = - \frac {1}{0 . 084} \ln (1 - 0. 125) = 1. 590
$$

 Continued application of Equation (21) for \(i = 2 , 3 , \dots , 7\) results in \(a_{2} , \ldots , a_{7}\) as 3.425, 5.595, 8.252, 11.677, 16.503, and 24.755. Since \(k = 8 , a_{8} = \infty\). The first interval is [0, 1.590), the second interval is [1.590, 3.425), and so on. The expectation is that 0.125 of the observations will fall in each interval. The observations, the expectations, and the contributions to the calculated value of \(\chi_{0} ^ {2}\) are shown in Table 7. The calculated value of \(\chi_{0} ^ {2}\) is 39.6. The degrees of freedom are given by \(k - s - 1 = 8 - 1 - 1 = 6 . \mathrm{A t} \alpha = 0 . 05\), the tabulated value of \(\chi_{0 . 05 , 6} ^ {2}\) is 12.6. Since \(\chi_{0} ^ {2} > \chi_{0 . 05 , 6} ^ {2} ,\) the null hypothesis is rejected. (The value of \(\chi_{0 . 01 , 6} ^ {2}\) is 16.8, so the null hypothesis would also be rejected at level of significance \(\alpha = 0 . 01 . )\)
### 4.3 Kolmogorov--Smirnov Goodness-of-Fit Test

The chi-square goodness-of-fit test can accommodate the estimation of parameters from the data with a resultant decrease in the degrees of freedom (one for each parameter estimated). The chisquare test requires that the data be placed in class intervals; in the case of a continuous distributiona assumption, this grouping is arbitrary. Changing the number of classes and the interval width affects the value of the calculated and tabulated chi-square. A hypothesis could be accepted when the data are grouped one way, but rejected when they are grouped another way. Also, the distribution of the chi-square test statistic is known only approximately, and the power of the test is sometimes rather low. As a result of these considerations, goodness-of-fit tests other than the chi-square, are desired. The Kolmogorov–Smirnov test formalizes the idea behind examining a q-q plot.


The Kolmogorov–Smirnov test can be presented to test for the uniformity of numbers. Both of these uses fall into the category of testing for goodness of fit. Any continuous distributiona assumption can be tested for goodness of fit.

The Kolmogorov–Smirnov test is particularly useful when sample sizes are small and when no parameters have been estimated from the data. When parameter estimates have been made, the critica values in Table A.8 are biased; in particular, they are too conservative. In this context, “conservative” means that the critical values will be too large, resulting in smaller Type I (α) errors than those specified. The exact value of α can be worked out in some instances, as is discussed at the end of this section.

The Kolmogorov–Smirnov test does not take any special tables when an exponential distribution is assumed. The following example indicates how the test is applied in this instance. (Notice that it is not necessary to estimate the parameter of the distribution in this example, so we may use Table A.8.)

Example 19: Kolmogorov–Smirnov Test for Exponential Distribution
Suppose that 50 interarrival times (in minutes) are collected over a 100-minute interval (arranged in order of occurrence):

| 0.44 | 0.53 | 2.04 | 2.74 | 2.00 | 0.30 | 2.54 | 0.52 | 2.02 | 1.89 | 1.53 | 0.21 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 2.80 | 0.04 | 1.35 | 8.32 | 2.34 | 1.95 | 0.10 | 1.42 | 0.46 | 0.07 | 1.09 | 0.76 |
| 5.55 | 3.93 | 1.07 | 2.26 | 2.88 | 0.67 | 1.12 | 0.26 | 4.57 | 5.37 | 0.12 | 3.19 |
| 1.63 | 1.46 | 1.08 | 2.06 | 0.85 | 0.83 | 2.44 | 1.02 | 2.24 | 2.11 | 3.15 | 2.90 |
| 6.58 | 0.64 |  |  |  |  |  |  |  |  |  |  |

The null hypothesis and its alternate are formed as follows:\(H_{0} {\mathrm{:}}\) The interarrival times are exponentially distributed.\(H_{1}\): The interarrival times are not exponentially distributed.

The data were collected over the interval from 0 to \(T = 100\) minutes. It can be shown that, if the underlying distribution of interarrival times \(\{T_{1} , T_{2} , \dots \}\) is exponential, the arrival times are uniformly distributed on the interval [0, T]. The arrival times \(T_{1} , T_{1} + T_{2} , T_{1} + T_{2} + T_{3} , . . . ,\)\(T_{1} + \cdots + T_{50}\) are obtained by adding interarrival times. The arrival times are then normalized to a [0, 1] interval so that the Kolmogorov–Smirnov test can be applied. On a [0, 1] interval, the points will be \([ T_{1} / T , ( T_{1} + T_{2} ) / T , \dots , ( T_{1} + \cdot \cdot \cdot + T_{50} ) / T ]\). The resulting 50 data points are as follows:

| 0.0044 | 0.0097 | 0.0301 | 0.0575 | 0.0775 | 0.0805 | 0.1059 | 0.1111 | 0.1313 | 0.1502 |
| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
| 0.1655 | 0.1676 | 0.1956 | 0.1960 | 0.2095 | 0.2927 | 0.3161 | 0.3356 | 0.3366 | 0.3508 |
| 0.3553 | 0.3561 | 0.3670 | 0.3746 | 0.4300 | 0.4694 | 0.4796 | 0.5027 | 0.5315 | 0.5382 |
| 0.5494 | 0.5520 | 0.5977 | 0.6514 | 0.6526 | 0.6845 | 0.7008 | 0.7154 | 0.7262 | 0.7468 |
| 0.7553 | 0.7636 | 0.7880 | 0.7982 | 0.8206 | 0.8417 | 0.8732 | 0.9022 | 0.9680 | 0.9744 |

Following the procedure produces a \(D^{+}\) of 0.1054 and a \(D^{-}\) of 0.0080. Therefore, the Kolmogorov–Smirnov statistic is \(D \ = \ \operatorname* {m a x} ( 0 . 1054 , 0 . 0080 ) \ = \ 0 . 1054\). The critical value


of D obtained from Table A.8 for a level of significance of \(\alpha \ : = \ : 0 . 05\) and \(n = 50\) is \(D_{0 . 05} \ =\)\(1 . 36 / \sqrt {n} = 0 . 1923\); however,\(D = 0 . 1054\), so the hypothesis that the interarrival times are exponentially distributed cannot be rejected.

The Kolmogorov–Smirnov test has been modified so that it can be used in several situations where the parameters are estimated from the data. The computation of the test statistic is the same, bu different tables of critical values are used. Different tables of critical values are required for different distributional assumptions. Lilliefors [1967] developed a test for normality. The null hypothesis states that the population is one of the family of normal distributions, without specifying the parameters of the distribution. The interested reader might wish to study Lilliefors’ original work; he describes how simulation was used to develop the critical values.

Lilliefors [1969] also modified the critical values of the Kolmogorov–Smirnov test for the exponential distribution. Lilliefors again used random sampling to obtain approximate critical values, but Durbin [1975] subsequently obtained the exact distribution. Connover [1998] gives examples o Kolmogorov–Smirnov tests for the normal and exponential distributions. He also refers to severa other Kolmogorov–Smirnov-type tests that might be of interest to the reader.

A test that is similar in spirit to the Kolmogorov–Smirnov test is the Anderson-Darling test. Like the Kolmogorov–Smirnov test, the Anderson-Darling test is based on the difference between the empirical cdf and the fitted cdf; unlike the Kolmogorov–Smirnov test, the Anderson-Darling test is based on a more comprehensive measure of difference (not just the maximum difference) and is more sensitive to discrepancies in the tails of the distributions. The critical values for the Anderson-Darling test also depend on the candidate distribution and on whether parameters have been estimated. Fortunately, this test and the Kolmogorov–Smirnov test have been implemented in a number of software packages that support simulation-input modeling.

### 4.4 p-Values and ‘‘Best Fits’’

To apply a goodness-of-fit test, a significance level must be chosen. Recall that the significance level is the probability of falsely rejecting \(H_{0} {\mathrm{:}}\): The random variable conforms to the distributiona assumption. The traditional significance levels are 0.1, 0.05, and 0.01. Prior to the availability o high-speed computing, having a small set of standard values made it possible to produce tables of useful critical values. Now, most statistical software computes critical values as needed, rather than storing them in tables. Thus, the analyst can employ a different level of significance, say, 0.07.

However, rather than require a prespecified significance level, many software packages compute a \(p \mathrm{.}\)-value for the test statistic. The \(p \mathrm{-}\)-value is the significance level at which one would just reject \(H_{0}\) for the given value of the test statistic. Therefore, a large p-value tends to indicate a good fit (we would have to accept a large chance of error in order to reject), while a small p-value suggests a poor fit (to accept we would have to insist on almost no risk).

Recall Example 17, in which a chi-square test was used to check the Poisson assumption for the vehicle-arrival data. The value of the test statistic was \(\chi_{0} ^ {2} = 27 . 68\), with 5 degrees of freedom. The \(p \mathrm{-}\) value for this test statistic is 0.00004, meaning that we would reject the hypothesis that the data are Poisson at the 0.00004 significance level. (Recall that we rejected the hypothesis at the 0.05 level; now we know that we would also have to reject it at even lower levels.)

The p-value can be viewed as a measure of fit, with larger values being better. This suggests tha we could fit every distribution at our disposal, compute a test statistic for each fit, and then choose the distribution that yields the largest p-value. We know of no input modeling software that implements this specific algorithm, but many such packages do include a “best fit” option, in which the software recommends an input model to the user after evaluating all feasible models. The software might also take into account other factors—such as whether the data are discrete or continuous, bounded or unbounded—but, in the end, some summary measure of fit, like the p-value, is used to rank the distributions. There is nothing wrong with this, but there are several things to keep in mind:

1. The software might know nothing about the physical basis of the data, whereas that information can suggest distribution families that are appropriate. (See the list in Section 2.2.) Remember that the goal of input modeling is often to fill in gaps or smooth the data, rather than to find an input model that conforms as closely as possible to the given sample.

2. Recall that both the Erlang and the exponential distributions are special cases of the gamma and that the exponential is also a special case of the more flexible Weibull. Automated best-fit procedures tend to choose the more flexible distributions (gamma and Weibull over Erlang and exponential) because the extra flexibility allows closer conformance to the data and a better summary measure of fit. But again, close conformance to the data does not always lead to the most appropriate input model.

3. A summary statistic, like the p-value, is just that, a summary measure. It says little or nothing about where the lack of fit occurs (in the body of the distribution, in the right tail, or in the left tail). A human, using graphical tools, can see where the lack of fit occurs and decide whether or not it is important for the application at hand.

Our recommendation is that automated distribution selection be used as one of several ways to suggest candidate distributions. Always inspect the automatic selection, using graphical methods, and remember that the final choice is yours.

## 5 Fitting a Nonstationary Poisson Process

Fitting a nonstationary Poisson process (NSPP) to arrival data is a difficult problem, in general, because we seldom have knowledge about the appropriate form of the arrival rate function λ(t). One approach is to choose a very flexible model with lots of parameters and fit it with a method such as maximum likelihood; see Johnson, Lee, and Wilson [1994] for an example of this approach. A second method, and the one we consider here, is to approximate the arrival rate as being constant over some basic interval of time, such as an hour, or a day, or a month, but varying from time interval to time interval. The problem then becomes choosing the basic time interval and estimating the arriva rate within each interval.

Suppose we need to model arrivals over a time period, say [0, T]. The approach that we describe is most appropriate when it is possible to observe the time period [0, T] repeatedly and count arrivals. For instance, if the problem involves modeling the arrival of e-mail throughout the business day (8 A.M. to 6 P.M.), and we believe that the arrival rate is approximately constant over half-hour intervals, then we need to be able to count arrivals during half-hour intervals for several days. If it is possible to record actual arrival times, rather than counts, then actual arrival times are clearly better since they can later be grouped into any interval lengths we desire. However, we will assume from here on that only counts are available.

Table 8 Monday E-mail Arrival Data for NSPP Example

| Time Period | Number of Arrivals | Estimated Arrival Rate (arrivals/hour) |  |  |
| --- | --- | --- | --- | --- |
| Day 1 | Day 2 | Day 3 |  |  |
| 8:00–8:30 | 12 | 14 | 10 | 24 |
| 8:30–9:00 | 23 | 26 | 32 | 54 |
| 9:00–9:30 | 27 | 19 | 32 | 52 |
| 9:30–10:00 | 20 | 13 | 12 | 30 |

Divide the time period [0, T] into k equal intervals of length \(\Delta t = T / k\). For instance, if we are considering a 10-hour business day from 8 A.M. to 6 P.M. and if we allow the rate to change every half hour, then \(T = 10 , k = 20\), and \(\Delta t = 1 / 2\). Over n periods of observation (e.g., n days), let \(C_{i j}\) be the number of arrivals that occurred during the ith time interval on the jth period of observation. In our example,\(C_{23}\) would be the number of arrivals from 8:30 A.M. to 9 A.M. (second half-hour period) on the third day of observation.

The estimated arrival rate during the ith time period,\(( i - 1 ) \Delta t < t \leq i \Delta t .\), is then just the average number of arrivals scaled by the length of the time interval:

$$
\widehat {\lambda} (t) = \frac {1}{n \Delta t} \sum_{j = 1} ^ {n} C_{i j}\tag{22}
$$

 After the arrival rates for each time interval have been estimated, adjacent intervals whose rates appear to be the same can be combined.

For instance, consider the e-mail arrival counts during the first two hours of the business day on three Mondays, shown in Table 8. The estimated arrival rate for 8:30–9:00 is 

$$
\frac {1}{3 (1 / 2)} (23 + 26 + 32) = 54 \text{arrivals / hour}
$$

 After seeing these results, we might consider combining the interval 8:30–9:00 with the interva 9:00–9:30, because the rates are so similar. Note also that the goodness-of-fit tests described in the previous section can be applied to the data from each time interval individually, to check the Poisson approximation.

## 6 Selecting Input Models without Data

Unfortunately, it is often necessary in practice to develop a simulation model—perhaps for demonstration purposes or a preliminary study—before any process data are available. In this case, the modeler must be resourceful in choosing input models and must carefully check the sensitivity of results to the chosen models.


There are a number of ways to obtain information about a process even if data are not available:

Engineering data: Often a product or process has performance ratings provided by the manufacturer (for example, the mean time to failure of a disk drive is 10,000 hours; a laser printer can produce 8 pages/minute; the cutting speed of a tool is 1 cm/second; etc.). Company rules might specify time or production standards. These values provide a starting point for input modeling by fixing a central value.

Expert option: Talk to people who are experienced with the process or similar processes. Often, they can provide optimistic, pessimistic, and most-likely times. They might also be able to say whether the process is nearly constant or highly variable, and they might be able to define the source of variability.

Physical or conventional limitations: Most real processes have physical limits on performance; for example, computer data entry cannot be faster than a person can type. Because of company policies, there could be upper limits on how long a process may take. Do not ignore obvious limits or bounds that narrow the range of the input process.

The nature of the process: The descriptions of the distributions in Section 2.2 can be used tojustify a particular choice even when no data are available.

When data are not available, the uniform, triangular, and beta distributions are often used as input models. The uniform can be a poor choice, because the upper and lower bounds are rarely jus as likely as the central values in real processes. If, in addition to upper and lower bounds, a mostlikely value can be given, then the triangular distribution can be used. The triangular distribution places much of its probability near the most-likely value, and much less near the extremes. If a beta distribution is used, then be sure to plot the density function of the selected distribution; the beta can take unusual shapes.

A useful refinement is obtained when a minimum, a maximum, and one or more “breakpoints” can be given. A breakpoint is an intermediate value together with a probability of being less than or equal to that value. The following example illustrates how breakpoints are used.

### Example 20

For a production-planning simulation, the sales volume of various products is required. The salesperson responsible for product XYZ-123 says that no fewer than 1000 units will be sold (because of existing contracts) and no more than 5000 units will be sold (because that is the entire market for the product). Given her experience, she believes that there is a 90% chance of selling more than 2000 units, a 25% chance of selling more than 3500 units, and only a 1% chance of selling more than 4500 units.

Table 9 summarizes this information. Notice that the chances of exceeding certain sales goals have been translated into the cumulative probability of being less than or equal to those goals.

Table 9 Summary of Sales Information

| i | Interval (sales) | Cumulative Frequency \(c_i\)|
| --- | --- | --- |
| 1 |\(1000 \le x \le 2000\)| 0.10 |
| 2 |\(2000 < x \le 3500\)| 0.75 |
| 3 |\(3500 < x \le 4500\)| 0.99 |
| 4 |\(4500 < x \le 5000\)| 1.00 |

When input models have been selected without data, it is especially important to test the sensitivity of simulation results to the distribution chosen. Check sensitivity not only to the center of the distribution but also to the variability or limits. Extreme sensitivity of output results to the input model provides a convincing argument against making critical decisions based on the results and in favor of undertaking data collection

## 7 Multivariate and Time-Series Input Models

In Sections 1–4, the input random variables were considered to be independent of any other variables within the context of the problem. When this is not the case it is critical that input models be used that account for dependence; otherwise, a highly inaccurate simulation may result.

### Example 21

A supply-chain simulation includes the lead time and annual demand for industrial robots.An increase in demand results in an increase in lead time: The final assembly of the robots must be made according to the specifications ofthe purchaser. Therefore, rather than treat lead time and demand as independen random variables, a multivariate input model should be developed.

### Example 22

A simulation of the web-based trading site of a stock broker includes the time between arrivals of orders to buy and sell. Investors tend to react to what other investors are doing, so these buy and sel orders arrive in bursts. Therefore, rather than treat the time between arrivals as independent random variables, a time-series model should be developed.

We distinguish multivariate input models of a fixed, finite number of random variables (such as the two random variables lead time and annual demand in Example 21) from time-series input models of a (conceptually infinite) sequence of related random variables (such as the successive times between orders in Example 22). We will describe input models appropriate for these examples after reviewing two measures of dependence, the covariance and the correlation.

### 7.1 Covariance and Correlation

Let \(X_{1}\) and \(X_{2}\) be two random variables, and let \(\mu_{i} = \operatorname{E} ( X_{i} )\) and \(\sigma_{i} ^ {2} = \mathrm{V} ( X_{i} )\) be the mean and variance of \(X_{i} ,\) respectively. The covariance and correlation are measures of the linear dependence between \(X_{1}\) and \(X_{2} .\). In other words, the covariance and correlation indicate how well the relationship between \(X_{1}\) and \(X_{2}\) is described by the model 

$$
(X_{1} - \mu_{1}) = \beta (X_{2} - \mu_{2}) + \varepsilon
$$

 where ε is a random variable with mean 0 that is independent of \(X_{2}\). If, in fact,\(( X_{1} - \mu_{1} ) = \beta ( X_{2} - \mu_{2} )\) then this model is perfect. On the other hand,\(\operatorname{i f} X_{1}\) and \(X_{2}\) are statistically independent, then \(\beta = 0\) and the model is of no value. In general, a positive value of \(\beta\) indicates that \(X_{1}\) and \(X_{2}\) tend to be above or below their means together; a negative value o \(\boldsymbol {\beta}\) indicates that they tend to be on opposite sides of their means.

The covariance between \(X_{1}\) and \(X_{2}\) is defined to be 

$$
\operatorname{cov} \left(X_{1}, X_{2}\right) = \operatorname{E} \left[ \left(X_{1} - \mu_{1}\right) \left(X_{2} - \mu_{2}\right) \right] = \operatorname{E} \left(X_{1} X_{2}\right) - \mu_{1} \mu_{2}\tag{23}
$$

 The value cov \(( X_{1} , X_{2} ) = 0\) implies \(\beta = 0\) in our model of dependence, and \(\operatorname{c o v} ( X_{1} , X_{2} ) < 0 ( > 0 )\) implies \(\beta < 0 ( > 0 )\) The covariance can take any value between and . The correlation standardizes the covariance to be between 1 and 1:

$$
\rho = \operatorname{corr} (X_{1}, X_{2}) = \frac {\operatorname{cov} (X_{1} , X_{2})}{\sigma_{1} \sigma_{2}}\tag{24}
$$

 Again, the value corr \(( X_{1} , X_{2} ) = 0\) implies \(\beta = 0\) in our model, and \(\operatorname{c o r r} ( X_{1} , X_{2} ) < 0 ( > 0 )\) implies \(\beta < 0 ( > 0 )\). The closer \(\rho\) is to 1 or 1, the stronger the linear relationship is between \(X_{1}\) and \(X_{2}\).

Now, suppose that we have a sequence of random variables \(X_{1} , X_{2} , X_{3} , . . .\). that are identically distributed (implying that they all have the same mean and variance), but could be dependent. We refer to such a sequence as a time series and to cov \(( X_{t} , X_{t + h} )\) and \(\operatorname{c o r r} ( X_{t} , X_{t + h} )\) as the lag-h autocovariance and lag-h autocorrelation, respectively. If the value of the autocovariance depends only on h and not on \(t ,\) then we say that the time series is covariance stationary. For a covariance-stationary time series, we use the shorthand notation 

$$
\rho_{h} = \mathrm{corr} (X_{t}, X_{t + h})
$$

 for the lag-h autocorrelation. Notice that autocorrelation measures the dependence between random variables that are separated by \(h - 1\) others in the time series.

### 7.2 Multivariate Input Models

If \(X_{1}\) and \(X_{2}\) each are normally distributed, then dependence between them can be modeled by the bivariate normal distribution with parameters \(\mu_{1} , \mu_{2} , \sigma_{1} ^ {2} , \sigma_{2} ^ {2}\), and \(\rho = \operatorname{c o r r} ( X_{1} , X_{2} )\)). Estimation of \(\mu_{1} , \mu_{2} , \sigma_{1} ^ {2}\), and \(\sigma_{2} ^ {2}\) was described in Section 3.2. To estimate \(\rho ,\), suppose that we have n independent and identically distributed pairs \(( X_{11} , X_{21} ) , ( X_{12} , X_{22} ) , \dots , ( X_{1 n} , X_{2 n} )\). Then the sample covariance is 

$$
\begin{array}{l} \widehat {\operatorname{cov}} (X_{1}, X_{2}) = \frac {1}{n - 1} \sum_{j = 1} ^ {n} \left(X_{1 j} - \bar {X} _ {1}\right) (X_{2 j} - \bar {X} _ {2}) \\ = \frac {1}{n - 1} \left(\sum_{j = 1} ^ {n} X_{1 j} X_{2 j} - n \bar {X} _ {1} \bar {X} _ {2}\right) \end{array}\tag{25}
$$

 where \({\bar {X}} _ {1}\) and \({\bar {X}} _ {2}\) are the sample means. The correlation is estimated by 

$$
\widehat {\rho} = \frac {\widehat {\mathrm{cov}} (X_{1} , X_{2})}{\widehat {\sigma} _ {1} \widehat {\sigma} _ {2}}\tag{26}
$$

 where \(\widehat {\sigma} _ {1}\) and \(\widehat {\sigma} _ {2}\) are the sample variances.

### Example 23: Example 21 (cont.)

Let \(X_{1}\) represent the average lead time (in months) to deliver, and \(X_{2}\) the annual demand, for industria robots. The following data are available on demand and lead time for the last ten years:

| Lead Time | Demand |
| --- | --- |
| 6.5 | 103 |
| 4.3 | 83 |
| 6.9 | 116 |
| 6.0 | 97 |
| 6.9 | 112 |
| 6.9 | 104 |
| 5.8 | 106 |
| 7.3 | 109 |
| 4.5 | 92 |
| 6.3 | 96 |

Standard calculations give \({\bar {X}} _ {1} = 6 . 14 , {\widehat {\sigma}} _ {1} = 1 . 02 , {\bar {X}} _ {2} = 101 . 80 .\), and \(\widehat {\sigma} _ {2} = 9 . 93\) as estimates of \(\mu_{1} , \sigma_{1} , \mu_{2}\), and \(\sigma_{2} .\), respectively. To estimate the correlation, we need 

$$
\sum_{j = 1} ^ {10} X_{1 j} X_{2 j} = 6328. 5
$$

 Therefore,\(\widehat {\mathrm{c o v}} = [ 6328 . 5 - ( 10 ) ( 6 . 14 ) ( 101 . 80 ) ] / ( 10 - 1 ) = 8 . 66\), and 

$$
\widehat {\rho} = \frac {8 . 66}{(1 . 02) (9 . 93)} = 0. 86
$$


Clearly, lead time and demand are strongly dependent. Before we accept this model, however, lead time and demand should be checked individually to see whether they are represented well by normal distributions. In particular, demand is a discrete-valued quantity, so the continuous normal distribution is at best an approximation.

The following simple algorithm can be used to generate bivariate normal random variables:

Step 1. Generate \(Z_{1}\) and \(Z_{2} .\), independent standard normal random variables.

Step 2. Set \(X_{1} = \mu_{1} + \sigma_{1} Z_{1}\) Step 3. Set \(X_{2} = \mu_{2} + \sigma_{2} \left( \rho Z_{1} + \sqrt {1 - \rho^{2}} Z_{2} \right)\) Obviously, the bivariate normal distribution will not be appropriate for all multivariate-input modeling problems. It can be generalized to the k-variate normal distribution to model the dependence among more than two random variables, but, in many instances, a normal distribution is no appropriate in any form. We provide one method for handling nonnormal distributions in Section 7.4. Good references for other models are Johnson [1987] and Nelson and Yamnitsky [1998].

### 7.3 Time-Series Input Models

If \(X_{1} , X_{2} , X_{3} , \dots\). is a sequence of identically distributed, but dependent and covariance-stationary random variables, then there are a number of time-series models that can be used to represent the process. We will describe two models that have the characteristic that the autocorrelations take the form 

$$
\rho_{h} = \mathrm{corr} (X_{t}, X_{t + h}) = \rho^{h}
$$

 for \(h = 1 , 2 , \ldots\). Notice that the \(l a g .\)-h autocorrelation decreases geometrically as the lag increases, so that observations far apart in time are nearly independent. For one model to be shown below, each \(X_{t}\) is normally distributed; for the other model, each \(X_{t}\) is exponentially distributed. More general time-series input models are described in Section 7.4 and in Nelson and Yamnitsky [1998].

### AR(1) MODEL

Consider the time-series model 

$$
X_{t} = \mu + \phi (X_{t - 1} - \mu) + \varepsilon_{t}\tag{27}
$$

 for \(t = 2 , 3 , \ldots\), where \(\varepsilon_{2} , \varepsilon_{3} , \ldots .\). are independent and identically (normally) distributed with mean 0 and variance \(\sigma_{\varepsilon} ^ {2}\), and \(- 1 < \phi < 1\). If the initial value \(X_{1}\) is chosen appropriately (see below), then \(X_{1} , X_{2} , . . .\). are all normally distributed with mean \(\mu ,\), variance \(\sigma_{\varepsilon} ^ {2} / ( 1 - \phi^{2} )\), and 

$$
\rho_{h} = \phi^{h}
$$

 for \(h = 1 , 2 , \ldots\). This time-series model is called the autoregressive order-1 model, or AR(1) for short.


Estimation of the parameter \(\phi\) can be obtained from the fact that 

$$
\phi = \rho^{1} = \mathrm{corr} (X_{t}, X_{t + 1})
$$

 the lag-1 autocorrelation. Therefore, to estimate \(\phi ,\), we first estimate the lag-1 autocovariance by 

$$
\widehat {\mathrm{cov}} (X_{t}, X_{t + 1}) = \frac {1}{n - 1} \sum_{t = 1} ^ {n - 1} (X_{t} - \bar {X}) (X_{t + 1} - \bar {X})
$$


$$
\doteq \frac {1}{n - 1} \left(\sum_{t = 1} ^ {n - 1} X_{t} X_{t + 1} - (n - 1) \bar {X} ^ {2}\right)\tag{28}
$$

 and the variance \(\sigma^{2} = \operatorname{v a r} ( X )\) by the usual estimator \({\widehat {\sigma}} ^ {2}\). Then 

$$
\widehat {\phi} = \frac {\widehat {\mathrm{cov}} (X_{t} , X_{t + 1})}{\widehat {\sigma} ^ {2}}
$$

 Finally, estimate \(\mu\) and \(\sigma_{\varepsilon} ^ {2}\) by \({\widehat {\mu}} = {\bar {X}}\) and \(\widehat {\sigma} _ {\varepsilon} ^ {2} = \widehat {\sigma} ^ {2} ( 1 - \widehat {\phi} ^ {2} )\)), respectively.

  The following algorithm generates a stationary \(\mathbf{A R} ( 1 )\)) time series, given values of the parameters \(\phi , \mu\), and \(\sigma_{\varepsilon} ^ {2} \mathrm{:}\):

Step 1. Generate \(X_{1}\) from the normal distribution with mean \(\mu\) and variance \(\sigma_{\varepsilon} ^ {2} / ( 1 - \phi^{2} )\). Set \(t = 2\) Step 2. Generate \(\varepsilon_{t}\) from the normal distribution with mean \(_ 0\) and variance \(\sigma_{\varepsilon} ^ {2}\) Step 3. Set \(X_{t} = \mu + \phi ( X_{t - 1} - \mu ) + \varepsilon_{t}\) Step 4. Set \(t = t + 1\) and go to Step 2.

### EAR(1) MODEL

Consider the time-series model 

$$
X_{t} = \left\{\begin{array}{l l} \phi X_{t - 1}, & \text{with   probability} \phi \\ \phi X_{t - 1} + \varepsilon_{t}, & \text{with   probability} 1 - \phi \end{array} \right.\tag{29}
$$

 for \(t = 2 , 3 , \ldots\), where \(\varepsilon_{2} , \varepsilon_{3} , . . .\). are independent and identically (exponentially) distributed with mean \(1 / \lambda\) and \(0 \leq \phi < 1\). If the initial value \(X_{1}\) is chosen appropriately (see below), then \(X_{1} , X_{2} , \dots\) are all exponentially distributed with mean \(1 / \lambda\) and 

$$
\rho_{h} = \phi^{h}
$$

 for \(h = 1 , 2 , \ldots\). This time-series model is called the exponential autoregressive order-1 model, or \(\mathrm{E A R} ( 1 )\) for short. Only autocorrelations greater than 0 can be represented by this model. Estimation of the parameters proceeds as for the \(\mathbf{A R} ( 1 )\) by setting \({\widehat {\phi}} = {\widehat {\rho}} .\), the estimated lag-1 autocorrelation, and setting \(\widehat {\lambda} = 1 / \bar {X}\)

The following algorithm generates a stationary EAR(1) time series, given values of the parameters φ and λ:

Step 1. Generate \(X_{1}\) from the exponential distribution with mean \(1 / \lambda\). Set \(t = 2\) Step 2. Generate U from the uniform distribution on [0, 1]. If \(U \leq \phi .\), then set 

$$
X_{t} = \phi X_{t - 1}
$$

 Otherwise, generate \(\varepsilon_{t}\) from the exponential distribution with mean \(1 / \lambda\) and set 

$$
X_{t} = \phi X_{t - 1} + \varepsilon_{t}
$$

 Step 3. Set \(t = t + 1\) and go to Step 2.

### Example 24: Example 22 (cont.)

The stock broker would typically have a large sample of data, but, for the sake of illustration, suppose that the following twenty time gaps between customer buy and sell orders had been recorded (in seconds): 1.95, 1.75, 1.58, 1.42, 1.28, 1.15, 1.04, 0.93, 0.84, 0.75, 0.68, 0.61, 11.98, 10.79, 9.71, 14.02, 12.62, 11.36, 10.22, 9.20. Standard calculations give \(\bar {X} = 5 . 2\) and \({\widehat {\sigma}} ^ {2} = 26 . 7\). To estimate the lag-1 autocorrelation, we need 

$$
\sum_{j = 1} ^ {19} X_{t} X_{t + 1} = 924. 1
$$

 Thus,\({\widehat {\mathsf {c o v}}} = [ 924 . 1 - ( 20 - 1 ) ( 5 . 2 ) ^ {2} ] / ( 20 - 1 ) = 21 . 6 ,\) and 

$$
\widehat {\rho} = \frac {21 . 6}{26 . 7} = 0. 8
$$

 Therefore, we could model the interarrival times as an EAR(1) process with \(\widehat {\lambda} = 1 / 5 . 2 = 0 . 192\) and \(\widehat {\phi} = 0 . 8 .\), provided that an exponential distribution is a good model for the individual gaps.

### 7.4 The Normal-to-Anything Transformation

The bivariate normal distribution and the AR(1) and EAR(1) time-series models are useful input models that are easy to fit and simulate. However, the marginal distribution is either normal or exponential, which is certainly not the best choice for many applications. Fortunately, we can start with a bivariate normal or AR(1) model and transform it to have any marginal distributions we want (including exponential).


Suppose we want to simulate a random variable X with cdf \(F ( x )\). Let \(Z\) be a standard normal random variable (mean 0 and variance 1), and let \(\Phi ( z )\) be its cdf. Then it can be shown that 

$$
R = \Phi (Z)
$$

 is a \(U ( 0 ,\)1) random variable. If we have a \(U ( 0 , 1 )\) random variable, we can get X by using the inverse cdf transformation 

$$
X = F^{- 1} [ R ] = F^{- 1} [ \Phi (Z) ]
$$

 We refer this as the normal to anything transformation, or NORTA for short.

Of course, if all we want is \(X ,\) then there is no reason to go to this trouble; we can just generate R directly. But suppose we want a bivariate random vector \(( X_{1} , X_{2} )\) such that \(X_{1}\) and \(X_{2}\) are correlated but their distributions are not normal. Then we can start with a bivariate normal random vector \(( Z_{1} , Z_{2} )\) and apply the NORTA transformation to obtain 

$$
X_{1} = F_{1} ^ {- 1} [ \Phi (Z_{1}) ] \text{and} X_{2} = F_{2} ^ {- 1} [ \Phi (Z_{2}) ]
$$

 There is not even a requirement that \(F_{1}\) and \(F_{2}\) be from the same distribution family; for instance,\(F_{1}\) could be an exponential distribution and \(F_{2}\) a beta distribution.

The same idea applies for time series. If \(Z_{t}\) is generated by an \(\mathbf{A R} ( 1 )\) with \(N ( 0 , 1 )\) marginals, then 

$$
X_{t} = F^{- 1} [ \Phi (Z_{t}) ]
$$

 will be a time-series model with marginal distribution \(F ( x )\). To ensure that \(Z_{t}\) is \(N ( 0 , 1 )\), we set \(\mu = 0\) and \(\sigma _ {\mathrm {{s}}} ^ {2} = 1 - \phi^{2}\) in the AR(1) model.

Although the NORTA method is very general, there are two technical issues that must be addressed to implement it:

1. The NORTA approach requires being able to evaluate that standard normal cdf,\(\Phi ( z )\), and the inverse cdf of the distributions of interest,\({\cal F} ^ {- 1} ( R )\). There is no closed-form expression for \(\Phi ( z )\) and no closed-form expression for \({\cal F} ^ {- 1} ( R )\) for many distributions. Therefore, numerical approximations are required. Fortunately, these functions are built into many symbolic calculation and spreadsheet programs, and we give one example next. In addition, Bratley, Fox, and Schrage [1987] contains algorithms for many distributions.

2. The correlation between the standard normal random variables \(( Z_{1} , Z_{2} )\) is distorted when it passes through the NORTA transformation. To be more specific, if \(( Z_{1} , Z_{2} )\)) have correlation \(\rho ,\) then in general \(X_{1} = F_{1} ^ {- 1} [ \Phi ( Z_{1} ) ]\) and \(X_{2} = F_{2} ^ {- 1} [ \Phi ( Z_{2} ) ]\)] will have a correlation \(\rho_{X} \neq \rho\) The difference is often small, but not always.

The second issue is more critical, because in input-modeling problems we want to specify the bivariate or lag-1 correlation. Thus, we need to find the bivariate normal correlation \(\rho\) that gives us the input correlation \(\rho_{X}\) that we want (recall that we specify the time-series model via the lag-1 correlation,\(\rho_{X} = \operatorname{c o r r} ( X_{t} , X_{t + 1} ) )\). There has been much research on this problem, including Cario and Nelson [1996, 1998] and Biller and Nelson [2003]. Fortunately, it has been shown that \(\rho_{X}\) is


a nondecreasing function of \(\rho ,\) and \(\rho\) and \(\rho_{X}\) will always have the same sign. Thus, we can do a relatively simple search based on the following algorithm:

Step 1. Set \(\rho = \rho_{X}\) to start.

Step 2. Generate a large number of bivariate normal pairs \(( Z_{1} , Z_{2} )\)) with correlation \(\rho ,\), and transform them into \(( X_{1} , X_{2} ) \mathbf{s}\), using the NORTA transformation.

Step 3. Compute the sample correlation between \(( X_{1} , X_{2} )\), using Equation (25), and call it \(\widehat {\rho} _ {T}\). If \(\widehat {\rho} _ {T} > \rho_{X}\), then reduce \(\rho\) and go to Step 2; if \(\widehat {\rho_{T}} < \rho_{X}\), then increase \(\rho\) and \({\bf g 0}\)to Step 2. If \(\widehat {\rho} _ {T} \approx \rho_{X}\) then stop.

### Example 25

Suppose we need \(X_{1}\) to have an exponential distribution with mean \(1 , X_{2}\) to have a beta distribution with \(\beta_{1} = 1 , \beta_{2} = 1 / 2\), and the two of them to have correlation \(\rho_{X} = 0 . 45\). Figure 8 shows a procedure in Maple that will estimate the required value of \(\rho .\). In the procedure, n is the number of sample pairs used to estimate the correlation. Running this procedure with n set to 1000 gives \(\rho = 0 . 52\)
## 8 Summary

Input-data collection and analysis require major time and resource commitments in a discrete-event simulation project. However, regardless of the validity or sophistication of the simulation model, unreliable inputs can lead to outputs whose subsequent interpretation could result in faulty recommendations.

This chapter discussed four steps in the development of models of input data: collecting the raw data, identifying the underlying statistical distribution, estimating the parameters, and testing for goodness of fit.

Some suggestions were given for facilitating the data-collection step. However, experience, such as that obtained by completing any of Exercises 1 through 5, will increase awareness of the difficulty of problems that can arise in data collection and of the need for planning.

Once the data have been collected, a statistical model should be hypothesized. Constructing a histogram is very useful at this point if sufficient data are available. A distribution based on the underlying process and on the shape of the histogram can usually be selected for further investigation.

The investigation proceeds with the estimation of parameters for the hypothesized distribution. Suggested estimators were given for distributions used often in simulation. In a number of instances, these are functions of the sample mean and sample variance.

The last step in the process is the testing of the distributional hypothesis. The \(q {-} q\) plot is a useful graphical method for assessing fit. The chi-square, Kolmogorov–Smirnov, and Anderson-Darling goodness-of-fit tests can be applied to many distributional assumptions. When a distributiona assumption is rejected, another distribution is tried. When all else fails, the empirical distribution could be used in the model


```txt
NORTARho := proc(rhoX, n)
local Z1, Z2, Ztemp, X1, X2, R1, R2, rho, rhoT, lower, upper;
randomize(123456);
Z1 := [random[normald[0,1]](n)]:
ZTemp := [random[normald[0,1]](n)]:
Z2 := [0]:
# set up bisection search
rho := rhoX:
if (rhoX < 0) then
    lower := -1:
    upper := 0:
else
    lower := 0:
    upper := 1:
fi:
Z2 := rho*Z1 + sqrt(1-rho^2)*ZTemp:
R1 := statevalf[cdf,normald[0,1]](Z1):
R2 := statevalf[cdf,normald[0,1]](Z2):
X1 := statevalf/icdf,exponential[1,0]](R1):
X2 := statevalf/icdf,beta[1,2]](R2):
rhoT := describe(linearcorrelation)(X1, X2);
# do bisection search until 5% relative error
while abs(rhoT - rhoX)/abs(rhoX) > 0.05 do
    if (rhoT > rhoX) then
    upper := rho:
    else
    lower := rho:
    fi:
    rho := evalf((lower + upper)/2):
    Z2 := rho*Z1 + sqrt(1-rho^2)*ZTemp:
    R1 := statevalf[cdf,normald[0,1]](Z1):
    R2 := statevalf[cdf,normald[0,1]](Z2):
    X1 := statevalf/icdf,exponential[1,0]](R1):
    X2 := statevalf/icdf,beta[1,2]](R2):
    rhoT := describe(linearcorrelation)(X1, X2);
end do;
RETURN(rho);
end;

Unfortunately, in some situations, a simulation study must be undertaken when there is not time or resources to collect data on which to base input models. When this happens, the analyst must use any available information—such as manufacturer specifications and expert opinion—to construct the input models. When input models are derived without the benefit of data, it is particularly importan to examine the sensitivity of the results to the models chosen.

Many, but not all, input processes can be represented as sequences of independent and identically distributed random variables. When inputs should exhibit dependence, then multivariate-input models are required. The bivariate normal distribution (and more generally the multivariate normal distribution) is often used to represent a finite number of dependent random variables. Time-series models are useful for representing a (conceptually infinite) sequence of dependent inputs. The NORTA transformation facilitates developing multivariate-input models with marginal distributions that are no normal.

REFERENCES

BILLER, B., AND B. L. NELSON [2003], “Modeling and Generating Multivariate Time Series with Arbitrary Marginals Using an Autoregressive Technique,” ACM Transactions on Modeling and Computer Simulation, Vol. 13, pp. 211–237.

BRATLEY, P., B. L. FOX, AND L. E. SCHRAGE [1987], A Guide to Simulation, 2d ed., Springer-Verlag, New York.

CARIO, M. C., AND B. L. NELSON [1996], “Autoregressive to Anything: Time-Series Input Processes for Simulation,” Operations Research Letters, Vol. 19, pp. 51–58.

CARIO, M. C., AND B. L. NELSON [1998], “Numerical Methods for Fitting and Simulating Autoregressiveto-Anything Processes,” INFORMS Journal on Computing, Vol. 10, pp. 72–81.

CHOI, S. C., AND R. WETTE [1969], “Maximum Likelihood Estimation of the Parameters of the Gamma Distribution and Their Bias,” Technometrics, Vol. 11, No. 4, pp. 683–890.

CHAMBERS, J. M., W. S. CLEVELAND, AND P. A. TUKEY [1983], Graphical Methodsfor Data Analysis, CRC Press, Boca Raton, FL.

CONNOVER, W. J. [1998], Practical Nonparametric Statistics, 3d ed., Wiley, New York.

DURBIN, J. [1975], “Kolmogorov–Smirnov Tests When Parameters Are Estimated with Applications to Tests of Exponentiality and Tests on Spacings,” Biometrika, Vol. 65, pp. 5–22.

FISHMAN, G. S. [1973], Concepts and Methods in Discrete Event Digital Simulation, Wiley, New York.

GUMBEL, E. J. [1943], “On the Reliability ofthe Classical Chi-squared Test,”Annals ofMathematical Statistics, Vol. 14, pp. 253ff.

HINES, W. W., D. C. MONTGOMERY, D. M. GOLDSMAN, AND C. M. BORROR [2002], Probability and Statistics in Engineering and Management Science, 4th ed., Wiley, New York.

JOHNSON, M. A., S. LEE, AND J. R. WILSON [1994], “NPPMLE and NPPSIM: Software for Estimating and Simulating Nonhomogeneous Poisson Processes Having Cyclic Behavior,” Operations Research Letters, Vol. 15, pp. 273–282.

JOHNSON, M. E. [1987], Multivariate Statistical Simulation, Wiley, New York.

LAW, A. M. [2007], Simulation Modeling and Analysis, 4th ed., McGraw-Hill, New York.

LILLIEFORS, H. W. [1967], “On the Kolmogorov–Smirnov Test for Normality with Mean and Variance Unknown,” Journal ofthe American Statistical Association, Vol. 62, pp. 339–402.

LILLIEFORS, H. W. [1969], “On the Kolmogorov–Smirnov Test for the Exponential Distribution with Mean Unknown,” Journal ofthe American Statistical Association, Vol. 64, pp. 387–389.

MANN, H. B., AND A. WALD [1942], “On the Choice of the Number of Intervals in the Application of the Chi-squared Test,” Annals ofMathematical Statistics, Vol. 18, p. 50ff.

NELSON, B. L.,AND M.YAMNITSKY [1998], “Input Modeling Tools for Complex Problems,” in Proceedings of the 1998 Winter Simulation Conference, D. Medeiros, E. Watson, J. Carson, and M. Manivannan, eds., Washington, DC, Dec. 13–16, pp. 105–112.

STUART, A., J. K. ORD, AND E. ARNOLD [1998], Kendall’s Advanced Theory of Statistics, 6th ed., Vol. 2, Oxford University Press, Oxford

EXERCISES

  1. Go to a small store and record the interarrival- and service-time distributions. If there are severa workers, how do the service-time distributions compare to one another? Do service-time distributions need to be constructed for each type of appliance? (Make sure that the management gives permission to perform this study.)

  2. Go to a cafeteria and collect data on the distributions of interarrival and service times. The distribution of interarrival times is probably different for each of the three daily meals and migh also vary during the meal—that is, the interarrival time distribution for 11:00 A.M. to 12:00 noon could be different from that for 12:00 noon to 1:00 P.M. Define service time as the time from when the customer reaches the point at which the first selection could be made until the time of exiting from the cafeteria line. (Any reasonable modification of this definition is acceptable.) The service-time distribution probably changes for each meal. Can times of the day or days of the week for either distribution be grouped to suit the homogeneity of the data? (Make sure tha the management gives permission to perform this study.)

  3. Go to a major traffic intersection and record the interarrival-time distributions from each direction. Some arrivals want to go straight, some turn left, some turn right. The interarrival-time distribution varies during the day and by day of the week. Every now and then an acciden occurs. Develop an input model for your data.

  4. Go to a grocery store and construct the interarrival and service distributions at the checkout counters. These distributions might vary by time of day and by day of week. Also record the number of service channels available at all times. (Make sure that the management gives permission to perform this study.)

  5. Go to a laundromat and collect data to develop input models for the number of washers and dryers a customer uses (probably dependent). Also collect data on the arrival rate of customers (probably not stationary). (Make sure that the management gives permission to perform this study.)

  6. Prepare four theoretical normal density functions, all on the same figure, each distribution having mean zero, but let the standard deviations be 1/4, 1/2, 1, and 2.

  7. On one figure, draw the pdfs of the Erlang distribution where θ=1/2\theta = 1 / 2 and k=1,2,4k = 1 , 2 , 4, and 8.

  8. On one figure, draw the pdfs of the Erlang distribution where θ 2 and k 1, 2, 4, and 8.

  9. Draw the pmf of the Poisson distribution that results when the parameter α is equal to the following:

α=1/2 \alpha = 1 / 2 α=1 \alpha = 1 α=2 \alpha = 2 α=4 \alpha = 4
  1. On one figure, draw the two exponential pdfs that result when the parameter λ equals 0.6 and 1.2.

  2. On one figure, draw the three Weibull pdfs that result when ν 0,α=1/2,\alpha = 1 / 2 ,, and β=1,2,\beta = 1 , 2 ,, and 4.

  3. The following data are generated randomly from a gamma distribution:

1.6911.4378.2215.976
1.1164.4352.3451.782
3.8104.5895.31310.90
2.6492.4321.5812.432
1.8432.4662.8332.361

Compute the maximum-likelihood estimators β^\widehat {\beta} and θ^.{\widehat {\theta}} .13. The following data are generated randomly from a Weibull distribution where ν=0:\nu = 0 \mathrm{:}| 7.936 | 5.224 | 3.937 | 6.513 | | — | — | — | — | | 4.599 | 7.563 | 7.172 | 5.132 | | 5.259 | 2.759 | 4.278 | 2.696 | | 6.212 | 2.407 | 1.857 | 5.002 | | 4.612 | 2.003 | 6.908 | 3.326 |

Compute the maximum-likelihood estimators α and β^.{\widehat {\beta}} .(This exercise requires a programmable calculator, a computer, or a lot of patience.)

  1. The highway between Atlanta, Georgia and Athens, Georgia has a high incidence of accidents along its 100 kilometers. Public safety officers say that the occurrence of accidents along the

highway is randomly (uniformly) distributed, but the news media say otherwise. The Georgia Department of Public Safety published records for the month of September. These records indicated the point at which 30 accidents involving an injury or death occurred, as follows (the data points representing the distance from the city limits of Atlanta):

88.340.736.327.336.8
91.767.37.045.223.3
98.890.117.223.797.4
32.487.869.862.699.7
20.673.121.66.045.3
76.673.227.387.687.2

Use the Kolmogorov–Smirnov test to discover whether the distribution of location of accidents is uniformly distributed for the month of September.

  1. Show that the Kolmogorov–Smirnov test statistic for Example 19 is D=0.1054D = 0 . 105416. Records pertaining to the monthly number of job-related injuries at an underground coal mine were being studied by a federal agency. The values for the past 100 months were as follows:
Injuries per MonthFrequency of Occurrence
035
140
213
36
44
51
61

(a) Apply the chi-square test to these data to test the hypothesis that the underlying distribution is Poisson. Use the level of significance α=0.05\alpha = 0 . 05(b) Apply the chi-square test to these data to test the hypothesis that the distribution is Poisson with mean 1.0. Again let α=0.05.\alpha = 0 . 05 .(c) What are the differences between parts (a) and (b), and when might each case arise?

  1. The time required for 50 different employees to compute and record the number of hours worked during the week was measured, with the following results in minutes:
EmployeeTime (minutes)EmployeeTime (minutes)
11.88260.04
20.54271.49
31.90280.66
40.15292.03
50.02301.00
62.81310.39
71.50320.34
80.53330.01
92.62340.10
102.67351.10
113.53360.24
120.53370.26
131.80380.45
140.79390.17
150.21404.29
160.80410.80
170.26425.50
180.63434.91
190.36440.35
202.03450.36
211.42460.90
221.28471.03
230.82481.73
242.16490.38
250.05500.48

Use the chi-square test (as in Example 18) to test the hypothesis that these service times are exponentially distributed. Let the number of class intervals be k 6. Use the level of significance α 0.05.

218.95232.75212.80231.10215.95
237.55235.45228.25218.65212.80
230.35228.55216.10229.75229.00
199.75225.10208.15213.85205.45
219.40208.15198.40238.60219.55
243.10198.85224.95212.20222.90
218.80203.35223.45213.40206.05
229.30239.20201.25216.85207.25
204.85219.85226.15230.35211.45
227.95229.30225.25201.25216.10

Using input-modeling software, apply as many tests for normality as are available in the software. If the chi-square test is available, apply it with at least two different choices for the number of intervals. Do all of the tests reach the same conclusion?

  1. The Crosstowner was a bus that cut a diagonal path from northeast Atlanta to southwest Atlanta. The time required to complete the route was recorded by the bus operator. The bus runs from Monday through Friday. The times of the last fifty 8:00 A.M. runs, in minutes, are as follows:
92.392.8106.8108.9106.6
115.294.8106.4110.090.9
104.672.086.0102.499.8
87.5111.4105.990.799.2
97.888.397.597.493.7
99.7122.7100.2106.5105.5
80.7107.9103.2116.4101.7
84.8101.999.1102.2102.5
111.7101.595.192.888.5
74.498.9111.996.595.9

How are these run times distributed? Develop and test a suitable model.

  1. The time required for the transmission of a message (in milliseconds) is sampled electronically at a communications center. The last 50 values in the sample are as follows:
7.9364.6122.4074.2785.132
4.5995.2242.0031.8572.696
5.2597.5633.9376.9085.002
6.2122.7597.1726.5133.326
8.7614.5026.1882.5665.515
3.7853.7424.6824.3465.359
3.5355.0614.6295.2986.492
3.5024.2663.1291.2983.454
5.2896.8053.8273.9122.969
4.6465.9633.8294.4044.924

How are the transmission times distributed? Develop and test an appropriate model.

  1. The time (in minutes) between requests for the hookup ofelectric service was accurately recorded at the Gotwatts Flash and Flicker Company, with the following results for the last 50 requests:
0.6614.9108.98912.80120.249
5.12415.03358.0911.5433.624
13.5095.7450.6510.96562.146
15.5122.75817.6026.67511.209
2.7316.89216.7135.6926.636
2.4202.98410.6133.82710.244
6.25527.96912.1074.6367.093
6.89213.24312.7113.4117.897
12.4132.1690.9211.9000.315
4.3700.3779.0631.8750.790

How are the times between requests for service distributed? Develop and test a suitable model.

  1. Daily demands for transmission overhaul kits for the D-3 dragline were maintained by Earth Moving Tractor Company, with the following results:
02000
10111
01000
20101
01002
10100
00000
10101
00301
10000

How are the daily demands distributed? Develop and test an appropriate model.

  1. A simulation is to be conducted of a job shop that performs two operations: milling and planing, in that order. It would be possible to collect data about processing times for each operation, then generate random occurrences from each distribution. However, the shop manager says that the times might be related; large milling jobs take lots of planing. Data are collected for the next 25 orders, with the following results in minutes:
OrderMilling Time (minutes)Planing Time (minutes)OrderMilling Time (minutes)Planing Time (minutes)
112.310.61424.616.6
220.413.91528.521.2
318.914.11611.39.9
416.510.11713.310.7
58.38.41821.014.0
66.58.11919.513.0
725.216.92015.011.5
817.713.72112.69.9
910.610.22214.313.2
1013.712.12317.012.5
1126.216.02421.214.2
1230.418.92528.419.1
139.97.7

(a) Plot milling time on the horizontal axis and planing time on the vertical axis. Do these data seem dependent? (b) Compute the sample correlation between milling time and planing time. (c) Fit a bivariate normal distribution to these data.

  1. Write a computer program to compute the maximum-likelihood estimators (α^,β^)( {\widehat {\alpha}} , {\widehat {\beta}} ) of the Weibull distribution. Inputs to the program should include the sample size n;n ;the observations x1,x2,…,xn;x_{1} , x_{2} , \ldots , x_{n} ; a stopping criterion  (stop when $| f ( \widehat {\beta} _ {j} ) | \leq \epsilon ) $; and a print option OPT (usually set = 0). Output would be the estimates α and β^.IfOPT=1{\widehat {\beta}} . {\mathrm{I f}} {\mathrm{O P T}} = 1, additional output would be printed, as in Table 4, showing convergence. Make the program as “user friendly” as possible.

  2. Examine a computer-software library or simulation-support environment to which you have access. Obtain documentation on data-analysis software that would be useful in solving exercises 7 through 24. Use the software as an aid in solving selected problems.

  3. The numbers of patrons staying at a small hotel on 20 successive nights was observed to be 20, 14, 21, 19, 14, 18, 21, 25, 27, 26, 22, 18, 13, 18, 18, 18, 25, 23, 20, 21. Fit both an AR(1) and an EAR(1) model to these data. Decide which model provides a better fit by looking at a histogram of the data.

  4. The following data represent the time to perform transactions in a bank, measured in minutes: 0.740, 1.28, 1.46, 2.36, 0.354, 0.750, 0.912, 4.44, 0.114, 3.08, 3.24, 1.10, 1.59, 1.47, 1.17, 1.27, 9.12, 11.5, 2.42, 1.77. Develop an input model for these data.

  5. Two types ofjobs (A and B) are released to the input buffer of a job shop as orders arrive, and the arrival of orders is uncertain. The following data are available from the last week of production:

DayNumber of JobsNumber of As
18353
29362
311266
46541
57855

Develop an input model for the number of new arrivals of each type each day.

  1. The following data are available on the processing time at a machine (in minutes): 0.64, 0.59, 1.1, 3.3, 0.54, 0.04, 0.45, 0.25, 4.4, 2.7, 2.4, 1.1, 3.6, 0.61, 0.20, 1.0, 0.27, 1.7, 0.04, 0.34. Develop an input model for the processing time.

  2. For the arrival-count data shown here, estimate the arrival-rate function λ(t) for an NSPP in arrivals per hour:

Time PeriodNumber of Arrivals
Day 1Day 2Day 3Day 4
8:00–10:0022242028
10:00–12:0023263230
12:00–2:0040333238
  1. Using the web, research some of the input-modeling software packages mentioned in this chapter (try www.informs-sim.org as a starting place). What are their features? What distributions do they include?

  2. As part of a surgical admitting process orderlies are available to escort patients to the presurgery preparation area. Patients are not allowed to go by themselves as a matter of policy. A Management Engineer walked the route briskly and found it took 2 minutes to walk to the prep area. Orderlies say that it sometimes takes as long as 7 minutes to escort a patient to the area, but it usually takes 5 minutes. Construct an input model for time to escort a patient based on the information given.

  3. At an insertion/sealing/inspection operation electronic components are inserted into a board, the case is assembled and sealed, and the completed unit is tested. The time to accomplish all of this is expected to be 2 minutes for type A12117c assemblies and 3 minutes for the B33433x assemblies. An average deviation of plus-or-minus 20% around these values is considered the standard allowance for variability. Construct an input model for the insertion/sealing/inspection operation based on the information given.

  4. The following data are counts of calls arriving to a call center by hour of the day over five Mondays. Does it appear that the process is nonstationary? If so, then develop an NSPP inpu model for the arrival of calls between 8 A.M. and 4 P.M.

8-9A.M.9-10A.M.10-11A.M.11-12P.M.12-1P.M.1-2P.M.2-3P.M.3-4P.M.
2737586865333721
2735679374423921
2539587582344619
1842487562514914
2942658870434522

This page intentionally left blank

10 Verification and Validation of Simulation Models

One ofthe most important and difficult tasks facing a model developer is the verification and validation of the simulation model. The engineers and analysts who use the model outputs to aid in making design recommendations and the managers who make decisions based on these recommendations— justifiably look upon a model with some degree of skepticism about its validity. It is the job o the model developer to work closely with the end users throughout the period of development and validation to reduce this skepticism and to increase the model’s credibility.

The goal of the validation process is twofold: (a) to produce a model that represents true system behavior closely enough for the model to be used as a substitute for the actual system for the purpose of experimenting with the system, analyzing system behavior, and predicting system performance; and (b) to increase the credibility of the model to an acceptable level, so that the model will be used by managers and other decision makers.

Validation should not be seen as an isolated set of procedures that follows model development, but rather as an integral part of model development. Conceptually, however, the verification and validation process consists of the following components:

  1. Verification is concerned with building the model correctly. It proceeds by the comparison of the conceptual model to the computer representation that implements that conception. It asks the questions: Is the model implemented correctly in the simulation software? Are the input parameters and logical structure of the model represented correctly?

  2. Validation is concerned with building the correct model. It attempts to confirm that a mode is an accurate representation of the real system. Validation is usually achieved through the calibration ofthe model, an iterative process ofcomparing the model to actual system behavior and using the discrepancies between the two, and the insights gained, to improve the model. This process is repeated until model accuracy is judged to be acceptable.

This chapter describes methods that have been recommended and used in the verification and validation process. Most of the methods are informal subjective comparisons; a few are forma statistical procedures. The use of the latter procedures involves issues related to output analysis. Output analysis refers to analysis of the data produced by a simulation and to drawing inferences from these data about the behavior of the real system. To summarize their relationship, validation is the process by which model users gain confidence that output analysis is making valid inferences about the real system under study.

Many articles and chapters in texts have been written on verification and validation. For discussion of the main issues, the reader is referred to Balci [1994, 1998, 2003], Carson [1986, 2002], Gass [1983], Kleijnen [1995], Law and Kelton [2000], Naylor and Finger [1967], Oren [1981], Sargen [2003], Shannon [1975], and van Horn [1969, 1971]. For statistical techniques relevant to various aspects of validation, the reader can obtain the foregoing references plus those by Balci and Sargen [1982a,b; 1984a], Kleijnen [1987], and Schruben [1980]. For case studies in which validation is emphasized, the reader is referred to Carson et al. [1981a,b], Gafarian and Walsh [1970], Kleijnen [1993], and Shechter and Lucas [1980]. Bibliographies on validation have been published by Balc and Sargent [1984b] and by Youngblood [1993].

1 Model Building, Verification, and Validation

The first step in model building consists of observing the real system and the interactions among its various components and of collecting data on their behavior. But observation alone seldom yields sufficient understanding of system behavior. People familiar with the system, or any subsystem, should be questioned, to take advantage of their special knowledge. Operators, technicians, repair and maintenance personnel, engineers, supervisors, and managers understand certain aspects of the system that might be unfamiliar to others. As model development proceeds, new questions may arise, and the model developers will return to this step to learn more about system structure and behavior.

The second step in model building is the construction of a conceptual model—a collection of assumptions about the components and the structure of the system, plus hypotheses about the values of model input parameters. As is illustrated by Figure 1, conceptual validation is the comparison o the real system to the conceptual model.

The third step is the implementation of an operational model, usually by using simulation software, and incorporating the assumptions ofthe conceptual model into the worldview and concepts of the simulation software.

Figure 1 Model building, verification, and validation.

In actuality, model building is not a linear process with three steps. Instead, the model builder will return to each of these steps many times while building, verifying, and validating the model. Figure 1 depicts the ongoing model building process, in which the need for verification and validation causes continual comparison of the real system to both the conceptual model and the operationa model, and induces repeated modification of the model to improve its accuracy.

2 Verification of Simulation Models

The purpose of model verification is to assure that the conceptual model is reflected accurately in the operational model. The conceptual model quite often involves some degree of abstraction about system operations or some amount of simplification of actual operations. Verification asks the following question: Is the conceptual model (assumptions about system components and system structure, parameter values, abstractions, and simplifications) accurately represented by the operationa model?

Many common-sense suggestions can be used in the verification process:

  1. Have the operational model checked by someone other than its developer, preferably an expert in the simulation software being used.

  2. Make a flow diagram that includes each logically possible action a system can take when an event occurs, and follow the model logic for each action for each event type.

  3. Closely examine the model output for reasonableness under a variety of settings of the input parameters. Have the implemented model display a wide variety of output statistics, and examine all of them closely.

  4. Have the operational model print the input parameters at the end of the simulation, to be sure that these parameter values have not been changed inadvertently.

  5. Make the operational model as self-documenting as possible. Give a precise definition of every variable used and a general description of the purpose of each submodel, procedure (or major section of code), component, or other model subdivision.

  6. If the operational model is animated, verify that what is seen in the animation imitates the actual system. Examples of errors that can be observed through animation are automated guided vehicles (AGVs) that pass through one another on a unidirectional path or at an intersection and entities that disappear (unintentionally) during a simulation.

  7. The Interactive Run Controller (IRC) or debugger is an essential component of successfu simulation model building. Even the best of simulation analysts makes mistakes or commits logical errors when building a model. The IRC assists in finding and correcting those errors in the following ways:

(a) The simulation can be monitored as it progresses. This can be accomplished by advancing the simulation until a desired time has elapsed, then displaying model information at that time. Another possibility is to advance the simulation until a particular condition is in effect, and then display information.

(b) Attention can be focused on a particular entity, line of code, or procedure. For instance, every time that an entity enters a specified procedure, the simulation will pause so that information can be gathered. As another example, every time that a specified entity becomes active, the simulation will pause.

(c) Values of selected model components can be observed. When the simulation has paused, the current value or status of variables, attributes, queues, resources, counters, and so on can be observed.

(d) The simulation can be temporarily suspended, or paused, not only to view information, but also to reassign values or redirect entities.

  1. Graphical interfaces are recommended for accomplishing verification and validation [Bortscheller and Saulnier, 1992]. The graphical representation of the model is essentially a form of self-documentation. It simplifies the task of understanding the model.

These suggestions are basically the same ones any software engineer would follow.

Among these common-sense suggestions, one that is very easily implemented, but quite often overlooked, especially by students who are learning simulation, is a close and thorough examination of model output for reasonableness (suggestion 3). For example, consider a model of a complex network of queues consisting of many service centers in series and parallel configurations. Suppose that the modeler is interested mainly in the response time, defined as the time required for a customer to pass through a designated part of the network. During the verification (and calibration) phase of model development, it is recommended that the program collect and print out many statistics in addition to response times, such as utilizations of servers and time-average number of customers in various subsystems. Examination of the utilization of a server, for example, might reveal that it is unreasonably low (or high), a possible error that could be caused by wrong specification of mean service time, or by a mistake in model logic that sends too few (or too many) customers to this particular server, or by any number of other possible parameter misspecifications or errors in logic.

In a simulation language that automatically collects many standard statistics (average queue lengths, average waiting times, etc.), it takes little or no extra programming effort to display almost all statistics of interest. The effort required can be considerably greater in a general-purpose language such as C, C++, or Java, which do not have statistics-gathering capabilities to aid the programmer.

Two sets ofstatistics that can give a quick indication ofmodel reasonableness are current contents and total count. These statistics apply to any system having items of some kind flowing through it, whether these items be called customers, transactions, inventory, or vehicles. Current contents refers to the number of items in each component of the system at a given time. Total count refers to the tota number of items that have entered each component of the system by a given time. In some simulation software, these statistics are kept automatically and can be displayed at any point in simulation time. In other simulation software, simple counters might have to be added to the operational mode and displayed at appropriate times. If the current contents in some portion of the system are high, this condition indicates that a large number of entities are delayed. If the output is displayed for successively longer simulation run times and the current contents tend to grow in a more or less linear fashion, it is highly likely that a queue is unstable and that the server(s) will fall further behind as time continues. This indicates possibly that the number of servers is too small or that a service time is misspecified On the other hand if the total count for some subsystem is zero this indicates that no items entered that subsystem—again, a highly suspect occurrence. Another possibility is tha the current count and total count are equal to one. This could indicate that an entity has captured a resource, but never freed that resource. Careful evaluation of these statistics for various run lengths can aid in the detection of mistakes in model logic and data misspecifications. Checking for outpu reasonableness will usually fail to detect the more subtle errors, but it is one of the quickest ways to discover gross errors. To aid in error detection, it is best for the model developer to forecast a reasonable range for the value of selected output statistics before making a run of the model. Such a forecast reduces the possibility of rationalizing a discrepancy and failing to investigate the cause o unusual output.

For certain models, it is possible to consider more than whether a particular statistic is reasonable. It is possible to compute certain long-run measures of performance. For example, the analys can compute the long-run server utilization for a large number of queueing systems without any special assumptions regarding interarrival or service-time distributions. Typically, the only information needed is the network configuration, plus arrival and service rates. Any measure of performance that can be computed analytically and then compared to its simulated counterpart provides another valuable tool for verification. Presumably, the objective of the simulation is to estimate some measure of performance, such as mean response time, that cannot be computed analytically; but, all the measures of performance in a queueing system are interrelated. Thus, if a simulation mode is predicting one measure (such as utilization) correctly, then confidence in the model’s predictive ability for other related measures (such as response time) is increased (even though the exact rela tion between the two measures is, of course, unknown in general and varies from model to model). Conversely, if a model incorrectly predicts utilization, its prediction of other quantities, such as mean response time, is highly suspect.

Another important way to aid the verification process is the oft-neglected documentation phase. If a model builder writes brief comments in the operational model, plus definitions of all variables and parameters, plus descriptions of each major section of the operational model, it becomes much simpler for someone else, or the model builder at a later date, to verify the model logic. Documentation is also important as a means of clarifying the logic of a model and verifying its completeness.

A more sophisticated technique is the use of a trace. In general, a trace provides detailed, timestamped simulation output representing the values for a selected set of system states, entity attributes, and model variables whenever an event occurs. That is, at the time an event occurs, the model would write detailed status information to a file for later examination by the model developer to assist in model verification and the detection of modeling errors

Example 1

When verifying the operational model (in a general-purpose language such as C, C++ or Java, or most simulation languages) of the single-server queue model of Example 5 from the “Simulation Examples in a Spreadsheet” chapter, an analyst made a run over 16 units of time and observed that the time-average length of the waiting line was L^Q=0.4375\hat {L} _ {Q} = 0 . 4375 customer, which is certainly reasonable for a short run of only 16 time units. Nevertheless, the analyst decided that a more detailed verification would be of value.

The trace in Figure 2 gives the hypothetical trace output from simulation time CLOCK 0 to CLOCK 16 for the simple single-server queue of Example 5 from the “Simulation Examples in a Spreadsheet” chapter. This example illustrates how an error can be found with a trace, when no error was apparent from the examination of the summary output statistics (such as L^Q)\hat {L} _ {Q} ). Note that, at simulation time CLOCK 3, the number of customers in the system is NCUST=1\mathrm{N C U S T} = 1, but the server is idle (STATUS 0). The source of this error could be incorrect logic, or simply not setting the attribute STATUS to the value 1 (when coding in a general-purpose language or most simulation languages).

In any case, the error must be found and corrected. Note that the less sophisticated practice of examining the summary measures, or output, did not detect the error. By using equation L^=1T∑i=0∞iTi=∑i=0∞i(TiT){\hat {L}} = {\textstyle {\frac {1} {T}}} \sum_{i = 0} ^ {\infty} i T_{i} = \sum_{i = 0} ^ {\infty} i \left( {\frac {T_{i}} {T}} \right), the reader can verify that L^Q\hat {L} _ {Q} was computed correctly from the data (L^Q( \hat {L} _ {Q} is the time-average value of NCUST minus STATUS):

L^Q=(0−0)3+(1−0)2+(0−0)6+(1−0)1+(2−1)43+2+6+1+4=716=0.4375 \begin{array}{r l} \hat {L} _ {Q} & = \frac {(0 - 0) 3 + (1 - 0) 2 + (0 - 0) 6 + (1 - 0) 1 + (2 - 1) 4}{3 + 2 + 6 + 1 + 4} \\ & = \frac {7}{16} = 0. 4375 \end{array}

as previously mentioned. Thus, the output measure L^Q\hat {L} _ {Q} had a reasonable value and was computed correctly from the data, but its value was indeed wrong because the attribute STATUS was not assuming correct values. As is seen from Figure 2, a trace yields information on the actual history of the model that is more detailed and informative than the summary measures alone.

Most simulation software has a built-in capability to conduct a trace without the programmer having to do any extensive programming. In addition, a ‘print’ or ‘write’ statement can be used to implement a tracing capability in a general-purpose language.

As can be easily imagined, a trace over a large span of simulation time can quickly produce an extremely large amount of output, which would be extremely cumbersome to check in detail for correctness. The purpose of the trace is to verify the correctness of the computer program by making detailed paper-and-pencil calculations. To make this practical, a simulation with a trace is usually

Definition of Variables:
CLOCK = Simulation clock
EVTYP = Event type (start, arrival, departure, or stop)
NCUST = Number of customers in system at time given by CLOCK
STATUS = Status of server (1-busy, 0-idle)

State of System Just After the Named Event Occurs:
CLOCK = 0    EVTYP = ‘Start’    NCUST = 0    STATUS = 0
CLOCK = 3    EVTYP = ‘Arrival’    NCUST = 1    STATUS = 0
CLOCK = 5    EVTYP = ‘Depart’    NCUST = 0    STATUS = 0
CLOCK = 11    EVTYP = ‘Arrival’    NCUST = 1    STATUS = 0
CLOCK = 12    EVTYP = ‘Arrival’    NCUST = 2    STATUS = 1
CLOCK = 16    EVTYP = ‘Depart’    NCUST = 1    STATUS = 1
.
.
.
.

Figure 2 Simulation Trace.

restricted to a very short period of time. It is desirable, of course, to ensure that each type of event (such as Arrival) occurs at least once, so that its consequences and effect on the model can be checked for accuracy. If an event is especially rare in occurrence, it may be necessary to use artificial data to force it to occur during a simulation of short duration. This is legitimate, as the purpose is to verify that the effect on the system of the rare event is as intended.

Some software allows a selective trace. For example, a trace could be set for specific locations in the model or could be triggered to begin at a specified simulation time. Whenever an entity goes through the designated locations, the simulation software writes a time-stamped message to a trace file. Some simulation software allows for tracing a selected entity; any time the designated entity becomes active, the trace is activated and time-stamped messages are written. This trace is very useful in following one entity through the entire model. Another example of a selective trace is to set it for the occurrence of a particular condition. For example, whenever the queue before a certain resource reaches five or more, turn on the trace. This allows running the simulation until something unusual occurs, then examining the behavior from that point forward in time. Different simulation software packages support tracing to various extents. In practice, it is often implemented by the model developer by adding printed messages at appropriate points into a model.

Of the three classes of techniques—the common-sense techniques, thorough documentation, and traces—it is recommended that the first two always be carried out. Close examination of mode output for reasonableness is especially valuable and informative. A generalized trace may provide voluminous data, far more than can be used or examined carefully. A selective trace can provide useful information on key model components and keep the amount of data to a manageable level.

3 Calibration and Validation of Models

Calibration and validation, although conceptually distinct, usually are conducted simultaneously by the modeler. Validation is the overall process of comparing the model and its behavior to the rea system and its behavior. Calibration is the iterativeprocess of comparing the model to the real system, making adjustments (or even major changes) to the model, comparing the revised model to reality, making additional adjustments, comparing again, and so on. Figure 3 shows the relationship of mode calibration to the overall validation process. The comparison of the model to reality is carried out by a variety of tests—some subjective, others objective. Subjective tests usually involve people, who are knowledgeable about one or more aspects of the system, making judgments about the model and its output. Objective tests always require data on the system’s behavior, plus the corresponding data produced by the model. Then one or more statistical tests are performed to compare some aspect of the system data set with the same aspect of the model data set. This iterative process of comparing model with system and then revising both the conceptual and operational models to accommodate any perceived model deficiencies is continued until the model is judged to be sufficiently accurate.

A possible criticism of the calibration phase, were it to stop at this point, is that the model has been validated only for the one data set used—that is, the model has been “fitted” to one data set. One way to alleviate this criticism is to collect a new set of system data (or to reserve a portion of the original system data) to be used at this final stage of validation. That is, after the model has been calibrated by using the original system data set, a “final” validation is conducted, using the second system data set. If unacceptable discrepancies between the model and the real system are discovered in the “final” validation effort, the modeler must return to the calibration phase and modify the mode until it becomes acceptable.

Figure 3 Iterative process of calibrating a model.

Validation is not an either/or proposition—no model is ever totally representative of the system under study. In addition, each revision of the model, as pictured in Figure 3, involves some cost, time, and effort. The modeler must weigh the possible, but not guaranteed, increase in model accuracy versus the cost of increased validation effort. Usually, the modeler (and model users) have some maximum discrepancy between model predictions and system behavior that would be acceptable. If this level of accuracy cannot be obtained within the budget constraints, either expectations of mode accuracy must be lowered, or the model must be abandoned.

As an aid in the validation process, Naylor and Finger [1967] formulated a three-step approach that has been widely followed:

Step 1. Build a model that has high face validity.

Step 2. Validate model assumptions.

Step 3. Compare the model input-output transformations to corresponding input-output transformations for the real system.

The next five subsections investigate these three steps in detail.

3.1 Face Validity

The first goal of the simulation modeler is to construct a model that appears reasonable on its face to model users and others who are knowledgeable about the real system being simulated. The potentia users of a model should be involved in model construction from its conceptualization to its implementation, to ensure that a high degree of realism is built into the model through reasonable assumptions regarding system structure and through reliable data. Potential users and knowledgeable people can also evaluate model output for reasonableness and can aid in identifying model deficiencies. Thus, the users can be involved in the calibration process as the model is improved iteratively by the insights gained from identification of the initial model deficiencies. Another advantage of user involvement is the increase in the model’s perceived validity, or credibility, without which a manager would no be willing to trust simulation results as a basis for decision making.

Sensitivity analysis can also be used to check a model’s face validity. The model user is asked whether the model behaves in the expected way when one or more input variables is changed. For example, in most queueing systems, if the arrival rate of customers (or demands for service) were to increase, it would be expected that utilizations of servers, lengths of lines, and delays would tend to increase (although by how much might well be unknown). From experience and from observations on the real system (or similar related systems), the model user and model builder would probably have some notion at least of the direction of change in model output when an input variable is increased or decreased. For most large-scale simulation models, there are many input variables and thus many possible sensitivity tests. The model builder must attempt to choose the most critical input variables for testing if it is too expensive or time consuming to vary all input variables. If real system data are available for at least two settings of the input parameters, objective scientific sensitivity tests can be conducted via appropriate statistical techniques.

3.2 Validation of Model Assumptions

Model assumptions fall into two general classes: structural assumptions and data assumptions. Structural assumptions involve questions of how the system operates and usually involve simplifications and abstractions of reality. For example, consider the customer queueing and service facility in a bank. Customers can form one line, or there can be an individual line for each teller. If there are many lines, customers could be served strictly on a first-come-first-served basis, or some customers could change lines if one line is moving faster. The number of tellers could be fixed or variable. These structural assumptions should be verified by actual observation during appropriate time periods and by discussions with managers and tellers regarding bank policies and actual implementation of these policies.

Data assumptions should be based on the collection ofreliable data and correct statistical analysis of the data. For example, in the bank study previously mentioned, data were collected on

  1. interarrival times of customers during several 2-hour periods of peak loading (“rush-hour” traffic);

  2. interarrival times during a slack period;

  3. service times for commercial accounts;

  4. service times for personal accounts.

The reliability of the data was verified by consultation with bank managers, who identified typica rush hours and typical slack times. When combining two or more data sets collected at differen times, data reliability can be further enhanced by objective statistical tests for homogeneity of data. (Do two data sets X and Y on service times for personal accounts, collected at two differen times, come from the same parent population? If so, the two sets can be combined.) Additional tests might be required, to test for correlation in the data. As soon as the analyst is assured of dealing with a random sample (i.e., correlation is not present), the statistical analysis can begin.

Whether done manually or by special-purpose software, the analysis consists of three steps:

Step 1. Identify an appropriate probability distribution.

Step 2. Estimate the parameters of the hypothesized distribution.

Step 3. Validate the assumed statistical model by a goodness-of-fit test, such as the chi-square or Kolmogorov–Smirnov test, and by graphical methods.

The use of goodness-of-fit tests is an important part of the validation of data assumptions.

3.3 Validating Input-Output Transformations

The ultimate test of a model, and in fact the only objective test of the model as a whole, is the model’s ability to predict the future behavior of the real system when the model input data match the rea inputs and when a policy implemented in the model is implemented at some point in the system. Furthermore, if the level of some input variables (e.g., the arrival rate of customers to a service facility) were to increase or decrease, the model should accurately predict what would happen in the real system under similar circumstances. In other words, the structure of the model should be accurate enough for the model to make good predictions, not just for one input data set, but for the range of input data sets that are of interest.

In this phase of the validation process, the model is viewed as an input-output transformation— that is, the model accepts values of the input parameters and transforms these inputs into outpu measures of performance. It is this correspondence that is being validated.

Instead ofvalidating the model input-output transformations by predicting the future, the modeler could use historical data that have been reserved for validation purposes only—that is, if one data set has been used to develop and calibrate the model, it is recommended that a separate data set be used as the final validation test. Thus, accurate “prediction of the past” can replace prediction of the future for the purpose of validating the model.

A model is usually developed with primary interest in a specific set of system responses to be measured under some range of input conditions. For example, in a queueing system, the responses may be server utilization and customer delay, and the range of input conditions (or input variables) may include two or three servers at some station and a choice of scheduling rules. In a production system, the response may be throughput (i.e., production per hour), and the input conditions may be a choice of several machines that run at different speeds, with each machine having its own breakdown and maintenance characteristics.

In any case, the modeler should use the main responses of interest as the primary criteria for validating a model. If the model is used later for a purpose different from its original purpose, the model should be revalidated in terms of the new responses of interest and under the possibly new input conditions.

A necessary condition for the validation of input-output transformations is that some version of the system under study exist, so that system data under at least one set of input conditions can be collected to compare to model predictions. If the system is in the planning stages and no system operating data can be collected, complete input-output validation is not possible. Other types o validation should be conducted, to the extent possible. In some cases, subsystems of the planned system may exist, and a partial input-output validation can be conducted.

Presumably, the model will be used to compare alternative system designs or to investigate system behavior under a range of new input conditions. Assume for now that some version of the system is operating and that the model of the existing system has been validated. What, then, can be said about the validity of the model when different inputs are used? That is, if model inputs are being changed to represent a new system design, or a new way to operate the system, or even hypothesized future conditions, what can be said about the validity of the model with respect to this new bu nonexistent proposed system or to the system under new input conditions?

First, the responses of the two models under similar input conditions will be used as the criteria for comparison of the existing system to the proposed system. Validation increases the modeler’s confidence that the model of the existing system is accurate. Second, in many cases, the proposed system is a modification of the existing system, and the modeler hopes that confidence in the mode of the existing system can be transferred to the model of the new system. This transfer of confidence usually can be justified if the new model is a relatively minor modification of the old model in terms of changes to the operational model (it may be a major change for the actual system). Changes in the operational model ranging from relatively minor to relatively major include the following:

  1. minor changes of single numerical parameters, such as the speed of a machine, the arrival rate of customers (with no change in distributional form of interarrival times), the number of servers in a parallel service center, or the mean time to failure or mean time to repair of a machine;

  2. minor changes in the form of a statistical distribution, such as the distribution of a service time or a time to failure of a machine;

  3. major changes in the logical structure of a subsystem, such as a change in queue discipline for a waiting-line model or a change in the scheduling rule for a job-shop model;

  4. major changes involving a different design for the new system, such as a computerized inventory control system replacing an older noncomputerized system, or an automated storageand-retrieval system replacing a warehouse system in which workers manually pick items using fork trucks.

If the change to the operational model is minor, such as in items 1 or 2, these changes can be carefully verified and output from the new model accepted with considerable confidence. If a sufficiently similar subsystem exists elsewhere, it might be possible to validate the submodel tha represents the subsystem and then to integrate this submodel with other validated submodels to build a complete model. In this way, partial validation of the substantial model changes in items 3 and 4 might be possible. Unfortunately, there is no way to validate the input-output transformations of a model of a nonexisting system completely. In any case, within time and budget constraints, the modeler should use as many validation techniques as possible, including input-output validation o subsystem models if operating data can be collected on such subsystems.

Example 2 will illustrate some of the techniques that are possible for input-output validation and will discuss the concepts of an input variable, uncontrollable variable, decision variable, outpu or response variable, and input-output transformation in more detail.

Example 2: The Fifth National Bank of Jaspar

The Fifth National Bank of Jaspar, as shown in Figure 4, is planning to expand its drive-in service at the corner of Main Street. Currently. there is one drive-in window serviced by one teller. Only one or two transactions are allowed at the drive-in window, so it was assumed that each service time was a random sample from some underlying population. Service times {Si,i=1,2,…,90}\{S_{i} , i = 1 , 2 , \ldots , 90 \} and interarrival times {Ai,i=1,2,…,90}\{A_{i} , i = 1 , 2 , \ldots , 90 \} were collected for the 90 customers who arrived between 11:00 A.M. and 1:00 P.M. on a Friday. This time slot was selected for data collection after consultation with management and the teller because it was felt to be representative of a typical rush hour.

Data analysis led to the conclusion that arrivals could be modeled as a Poisson process at a rate of 45 customers per hour and that service times were approximately normally distributed, with mean

Figure 4 Drive-in window at the Fifth National Bank.

1.1 minutes and standard deviation 0.2 minute. Thus, the model has two input variables:

  1. interarrival times, exponentially distributed (i.e., a Poisson arrival process) at rate λ=45\lambda = 45 per hour;

  2. service times, assumed to be N(1.1,(0.2)2)N ( 1 . 1 , ( 0 . 2 ) ^ {2} ) Each input variable has a level: the rate λ=45\lambda = 45 per hour for the interarrival times, and the mean 1.1 minutes and standard deviation 0.2 minute for the service times. The interarrival times are examples of uncontrollable variables (i.e., uncontrollable by management in the real system). The service times are also treated as uncontrollable variables, although the level of the service times might be partially controllable. If the mean service time could be decreased to 0.9 minute by installing a computer terminal, the level of the service-time variable becomes a decision variable or controllable parameter. Setting all decision variables at some level constitutes a policy. For example, the curren bank policy is one teller D1=1D_{1} = 1, mean service time D2=1.1D_{2} = 1 . 1 minutes, and one line for waiting cars D3 = 1. (D1,D2,...D_{3} \ = \ 1 . \ ( D_{1} , D_{2} , . . . are used to denote decision variables.) Decision variables are under management’s control; the uncontrollable variables, such as arrival rate and actual arrival times, are not under management’s control. The arrival rate might change from time to time, but such change is treated as being due to external factors not under management control.

Table 1 Input and Output Variables for Model of Current Bank Operations

Input VariablesModel Output Variables, Y
D = decision variablesVariables of primary interest to management (Y1, Y2, Y3)
X = other variables
Y1 = teller's utilization
Poisson arrivals at rate = 45/hourY2 = average delay
X11, X12, …Y3 = maximum line length
Service times, N(D2, 0.22)Other output variables of secondary interest
X21, X22, …
Y4 = observed arrival rate
D1 = 1 (one teller)Y5 = average service time
D2 = 1.1 minutes (mean service time)Y6 = sample standard deviation of service times
D3 = 1 (one line)
Y7 = average length of waiting line

A model of current bank operations was developed and verified in close consultation with bank management and employees. Model assumptions were validated, as discussed in Section 3.2. The resulting model is now viewed as a “black box” that takes all input-variable specifications and transforms them into a set of output or response variables. The output variables consist of all statistics of interest generated by the simulation about the model’s behavior. For example, management is interested in the teller’s utilization at the drive-in window (percent of time the teller is busy at the window), average delay in minutes of a customer from arrival to beginning of service, and the maximum length of the line during the rush hour. These input and output variables are shown in Figure 5 and are listed in Table 1, together with some additional output variables. The uncontrollable input variables are denoted by X, the decision variables by D, and the output variables by Y. From the “black box” point of view, the model takes the inputs X and D and produces the outputs Y,Y , namely

(X,D)→fY (X, D) \xrightarrow {f} Y

or

f(X,D)=Y f (X, D) = Y

Here f denotes the transformation that is due to the structure of the model. For the Fifth Nationa Bank study, the exponentially distributed interarrival time generated in the model between customer n−1n - 1 and customer n is denoted by X1nX_{1 n}. (Do not confuse X1nX_{1 n} with An;A_{n} ;; the latter was an observation made on the real system.) The normally distributed service time generated in the model for customer n is denoted by X2nX_{2 n}. The set of decision variables, or policy, is D=(D1,D2,D3)=(1,1.1,1)D = ( D_{1} , D_{2} , D_{3} ) = ( 1 , 1 . 1 , 1 )) for current operations. The output, or response, variables are denoted by Y=(Y1,Y2,…,Y7)Y = ( Y_{1} , Y_{2} , \dots , Y_{7} ) and are defined in Table 1.

For validation of the input-output transformations of the bank model to be possible, real system data must be available, comparable to at least some of the model output Y of Table 1. The system responses should have been collected during the same time period (from 11:00 A.M. to 1:00 P.M. on the same Friday) in which the input data {Ai,Si}\{A_{i} , S_{i} \} were collected. This is important because, if system response data were collected on a slower day (say, an arrival rate of 40 per hour), the system responses such as teller utilization Z1Z_{1}, average delay Z2,Z_{2} ,, and maximum line length Z3Z_{3} would be expected to be lower than the same variables during a time slot when the arrival rate was 45 per hour, as observed. Suppose that the delay of successive customers was measured on the same Friday between 11:00 A.M. and 1:00 P.M. and that the average delay was found to be Z2=4.3Z_{2} = 4 . 3 minutes. For the purpose of validation, we will consider this to be the true mean value μ0=4.3\mu_{0} = 4 . 3 Figure 5 Model input-output transformation.

When the model is run with generated random variates X1nX_{1 n} and X2nX_{2 n}, it is expected that observed values of average delay Y2Y_{2} should be close to Z2=4.3Z_{2} = 4 . 3 minutes. The generated input values X1nX_{1 n} and X2nX_{2 n} cannot be expected to replicate the actual input values AnA_{n} and SnS_{n} of the real system exactly, but they are expected to replicate the statistical pattern of the actual inputs. Hence, simulation-generated values of Y2Y_{2} are expected to be consistent with the observed system variable Z2=4.3Z_{2} = 4 . 3 minutes. Now consider how the modeler might test this consistency.

The modeler makes a small number of statistically independent replications of the model. Statistical independence is guaranteed by using nonoverlapping sets of random numbers produced by the random-number generator or by choosing seeds for each replication independently (from a random number table). The results of six independent replications, each of 2 hours duration, are given in Table 2.

Observed arrival rate Y4Y_{4} and sample average service time Y5Y_{5} for each replication of the model are also noted, to be compared with the specified values of 45/hour and 1.1 minutes, respectively. The validation test consists of comparing the system response, namely average delay Z2=4.3Z_{2} = 4 . 3 minutes, to the model responses Y2Y_{2}. Formally, a statistical test of the null hypothesis

versus

H0:E(Y2)=4.3minutesH1:E(Y2)≠4.3minutes(1) \begin{array}{l} H_{0}: E (Y_{2}) = 4. 3 \text{minutes} \\ H_{1}: E (Y_{2}) \neq 4. 3 \text{minutes} \end{array}\tag{1}

is conducted. If H0H_{0} is not rejected, then, on the basis of this test, there is no reason to consider the model invalid. If H0H_{0} is rejected, the current version of the model is rejected, and the modeler is forced to seek ways to improve the model, as illustrated by Figure 3. As formulated here, the appropriate statistical test is the t test, which is conducted in the following manner:

Choose a level of significance α and a sample size n. For the bank model, choose

α=0.05,n=6 \alpha = 0. 05, \quad n = 6

Compute the sample mean Yˉ2{\bar {Y}} _ {2} and the sample standard deviation S over the n replications, by using:

Yˉ2=1n∑i=1nY2i=2.51minutes \bar {Y} _ {2} = \frac {1}{n} \sum_{i = 1} ^ {n} Y_{2 i} = 2. 51 \text{minutes}

and

S=[∑i=1n(Y2i−Yˉ2)2n−1]1/2=0.82minute S = \left[ \frac {\sum_{i = 1} ^ {n} (Y_{2 i} - \bar {Y} _ {2}) ^ {2}}{n - 1} \right] ^ {1 / 2} = 0. 82 \text{minute}

where Y2i,i=1,…,6,Y_{2 i} , i = 1 , \ldots , 6 ,, are as shown in Table 2.

Get the critical value of t from Table A.5 in the Appendix. For a two-sided test, such as that in equation (1), use tα/2,n−1;t_{\alpha / 2 , n - 1} ; for a one-sided test, use tα,n−1or−tα,n−1t_{\alpha , n - 1} \mathrm{o r} - t_{\alpha , n - 1}, as appropriate (n 1 being the degrees of freedom). From Table A.5,t0.025,5=2.571\mathrm{A} . 5 , t_{0 . 025 , 5} = 2 . 571 for a two-sided test.

Table 2 Results of Six Replications of the Bank Model

ReplicationY4Y_4(arrivals/hour)Y5Y_5(minutes)$ Y_2 = Average Delay $(minutes)
1511.072.79
2401.121.12
345.51.062.24
450.51.103.45
5531.093.13
6491.072.38
Sample mean2.51
Standard deviation0.82

Compute the test statistic

t0=Yˉ2−μ0S/n(2) t_{0} = \frac {\bar {Y} _ {2} - \mu_{0}}{S / \sqrt {n}}\tag{2}

where μ0\mu_{0} is the specified value in the null hypothesis H0H_{0}. Here μ0=4.3\mu_{0} = 4 . 3 minutes, so that

t0=2.51−4.30.82/6=−5.34 t_{0} = \frac {2 . 51 - 4 . 3}{0 . 82 / \sqrt {6}} = - 5. 34

For the two-sided test,$\mathrm{i f} \left| t_{0} \right| > t_{\alpha / 2 , n - 1} ,$, reject H0H_{0}. Otherwise, do not reject H0.H_{0} .. [For the one-sided test with H1:E(Y2)>μ0H_{1} : E ( Y_{2} ) > \mu_{0}, reject H0H_{0} if t>tα,n−1;t > t_{\alpha , n - 1} ; with H1:E(Y2)<μ0H_{1} : E ( Y_{2} ) < \mu_{0}, reject H0H_{0} if t<−tα,n−1.]t < - t_{\alpha , n - 1} . ] Since $| t | = 5 . 34 > t_{0 . 025 , 5} = 2 . 571 $, reject H0,H_{0} ,, and conclude that the model is inadequate in its prediction of average customer delay.

Recall that, in the testing of hypotheses, rejection of the null hypothesis H0H_{0} is a strong conclusion, because

P(H0rejected∣H0is true)=α(3) P (H_{0} \text{rejected} | H_{0} \text{is true}) = \alpha\tag{3}

and the level of significance α is chosen small, say α=0.05\alpha = 0 . 05, as was done here. Equation (3)( 3 ) says that the probability is low (α=0.05)( \alpha = 0 . 05 ) of making the error of rejecting H0H_{0} when H0H_{0} is in fact true —that is, the probability is small of declaring the model invalid when it is valid (with respect to the variable being tested). The assumptions justifying a t test are that the observations Y2iY_{2 i} are normally and independently distributed. Are these assumptions met in the present case?

  1. The ith observation Y2iY_{2 i} is the average delay of all drive-in customers who began service during the ith simulation run of 2 hours; thus, by a Central Limit Theorem effect, it is reasonable to assume that each observation Y2iY_{2 i} is approximately normally distributed, provided that the number of customers it is based on is not too small.

  2. The observations Y2i,i = 1,…,6.Y_{2 i} , i \ = \ 1 , \ldots , 6 ., are statistically independent by design—that is, by choosing the random-number seeds independently for each replication or by using nonoverlapping streams.

  3. The t statistic computed by Equation (2) is a robust statistic—that is, it is distributed approximately as the t distribution with n 1 degrees of freedom, even when Y21,Y22,…Y_{21} , Y_{22} , \ldots. are not exactly normally distributed, and thus the critical values in Table A.5 can reliably be used.

Now that the model of the Fifth National Bank of Jaspar has been found lacking, what should the modeler do? Upon further investigation, the modeler realized that the model contained two unstated assumptions:

  1. When a car arrived to find the window immediately available, the teller began service immediately.

  2. There is no delay between one service ending and the next beginning, when a car is waiting.

Assumption 2 was found to be approximately correct, because a service time was considered to begin when the teller actually began service but was not considered to have ended until the car had exited the drive-in window and the next car, if any, had begun service, or the teller saw that the line was empty. On the other hand, assumption 1 was found to be incorrect because the teller had other duties—mainly, serving walk-in customers if no cars were present—and tellers always finished with a previous customer before beginning service on a car. It was found that walk-in customers were always present during rush hour; that the transactions were mostly commercial in nature, taking a considerably longer time than the time required to service drive-up customers; and that, when an arriving car found no other cars at the window, it had to wait until the teller finished with the presen walk-in customer. To correct this model inadequacy, the structure of the model was changed to include the additional demand on the teller’s time, and data were collected on service times of walkin customers. Analysis of these data found that they were approximately exponentially distributed with a mean of 3 minutes.

The revised model was run, yielding the results in Table 3. A test of the null hypothesis H0H_{0}E(Y2)=4.3E ( Y_{2} ) = 4 . 3 minutes was again conducted, according to the procedure previously outlined.

Choose α=0.05\alpha = 0 . 05 and n=6n = 6(sample size).

Compute Yˉ2=4.78\bar {Y} _ {2} = 4 . 78 minutes,S=1.66S = 1 . 66 minutes.

Look up,{\mathrm{u p}} , in Table A.5, the critical value t0.25,5=2.571t_{0 . 25 , 5} = 2 . 571 Compute the test statistic t0=(Yˉ2−μ0)/(S/n)=0.710.t_{0} = ( \bar {Y} _ {2} - \mu_{0} ) / ( S / \sqrt {n} ) = 0 . 710 . Since $| t_{0} | < t_{0 . 025 , 5} = 2 . 571 $, do not reject H0H_{0}, and thus tentatively accept the model as valid.

Failure to reject H0H_{0} must be considered as a weak conclusion unless the power of the test has been estimated and found to be high (close to 1)—that is, it can be concluded only that the data at hand (Y21,…,Y26)( Y_{21} , \ldots , Y_{26} ) were not sufficient to reject the hypothesis H0:μ0=4.3H_{0} : \mu_{0} = 4 . 3 minutes. In other words, this test detects no inconsistency between the sample data (Y21,…,Y26)( Y_{21} , \ldots , Y_{26} ) and the specified mean μ0\mu_{0} The power of a test is the probability of detecting a departure from H0:μ=μ0H_{0} : \mu = \mu_{0} when, in fact, such a departure exists. In the validation context, the power of the test is the probability of detecting an invalid model. The power may also be expressed as 1 minus the probability of a Type II, or β,\beta , error, where β=P(TypeIIerror)=P(failing\beta = P ( \mathrm{T y p e I I e r r o r} ) = P ( \mathrm{f a i l i n g} to reject $ H_{0} | H_{1}$ is true) is the probability of accepting the model as valid when it is not valid.

Table 3 Results of Six Replications of the Revised Bank Model

ReplicationY4Y_4(arrivals/hour)Y5Y_5(minutes)$ Y_2 = Average Delay $(minutes)
1511.075.37
2401.111.98
345.51.065.29
450.51.093.82
5531.086.74
6491.085.49
Sample mean4.78
Standard deviation1.66

To consider failure to reject H0H_{0} as a strong conclusion, the modeler would want β\beta to be small. Now,β\beta depends on the sample size n and on the true difference between E(Y2)E ( Y_{2} ) and μ0=4.3\mu_{0} = 4 . 3 minutes—that is, on

δ=∣E(Y2)−μ0∣σ \delta = \frac {| E (Y_{2}) - \mu_{0} |}{\sigma}

where σ,\sigma , the population standard deviation of an individual Y2i,Y_{2 i} ,, is estimated by S. Tables A.10 and A.11 are typical operating-characteristic (OC) curves, which are graphs of the probability of a Type II error β(δ)\beta ( \delta ) versus δ for given sample size n. Table A.10 is for a two-sided t test; Table A.11 is for a one-sided t test. Suppose that the modeler would like to reject H0H_{0}(model validity) with probability at least 0.90 if the true mean delay of the model,E(Y2)E ( Y_{2} ), differed from the average delay in the system,μ0=4.3\mu_{0} = 4 . 3 minutes, by 1 minute. Then δ is estimated by

δ^=∣E(Y2)−μ0∣S=11.66=0.60 \hat {\delta} = \frac {| E (Y_{2}) - \mu_{0} |}{S} = \frac {1}{1 . 66} = 0. 60

For the two-sided test with α=0.05\alpha = 0 . 05, use of Table A.10 results in

β(δ^)=β(0.6)=0.75forn=6 \beta (\hat {\delta}) = \beta (0. 6) = 0. 75 \mathrm{for} n = 6

To guarantee that β(δ^)≤0.10\beta ( \hat {\delta} ) \leq 0 . 10, as was desired by the modeler, Table A.10 reveals that a sample size of approximately n=30n = 30 independent replications would be required—that is, for a sample size n=n =6 and assuming that the population standard deviation is 1.66, the probability of accepting H0H_{0}(mode validity), when, in fact, the model is invalid $( | E ( Y_{2} ) - \mu_{0} | = 1 $ minute), is β=0.75\beta = 0 . 75, which is quite high. If a 1-minute difference is critical, and if the modeler wants to control the risk of declaring the model valid when model predictions are as much as 1 minute off, a sample size of n=30n = 30 replications is required to achieve a power of 0.9. If this sample size is too high, either a higher β\beta risk (lower power) or a larger difference δ must be considered.

In general, it is always best to control the Type II error, or β\beta error, by specifying a critica difference δ and choosing a sample size by making use of an appropriate OC curve. (Computation of power and use of OC curves for a wide range of tests is discussed in Hines, Montgomery, Goldsman, and Borror [2002].) In summary, in the context of model validation, the Type I error is the rejection of a valid model and is easily controlled by specifying a small level of significance α, say,α=0.1\alpha = 0 . 10.05, or 0.01. The Type II error is the acceptance of a model as valid when it is invalid. For a fixed sample size n, increasing α will decrease β,\beta ,, the probability of a Type II error. Once α is set, and the critical difference to be detected is selected, the only way to decrease β\beta is to increase the sample size. A Type II error is the more serious of the two types of errors; thus, it is important to design the simulation experiments to control the risk of accepting an invalid model. The two types of error are summarized in Table 4, which compares statistical terminology to modeling terminology.

Note that validation is not to be viewed as an either/or proposition, but rather should be viewed in the context of calibrating a model, as conceptually exhibited in Figure 3. If the current version of the bank model produces estimates of average delay Y2Y_{2} that are not close enough to real system behavior (μ0=4.3minutes)( \mu_{0} = 4 . 3 \mathrm{m i n u t e s} ), the source of the discrepancy is sought, and the model is revised in light of this new knowledge. This iterative scheme is repeated until model accuracy is judged adequate.

Table 4 Types of Error in Model Validation

Statistical TerminologyModeling TerminologyAssociated Risk
Type I: rejecting H0H_0 when H0H_0 is trueRejecting a valid modelα\alpha
Type II: failure to reject H0H_0 when H1H_1 is trueFailure to reject an invalid modelβ\beta

Philosophically, the hypothesis-testing approach tries to evaluate whether the simulation and the real system are the same with respect to some output performance measure or measures. A different, but closely related, approach is to attempt to evaluate whether the simulation and the real-system performance measures are close enough by using confidence intervals.

We continue to assume that there is a known output performance measure for the existing system, denoted by μ0.\mu_{0} ., and an unknown performance measure of the simulation,μ\mu, that we hope is close. The hypothesis-testing formulation tested whether μ=μ0;\mu = \mu_{0} ; the confidence-interval formulation tries to bound the difference $| \mu - \mu_{0} |$ to see whether it is ≤ε,\leq \varepsilon ,, a difference that is small enough to allow valid decisions to be based on the simulation. The value of ε is set by the analyst.

Specifically, if YY is the simulation output and μ=E(Y)\mu = E ( Y ), then we execute the simulation and form a confidence interval for μ.\mu ., such as Yˉ±tα/2,n−1S/n\bar {Y} \pm t_{\alpha / 2 , n - 1} S / \sqrt {n}. The determination of whether to accep the model as valid or to refine the model depends on the best-case and worst-case error implied by the confidence interval.

  1. Suppose the confidence interval does not contain μ0\mu_{0}. [See Figure 6(a).]

(a) If the best-case error is >ε,> \varepsilon , then the difference in performance is large enough, even in the best case, to indicate that we need to refine the simulation model.

(b) If the worst-case error i ≤ε,\leq \varepsilon ,, then we can accept the simulation model as close enough to be considered valid.

(c) If the best-case error is ≤ε,\leq \varepsilon ,, but the worst-case error is >ε,> \varepsilon , then additional simulation replications are necessary to shrink the confidence interval until a conclusion can be reached.

  1. Suppose the confidence interval does contain μ0.\mu_{0} .. [See Figure 6(b).]6 ( \mathbf{b} ) . ](a) If either the best-case or worst-case error is >ε,> \varepsilon , then additional simulation replications are necessary to shrink the confidence interval until a conclusion can be reached.

(b) If the worst-case error is≤ε,{\mathrm{i s}} \leq \varepsilon ,, then we can accept the simulation model as close enough to be considered valid.

In Example 2,μ0=4.32 , \mu_{0} = 4 . 3 minutes, and “close enough” was ε=1\varepsilon = 1 minute of expected customer delay. A 95% confidence interval, based on the 6 replications in Table 2, is

Yˉ±t0.025,5S/n \bar {Y} \pm t_{0. 025, 5} S / \sqrt {n} 2.51±2.571(0.82/6) 2. 51 \pm 2. 571 (0. 82 / \sqrt {6})

(a)

Figure 6 Validation of the input-output transformation (a) when the known value falls outside, and (b) when the known value falls inside, the confidence interval.

yielding the interval [1.65, 3.37]. As in Figure 6(a),μ0=4.3\mu_{0} = 4 . 3 falls outside the confidence interval. Since in the best case $| 3 . 37 - 4 . 3 | = 0 . 93 < 1 $, but in the worst case $| 1 . 65 - 4 . 3 | = 2 . 65 > 1 $ additional replications are needed to reach a decision.

3.4 Input-Output Validation: Using Historical Input Data

When using artificially generated data as input data, as was done to test the validity of the bank models in Section 3.3, the modeler expects the model to produce event patterns that are compatible with, but not identical to, the event patterns that occurred in the real system during the period of data collection. Thus, in the bank model, artificial input data {X1n,X2n,n=1,2,...}\{X_{1 n} , X_{2 n} , n = 1 , 2 , . . . \} for interarriva and service times were generated, and replicates of the output data Y2Y_{2} were compared to what was observed in the real system by means of the hypothesis test stated in equation (1). An alternative to generating input data is to use the actual historical record,{An,Sn,n=1,2,…}\{A_{n} , S_{n} , n = 1 , 2 , \ldots \}, to drive the simulation model and then to compare model output with system data.

To implement this technique for the bank model, the data A1,A2,…A_{1} , A_{2} , \dotsc. and S1,S2,…S_{1} , S_{2} , \ldots. would have to be entered into the model into arrays, or stored in a file to be read as the need arose. Just after customer n arrived at time tn=∑i=1nAi.\begin{array} {r} {t_{n} = \sum_{i = 1} ^ {n} A_{i} .} \end{array}, customer n 1 would be scheduled on the future event list to arrive at future time tn+An+1t_{n} + A_{n + 1}(without any random numbers being generated). If customer n were to begin service at time tn′.t_{n} ^ {\prime} ., a service completion would be scheduled to occur at time tn′+Snt_{n} ^ {\prime} + S_{n} This event scheduling without random-number generation could be implemented quite easily in a general-purpose programming language or most simulation languages by using arrays to store the data or reading the data from a file.

When using this technique, the modeler hopes that the simulation will duplicate as closely as possible the important events that occurred in the real system. In the model of the Fifth National Bank of Jaspar, the arrival times and service durations will exactly duplicate what happened in the rea system on that Friday between 11:00 A.M. and 1:00 P.M. If the model is sufficiently accurate, then the delays of customers, lengths of lines, utilizations of servers, and departure times of customers predicted by the model will be close to what actually happened in the real system. It is, of course, the model-builder’s and model-user’s judgment that determines the level of accuracy required.

To conduct a validation test using historical input data, it is important that all the input data (An,Sn,…)( A_{n} , S_{n} , \ldots ) and all the system response data, such as average delay (Z2)( Z_{2} ), be collected during the same time period. Otherwise, the comparison of model responses to system responses, such as the comparison of average delay in the model (Y2)( Y_{2} ) to that in the system (Z2)( Z_{2} ), could be misleading. The responses Y2Y_{2} and Z2Z_{2} depend both on the inputs AnA_{n} and SnS_{n} and on the structure of the system (or model). Implementation of this technique could be difficult for a large system, because of the need for simultaneous data collection of all input variables and those response variables of primary interest. In some systems, electronic counters and devices are used to ease the data-collection task by automatically recording certain types of data. The following example was based on two simulation models reported in Carson et al. [1981a, b], in which simultaneous data collection and the subsequen validation were both completed successfully.

Example 3: The Candy Factory

The production line at the Sweet Lil’ Things Candy Factory in Decatur consists of three machines that make, package, and box their famous candy. One machine (the candy maker) makes and wraps individual pieces of candy and sends them by conveyor to the packer. The second machine (the packer) packs the individual pieces into a box. A third machine (the box maker) forms the boxes and supplies them by conveyor to the packer. The system is illustrated in Figure 7.

Each machine is subject to random breakdowns due to jams and other causes. These breakdowns cause the conveyor to begin to empty or fill. The conveyors between the two makers and the packer are used as a temporary storage buffer for in-process inventory. In addition to the randomly occurring breakdowns, if the candy conveyor empties, a packer runtime is interrupted and the packer remains idle until more candy is produced. If the box conveyor empties because of a long random breakdown of the box machine, an operator manually places racks of boxes onto the packing machine. If a conveyor fills, the corresponding maker becomes idle. The purpose of the model is to investigate the frequency of those operator interventions that require manual loading of racks of boxes as a function of various combinations of individual machines and lengths of conveyor. Different machines have different production speeds and breakdown characteristics, and longer conveyors can hold more inprocess inventory. The goal is to hold operator interventions to an acceptable level while maximizing production. Machine stoppages (whether due to a full or an empty conveyor) cause damage to the product, so this is also a factor in production.

Figure 7 Production line at the candy factory.

A simulation model of the candy factory was developed, and a validation effort using historical inputs was conducted. Engineers in the candy factory set aside a 4-hour time slot from 7:00 A.M. to 11:00 A.M. to collect data on an existing production line. For each machine—say, machine i—time to failure and downtime duration

Ti1,Di1,Ti2,Di2… T_{i 1}, D_{i 1}, T_{i 2}, D_{i 2} \dots

were collected. For machine i(i=1,2,3)i ( i = 1 , 2 , 3 )TijT_{i j} is the jth runtime (or time to failure), and DijD_{i j} is the successive downtime. A runtime TijT_{i j} can be interrupted by a full or empty conveyor (as appropriate), but resumes when conditions are right. Initial system conditions at 7:00 A.M. were recorded so that they could be duplicated in the model as initial conditions at time 0. Additionally, system responses of primary interest—the production level Z1Z_{1}, and the number Z2Z_{2} and time of occurrence Z3Z_{3} of operator interventions—were recorded for comparison with model predictions.

The system input data TijT_{i j} and DijD_{i j} were fed into the model and used as runtimes and random downtimes. The structure of the model determined the occurrence of shutdowns due to a full or empty conveyor and the occurrence of operator interventions. Model response variables Yi,i=1,2,3Y_{i} , i = 1 , 2 , 3 were collected for comparison to the corresponding system response variables Zi,i=1,2,3Z_{i} , i = 1 , 2 , 3 The closeness of model predictions to system performance aided the engineering staff considerably in convincing management of the validity of the model. These results are shown in Table 5. A simple display such as Table 5 can be quite effective in convincing skeptical engineers and managers of a model’s validity—perhaps more effectively than the most sophisticated statistical methods!

With only one set of historical input and output data, only one set of simulated output data can be obtained, and thus no simple statistical tests based on summary measures are possible. However, if K historical input data sets are collected, and K observations Zi1,Zi2,…,ZiKZ_{i 1} , Z_{i 2} , \dots , Z_{i K} of some system response variable ZiZ_{i} are collected, such that the output measure ZijZ_{i j} corresponds to thejth input set, an objective statistical test becomes possible. For example,ZijZ_{i j} could be the average delay of all customers who were served during the time the jth input data set was collected. With the K input data sets in hand, the modeler now runs the model K times, once for each input set, and observes the simulated results Wi1,Wi2,…,WiKW_{i 1} , W_{i 2} , \dots , W_{i K} corresponding to Zij,j=1,…,KZ_{i j} , j = 1 , \ldots , K. Continuing the same example,WijW_{i j} would be the average delay predicted by the model for the jth input set. The data available for comparison appears as in Table 6.

Table 5 Validation of the Candy-Factory Model

Response iSystem ZiZ_iModel YiY_i
1. Production level897,208883,150
2. Number of operator interventions33
3. Time of occurrence7:22, 8:41, 10:107:24, 8:42, 10:14

Table 6 Comparison of System and Model Output Measures for Identical Historical Inputs

Input Data SetSystem Output ZijZ_{ij}Model Output WijW_{ij}Observed Difference djd_jSquared Deviation from Mean (dj−dˉ)2(d_j - \bar{d})^2
1Zi1Z_{i1}Wi1W_{i1}d1=Zi1−Wi1d_1 = Z_{i1} - W_{i1}(d1−dˉ)2(d_1 - \bar{d})^2
2Zi2Z_{i2}Wi2W_{i2}d2=Zi2−Wi2d_2 = Z_{i2} - W_{i2}(d2−dˉ)2(d_2 - \bar{d})^2
3Zi3Z_{i3}Wi3W_{i3}d3=Zi3−Wi3d_3 = Z_{i3} - W_{i3}(d3−dˉ)2(d_3 - \bar{d})^2
.....
.....
.....
KZiKZ_{iK}WiKW_{iK}dK=ZiK−WiKd_K = Z_{iK} - W_{iK}(dK−dˉ)2(d_K - \bar{d})^2
dˉ=1K∑j=1Kdj\bar{d} = \frac{1}{K} \sum_{j=1}^{K} d_jSd2=1K−1∑j=1K(dj−dˉ)2S_d^2 = \frac{1}{K-1} \sum_{j=1}^{K} (d_j - \bar{d})^2

If the K input data sets are fairly homogeneous, it is reasonable to assume that the K observed differences dj=Zij−Wij, j=1,…,Kd_{j} = Z_{i j} - W_{i j} , \thinspace j = 1 , \ldots , K, are identically distributed. Furthermore, if the collection o the K sets of input data was separated in time—say, on different days—it is reasonable to assume tha the K differences d1,…,dKd_{1} , \ldots , d_{K} are statistically independent and, hence, that the differences d1,…,dKd_{1} , \ldots , d_{K} constitute a random sample. In many cases, each ZiZ_{i} and WiW_{i} is a sample average over customers, and so (by the Central Limit Theorem) the differences dj=Zij−Wijd_{j} = Z_{i j} - W_{i j} are approximately normally distributed with some mean μd\mu_{d} and variance σd2.\sigma_{d} ^ {2} .. The appropriate statistical test is then a t test of the null hypothesis of no mean difference:

H0:μd=0 H_{0}: \mu_{d} = 0

versus the alternative of significant difference:

H1:μd≠0 H_{1}: \mu_{d} \neq 0

The proper test is a paired t test (Zi1( Z_{i 1} is paired with Wi1W_{i 1}, each having been produced by the first input data set, and so on). First, compute the sample mean difference, d¯ , and the sample variance,Sd2.S_{d} ^ {2} ., by the formulas given in Table 6. Then, compute the t statistic as

t0=dˉ−μdSd/K(4) t_{0} = \frac {\bar {d} - \mu_{d}}{S_{d} / \sqrt {K}}\tag{4}

(with μd = 0)\mu_{d} ~ = ~ 0 ), and get the critical value tα/2,K−1t_{\alpha / 2 , K - 1} from Table A.5, where α is the prespecified significance level and K−1K - 1 is the number of degrees of freedom. If $| t_{0} | > t_{\alpha / 2 , K - 1} ,$, reject the hypothesis H0H_{0} of no mean difference, and conclude that the model is inadequate. If t ≤tα/2,K−1\leq t_{\alpha / 2 , K - 1} do not reject H0H_{0}, and hence conclude that this test provides no evidence of model inadequacy.

Engineers at the Sweet Lil’ Things Candy Factory decided to expand the initial validation effort reported in Example 3. Electronic devices were installed that could automatically monitor one of the production lines, and the validation effort of Example 3 was repeated with K 5 sets of input data. The system and the model were compared on the basis of production level. The results are shown in Table 7.

A paired t test was conducted to test H0:μd=0.H_{0} : \mu_{d} = 0 ., or equivalently,H0:E(Z1)=E(W1)H_{0} : E ( Z_{1} ) = E ( W_{1} ), where Z1Z_{1} is the system production level and W1W_{1} is the production level predicted by the simulated model. Let the level of significance be α=0.05\alpha = 0 . 05. Using the results in Table 7, the test statistic, as given by equation (4), is

t0=dˉSd/K=5343.28705.85/5=1.37 t_{0} = \frac {\bar {d}}{S_{d} / \sqrt {K}} = \frac {5343 . 2}{8705 . 85 / \sqrt {5}} = 1. 37

From Table A.5, the critical value is tα/2,K−1=t0.025,4=2.78t_{\alpha / 2 , K - 1} = t_{0 . 025 , 4} = 2 . 78. Since $| t_{0} | = 1 . 37 < t_{0 . 025 , 4} =$2.78, the null hypothesis cannot be rejected on the basis of this test—that is, no inconsistency is detected between system response and model predictions in terms of mean production level. If H0H_{0} had been rejected, the modeler would have searched for the cause of the discrepancy and revised the model, in the spirit of Figure 3.

Table 7 Validation of the Candy-Factory Model (cont.)

Input Data Set jSystem Production Z1jZ_{1j}Model Production W1jW_{1j}Observed Difference djd_jSquared Deviation from Mean (dj−dˉ)2(d_j - \bar{d})^2
1897,208883,15014,0587.594×1077.594 \times 10^7
2629,126630,550-1,4244.580×1074.580 \times 10^7
3735,229741,420-6,1911.330×1081.330 \times 10^8
4797,263788,2309,0331.362×1071.362 \times 10^7
5825,430814,19011,2403.4772×1073.4772 \times 10^7
dˉ=5,343.2\bar{d} = 5,343.2Sd2=7.580×107S_d^2 = 7.580 \times 10^7

3.5 Input-Output Validation: Using a Turing Test

In addition to statistical tests, or when no statistical test is readily applicable, personnel knowledgeable about system behavior can be used to compare model output to system output. For example, suppose that five reports of system performance over five different days are prepared, and simulation outpu data are used to produce five “fake” reports. The 10 reports should all be in exactly the same forma and should contain information of the type that managers and engineers have previously seen on the system. The 10 reports are randomly shuffled and given to the engineer, who is asked to decide which reports are fake and which are real. If the engineer identifies a substantial number of the fake reports, the model builder questions the engineer and uses the information gained to improve the model. If the engineer cannot distinguish between fake and real reports with any consistency, the modeler will conclude that this test provides no evidence of model inadequacy. For further discussion and an application to a real simulation, the reader is referred to Schruben [1980]. This type of validation test is commonly called a Turing test. Its use as model development proceeds can be a valuable tool in detecting model inadequacies and, eventually, in increasing model credibility as the model is improved and refined.

4 Summary

Validation of simulation models is of great importance. Decisions are made on the basis of simulation results; thus, the accuracy of these results should be subject to question and investigation.

Quite often, simulations appear realistic on the surface because simulation models, unlike analytic models, can incorporate any level of detail about the real system. To avoid being “fooled” by this apparent realism, it is best to compare system data to model data and to make the comparison by using a wide variety of techniques, including an objective statistical test, if at all possible.

As discussed by Van Horn [1969, 1971], some of the possible validation techniques, in order of increasing cost-to-value ratios, include

  1. Develop models with high face validity by consulting people knowledgeable about system behavior on model structure, model input, and model output. Use any existing knowledge in the form of previous research and studies, observation, and experience.

  2. Conduct simple statistical tests of input data for homogeneity, for randomness, and for goodness of fit to assumed distributional forms.

  3. Conduct a Turing test. Have knowledgeable people (engineers, managers) compare mode output to system output and attempt to detect the difference.

  4. Compare model output to system output by means of statistical tests.

  5. After model development, collect new system data and repeat techniques 2 to 4.

  6. Build the new system (or redesign the old one), conforming to the simulation results, collec data on the new system, and use the data to validate the model (not recommended if this is the only technique used).

  7. Do little or no validation. Implement simulation results without validating. (Not recommended.)

It is usually too difficult, too expensive, or too time consuming to use all possible validation techniques for every model that is developed. It is an important part of the model-builder’s task to choose those validation techniques most appropriate, both to assure model accuracy and to promote model credibility.

REFERENCES

BALCI, O. [1994], “Validation, Verification and Testing Techniques throughout the Life Cycle of a Simulation Study,” Annals ofOperations Research, Vol. 53, pp. 121–174.

BALCI, O. [1998], “Verification, Validation, and Testing,” in Handbook ofSimulation, J. Banks, ed., John Wiley, New York.

BALCI, O. [2003], “Verification, Validation, and Certification of Modeling and Simulation Applications,” in Proceedings ofthe 2003 Winter Simulation Conference, S. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, eds., New Orleans, LA, Dec. 7–10, pp. 150–158.

BALCI, O.,AND R. G. SARGENT [1982a], “Some Examples ofSimulation ModelValidation Using Hypothesis Testing,” in Proceedings of the 1982 Winter Simulation Conference, H. J. Highland, Y. W. Chao, and O. S. Madrigal, eds., San Diego, CA, Dec. 6–8, pp. 620–629.

BALCI, O., AND R. G. SARGENT [1982b], “Validation of Multivariate Response Models Using Hotelling’s Two-Sample T^2 Test,” Simulation, Vol. 39, No. 6, pp. 185–192.

BALCI, O., AND R. G. SARGENT [1984a], “Validation of Simulation Models via Simultaneous Confidence Intervals,” American Journal ofMathematical Management Sciences, Vol. 4, Nos. 3 & 4, pp. 375–406.

BALCI, O., AND R. G. SARGENT [1984b], “A Bibliography on the Credibility Assessment and Validation of Simulation and Mathematical Models,” Simuletter, Vol. 15, No. 3, pp. 15–27.

BORTSCHELLER, B. J., AND E. T. SAULNIER [1992], “Model Reusability in a Graphical Simulation Package,” in Proceedings ofthe 24th Winter Simulation Conference, J. J. Swain, D. Goldsman, R. C. Crain, and J. R. Wilson, eds., Arlington, VA, Dec. 13–16, pp. 764–772.

CARSON, J. S., [1986], “Convincing Users of Model’s Validity is Challenging Aspect of Modeler’s Job,” Industrial Engineering, June, pp. 76–85.

CARSON, J. S. [2002], “Model Verification and Validation,” in Proceedings of the 34th Winter Simulation Conference, E. Y¨ucesan, C.-H. Chen, J. L. Snowdon, and J. M. Charnes, eds., San Diego, Dec. 8-11, pp. 52–58.

CARSON, J. S., N. WILSON, D. CARROLL, AND C. H. WYSOWSKI [1981a], “A Discrete Simulation Model of a Cigarette Fabrication Process,” Proceedings ofthe Twelfth Modeling and Simulation Conference, University of Pittsburgh, PA., Apr. 30–May 1, pp. 683–689.

CARSON, J. S., N. WILSON, D. CARROLL, AND C. H. WYSOWSKI [1981b], “Simulation of a Filter Rod Manufacturing Process,” Proceedings ofthe 1981 Winter Simulation Conference, T. I. Oren, C. M. Delfosse, and C. M. Shub, eds., Atlanta, GA, Dec. 9–11, pp. 535–541.

GAFARIAN, A. V., AND J. E. WALSH [1970], “Methods for Statistical Validation of a Simulation Model fo Freeway Traffic near an On-Ramp,” Transportation Research, Vol. 4, p. 379–384

GASS, S. I. [1983], “Decision-Aiding Models: Validation, Assessment, and Related Issues for Policy Analysis,” Operations Research, Vol. 31, No. 4, pp. 601–663.

HINES, W. W., D. C. MONTGOMERY, D. M. GOLDSMAN, AND C. M. BORROR [2002], Probability and Statistics in Engineering, 4th ed., Wiley, New York.

KLEIJNEN, J. P. C. [1987], Statistical Toolsfor Simulation Practitioners, Marcel Dekker, New York.

KLEIJNEN, J. P. C. [1993], “Simulation and Optimization in Production Planning: A Case Study,” Decision Support Systems, Vol. 9, pp. 269–280.

KLEIJNEN, J. P. C. [1995], “Theory and Methodology: Verification and Validation of Simulation Models,” European Journal ofOperational Research, Vol. 82, No. 1, pp. 145–162.

LAW, A. M., AND W. D. KELTON [2000], Simulation Modeling andAnalysis, 3d ed., McGraw-Hill, NewYork.

NAYLOR, T. H., AND J. M. FINGER [1967], “Verification of Computer Simulation Models,” Management Science, Vol. 2, pp. B92–B101.

OREN, T. [1981], “Concepts and Criteria to Assess Acceptability of Simulation Studies: A Frame of Reference,” Communications ofthe Associationfor Computing Machinery, Vol. 24, No. 4, pp. 180–189.

SARGENT, R. G. [2003], “Verification and Validation of Simulation Models,” in Proceedings of the 2003 Winter Simulation Conference, S. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, eds., New Orleans, LA, Dec. 7–10, pp. 37–48.

SCHECTER, M., AND R. C. LUCAS [1980], “Validating a Large Scale Simulation Model of Wilderness Recreation Travel,” Interfaces, Vol. 10, pp. 11–18.

SCHRUBEN, L. W. [1980], “Establishing the Credibility of Simulations,” Simulation, Vol. 34, pp. 101–105.

SHANNON, R. E. [1975], Systems Simulation: The Art and Science. Prentice-Hall, Englewood Cliffs, NJ.

VAN HORN, R. L. [1969], “Validation,” in The Design ofComputer Simulation Experiments, T. H. Naylor, ed., pp. 232–235 Duke University Press, Durham, NC

VAN HORN, R. L. [1971], “Validation of Simulation Results,” Management Science, Vol. 17, pp. 247–258.

YOUNGBLOOD, S. M. [1993], “Literature Review and Commentary on theVerification,Validation andAccreditation of Models,” in Proceedings of the 1993 Summer Computer Simulation Conference, J. Schoen, ed., Boston, MA, July 19–21, pp. 10–17.

EXERCISES

  1. A simulation model of a job shop was developed to investigate different scheduling rules. To validate the model, the scheduling rule currently used was incorporated into the model and the resulting output was compared against observed system behavior. By searching the previous year’s database records, it was estimated that the average number ofjobs in the shop was 22.5 on a given day. Seven independent replications of the model were run, each of 30 days’ duration, with the following results for average number of jobs in the shop:

18.9 22.0 19.4 22.1 19.8 21.9 20.2

(a) Develop and conduct a statistical test to evaluate whether model output is consistent with system behavior. Use the level of significance α=0.05\alpha = 0 . 05(b) What is the power of this test if a difference of two jobs is viewed as critical? What sample size is needed to guarantee a power of 0.8 or higher? (Use α=0.05.)\alpha = 0 . 05 . ))

  1. System data for the job shop of Exercise 1 revealed that the average time spent by a job in the shop was approximately 4 working days. The model made the following predictions, on seven independent replications, for average time spent in the shop:

3.704.214.354.133.834.324.05

(a) Is model output consistent with system behavior? Conduct a statistical test, using the level of significance α=0.01\alpha = 0 . 01(b) If it is important to detect a difference of 0.5 day, what sample size is needed to have a power of 0.90? Interpret your results in terms of model validity or invalidity. (Use α=0.01. \alpha = 0 . 01 . \mathrm{~})

  1. For the job shop of Exercise 1, four sets of input data were collected over four different 10-day periods, together with the average number of jobs in the shop ZiZ_{i} for each period. The input data were used to drive the simulation model for four runs of 10 days each, and model predictions o average number of jobs in the shop YiY_{i} were collected, with these results:
i1234
ZiZ_i21.719.222.819.4
YiY_i24.621.119.724.9

(a) Conduct a statistical test to check the consistency of system output and model output. Use the level of significance α=0.05\alpha = 0 . 05(b) If a difference of two jobs is viewed as important to detect, what sample size is required to guarantee a probability of at least 0.80 of detecting this difference, if it indeed exists? (Use α 0.05.)

  1. Obtain at least two of the papers or reports listed in the References dealing with validation and verification. Write a short essay comparing and contrasting the various philosophies and approaches to the topic of verification and validation.

  2. Find several examples of actual simulations reported in the literature in which the authors discuss validation of their model. Is enough detail given to judge the adequacy of the validation effort? If so, compare the reported validation with the criteria set forth in this chapter. Did the authors use any validation technique not discussed in this chapter? [Hint: Several potential sources of articles on simulation applications include the journals Interfaces and Simulation, and the Winter Simulation Conference Proceedings at www.informs-cs.org.]

  3. Compare and contrast the various simulation-software packages in their capability to aid the modeler in the often arduous task of debugging and verification. [Hint: Articles discussing the nature of simulation software packages may be found in the Winter Simulation Conference Proceedings at www.informs-cs.org.]

  4. (a) Compare validation in simulation to the validation of theories in the physical sciences.

(b) Compare the issues involved and the techniques available for validation of models of physica systems versus models of social systems.

(c) Contrast the difficulties, and compare the techniques, in validating a model of a manually operated warehouse with fork trucks and other manually operated vehicles, versus a model of a facility with automated guided vehicles, conveyors, and an automated storage-and-retrieva system.

(d) Repeat (c) for a model of a production system involving considerable manual labor and human decision making, versus a model of the same production system after it has been automated.

  1. Use the confidence-interval approach to assess the validity of the revised bank model in Example 2, using the output data in Table 3.

11 Estimation of Absolute Performance

Output analysis is the examination of data generated by a simulation. Its purpose is either to predic the performance ofa system or to compare the performance oftwo or more alternative system designs. This chapter deals with estimating absolute performance, by which we mean estimating the value of one or more system performance measures as opposed to the comparison of two or more systems, in other words relative performance.

The need for statistical output analysis is based on the observation that the output data from a simulation exhibits random variability when random-number generators are used to produce the values of the input variables—that is, two different streams or sequences of random numbers wil produce two sets ofoutputs, which (probably) will differ. Ifthe performance ofthe system is measured by a parameter θ,\theta , the result ofa set ofsimulation experiments will be an estimator θ ofθ. The precision of the estimator θ^\widehat {\theta} can be measured by the standard error of θ^\widehat {\theta}-or by the width of a confidence interva - -for θ. The purpose of the statistical analysis is either to estimate this standard error or confidence interval or to figure out the number of observations required to achieve a standard error or confidence interval of a given size—or both.

Consider a typical output variable Y, the total cost per week of an inventory system; Y should be treated as a random variable with an unknown distribution. A simulation run of length 1 week provides a single sample observation from the population of all possible observations on Y. By increasing the run length, the sample size can be increased to n observations,Y1,Y2,…,Yn.Y_{1} , Y_{2} , \ldots , Y_{n} ., based on a run length of n weeks. However, these observations do not constitute a random sample, in the classic sense, because they are not statistically independent. In this case, the inventory on hand a the end of one week is the beginning inventory on hand for the next week, and so the value of YiY_{i} has some influence on the value of Yi+1Y_{i + 1}. Thus, the sequence of random variables Y1,Y2,…,YnY_{1} , Y_{2} , \dots , Y_{n} could be autocorrelated (i.e., correlated with itself). This autocorrelation, which is a measure of a lack of statistical independence, means that classic methods of statistics, which assume independence, are not directly applicable to the analysis of these output data. The methods must be properly modified and the simulation experiments properly designed for valid inferences to be made.

In addition to the autocorrelation present in most simulation output data, the specification o the initial conditions of the system at time 0 can pose a problem for the simulation analyst and could influence the output data. By “time 0∘0^{\circ} we mean whatever point in time the beginning of the simulation run represents. For example, the inventory on hand and the number of backorders at time 0 (Monday morning) would most likely influence the value of Y1Y_{1}, the total cost for week 1. Because of the autocorrelation, these initial conditions would also influence the costs Y2,…,YnY_{2} , \dots , Y_{n} for subsequent weeks. The specified initial conditions, if not chosen well, can have an effect on estimation of the steady-state (long-run) performance of a simulation model. For purposes of statistical analysis, the effect of the initial conditions is that the output observations might not be identically distributed and that the initial observations might not be representative of the steady-state behavior of the system.

Section 1 distinguishes between two types of simulation—transient versus steady state—and defines commonly used measures of system performance for each type of simulation. Section 2 illustrates by example the inherent variability in a stochastic (i.e., probabilistic) discrete-event simulation and thereby demonstrates the need for a statistical analysis of the output. Section 3 covers the statistical estimation of performance measures. Section 4 discusses the analysis of terminating simulations, and Section 5 the analysis of steady-state simulations. To support the calculations in this chapter a spreadsheet called SimulationTools.xls is provided at www.bcnn.net. SimulationTools.xls is a menu-driven application that allows the user to paste in their own data—generated by any simulation application—and perform statistical analyses on it. A detailed user guide is also available on the book web site, and SimulationTools.xls has integrated help.

1 Types of Simulations with Respect to Output Analysis

In analyzing simulation output data, a distinction is made between terminating or transient simulations and steady-state simulations.

A terminating simulation is one that runs for some duration of time TET_{E}, where E is a specified event (or set of events) that stops the simulation. Such a simulated system opens at time 0 under well-specified initial conditions and closes at the stopping time TET_{E}. The next four examples are terminating simulations.

Example 1

The Shady Grove Bank opens at 8:30 A.M. (time 0) with no customers present and 8 of the 11 tellers working (initial conditions) and closes at 4:30 P.M. (time TE=480T_{E} = 480 minutes). Here, the event E is merely the fact that the bank has been open for 480 minutes. The simulation analyst is interested in modeling the interaction between customers and tellers over the entire day, including the effect of starting up and closing down at the end of the day.

Example 2

Consider the Shady Grove Bank of Example 1, but restricted to the period from 11:30 A.M. (time 0) to 1:30 P.M., when it is especially busy. The simulation run length is TE=120T_{E} = 120 minutes. The initial conditions at time 0 (11:30 A.M.) could be specified in essentially two ways: (a) the real system could be observed at 11:30 on a number of different days and a distribution of number of customers in system (at 11:30 A.M.) could be estimated, then these data could be used to load the simulation model with customers at time 0; or (b) the model could be simulated from 8:30 A.M. to 11:30 A.M. without collecting output statistics, and the ending conditions at 11:30 A.M. used as initial conditions for the 11:30 A.M. to 1:30 P.M. simulation.

Example 3

A communications system consists of several components plus several backup components. It is represented schematically in Figure 1. Consider the system over a period of time TE,T_{E} ,, until the system fails. The stopping event E is defined by E={AE = \{A fails, or D fails, or (B and C both fail) . Initia conditions are that all components are new at time 0.

Figure 1 Example of a communications system.

Notice that, in the bank model of Example 1, the stopping time TE=480T_{E} = 480 minutes is known, but in Example 3, the stopping time TET_{E} is generally unpredictable in advance; in fact,TET_{E} is probably the output variable of interest, as it represents the total time until the system breaks down. One goal o the simulation might be to estimate E(TE)E ( T_{E} ), the mean time to system failure.

Example 4

A manufacturing process runs continuously from Monday mornings until Saturday mornings. The first shift of each work week is used to load inventory buffers and chemical tanks with the components

and catalysts needed to make the final product. These components and catalysts are made continually throughout the week, except for the last shift Friday night, which is used for cleanup and maintenance. Thus, most inventory buffers are near empty at the end of the week. During the first shift on Monday, a buffer stock is built up to cover the eventuality of breakdown in some part of the process. It is desired to simulate this system during the first shift (time 0 to time TE=8T_{E} = 8 hours) to study various scheduling policies for loading inventory buffers.

In the simulating of a terminating system, the initial conditions of the system at time 0 must be specified, and the stopping time TE−orT_{E} - \mathrm {{o r}}, alternatively, the stopping event E—must be well defined. Although it is certainly true that the Shady Grove Bank in Example 1 will open again the next day, the simulation analyst has chosen to consider it a terminating system because the object of interest is one day’s operation, including start up and close down. On the other hand, if the simulation analys were interested in some other aspect of the bank’s operations, such as the flow of money or operation of automated teller machines, then the system might be considered as a nonterminating one. Similar comments apply to the communications system of Example 3. If the failed component were replaced and the system continued to operate, and, most important, if the simulation analyst were interested in studying its long-run behavior, it might be considered as a nonterminating system. In Example 3, however, interest is in its short-run behavior, from time 0 until the first system failure at time TET_{E} Therefore whether a simulation is considered to be terminating depends on both the obiectives of the simulation study and the nature of the system.

Example 4 is a terminating system, too. It is also an example of a transient (or nonstationary) simulation: the variables of interest are the in-process inventory levels, which are increasing from zero or near zero (at time 0) to full or near full (at time 8 hours).

A nonterminating system is a system that runs continuously, or at least over a very long period of time. Examples include assembly lines that shut down infrequently, continuous production systems of many different types, telephone and other communications systems such as the Internet, hospita emergency rooms, police dispatching and patrolling operations, fire departments, and continuously operating computer networks.

A simulation of a nonterminating system starts at simulation time 0 under initial conditions defined by the analyst and runs for some analyst-specified period of time TET_{E}. (Significant problems arise concerning the specification of these initial and stopping conditions, problems that we discuss later.) Usually, the analyst wants to study steady-state, or long-run, properties of the system—tha is, properties that are not influenced by the initial conditions of the model at time 0. A steadystate simulation is a simulation whose objective is to study long-run, or steady-state, behavior of a nonterminating system.

The next two examples are steady-state simulations.

Example 5

Consider the manufacturing process ofExample 4, beginning with the second shift, when the complete production process is under way. It is desired to estimate long-run production levels and production efficiencies. For the relatively long period of 13 shifts, this may be considered as a steady-state simulation. To obtain sufficiently precise estimates of production efficiency and other response variables, the analyst could decide to simulate for any length of time,TET_{E}(even longer than 13 shifts). That is,TET_{E} is not determined by the nature of the problem (as it was in terminating simulations); rather, it is set by the analyst as one parameter in the design of the simulation experiment.

Example 6

HAL Inc., a large web-based order-processing company, has many customers worldwide. Thus, its large computer system with many servers, workstations, and peripherals runs continuously, 24 hours per day. To handle an increased work load, HAL is considering additional CPUs, memory, and storage devices in various configurations. Although the load on HAL’s computers varies throughou the day, management wants the system to be able to accommodate sustained periods of peak load. Furthermore, the time frame in which HAL’s business will change in any substantial way is unknown, so there is no fixed planning horizon. Thus, a steady-state simulation at peak-load conditions is appropriate. HAL systems staff develops a simulation model of the existing system with the current peak work load and then explores several possibilities for expanding capacity. HAL is interested in long-run average throughput and utilization of each computer. The stopping time TET_{E} is determined not by the nature of the problem, but rather by the simulation analyst, either arbitrarily or with a certain statistical precision in mind.

2 Stochastic Nature of Output Data

Consider one run of a simulation model over a period of time [0,TE]T_{E} ]. Since the model is an inputoutput transformation, and since some of the model input variables are random variables, it follows that the model output variables are random variables. Two examples are now given to illustrate the nature of the output data from stochastic simulations and to give a preliminary discussion of severa important properties of these data. Do not be concerned if some of these properties and the associated terminology are not entirely clear on a first reading. They will be explained carefully later in the chapter.

Example 7: Software Made Personal

Software Made Personal (SMP) customizes software products for clients in two areas: financia tracking and contact management. They have a customer support call center that handles questions for owners of their software from 8 A.M. to 4 P.M. Eastern Time. When a customer calls they use an automated system to select among the two product lines. Each product line has its own operators, and if an appropriate operator is available then the call is immediately routed to the operator; otherwise, the caller is placed in a hold queue. SMP is hoping to reduce the total number of operators they need by cross-training them so that they can answer calls for any product line. This is expected to increase the time to process a call by about 10%. Before considering reducing operators, however, SMP wants to know what their quality of service would be if they simply cross-train the operators they currently have. Using historical data, incoming calls have been modeled as a nonstationary Poisson arriva process and distributions have been fit for operator time to answer questions. Their quality of service measures are caller response time (time from initiating a call until speaking to an operator) and the number of callers on hold. Response-time differences of more than 30 seconds matter.

This is clearly a terminating simulation experiment with time 0 corresponding to 8 A.M. and TET_{E} corresponding to 4 P.M. (another way to terminate the simulation is when the last call that arrives before 4 P.M. is terminated, in which case TET_{E} is a random value). Table 1 shows the results from 4 replications of the SMP simulation; each row presents the average number of minutes callers spen on hold, and the average number of callers on hold, during the course of a simulated 8-hour day.

Table 1 Results of Four Independent Replications of the SMP Call Center

Replication,rAverage Waiting Time,w^Qr\widehat{w}_{Qr}(minutes)Average on Hold,L^Qr\widehat{L}_{Qr}(people)
10.880.68
25.044.18
34.133.26
40.520.34

The table illustrates that there is significant variation in these averages from day to day, implying that a substantial number of replications may be required to precisely estimate, say, the mean values wQ=E(w^Q)w_{Q} = E ( \widehat {w} _ {Q} ) and LQ=E(L^Q)L _ {\mathcal {Q}} = E ( \widehat {L} _ {\mathcal {Q}} ). Even with a large number of replications there will still be some - -estimation error, which is why we want to report not just a single value (the point estimate), but also a measure of its error in the form of a confidence interval or standard error.

These questions are addressed in Section 4 for terminating simulations such as Example 7. Classic methods of statistics may be used because w^Q1,w^Q2,w^Q3\widehat {w} _ {Q 1} , \widehat {w} _ {Q 2} , \widehat {w} _ {Q 3}, and w^Q4\widehat {w} _ {Q 4} constitute a random sample—that is, they are independent and identically distributed. In addition,wQ=E(w^Qr)w_{Q} = E ( \widehat {w} _ {Q r} ) is the parameter being estimated, so each w^Qr\widehat {w} _ {Q r} is an unbiased estimate of the true mean waiting time wQw_{Q} The analysis of Example 7 is considered in Example 10 of Section 4. A survey of statistical methods applicable to terminating simulations is given by Law [1980]. Additional guidance may be found in Alexopoulos and Seila [1998], Kleijnen [1987], Law [2007], and Nelson [2001].

The next example illustrates the effects of correlation and initial conditions on the estimation o long-run mean measures of performance of a system.

Example 8

Semiconductor wafer fabrication is an amazingly expensive process involving hundreds of millions of dollars in processing equipment, material handling, and human resources. FastChip, Inc. wants to use simulation to design a new “fab” by evaluating the steady-state mean cycle time (time from wafer release to completion) that they can expect under a particular loading of two distinct products, called C-chip and D-chip. The process of wafer fabrication consists of two basic steps, diffusion and lithography, each of which contains many substeps, and the fabrication process requires multiple passes through these steps. Product will be released in cassettes at the rate of 1 cassette/hour, 7 days a week, 24-hours a day, to achieve a desired throughput of 1 cassette/hour. The hope is that the curren design will achieve long-run average cycle times of less than 45 hours for the C-chip and 30 hours for the D-chip.

Figure 2 shows the first 30 Chip-C cycle times from one run of the simulation model of the fab. The goal is to estimate the long-run average cycle time as, conceptually, the number of cassettes produced goes to infinity. Notice that the first few cycle times seem lower than the ones that follow; this occurs because the simulation was started with the fab “empty and idle,” which is not representative of long-run or steady-state conditions. Also notice that when there is a low cycle time (say, around 40 hours), it tends to be followed by several additional low cycle times. Thus, the cycle time of successive cassettes may be correlated. These features suggest that the cycle-time data are not a random sample, so classic statistical methods may not apply. The analysis of Example 8 is considered in Section 5.

Figure 2 First 30 Chip-C cycle times from one simulation run.

3 Absolute Measures of Performance and Their Estimation

Consider the estimation of a performance parameter θ (or φ) of a simulated system. It is desired to have a point estimate and an interval estimate of θ (or φ). The length of the interval estimate is a measure of the error in the point estimate. The simulation output data are of the form {Y1,Y2,…,Yn}\{Y_{1} , Y_{2} , \ldots , Y_{n} \} for estimating θ;\theta ; we refer to such output data as discrete-time data, because the index n is discrete valued. The simulation output data are of the form {Y(t),0≤t≤TE}\{Y ( t ) , 0 \leq t \leq T_{E} \} for estimating φ; we refer to such output data as continuous-time data, because the index t is continuous valued. For example,YiY_{i} might be the delay of customer i, or the total cost in week i;Y(t)i ; Y ( t ) might be the queue length at time t, or the number of backlogged orders at time t. The parameter θ\theta is an ordinary mean;ϕ\phi will be referred to as a time-weighted mean. Whether we call the performance parameter θ\theta or ϕ\phi does not really matter; we use two different symbols here simply to provide a distinction between ordinary means and time-weighted means. To make the discussions more concrete, we consider output measures of queueing systems.

3.1 Point Estimation

The point estimator of θ, based on the data {Y1,…,Yn}\{Y_{1} , \ldots , Y_{n} \}, is defined by

θ^=1n∑i=1nYi(1) \widehat {\theta} = \frac {1}{n} \sum_{i = 1} ^ {n} Y_{i}\tag{1}

where θ^\widehat {\theta} is a sample mean based on a sample of size n. Computer simulation languages may refer to -this as a “discrete-time,” “collect,” “tally,” or “observational” statistic.

The point estimator θ is said to be unbiased for θ if its expected value is θ;\theta ; that is,{\mathrm{i s}} , if

E(θ^)=θ(2) E (\widehat {\theta}) = \theta\tag{2}

In general, however,

E(θ^)≠θ(3) E (\widehat {\theta}) \neq \theta\tag{3}

and E(θ^)−θE ( \widehat {\theta} ) - \theta is called the bias in the point estimator θ^.{\widehat {\theta}} . It is desirable to have estimators that are -unbiased,or,^ {\mathrm{o r ,}}-if this is not possible, to have a small bias relative to the magnitude of θ. Examples of estimators of the form of Equation (1) include w^\widehat {w} and w^Q\widehat {w} _ {Q} of equations w^=1N∑i=1NWi\widehat {w} = \textstyle \frac {1} {N} \sum_{i = 1} ^ {N} W_{i} and w^Q=\widehat {w} _ {Q} =1N∑i=1N :WiQ⟶wQ\frac {1} {N} \sum_{i = 1} ^ {N} \ : W_{i} ^ {Q} \longrightarrow w_{Q} as N⟶∞N \longrightarrow \infty, in which case YiY_{i} is the time spent in the (sub)system by customer i. The point estimator of ϕ,\phi , based on the data {Y(t),0≤t≤TE}\{Y ( t ) , 0 \leq t \leq T_{E} \}, where TET_{E} is the simulation run length, is defined by

ϕ^=1TE∫0TEY(t)dt(4) \widehat {\phi} = \frac {1}{T_{E}} \int_{0} ^ {T_{E}} Y (t) d t\tag{4}

and is called a time average of Y(t)Y ( t ) over [0,TE][ 0 , T_{E} ]. Simulation languages may refer to this as a “continuous-time,” “discrete-change,” or “time-persistent” statistic. In general,

E(ϕ^)≠ϕ(5) E (\widehat {\phi}) \neq \phi\tag{5}

and ϕ^\widehat {\phi} is said to be biased for φ. Again, we would like to obtain unbiased or low-bias estimators. -Examples of time averages include L^\widehat {L} and L^Q\widehat {L} _ {Q} of Equations L^=1T∫0TL(t)dt⟶L\begin{array} {r} {\widehat {L} = \frac {1} {T} \int_{0} ^ {T} L ( t ) d t \longrightarrow L} \end{array} as T⟶∞T \longrightarrow \infty and L^Q=1T∑i=0∞iTiQ=1T∫0TLQ(t)dt⟶LQ\begin{array} {r} {\widehat {L} _ {Q} = \frac {1} {T} \displaystyle \sum_{i = 0} ^ {\infty} i T_{i} ^ {Q} = \frac {1} {T} \int_{0} ^ {T} L_{Q} ( t ) d t \longrightarrow L_{Q}} \end{array} as T⟶∞T \longrightarrow \infty and YjY_{j} of Equation (11.4)

Generally, θ and φ are regarded as mean measures of performance of the system being simulated. Other measures usually can be put into this common framework. For example, consider estimation o the proportion of days on which sales are lost through an out-of-stock situation. In the simulation, le

Yi={1,if out of stock on dayi0,otherwise Y_{i} = \left\{\begin{array}{l l} 1, & \text{if out of stock on day} i \\ 0, & \text{otherwise} \end{array} \right.

With n equal to the total number of days θ^,{\widehat {\theta}} ,, as defined by Equation (1), is a point estimator of θ;\theta_{;}, the -proportion of out-of-stock days. For a second example, consider estimation of the proportion of time queue length is greater than 10 customers. If LQ(t)L_{Q} ( t ) represents simulated queue length at time t,t , then (in the simulation) define

Y(t)={1,if LQ(t)>100,otherwise Y (t) = \left\{\begin{array}{l l} 1, & \text{if }L_{Q}(t) > 10 \\ 0, & \text{otherwise} \end{array} \right.

Then ϕ^,{\widehat {\phi}} , as defined by Equation (4), is a point estimator of ϕ,\phi ,, the proportion of time that the queue -length is greater than 10 customers. Thus, estimation of proportions or probabilities is a special case of the estimation of means.

A performance measure that does not fit this common framework is a quantile or percentile. Quantiles describe the level of performance that can be delivered with a given probability p.p . For instance, suppose that Y represents the delay in queue that a customer experiences in a service system, measured in minutes. Then the p=0.85p = 0 . 85 quantile of Y is the value θ such that

Pr⁡{Y≤θ}=0.85(6) \operatorname * {P r} \{Y \leq \theta \} = 0. 85\tag{6}

As a percentage,θ\theta is the 100pth or 85th percentile of customer delay. Therefore, 85% of all customers will experience a delay of θ minutes or less. Stated differently, a customer has only a 0.15 probabilit of experiencing a delay of longer than θ minutes. A widely used performance measure is the median, which is the 0.5 quantile or 50th percentile.

The problem of estimating a quantile is the inverse of the problem of estimating a proportion or probability. In estimating a proportion,θ\theta is given and the probability pp is to be estimated; however, in estimating a quantile,pp is given and θ is to be estimated.

The most intuitive method for estimating a quantile is to form a histogram of the observed values of Y, then find a value θ^\widehat {\theta} such that 100p% of the histogram is to the left of (smaller than) θ^.{\widehat {\theta}} . For instance, if we observe n=250n = 250 customer delays {Y1,…,Y250}\{Y_{1} , \ldots , Y_{250} \}-, then an estimate of the 85th percentile of delay is a value θ^\widehat {\theta} such that (0.85)(250)=212.5≈213( 0 . 85 ) ( 250 ) = 212 . 5 \approx 213 of the observed values are less than or equal to θ.\theta .-An obvious estimate is, therefore, to set θ^\widehat {\theta} equal to the 213th smallest value -in the sample (this requires sorting the data). When the output is a continuous-time process, such as the queue-length process {LQ(t),0≤t≤TE}\{L_{Q} ( t ) , 0 \leq t \leq T_{E} \}, then a histogram gives the fraction of time tha the process spent at each possible level (queue length, in this example). However, the method for quantile estimation remains the same: Find a value θ^\widehat {\theta} such that 100p% of the histogram is to the left of θ^.{\widehat {\theta}} ..

3.2 Confidence-Interval Estimation

To understand confidence intervals fully, it is important to understand the difference between a measure of error and a measure of risk. One way to make the difference clear is to contrast a confidence interval with a prediction interval (which is another useful output-analysis tool).

Both confidence intervals and prediction intervals are based on the premise that the data being produced by the simulation is represented well by a probability model. Suppose that model is the normal distribution with mean θ and variance σ2\sigma^{2}, both unknown. To make the example concrete, let YiY_{i} be the average cycle time for parts produced on the ith replication (representing a day of production) of the simulation. Therefore,θ\theta is the mathematical expectation of YiY_{i}, and σ is represents the day-to-day variation of the average cycle time.

Suppose our goal is to estimate θ. If we are planning to be in business for a long time, producing parts day after day, then θ\theta is a relevant parameter, because it is the long-run mean daily cycle time. Our average cycle time will vary from day to day, but over the long run the average of the averages will be close to θ.

The natural estimator for θ\theta is the overall sample mean of n independent replications,Yˉ =\bar {Y} \ =∑i=1nYi/n\scriptstyle \sum_{i = 1} ^ {n} Y_{i} / n. But Yˉ\bar {Y} is not θ, it is an estimate, based on a sample, and it has error. A confidence interva is a measure of that error. Let

S2=1n−1∑i=1n(Yi−Yˉ)2 S^{2} = \frac {1}{n - 1} \sum_{i = 1} ^ {n} \left(Y_{i} - \bar {Y}\right) ^ {2}

be the sample variance across the R replications. The usual confidence interval, which assumes the YiY_{i} are normally distributed, is

Yˉ±tα/2,n−1Sn \bar {Y} \pm t_{\alpha / 2, n - 1} \frac {S}{\sqrt {n}}

where tα/2,R−1t_{\alpha / 2 , R - 1} is the quantile of the t distribution with R−1R - 1 degrees of freedom that cuts off α/2\alpha / 2 the area of each tail. (See Table A.5 in the Appendix). We cannot know for certain exactly how far Yˉ\bar {Y} is from θ,\theta , but the confidence interval attempts to bound that error. Unfortunately, the confidence interval itself may be wrong. A confidence level, such as 95%, tells us how much we can trust the interval to actually bound the error between Y¯ and θ. The more replications we make, the less error there is in Yˉ,{\bar {Y}} , and our confidence interval reflects that because tα/2,n−1S/nt_{\alpha / 2 , n - 1} S / {\sqrt {n}} will tend to get smaller as n increases, converging to 0 as n goes to infinity.

Now suppose we need to make a promise about what the average cycle time will be on a particular day. A good guess is our estimator Yˉ,{\bar {Y}} ,, but it is unlikely to be exactly right. Even θ itself, which is the center of the distribution, is not likely to be the actual average cycle time on any particular day, because the daily average cycle time varies. A prediction interval, on the other hand, is designed to be wide enough to contain the actual average cycle time on any particular day, with high probability.

The normal-theory prediction interval is

Yˉ±tα/2,n−1S1+1n \bar {Y} \pm t_{\alpha / 2, n - 1} S \sqrt {1 + \frac {1}{n}}

The length of this interval will not go to 0 as n increases. In fact, in the limit it becomes

θ±zα/2σ \theta \pm z_{\alpha / 2} \sigma

to reflect the fact that, no matter how much we simulate, our daily average cycle time still varies.

In summary, a prediction interval is a measure of risk, and a confidence interval is a measure of error. We can simulate away error by making more and more replications, but we can never simulate away risk, which is an inherent part of the system. We can, however, do a better job of evaluating risk by making more replications.

Example 9

Suppose that the overall average of the average cycle time on 120 replications of a manufacturing simulation is 5.80 hours, with a sample standard deviation of 1.60 hours. Since t0.025,119=1.98,t_{0 . 025 , 119} = 1 . 98 ,, a 95% confidence interval for the long-run expected daily average cycle time is 5.80±1.98(1.60/120)5 . 80 {\pm} 1 . 98 ( 1 . 60 / \sqrt {120} ) or 5.80±0.295 . 80 \pm 0 . 29 hours. Thus, our best guess of the long-run average of the daily average cycle times is 5.80 hours, but there could be as much as 0.29 hours error in this estimate.

On any particular day, we are 95% confident that the average cycle time for all parts produced on that day will be

5.80±1.98(1.60)1+1120 5. 80 \pm 1. 98 (1. 60) \sqrt {1 + \frac {1}{120}}

or 5.80±3.185 . 80 \pm 3 . 18 hours. The 3.18 hours reflects the inherent variability in the daily average cycle times and the fact that we want to be 95% confident of covering the actual average cycle time on a particular day, rather than simply covering the long-run average.

A caution: In neither case (prediction interval or confidence interval) can we make statements about the cycle time for individual products because we observed the daily average. To make valid statements about the cycle times of individual products, the analysis must be based on individua cycle times.

4 Output Analysis for Terminating Simulations

Consider a terminating simulation that runs over a simulated time interval [0,TE][ 0 , T_{E} ] and results in observations Y1,…,YnY_{1} , \dots , Y_{n}. The sample size n may be a fixed number, or it may be a random variable (say, the number of observations that occur during time TE)T_{E} ). A common goal in simulation is to estimate

θ=E(1n∑i=1nYi) \theta = E \left(\frac {1}{n} \sum_{i = 1} ^ {n} Y_{i}\right)

When the output data are of the form {Y(t),0≤t≤TE}\{Y ( t ) , 0 \leq t \leq T_{E} \}, the goal is to estimate

ϕ=E(1TE∫0TEY(t)dt) \phi = E \left(\frac {1}{T_{E}} \int_{0} ^ {T_{E}} Y (t) d t\right)

The method used in each case is the method of independent replications. The simulation is repeated a total of R times, each run using a different random number stream and independently chosen initia conditions (which includes the case that all runs have identical initial conditions). We now address this problem.

4.1 Statistical Background

Perhaps the most confusing aspect of simulation output analysis is distinguishing within-replication data from across-replication data, and understanding the properties and uses of each. The issue can be further confused by the fact that simulation languages often provide only summary measures, like sample means, sample variances, and confidence intervals, rather than all of the raw data. Sometimes these summary measures are all that the simulation language provides, without a lot of extra work.

To illustrate the key ideas, think in terms of the simulation of a manufacturing system and two performance measures of that system, the cycle time for parts (time from release into the factory until completion) and the work in process (WIP, the total number of parts in the factory at any time). In computer applications, these two measures could correspond to the response time and the length of the task queue at the CPU; in a service application, they could be the time to fulfill a customer’s request and the number of requests on the “to do” list; in a supply-chain application, they could be the order fill time and the inventory level. Similar measures appear in many systems.

Here is the usual set up for something like cycle time: Let YijY_{i j} be the cycle time for the jth part produced in the ith replication. If each replication represents two shifts of production, then the number of parts produced in each replication might differ. Table 2 shows, symbolically, the results of R replications.

Table 2 Within and Across-Replication Cycle-Time Data

Within-Rep DataAcross-Rep Data
Y11Y_{11}Y12Y_{12}⋯\cdotsY1n1Y_{1n_1}Yˉ1..,S12,H1\bar{Y}_{1..}, S_1^2, H_1
Y21Y_{21}Y22Y_{22}⋯\cdotsY2n2Y_{2n_2}Yˉ2..,S22,H2\bar{Y}_{2..}, S_2^2, H_2
⋮\vdots⋮\vdots⋯\cdots⋮\vdots⋮\vdots
YR1Y_{R1}YR2Y_{R2}⋯\cdotsYRnRY_{Rn_R}YˉR..,SR2,HR\bar{Y}_{R..}, S_R^2, H_R
Yˉ..,S2,H\bar{Y}_{..}, S^2, H

The across-replication data are formed by summarizing within-replication data:^1Yˉi⋅{\bar {Y}} _ {i \cdot} is the sample mean of the nin_{i} cycle times from the ith replication,Si2S_{i} ^ {2} is the sample variance of the same data, and

Hi=tα/2,ni−1Sini(7) H_{i} = t _ {\alpha / 2, n_{i} - 1} \frac {S_{i}}{\sqrt {n_{i}}}\tag{7}

is a confidence-interval half-width based on this dataset.

From the across-replication data, we compute overall statistics, the average of the daily cycle time averages

Yˉ⋅⋅=1R∑i=1RYˉi.(8) \bar {Y} _ {\cdot \cdot} = \frac {1}{R} \sum_{i = 1} ^ {R} \bar {Y} _ {i}.\tag{8}

the sample variance of the daily cycle time averages

S2=1R−1∑i=1R(Yˉi.−Yˉ..)2(9) S^{2} = \frac {1}{R - 1} \sum_{i = 1} ^ {R} (\bar {Y} _ {i.} - \bar {Y} _ {..}) ^ {2}\tag{9}

and finally, the confidence-interval half-width

H=tα/2,R−1SR(10) H = t_{\alpha / 2, R - 1} \frac {S}{\sqrt {R}}\tag{10}

The quantity S/RS / \sqrt {R} is the standard error, which is sometimes interpreted as the average error in Yˉ.{\bar {Y}} . as an estimator of θ. Notice that S2S^{2} is not the average of the within-replication sample variances Si2S_{i} ^ {2}; rather, it is the sample variance of the within-replication averages Yˉ1⋅,Yˉ2⋅,…,YˉR⋅\bar {Y} _ {1 \cdot} , \bar {Y} _ {2 \cdot} , \dots , \bar {Y} _ {R \cdot} Table 3 Within and Across-Replication WIP Data

Within-Rep DataAcross-Rep Data
Y1(t),0≤t≤TE1Y_{1}(t), 0 \leq t \leq T_{E_{1}}Yˉ1..,S12,H1\bar{Y}_{1..}, S_{1}^{2}, H_{1}
Y2(t),0≤t≤TE2Y_{2}(t), 0 \leq t \leq T_{E_{2}}Yˉ2..,S22,H2\bar{Y}_{2..}, S_{2}^{2}, H_{2}
⋮\vdots⋮\vdots
YR(t),0≤t≤TERY_{R}(t), 0 \leq t \leq T_{E_{R}}YˉR..,SR2,HR\bar{Y}_{R..}, S_{R}^{2}, H_{R}
Yˉ..,S2,H\bar{Y}_{..}, S^{2}, H

Within a replication, work in process is a continuous-time output, denoted Yi(t)Y_{i} ( t ). The stopping time for the ith replication TEiT _ {E_{i}} could be a random variable, in general; in this example, it is the end of the second shift. Table 3 is an abstract representation of the data produced

The within-replication sample mean and variance are defined appropriately for continuous-time data:

Yˉi.=1TEi∫0TEiYi(t)dt(11) \bar {Y} _ {i.} = \frac {1}{T _ {E_{i}}} \int_{0} ^ {T _ {E_{i}}} Y_{i} (t) d t\tag{11}

and

Si2=1TEi∫0TEi(Yi(t)−Yˉi.)2dt(12) S_{i} ^ {2} = \frac {1}{T _ {E_{i}}} \int_{0} ^ {T _ {E_{i}}} \left(Y_{i} (t) - \bar {Y} _ {i.}\right) ^ {2} d t\tag{12}

A definition for HiH_{i} is more problematic, but, to be concrete, take it to be

Hi=zα/2SiTEi.(13) H_{i} = z_{\alpha / 2} \frac {S_{i}}{\sqrt {T _ {E_{i}}}}.\tag{13}

It is difficult to conceive of a situation in which HiH_{i} is relevant, a topic we discuss later. Although the definitions of the within-replication data change for continuous-time data, the across-replication statistics are unchanged, and this is a critical observation.

Here are the key points that must be understood:

The overall sample average Yˉ⋅⋅{\bar {Y}} _ {\cdot \cdot} and the individual replication sample averages Yˉi{\bar {Y}} _ {i} are always unbiased estimators of the expected daily average cycle time or daily average WIP.

Across-replication data are independent, since they are based on different random numbers; are identically distributed, since we are running the same model on each replication; and tend to be normally distributed, if they are averages of within-replication data, as they are here. This implies that the confidence interval Yˉ..±H{\bar {Y}} . . \pm H is often pretty good.

Within-replication data, on the other hand, might have none of these properties. The individua cycle times may not be identically distributed, if the first few parts of the day find the system empty; they are almost certainly not independent, because one part follows another; and whether they are normally distributed is difficult to know in advance. For this reason,Si2S_{i} ^ {2} and Hi⋅H_{i \cdot}, which are computed under the assumption of independent and identically distributed (i.i.d.)\mathrm{( i . i . d . )} data, tend not to be useful, although there are exceptions.

There are situations in which Y¯ and Yi⋅Y_{i \cdot} are valid estimators of the expected cycle time for an individual part or the expected WIP at any point in time, rather than the daily average. (See Section 5 on steady-state simulations.) Even when this is the case, the confidence interva Yˉ..±H{\bar {Y}} . . \pm H is valid, and Yˉi⋅±Hi\bar {Y} _ {i \cdot} \pm H_{i} is not. The difficulty occurs because Si2S_{i} ^ {2} is a reasonable estimator of the variance of the cycle time, but Si2/niS_{i} ^ {2} / n_{i} and Si2/TEiS_{i} ^ {2} / T _ {E_{i}} are not good estimators of the Var[Yˉi⋅];\mathrm{V a r} [ \bar {Y} _ {i \cdot} ] ; more on this in Section 5.2.

Example 10: Software Made Personal (cont.)

Consider Example 7, the SMP call center problem, with the data for R=4R = 4 replications given in Table 1. The four number-on-hold estimates L^Qr\widehat {L} _ {Q r} are time averages of the form of Equation (11), where Yr(t)=LO(t)Y_{r} ( t ) = L _ {\mathcal {O}} ( t )-, the number of customers on hold at time t. Similarly, the four average system times w^Q1,…,w^Q4\widehat {w} _ {Q 1} , \dots , \widehat {w} _ {Q 4} are analogous to Yˉr.{\bar {Y}} _ {r} . of Table 2, where YriY_{r i} is the actual time spent on hold by - -customer i on replication r.r . Suppose that the analyst desires a 95% confidence interval for the mean time spent on hold,wQw_{Q} Using Equation (8), compute an overall point estimator

Yˉ⋅⋅=w^Q=0.88+5.04+4.13+0.524=2.64 \bar {Y} _ {\cdot \cdot} = \widehat {w} _ {Q} = \frac {0 . 88 + 5 . 04 + 4 . 13 + 0 . 52}{4} = 2. 64

Using Equation (9), compute its estimated variance:

S2=(0.88−2.64)2+⋯+(0.52−2.64)24−1=(2.28)2 S^{2} = \frac {(0 . 88 - 2 . 64) ^ {2} + \cdots + (0 . 52 - 2 . 64) ^ {2}}{4 - 1} = (2. 28) ^ {2}

Thus, the standard error of w^Q=2.64\widehat {w} _ {Q} = 2 . 64 is estimated by s.e.(w^O)=S/4=1.14\mathrm{s . e .} ( \widehat {w} _ {O} ) = S / \sqrt {4} = 1 . 14. Obtain t0.025,3=t_{0 . 025 , 3} =- -3.18 from Table A.5, and compute the 95% confidence interval half-width by Equation (10) as

H=t0.025,3S4=(3.18)(1.14)=3.62 H = t_{0. 025, 3} \frac {S}{\sqrt {4}} = (3. 18) (1. 14) = 3. 62

giving 2.64±3.622 . 64 \pm 3 . 62 minutes with 95% confidence. Clearly 4 replications are far too few to make any sort of useful estimate of wQw_{Q}, since a negative mean waiting time is impossible. Later in the chapter we return to this problem and determine how many replications are required to get a meaningfu estimate.

4.2 Confidence Intervals with Specified Precision

By Expression (10), the half-length H of a 100(1−α)%100 ( 1 - \alpha ) \% confidence interval for a mean θ, based on the t distribution, is given by

H=tα/2,R−1SR H = t_{\alpha / 2, R - 1} \frac {S}{\sqrt {R}}

where S2S^{2} is the sample variance and R is the number of replications. In simulation we seldom need to select R and just accept the confidence interval half-length that results. Instead, we can drive the number of replications to be large enough so that H is small enough to facilitate the decision that the simulation is supposed to support. The acceptable size of H depends on the problem at hand: i might be $5000 in a financial simulation, 6 minutes for product cycle time, or 1 customer on hold in a call center.

Suppose that an error criterion of  is specified; in other words, it is desired to estimate θ by Yˉ.{\bar {Y}} . to within  with high probability—say, at least 1 α. Thus, it is desired that a sufficiently large sample size R be taken to satisfy

P(∣Yˉ..−θ∣≤ϵ)≥1−α P (| \bar {Y}.. - \theta | \leq \epsilon) \geq 1 - \alpha

When the sample size R is fixed, no guarantee can be given for the resulting error. But if the sample size can be increased, an error criterion (such as ϵ=$5000\epsilon = \$5000, 6 minutes, or 1 customer) can be specified.

Assume that an initial sample of size R0R_{0} replications has been observed—that is, the simulation analyst initially makes R0R_{0} independent replications. We must have R0≥2R_{0} \ge 2, with 10 or more being desirable. The R0R_{0} replications will be used to obtain an initial estimate S02S_{0} ^ {2} of the population variance σ2\sigma^{2}. To meet the half-length criterion, a sample size R must be chosen such that R≥R0R \geq R_{0} and

H=tα/2,R−1S0R≤ϵ(14) H = t_{\alpha / 2, R - 1} \frac {S_{0}}{\sqrt {R}} \leq \epsilon\tag{14}

Solving for R in Inequality (14) shows that R is the smallest integer satisfying R≥R0R \geq R_{0} and

R≥(tα/2,R−1S0ϵ)2(15) R \geq \left(\frac {t_{\alpha / 2 , R - 1} S_{0}}{\epsilon}\right) ^ {2}\tag{15}

An initial estimate for R is given by

R≥(zα/2S0ϵ)2(16) R \geq \left(\frac {z_{\alpha / 2} S_{0}}{\epsilon}\right) ^ {2}\tag{16}

where zα/2z_{\alpha / 2} is the 100(1−α/2)100 ( 1 - \alpha / 2 ) percentage point of the standard normal distribution from Table A.3 in the Appendix. And since tα/2,R−1≈zα/2t_{\alpha / 2 , R - 1} \approx z_{\alpha / 2} for large R, say,R≥50R \geq 50, the second inequality for R is adequate when R is large. After determining the final sample size R, collect R−R0R - R_{0} additional observations (i.e., make R−R0R - R_{0} additional replications, or start over and make R total replications) and form the 100(1 α)% confidence interval for θ by

Yˉ⋅⋅−tα/2,R−1SR≤θ≤Yˉ⋅⋅+tα/2,R−1SR(17) \bar {Y} _ {\cdot \cdot} - t_{\alpha / 2, R - 1} \frac {S}{\sqrt {R}} \leq \theta \leq \bar {Y} _ {\cdot \cdot} + t_{\alpha / 2, R - 1} \frac {S}{\sqrt {R}}\tag{17}

where Yˉ.{\bar {Y}} . and S2S^{2} are computed on the basis of all R replications,Yˉ.{\bar {Y}} . by Equation (8), and S2S^{2} by Equation (9). The half-length of the confidence interval given by Inequality (17) should be approximately  or smaller; however, with the additional R−R0R - R_{0} observations, the variance estimator S2S^{2} could differ somewhat from the initial estimate S02,S_{0} ^ {2} , possibly causing the half-length to be greater than desired. If the confidence interval from Inequality (17) is too large, the procedure may be repeated, using Inequality (15), to determine an even larger sample size.

Example 11

Suppose that it is desired to estimate the mean waiting time in SMP’s hold queue in Example 7 to within 0.5 minutes with 95% confidence. We will illustrate this calculation using the “Get Sample Sizeγ\mathrm {S i z e^{\gamma}} utility of SimulationTools.xls. The input dialog box is shown in Figure 3 and the results are displayed in Figure 4. Notice that “Absolute Precision” means that we directly specify the half width of the confidence interval ( 0.5 minutes in this case); “Relative Precision” specifies the length of the half width as a fraction of the mean.

An initial sample of size R0 = 20R_{0} ~ = ~ 20 is taken, and the program determines that R = 175R \ = \ 175 is the smallest integer satisfying Inequality (16). Therefore,R−R0=175−20=155R - R_{0} = 175 - 20 = 155 additional replications are needed. After obtaining the additional outputs, we would again need to compute the half-width H to ensure that it is as small as is desired. In this case the result—which can also be found at www.bcnn.net—was 2.66±0.342 . 66 \pm 0 . 34 minutes

Figure 3 Input Dialog for the ‘‘Get Sample Size’’ utility of SimulationTools.xls

Get Sample SizeCompletedData ColumnMinimum Sample Size
10.880897931175
Number of Observations2025.04340304
Alpha0.0534.132638545
Precision Type140.517418075
Precision Value0.552.584490259
60.860547939
71.544612493
81.762676832
96.925242515
102.201491896
112.915438392
120.486246064
131.792947434
141.244455641
154.278579049
1613.91696167
170.235565331
180.685156864
191.577792626
201.070626537

Figure 4 Sample Size Calculation using ‘‘Get Sample Size’’ in SimulationTools.xl

4.3 Quantiles

To present the interval estimator for quantiles, it is helpful to review the interval estimator for a mean in the special case when the mean represents a proportion or probability p.p . In this book, we have chosen to treat a proportion or probability as just a special case of a mean. However, in many statistics texts, probabilities are treated separately.

When the number of independent replications Y1,…,YRY_{1} , \dots , Y_{R} is large enough that tα/2,n−1≐zα/2t_{\alpha / 2 , n - 1} \doteq z_{\alpha / 2} the confidence interval for a probability pp is often written as

p^±zα/2p^(1−p^)R−1 \widehat {p} \pm z_{\alpha / 2} \sqrt {\frac {\widehat {p} (1 - \widehat {p})}{R - 1}}

where p^\widehat {p} is the sample proportion (algebra shows that this formula for the half-width is precisely -equivalent to Equation (10) when used in estimating a proportion).

As mentioned in Section 3, the quantile-estimation problem is the inverse of the probabilityestimation problem: Find θ such that Pr⁡{Y≤θ}=p.\operatorname* {P r} \{Y \leq \theta \} = p .. Thus, to estimate the pp quantile, we find tha value θ^\widehat {\theta} such that 100p% of the data in a histogram of Y is to the left of θ^,{\widehat {\theta}} ,, or, stated differently, the -npth smallest value of Y1,…,YRY_{1} , \dots , Y_{R} Extending this idea, an approximate (1−α)100%( 1 - \alpha ) 100 \% confidence interval for θ\theta can be obtained by finding two values:θℓ\theta_{\ell} that cuts off 100pℓ100 p_{\ell}% of the histogram and θu\theta_{u} that cuts off 100pu%100 p_{u} \% of the

histogram, where

pℓ=p−zα/2p(1−p)R−1 p_{\ell} = p - z_{\alpha / 2} \sqrt {\frac {p (1 - p)}{R - 1}} pu=p+zα/2p(1−p)R−1(18) p_{u} = p + z_{\alpha / 2} \sqrt {\frac {p (1 - p)}{R - 1}}\tag{18}

(Recall that we know p.)p . ) In terms of sorted values,θℓ^\widehat {\theta_{\ell}} is the RpℓR p_{\ell} smallest value (rounded down) and θu^\widehat {\theta_{u}} is the RpuR p_{u} smallest value (rounded up), of Y1,…,YRY_{1} , \dots , Y_{R}

Example 12

Suppose that we want to estimate the 0.75 quantile of average daily waiting time in the hold queue for SMP and form a 95% confidence interval for it, based on R=300R = 300 replications. The data may be found in the spreadsheet Quantile.xls at www.bcnn.net. The point estimator is θ^=3.39˙\widehat \theta = 3 . 3 \dot {9} minutes, because that is the 300×0.75=225th300 \times 0 . 75 = 225 \mathrm{t h}-smallest value of the sorted data. The interpretation is that, over the long run, on 75% of the days the average time customers spend on hold will be less than or equal to 3.39 minutes.

To obtain the confidence interval, we first compute

pℓ=p−zα/2p(1−p)R−1=0.75−1.960.75(0.25)299=0.700 p_{\ell} = p - z_{\alpha / 2} \sqrt {\frac {p (1 - p)}{R - 1}} = 0. 75 - 1. 96 \sqrt {\frac {0 . 75 (0 . 25)}{299}} = 0. 700 pu=p+zα/2p(1−p)R−1=0.75+1.960.75(0.25)299=0.799 p_{u} = p + z_{\alpha / 2} \sqrt {\frac {p (1 - p)}{R - 1}} = 0. 75 + 1. 96 \sqrt {\frac {0 . 75 (0 . 25)}{299}} = 0. 799

The lower bound ofthe confidence interval is θℓ^=3.13\widehat {\theta_{\ell}} = 3 . 13 minutes (the 300×pℓ=2300 \times p_{\ell} = 210th smallest value, -rounding down); the upper bound of the confidence interval is θu^=3\widehat {\theta_{u}} = 3.98 minutes (the 300×pu=300 \times p_{u} =-240th smallest value, rounding up). Thus, with 95% confidence, the point estimate of 3.39 minutes is no more than max {3.98−3.39,3.39−3.13}=0.59\{3 . 98 - 3 . 39 , 3 . 39 - 3 . 13 \} = 0 . 59 minutes off the true 0.75 quantile.

It is important to understand the 3.39 minutes is an estimate of the 0.75 quantile (75th percentile) of daily average customer delay, not an individual customer’s delay. Because the call center starts the day empty and idle, and the customer load on the system varies throughout the day, the 0.75 quantile of individual customer waiting time varies throughout the day and cannot be given by a single number.

4.4 Estimating Probabilities and Quantiles from Summary Data

Knowing the equation for the confidence interval half-width is important if all that the simulation software provides is Y¯ and H and you need to work out the number of replications required to get a prespecified precision, or if you need to estimate a probability or quantile. You know the number of replications, so the sample standard deviation can be extracted from H by using the formula

S=HRtα/2,R−1 S = \frac {H \sqrt {R}}{t_{\alpha / 2 , R - 1}}

With this information, the method in Section 4.2 can be employed.

The more difficult problem is estimating a probability or quantile from summary data. When al we have available is the sample mean and confidence-interval halfwidth (which gives us the sample standard deviation), then one approach is to use a normal-theory approximation for the probabilities or quantiles we desire, specifically

Pr⁡{Yˉi.≤c}≈Pr⁡{Z≤c−Yˉ..S} \operatorname * {P r} \{\bar {Y} _ {i.} \leq c \} \approx \operatorname * {P r} \left\{Z \leq \frac {c - \bar {Y} _ {. .}}{S} \right\}

and

θ^≈Yˉ..+zpS \widehat {\theta} \approx \bar {Y} _ {..} + z_{p} S

The following example illustrates how this is done.

Example 13

From 25 replications of a manufacturing simulation, a 90% confidence interval for the daily average WIP is 218 32. What is the probability that the daily average WIP is less than 350? What is the 85th percentile of daily average WIP?

First, we extract the standard deviation:

S=HRt0.05,24=32251.71=93 S = \frac {H \sqrt {R}}{t_{0 . 05 , 24}} = \frac {32 \sqrt {25}}{1 . 71} = 93

Then, we use the normal approximations and Table A.3 to get

Pr⁡{Yˉi.≤350}≈Pr⁡{Z≤350−21893}=Pr⁡{Z≤1.42}=0.92 \operatorname * {P r} \{\bar {Y} _ {i.} \leq 350 \} \approx \operatorname * {P r} \left\{Z \leq \frac {350 - 218}{93} \right\} = \operatorname * {P r} \{Z \leq 1. 42 \} = 0. 92

and

θ^≈Yˉ..+z0.85S=218+1.04(93)=315parts \widehat {\theta} \approx \bar {Y} _ {..} + z_{0. 85} S = 218 + 1. 04 (93) = 315 \text{parts}

There are shortcomings to obtaining our probabilities and quantiles this way. The approximation depends heavily on whether the output variable of interest is normally distributed. If the outpu variable itself is not an average, then this approximation is suspect. Therefore, we expect the approximation to work well for statements about the average daily cycle time, for instance, but very poorly for the cycle time of an individual part.

5 Output Analysis for Steady-State Simulations

Consider a single run of a simulation model whose purpose is to estimate a steady-state, or long-run, characteristic of the system. Suppose that the single run produces observations Y1,Y2,…Y_{1} , Y_{2} , \ldots, which, generally, are samples of an autocorrelated time series. The steady-state (or long-run) measure o performance, θ, is defined by

θ=lim⁡n⟶∞1n∑i=1nYi(19) \theta = \lim_{n \longrightarrow \infty} \frac {1}{n} \sum_{i = 1} ^ {n} Y_{i}\tag{19}

with probability 1, where the value of θ is independent of the initial conditions. (The phrase “with probability 1∘1^{\circ} means that essentially all simulations of the model, using different random numbers, will produce a series Yi,i=1,2,..Y_{i} , i = 1 , 2 , . .. whose sample average converges to θ.) For example, if YiY_{i} was the time customer i spent talking to an operator, then θ would be the long-run average time a customer spends talking to an operator; and, because θ is defined as a limit, it is independent of the call center’s conditions at time 0. Similarly, the steady-state performance for a continuous-time output measure {Y(t),t≥0}\{Y ( t ) , t \geq 0 \}, such as the number of customers in the call center’s hold queue, is defined as

ϕ=lim⁡TE⟶∞1TE∫0TEY(t)dt \phi = \lim _ {T_{E} \longrightarrow \infty} \frac {1}{T_{E}} \int_{0} ^ {T_{E}} Y (t) d t

with probability 1.

Of course, the simulation analyst could decide to stop the simulation after some number of observations, say, n, have been collected; or the simulation analyst could decide to simulate for some length of time TET_{E} that determines n (although n may vary from run to run). The sample size n (or TE)T_{E} ) is a design choice; it is not inherently determined by the nature of the problem. The simulation analyst will choose simulation run length (n or TE)T_{E} ) with several considerations in mind:

  1. Any bias in the point estimator that is due to artificial or arbitrary initial conditions. (The bias can be severe if run length is too short, but generally it decreases as run length increases.)

  2. The desired precision of the point estimator, as measured by the standard error or confidence interval half-width.

  3. Budget constraints on the time available to execute the simulation.

The next subsection discusses initialization bias and the following subsections outline two methods of estimating point-estimator variability. For clarity of presentation, we discuss only estimation of θ from a discrete-time output process. Thus, when discussing one replication (or run), the notation

Y1,Y2,Y3,… Y_{1}, Y_{2}, Y_{3}, \ldots

will be used; if several replications have been made, the output data for replication r will be denoted by

Yr1,Yr2,Yr3,…(20) Y_{r 1}, Y_{r 2}, Y_{r 3}, \ldots\tag{20}

5.1 Initialization Bias in Steady-State Simulations

There are several methods of reducing the point-estimator bias caused by using artificial and unrealistic initial conditions in a steady-state simulation. The first method is to initialize the simulation in a state that is more representative of long-run conditions. This method is sometimes called intelligent initialization. Examples include

  1. setting the inventory levels, number of backorders, and number of items on order and their arrival dates in an inventory simulation;

  2. placing customers in queue and in service in a queueing simulation;

  3. having some components fail or degrade in a reliability simulation.

There are at least two ways to specify the initial conditions intelligently. If the system exists, collect data on it and use these data to specify more nearly typical initial conditions. This method sometimes requires a large data-collection effort. In addition, if the system being modeled does no exist—for example, if it is a variant of an existing system—this method is impossible to implement. Nevertheless, it is recommended that simulation analysts use any available data on existing systems to help initialize the simulation, as this will usually be better than assuming the system to be “completely stocked,” “empty and idle,” or “brand new” at time 0.

A related idea is to obtain initial conditions from a second model of the system that has been simplified enough to make it mathematically solvable. The queueing models are very useful for this purpose. The simplified model can be solved to find long-run expected or most likely conditions— such as the expected number of customers in the queue—and these conditions can be used to initialize the simulation.

A second method to reduce the impact of initial conditions, possibly used in conjunction with the first, is to divide each simulation run into two phases: first, an initialization phase, from time 0 to time T0,T_{0} , followed by a data-collection phase from time T0T_{0} to the stopping time T0+TE;T_{0} + T_{E} ; that is, the simulation begins at time 0 under specified initial conditions I0I_{0} and runs for a specified period of time T0T_{0}. Data collection on the response variables of interest does not begin until time T0T_{0} and continues until time T0+TET_{0} + T_{E}. The choice of T0T_{0} is quite important, because the system state at time T0,T_{0} , denoted by I,I , should be more nearly representative of steady-state behavior than are the origina initial conditions I0I_{0} at time 0. In addition, the length TET_{E} of the data-collection phase should be long enough to guarantee sufficiently precise estimates of steady-state behavior. Notice that the system state I at time T0T_{0} is a random variable and to say that the system has reached an approximate steady state is to say that the probability distribution of the system state at time T0T_{0} is sufficiently close to the steady-state probability distribution as to make the bias in point estimates of response variables negligible. Figure 5 illustrates the two phases of a steady-state simulation. The effect of starting a simulation run of a queueing system in the empty and idle state, as well as a useful plot to aid the simulation analyst in choosing an appropriate value for T0,T_{0} ,, are given in the following example.

Figure 5 Initialization and data collection phases of a steady-state simulation run.

Consider the FastChip wafer fabrication problem discussed in Example 8. Suppose that a total of R 10 independent replications were made, each run long enough so that 250 cycle times were collected for each of Chip-C and Chip-D. We will focus on Chip-C.

Normally we average all data within each replication to obtain a replication average. However, our goal at this stage is to identify the trend in the data due to initialization bias and find out when i dissipates. To do this, we will average corresponding cycle times across replications and plot them (this idea is usually attributed to Welch [1983]). Such averages are known as ensemble averages. Specifically, let Yr1,Yr2,…,Yr250Y_{r 1} , Y_{r 2} , \dots , Y_{r 250} be the 250 Chip-C cycle times, in order of completion, from replication r. For the jth cycle time, define the ensemble average across all R replications to be

Yˉ.j=1R∑r=1RYrj(21) \bar {Y} _ {. j} = \frac {1}{R} \sum_{r = 1} ^ {R} Y_{r j}\tag{21}

(R 10 here). The ensemble averages are plotted as the solid line in Figure 6 (the dashed lines will be discussed below). This plot was produced by the SimulationTools.xls spreadsheet, and we will refer to it as a mean plot.

Notice the gradual upward tread at the beginning. The simulation analyst may suspect that this is due to the downward bias in these estimators, which in turn is due to the fab being empty and idle at time 0. As time becomes larger (so the number of cycle times recorded increases), the effect of the initial conditions on later observations lessens and the observations appear to vary around a common mean. When the simulation analyst feels that this point has been reached, then the data-collection phase begins. Here approximately 120 Chip-C cycle times might be adequate.

Although we have determined a deletion amount of 120 cycle times, the initialization phase is almost always specified in terms of simulation time T0,T_{0} , because we need to consider the initialization phase for each performance measure, and they may differ. In the FastChip example we would also

Figure 6 Mean Plot Across 10 Replications of 250 Product C Cycle Times

need to examine the cycle times for Chip-D. If we specified the initialization phase as a count for each output, then we would have to track these counts. When the initialization phase is specified by time, on the other hand, then a single event can be scheduled at time T0,T_{0} ,, and data only retained beyond that point.

To specify T0T_{0} by time we have to convert the appropriate counts into approximate times and use the largest of these. For instance, for the FastChip simulation 120 Chip-C cycle times corresponds to approximately 200 hours of simulation time, since cassettes are released at 1 per hour and 60% o the releases are Chip-C: 120 cycle times/0.6 releases/hour 200 hours (we could also increase this somewhat to account for the time it takes the 120th Chip-C release to traverse the fab). This turns out to be larger than the initialization phase for Chip-D, so we set T0=200T_{0} = 200 hours.

Plotting ensemble averages is extra work (although SimulationTools.xls makes it easier), so it might be tempting to take a shortcut. For instance, one might plot the output from only replication 1,Y11,Y12,…,Y1nY_{11} , Y_{12} , \dots , Y_{1 n}, or the cumulative average from a replication 1

Yˉ1ℓ=1ℓ∑j=1ℓY1j \bar {Y} _ {1 \ell} = \frac {1}{\ell} \sum_{j = 1} ^ {\ell} Y_{1 j}

for ℓ=1,2,…,n.\ell = 1 , 2 , \ldots , n .. Figure 7 shows both. Notice that the raw data from a single replication can be too highly variable to detect the trend, while the cumulative plot is clearly biased low because it retains all of the data from the beginning of the run. Thus, these shortcuts should be avoided and the mean plot used instead.

Figure 7 Plot of 250 Product C Cycle Times from 1 Replication, Raw and Cumulative Average

Some additional factors to keep in mind when using the mean plot to determine the initialization phase:

  1. When first starting to examine the initialization phase, a run length and number of replications will have to be guessed. Ensemble averages, such as Figure 6, will reveal a smoother and more precise trend as the number of replications R is increased, and it may have to be increased several times until the trend is clear. It is also possible that the run length guess is not long enough to get past the initialization phase (this would be indicated if the trend in the mean plot does not disappear), so the run length may have to be increased as well.

  2. Ensemble averages can also be smoothed by plotting a moving average rather than the original ensemble averages. In a moving average, each plotted point is actually the average of severa adjacent ensemble averages. Specifically, the jth plot point would be

Y~⋅j=12m+1∑i=j−mj+mYˉ⋅i \tilde {Y} _ {\cdot j} = \frac {1}{2 m + 1} \sum_{i = j - m} ^ {j + m} \bar {Y} _ {\cdot i}

for some m≥1m \geq 1, rather than the original ensemble average Yˉ⋅j{\bar {Y}} _ {\cdot j}. The value of m is typically chosen by trial and error until a smooth plot is obtained. The mean plot in Figure 6 was obtained with m=2m = 23. Since each ensemble average (or moving average) is the sample mean of i.i.d. observations across R replications, a confidence interval based on the t distribution can be placed around each point, as shown by the dashed lines in Figure 6,^ {6 ,} and these intervals can be used to judge whether or not the plot is precise enough to decide that bias has diminished. This is the preferred method to determine a deletion point.

  1. Cumulative averages, such as in Figure 7, become less variable as more data are averaged. Therefore, it is expected that the left side of the curve will always be less smooth than the righ side. Remember that cumulative averages tend to converge more slowly to long-run performance than do ensemble averages, because cumulative averages contain all observations, including the most biased ones from the beginning of the run. For this reason, cumulative averages should be used only if it is not feasible to compute ensemble averages, such as when only a single replication is possible.

There has been no shortage of solutions to the initialization-bias problem. Unfortunately, for every “solution” that works well in some situations, there are other situations in which either it is not applicable or it performs poorly. Important ideas include testing for bias (e.g., Kelton and Law [1983], Schruben [1980], Goldsman, Schruben, and Swain [1994]); modeling the bias (e.g., Snel and Schruben [1985]); and randomly sampling the initial conditions on multiple replications (e.g., Kelton [1989]).

5.2 Error Estimation for Steady-State Simulation

If {Y1,…,Yn}\{Y_{1} , \ldots , Y_{n} \} are not statistically independent, then S2/n,S^{2} / n ,, given by Equation (9),( 9 ) ,, is a biased estimator of the true variance ∇(θ^)\nabla ( \widehat {\theta} ). This is almost always the case when {Y1,…,Yn}\{Y_{1} , \ldots , Y_{n} \} is a sequence of output observations from within a single replication. In this situation,Y1,Y2,…Y_{1} , Y_{2} , \ldots. is an autocorrelated sequence, sometimes called a time series.

Suppose that our point estimator for θ is the sample mean Yˉ=∑i=1nYi/n.A⁡\textstyle {\bar {Y}} = \sum_{i = 1} ^ {n} Y_{i} / n . \operatorname{A} general result^2 from mathematical statistics is that the variance of Yˉ\bar {Y} is

V(Yˉ)=1n2∑i=1n∑j=1ncov⁡(Yi,Yj)(22) \mathrm{V} (\bar {Y}) = \frac {1}{n^{2}} \sum_{i = 1} ^ {n} \sum_{j = 1} ^ {n} \operatorname{cov} (Y_{i}, Y_{j})\tag{22}

where cov (Yi,Yi)=V⁡(Yi)( Y_{i} , Y_{i} ) = \operatorname{V} ( Y_{i} ). To construct a confidence interval for θ, an estimate of V(Yˉ)\mathrm{V} ( {\bar {Y}} ) is required. But obtaining an estimate of Equation (22) is futile, because each term cov (Yi,Yj)( Y_{i} , Y_{j} ) could be different, in general. Fortunately, systems that have a steady state will, if simulated long enough to pass the transient phase, produce an output process that is approximately covariance stationary. Intuitively, stationarity implies that Yi+kY_{i + k} depends on Yi+1Y_{i + 1} in the same manner as YkY_{k} depends on Y1Y_{1}. In particular, the covariance between two random variables in the time series depends only on the number o observations between them, called the lagl a g For a covariance-stationary time series,{Y1,Y2,…}\{Y_{1} , Y_{2} , \ldots \}, define the lag-k autocovariance by

γk=cov⁡(Y1,Y1+k)=cov⁡(Yi,Yi+k)(23) \gamma_{k} = \operatorname{cov} (Y_{1}, Y_{1 + k}) = \operatorname{cov} (Y_{i}, Y_{i + k})\tag{23}

which, by definition of covariance stationarity, is not a function of i. For k=0,k = 0 ,, γ becomes the population variance σ2;\sigma^{2} ; that is,

γ0=cov⁡(Yi,Yi+0)=V(Yi)=σ2(24) \gamma_{0} = \operatorname{cov} (Y_{i}, Y_{i + 0}) = \mathrm{V} (Y_{i}) = \sigma^{2}\tag{24}

The lag-k autocorrelation is the correlation between any two observations k apart. It is defined by

ρk=γkσ2(25) \rho_{k} = \frac {\gamma_{k}}{\sigma^{2}}\tag{25}

and has the property that

$$

  • 1 \leq \rho_{k} \leq 1, \quad k = 1, 2, \dots $$

If a time series is covariance stationary, then Equation (22) can be simplified substantially. Algebra shows that

V(Yˉ)=σ2n[1+2∑k=1n−1(1−kn)ρk](26) \mathrm{V} (\bar {Y}) = \frac {\sigma^{2}}{n} \left[ 1 + 2 \sum_{k = 1} ^ {n - 1} \left(1 - \frac {k}{n}\right) \rho_{k} \right]\tag{26}

where ρk\rho_{k} is the lag-k autocorrelation given by Equation (25).

When ρk>0\rho_{k} > 0 for all k (or most k), the time series is said to be positively autocorrelated. In this case, large observations tend to be followed by large observations, small observations by smal ones. Such a series will tend to drift slowly above and then below its mean. Figure 8(a) is an example of a stationary time series exhibiting positive autocorrelation. The output data from most queueing simulations are positively autocorrelated.

(a)

(b)

(c) Figure 8 (a) Stationary time series Yj\pmb {Y_{j}} exhibiting positive autocorrelation; (b) stationary time series Yj\pmb {Y_{j}} exhibiting negative autocorrelation; (c) nonstationary time series with an upward trend.

On the other hand, if some of the ρk<0,\rho_{k} < 0 , the series Y1,Y2,…Y_{1} , Y_{2} , \ldots. will display the characteristics of negative autocorrelation. In this case, large observations tend to be followed by small observations, and vice versa. Figure 8(b) is an example of a stationary time series exhibiting negative autocorrelation. The output of certain inventory simulations might be negatively autocorrelated.

Figure 8(c) also shows an example of a time series with an upward trend. Such a time series is not stationary; the probability distribution of YiY_{i} is changing with the index i.

Why does autocorrelation make it difficult to estimate V(Yˉ)?{\mathrm{V}} ( {\bar {Y}} ) {\mathrm{?}} Recall that the standard estimator for the variance of a sample mean is S2/nS^{2} / n. By using Equation (26), it can be shown [Law, 1977] that the expected value of the variance estimator S2/nS^{2} / n is

E(S2n)=BV(Yˉ)(27) E \left(\frac {S^{2}}{n}\right) = B \mathrm{V} (\bar {Y})\tag{27}

where

B=n/c−1n−1(28) B = \frac {n / c - 1}{n - 1}\tag{28}

and c is the quantity in brackets in Equation (26). The effect of the autocorrelation on the estimator S2/nS^{2} / n is derived by an examination of Equations (26) and (28). There are essentially three possibilities:

Case 1

If the YiY_{i} are independent, then ρk = 0\rho_{k} \ = \ 0 for k=1,2,3,…k = 1 , 2 , 3 , \ldots. Therefore,c=1+2∑k=1n−1(1−\begin{array} {r} {c = 1 + 2 \sum_{k = 1} ^ {n - 1} ( 1 -} \end{array}k/n)ρk=1k / n ) \rho_{k} = 1 and Equation (26) reduces to the familiar σ2/n\sigma^{2} / n. Notice also that B=1B = 1, so S2/nS^{2} / n is an unbiased estimator of V(Y¯ ). The YiY_{i} will always be independent when they are obtained from differen replications; that independence is the primary reason that we prefer experiment designs calling for multiple replications.

Case 2

If the autocorrelations ρk\rho_{k} are primarily positive, then c=1+2∑k=1n−1(1−k/n)ρk>1\begin{array} {r} {c = 1 + 2 \sum_{k = 1} ^ {n - 1} ( 1 - k / n ) \rho_{k} > 1} \end{array}, so that n/c<n,n / c < n ,, and hence B<1B < 1. Therefore,S2/nS^{2} / n is biased low as an estimator of V(Yˉ)\mathrm{V} ( {\bar {Y}} ). If this correlation were ignored, the nominal 100(1−α)%100 ( 1 - \alpha ) \% confidence interval given by Expression (10) would be too short, and its true confidence coefficient would be less than 1−α.1 - \alpha .. The practical effect would be that the simulation analyst would have unjustified confidence in the apparent precision of the poin estimator due to the shortness of the confidence interval. If the correlations ρk\rho_{k} are large, B could be quite small, implying a significant underestimation.

Case 3

If the autocorrelations ρk\rho_{k} are substantially negative, then 0≤c<10 \leq c < 1, and it follows that B>1B > 1 and S2/nS^{2} / n is biased high for V(Yˉ)\mathrm{V} ( {\bar {Y}} ). In other words, the true precision of the point estimator Yˉ\bar {Y} would be greater than what is indicated by its variance estimator S2/nS^{2} / n, because

V(Yˉ)<E(S2n) \mathrm{V} (\bar {Y}) < E \left(\frac {S^{2}}{n}\right)

As a result, the nominal 100(1−α)%100 ( 1 - \alpha ) \% confidence interval of Expression (10) would have true confidence coefficient greater than 1−α1 - \alpha. This error is less serious than Case 2, because we are unlikely to make incorrect decisions if our estimate is actually more precise than we think it is.

A simple example demonstrates why we are especially concerned about positive correlation: Suppose you want to know how students on a university campus will vote in an upcoming election. To estimate their preferences, you plan to solicit 100 responses. The standard experiment is to randomly select 100 students to poll; call this experiment A. An alternative is to randomly select 20 students and ask each of them to state their preference 5 times in the same day; call this experiment B. Both experiments obtain 100 responses, but clearly an estimate based on experiment B will be less precise (will have larger variance) than an estimate based on experiment A. Experiment A obtains 100 independent responses, whereas experiment B obtains only 20 independent responses and 80 dependent ones. The five opinions from any one student are perfectly positively correlated (assuming a student names the same candidate all five times). Although this is an extreme example, i illustrates that estimates based on positively correlated data are more variable than estimates based on independent data. Therefore, a confidence interval or other measure of error should account correctly for dependent data, but S2/nS^{2} / n does not.

Two methods for eliminating or reducing the deleterious effects of autocorrelation upon estimation of a mean are given in the following sections. Unfortunately, some simulation languages either use or facilitate the use of S2/nS^{2} / n as an estimator of V(Yˉ)\mathrm{V} ( {\bar {Y}} )), the variance of the sample mean, in all situations. If used uncritically in a simulation with positively autocorrelated output data, the downward bias in S2/nS^{2} / n and the resulting shortness of a confidence interval for θ will convey the impression of much greater precision than actually exists. When such positive autocorrelation is present in the output data, the true variance of the point estimator Yˉ\bar {Y} can be many times greater than is indicated by S2/nS^{2} / n

5.3 Replication Method for Steady-State Simulations

If initialization bias in the point estimator has been reduced to a negligible level (through some combination of intelligent initialization and deletion), then the method of independent replications can be used to estimate point-estimator variability and to construct a confidence interval. The basic idea is simple: Make R replications, initializing and deleting from each one the same way.

If, however, significant bias remains in the point estimator and a large number of replications are used to reduce point-estimator variability, the resulting confidence interval can be misleading. This happens because bias is not affected by the number of replications R; it is affected only by deleting more data (i.e., increasing T0)T_{0} ) or extending the length of each run (i.e., increasing TE)T_{E} ) Thus, increasing the number of replications R could produce shorter confidence intervals around the “wrong point.” Therefore, it is important to do a thorough job of investigating the initial-condition bias.

If the simulation analyst decides to delete d observations of the total of n observations in a replication, then the point estimator of θ is

Yˉ⋅⋅(n,d)=1R∑r=1R1n−d∑j=d+1nYrj(29) \bar {Y} _ {\cdot \cdot} (n, d) = \frac {1}{R} \sum_{r = 1} ^ {R} \frac {1}{n - d} \sum_{j = d + 1} ^ {n} Y_{r j}\tag{29}

That is, the point estimator is the average of the remaining data. The basic raw output data {Yrj,r=\{Y_{r j} , r =1,…,R;j=1,…,n}1 , \dots , R ; j = 1 , \dots , n \} are exhibited in Table 4. For instance,YrjY_{r j} could be the delay of customer j in queue, or the response time of job j in a job shop, on replication r. The number d of deleted observations and the total number of observations n might vary from one replication to the next, in which case replace d by drd_{r} and n by nr.n_{r} .. For simplicity, assume that d and n are constant over replications.

Table 4 Raw Output Data from a Steady-State Simulation

ReplicationObservationsReplication Averages
1⋯\cdotsdd+1d+1⋯\cdotsn
1Y1,1Y_{1,1}⋯\cdotsY1,dY_{1,d}Y1,d+1Y_{1,d+1}⋯\cdotsY1,nY_{1,n}Yˉ1.(n,d)\bar{Y}_{1}.(n,d)
2Y2,1Y_{2,1}⋯\cdotsY2,dY_{2,d}Y2,d+1Y_{2,d+1}⋯\cdotsY2,nY_{2,n}Yˉ2.(n,d)\bar{Y}_{2}.(n,d)
......
......
......
RYR,1Y_{R,1}⋯\cdotsYR,dY_{R,d}YR,d+1Y_{R,d+1}⋯\cdotsYR,nY_{R,n}YˉR.(n,d)\bar{Y}_{R}.(n,d)
Yˉ.1\bar{Y}_{.1}⋯\cdotsYˉ.d\bar{Y}_{.d}Yˉ.,d+1\bar{Y}_{.,d+1}⋯\cdotsYˉ.n\bar{Y}_{.n}Yˉ..(n,d)\bar{Y}_{..}(n,d)

When using the replication method, each replication is regarded as a single sample for the purpose of estimating θ. For replication r,r , define

Yˉr.(n,d)=1n−d∑j=d+1nYrj(30) \bar {Y} _ {r.} (n, d) = \frac {1}{n - d} \sum_{j = d + 1} ^ {n} Y_{r j}\tag{30}

as the sample mean of all (nondeleted) observations in replication r. Because all replications use different random-number streams and all are initialized at time 0 by the same set of initial conditions I0,I_{0} ,, the replication averages

Yˉ1.(n,d),…,YˉR.(n,d) \bar {Y} _ {1.} (n, d), \dots , \bar {Y} _ {R.} (n, d)

are independent and identically distributed random variables; that is, they constitute a random sample from some underlying population having unknown mean

θn,d=E⁡[Yˉr.(n,d)](31) \theta_{n, d} = \operatorname{E} [ \bar {Y} _ {r.} (n, d) ]\tag{31}

The overall point estimator, given in Equation (29), is also given by

Yˉ⋅⋅(n,d)=1R∑r=1RYˉr⋅(n,d)(32) \bar {Y} _ {\cdot \cdot} (n, d) = \frac {1}{R} \sum_{r = 1} ^ {R} \bar {Y} _ {r \cdot} (n, d)\tag{32}

as can be seen from Table 4 or from using Equation (21). Thus, it follows that

E⁡[Yˉ..(n,d)]=θn,d \operatorname{E} [ \bar {Y}.. (n, d) ] = \theta_{n, d}

also. If d and n are chosen sufficiently large, then θn,d≈θ\theta_{n , d} \approx \theta, and Yˉ⋅⋅(n,d){\bar {Y}} _ {\cdot \cdot} ( n , d ) is an approximately unbiased estimator of θ. The bias in Yˉ⋅⋅(n,d){\bar {Y}} _ {\cdot \cdot} ( n , d ) is θn,d−θ\theta_{n , d} - \theta For convenience, when the value of n and d are understood, abbreviate Yˉr.(n,d)\bar {Y} _ {r} . ( n , d )(the mean of the undeleted observations from the rth replication) and Yˉ⋅⋅(n,d){\bar {Y}} _ {\cdot \cdot} ( n , d )[the mean of Yˉ1⋅(n,d),…,YˉR⋅(n,d)]\bar {Y} _ {1 \cdot} ( n , d ) , \dots , \bar {Y} _ {R \cdot} ( n , d ) ] by Yˉr.{\bar {Y}} _ {r} . and Yˉ.{\bar {Y}} ., respectively. To estimate the standard error of Yˉ..{\bar {Y}} . ., first compute the sample variance,

S2=1R−1∑r=1R(Yˉr.−Yˉ..)2=1R−1(∑r=1RYˉr.2−RYˉ..2)(33) S^{2} = \frac {1}{R - 1} \sum_{r = 1} ^ {R} (\bar {Y} _ {r.} - \bar {Y} _ {..}) ^ {2} = \frac {1}{R - 1} \left(\sum_{r = 1} ^ {R} \bar {Y} _ {r.} ^ {2} - R \bar {Y} _ {..} ^ {2}\right)\tag{33}

The standard error of Yˉ.{\bar {Y}} . is given by

s.e.(Yˉ⋅⋅)=SR(34) \mathrm{s.e.} (\bar {Y} _ {\cdot \cdot}) = \frac {S}{\sqrt {R}}\tag{34}

A 100(1−α)%100 ( 1 - \alpha ) \% confidence interval for θ,\theta ,, based on the t distribution, is given by

Yˉ⋅⋅−tα/2,R−1SR≤θ≤Yˉ⋅⋅+tα/2,R−1SR(35) \bar {Y} _ {\cdot \cdot} - t_{\alpha / 2, R - 1} \frac {S}{\sqrt {R}} \leq \theta \leq \bar {Y} _ {\cdot \cdot} + t_{\alpha / 2, R - 1} \frac {S}{\sqrt {R}}\tag{35}

where tα/2,R−1t_{\alpha / 2 , R - 1} is the 100(1−α/2)100 ( 1 - \alpha / 2 ) percentage point of a t distribution with R−1R - 1 degrees of freedom. This confidence interval is valid only if the bias of Yˉ.{\bar {Y}} . is approximately zero.

As a rough rule, the length of each replication, beyond the deletion point, should be at least ten times the amount of data deleted. In other words,(n−d)( n - d ) should at least 10d (or more generally,TET_{E} should be at least 10T0)10 T_{0} ). Given this run length, the number of replications should be as many as time permits, up to about 25 replications. Kelton [1986] established that there is little value in dividing the available time into more than 25 replications, so, if time permits making more than 25 replications of length T0+10T0T_{0} + 10 T_{0}, then make 25 replications of longer than T0+10T0.T_{0} + 10 T_{0} \mathrm{.}, instead. Again, these are rough rules that need not be followed slavishly.

In this section we have presented results as if the run length is n observations and d of them are deleted. As discussed earlier, in practice we make a run of length T0+TET_{0} + T_{E} time units and delete the first T0T_{0} time units. In this case dd becomes the number of observations obtained up to time T0,T_{0} , and n−dn - d is the number of observations recorded between times T0T_{0} and TE+T0,T_{E} + T_{0} ,, both random variables that typically differ from replication to replication. In the following example we will use (T0+TE,T0)( T_{0} + T_{E} , T_{0} ) instead of (n,d)( n , d ) in the notation to make this point clear.

Example 15

Consider again the FastChip wafer fab simulation of Examples 8 and 14. Suppose that the simulation analyst decides to make R=10R = 10 replications, each of length T0+TE=2200T_{0} + T_{E} = 2200 hours, deleting the first T0=200T_{0} = 200 hours before data collection, begins as determined in Example 14. Remember that the raw output data consist of cycle times for Chip-C cassettes, and the output from each replication is the average of all of the Chip-C cassettes that finish between times T0=200T_{0} = 200 hours and T0+TE=2200T_{0} + T_{E} = 2200 hours (approximately 2000×60%=12002000 \times 60 \% = 1200 cycle times per replication). The purpose of the simulation is to estimate the long-run average cycle time, denoted w,w ,, and to measure the error of the estimate by a 95% confidence interval.

Table 5 Data Summary for FastChip Simulation by Replication

Replication rSample Mean for Replication r
146.86
246.09
347.64
447.43
546.94
646.43
747.11
846.56
946.73
1046.80
Yˉ..\bar{Y}_{..}46.86
S0.46

The replication averages Yˉr⋅(T0+TE,T0),r=1,2,…,10\bar {Y} _ {r \cdot} ( T_{0} + T_{E} , T_{0} ) , r = 1 , 2 , \ldots , 10, are shown in Table 5. The poin estimator is computed by Equation (32) as

Yˉ⋅⋅(T0+TE,T0)=46.86 \bar {Y} _ {\cdot \cdot} (T_{0} + T_{E}, T_{0}) = 46. 86

Its standard error is given by Equation (34) as

s.e.(Yˉ..T0+TE,T0))=SR=0.15 \text{s.e.} (\bar {Y}.. T_{0} + T_{E}, T_{0})) = \frac {S}{\sqrt {R}} = 0. 15

and using α=0.05\alpha = 0 . 05 and t0.025,9=2.26t_{0 . 025 , 9} = 2 . 26, the 95% confidence interval for long-run mean queue length is given by Inequality (35) a

46.86−2.26(0.15)≤w≤46.86+2.26(0.15) 46. 86 - 2. 26 (0. 15) \leq w \leq 46. 86 + 2. 26 (0. 15)

or

46.52≤w≤47.20 46. 52 \leq w \leq 47. 20

The simulation analyst may conclude with a high degree of confidence that the long-run mean cycle time for Chip-C is between 46.52 and 47.20 hours. The confidence interval computed here as given by Inequality (35) should be used with caution, because a key assumption behind its validity is tha enough data have been deleted to remove any significant bias due to initial conditions—that is, that T0T_{0} and TE+T0T_{E} + T_{0} are sufficiently large so that the bias θTE+T0,T0−θ\theta _ {T_{E} + T_{0} , T_{0}} - \theta is negligible.

5.4 Sample Size in Steady-State Simulations

Suppose it is desired to estimate a long-run performance measure θ within , with confidence 100(1−α)%100 ( 1 - \alpha ) \%. In a steady-state simulation, a specified precision may be achieved either by increasing the number of replications R or by increasing the run length TET_{E}. The first solution, controlling R, is carried out as given in Section 4.2 for terminating simulations.

Example 16

Consider the data in Table 5 for the FastChip wafer fab simulation as an initial sample of size R0=10R_{0} = 10 The initial estimate of standard deviation is S0=0.46S_{0} = 0 . 46 hours. Suppose that it is desired to estimate long-run mean cycle time of Chip-C, w, to within ϵ=0.\epsilon = 0 .1 hours (6 minutes) with 95% confidence. Using α=0.05\alpha = 0 . 05 in Inequality (16) yields an initial estimate of

R≥(z0.025S0ϵ)2=((1.96)(0.46)0.1)2=81.3 R \geq \left(\frac {z_{0 . 025} S_{0}}{\epsilon}\right) ^ {2} = \left(\frac {(1 . 96) (0 . 46)}{0 . 1}\right) ^ {2} = 81. 3

Thus, at least 82 replications will be needed.

An alternative to increasing R is to increase total run length T0+TET_{0} + T_{E} within each replication. If the calculations in Section 4.2, as illustrated in Example 16, indicate tha R−R0R - R_{0} additional replications are needed beyond the initial number R0.R_{0} ., then an alternative is to increase run length (T0+TE)( T_{0} + T_{E} ) in the same proportion (R/R0)( R / R_{0} ) to a new run length (R/R0)(T0+TE)( R / R_{0} ) ( T_{0} + T_{E} ). Thus, additional data will be deleted, from time 0 to time (R/R0)T0,( R / R_{0} ) T_{0} ,, and more data will be used to compute the point estimates, as illustrated by Figure 9. However, the total amount of simulation effort is the same as if we had simply increased the number of replications but maintained the same run length. The advantage of increasing total run length per replication and deleting a fixed proportion [T0/(T0+TE)][ T_{0} / ( T_{0} + T_{E} ) ] of the tota run length is that any residual bias in the point estimator should be further reduced by the additiona deletion of data at the beginning of the run. A possible disadvantage of the method is that, in order to continue the simulation of all R replications [from time T0+TET_{0} + T_{E} to time (R/R0)(T0+TE)]( R / R_{0} ) ( T_{0} + T_{E} ) ]], it is

Figure 9 Increasing run length to achieve specified accuracy.

necessary to have saved the state of the model at time T0+TET_{0} + T_{E} and to be able to restart the mode and run it for the additional required time. Otherwise, the simulations would have to be rerun from time 0, which could be time consuming for a complex model. Some simulation languages have the capability to save enough information that a replication can be continued from time TET_{E} onward, rather than having to start over from time 0.

Example 17

In Example 16,^ {16 ,} suppose that run length was to be increased to achieve the desired error 0.1 hours. Since R/R0=82/10=8.2R / R_{0} = 82 / 10 = 8 . 2, the run length should be (R/R0)(T0+TE)=8.2(2200)=18,040( R / R_{0} ) ( T_{0} + T_{E} ) = 8 . 2 ( 2200 ) = 18 , 040 hours. The data collected from time 0 to time (R/R0)T0=8.2(200)=1640( R / R_{0} ) T_{0} = 8 . 2 ( 200 ) = 1640 hours would be deleted, and the data from time 1640 to time 18,040 used to compute new point estimates and confidence intervals.

5.5 Batch Means Method for Steady-State Simulations

One disadvantage of the replication method is that data must be deleted on each replication and, in one sense, deleted data are wasted data, or at least lost information. This suggests that there might be merit in using an experiment design that is based on a single, long replication. The disadvantage of a single-replication design arises when we try to compute the standard error of the sample mean. Since we only have data from within one replication, the data are dependent, and the usual estimator is biased.

The method of batch means attempts to solve this problem by dividing the output data from one replication (after appropriate deletion) into a few large batches and then treating the means of these batches as if they were independent. When the raw output data after deletion form a continuous-time process {Y(t),T0≤t≤T0+TE}\{Y ( t ) , T_{0} \leq t \leq T_{0} + T_{E} \}, such as the length of a queue or the level of inventory, then we form k batches of size m=TE/km = T_{E} / k and compute the batch means as

Yˉj=1m∫(j−1)mjmY(t+T0)dt \bar {Y} _ {j} = \frac {1}{m} \int_{(j - 1) m} ^ {j m} Y (t + T_{0}) d t

forj=1,2,…,k\mathrm{f o r} j = 1 , 2 , \dots , k. In other words, thejth batch mean isjust the time-weighted average of the process over the time interval [T0+(j−1)m,T0+jm)[ T_{0} + ( j - 1 ) m , T_{0} + j m ).

When the raw output data after deletion form a discrete-time process {Yi,i=d+1,d+2,…,n}\{Y_{i} , i = d + 1 , d + 2 , \dots , n \} such as the customer delays in a queue or the cost per period of an inventory system, then we form k batches of size m=(n−d)/km = ( n - d ) / k and compute the batch means as

Yˉj=1m∑i=(j−1)m+1jmYi+d \bar {Y} _ {j} = \frac {1}{m} \sum_{i = (j - 1) m + 1} ^ {j m} Y_{i + d}

for j=1,2,…,kj = 1 , 2 , \dots , k(assuming k divides n−dn - d evenly, otherwise round down to the nearest integer). That is the batch means are formed as shown here

Y1,…,Yd⏟deleted,Yd+1,…,Yd+m⏟Yˉ1,Yd+m+1,…,Yd+2m⏟Yˉ2,…,Yd+(k−1)m+1,…,Yd+km⏟Yˉk \underbrace {Y_{1} , \ldots , Y_{d}} _ {\text{deleted}}, \underbrace {Y_{d + 1} , \ldots , Y_{d + m}} _ {\bar {Y} _ {1}}, \underbrace {Y_{d + m + 1} , \ldots , Y_{d + 2 m}} _ {\bar {Y} _ {2}}, \ldots , \underbrace {Y_{d + (k - 1) m + 1} , \ldots , Y_{d + k m}} _ {\bar {Y} _ {k}}

Starting with either continuous-time or discrete-time data, the variance of the sample mean is estimated by

S2k=1k∑j=1k(Yˉj−Yˉ)2k−1=∑j=1kYˉj2−kYˉ2k(k−1)(36) \frac {S^{2}}{k} = \frac {1}{k} \sum_{j = 1} ^ {k} \frac {(\bar {Y} _ {j} - \bar {Y}) ^ {2}}{k - 1} = \frac {\sum_{j = 1} ^ {k} \bar {Y} _ {j} ^ {2} - k \bar {Y} ^ {2}}{k (k - 1)}\tag{36}

where Yˉ\bar {Y} is the overall sample mean of the data after deletion. The batch means Yˉ1,Yˉ2,…,Yˉk{\bar {Y}} _ {1} , {\bar {Y}} _ {2} , \dots , {\bar {Y}} _ {k} are not independent; however, if the batch size is sufficiently large, successive batch means will be approximately independent, and the variance estimator will be approximately unbiased.

Unfortunately, there is no widely accepted and relatively simple method for choosing an acceptable batch size m (or equivalently, choosing a number of batches k)k ). But there are some genera guidelines that can be culled from the research literature:

a. Schmeiser [1982] found that, for a fixed total sample size, there is little benefit from dividing it into more than k 30 batches, even if we could do so and still retain independence between the batch means. Therefore, there is no reason to consider numbers of batches much greater than 30, no matter how much raw data are available. He also found that the performance of the confidence interval, in terms of its width and the variability of its width, is poor for fewer than 10 batches. Therefore, a number of batches between 10 and 30 should be used in mos applications.

b. Although there is typically autocorrelation between batch means at all lags, the lag-1 autocorrelation ρ1=corr⁡(Yˉj,Yˉj+1)\rho_{1} = \operatorname{c o r r} ( \bar {Y} _ {j} , \bar {Y} _ {j + 1} ) is usually studied to assess the dependence between batch means. When the lag-1 autocorrelation is nearly 0, then the batch means are treated as independent. This approach is based on the observation that the autocorrelation in many stochastic processes decreases as the lag increases. Therefore, all lag autocorrelations should be smaller, in absolute value, than the lag-1 autocorrelation.

c. The lag-1 autocorrelation between batch means can be estimated (see below). However, the autocorrelation should not be estimated from a small number of batch means (such as the 10≤k≤3010 \leq k \leq 30 recommended above); there is bias in the autocorrelation estimator. Law and Carson [1979] suggest estimating the lag-1 autocorrelation from a large number of batch means based on a smaller batch size, perhaps 100≤k≤400100 \leq k \leq 400. When the autocorrelation between these batch means is approximately 0, then the autocorrelation will be even smaller if we rebatch the data to between 10 and 30 batch means based on a larger batch size. Hypothesis tests for 0 autocorrelation are available, as described next.

d. If the total sample size is to be chosen sequentially, say to attain a specified precision, then it is helpful to allow the batch size and number of batches to grow as the run length increases. I can be shown that a good strategy is to allow the number of batches to increase as the square root of the sample size after first finding a batch size at which the lag-1 autocorrelation is approximately 0. Although we will not discuss this point further, an algorithm based on it can be found in Fishman and Yarberry [1997]; see also Steiger and Wilson [2002] and Lada, Steiger, and Wilson [2006].

Given these insights, we recommend the following general strategy:

  1. Obtain output data from a single replication and delete as appropriate. Recall our guideline: collecting at least 10 times as much data as are deleted.

  2. Form up to k=400k = 400 batches (but at least 100 batches) with the retained data, and compute the batch means. Estimate the sample lag-1 autocorrelation of the batch means as

ρ^1=∑j=1k−1(Yˉj−Yˉ)(Yˉj+1−Yˉ)∑j=1k(Yˉj−Yˉ)2 \widehat {\rho} _ {1} = \frac {\sum_{j = 1} ^ {k - 1} (\bar {Y} _ {j} - \bar {Y}) (\bar {Y} _ {j + 1} - \bar {Y})}{\sum_{j = 1} ^ {k} (\bar {Y} _ {j} - \bar {Y}) ^ {2}}
  1. Check the correlation to see whether it is sufficiently small.

(a) If ρ^1≤0.2\widehat {\rho} _ {1} \leq 0 . 2, then rebatch the data into 30≤k≤4030 \leq k \leq 40 batches, and form a confidence -interval using k−1k - 1 degrees of freedom for the t distribution and Equation (36) to estimate the variance of Yˉ˘\breve {\bar {Y}}.

(b) If ρ^1>0.2\widehat {\rho} _ {1} > 0 . 2, then extend the replication by 50% to 100% and go to Step 2. If it is -not possible to extend the replication, then rebatch the data into approximately k=10k = 10 batches, and form the confidence interval, using k−1k - 1 degrees of freedom for the t distribution and Equation (36) to estimate the variance of Yˉ.{\bar {Y}} .4. As an additional check on the confidence interval, examine the batch means (at the larger or smaller batch size) for independence, using the following test. See, for instance, Alexopoulos and Seila [1998]. Compute the test statistic

C=k2−1k−2(ρ1^+(Yˉ1−Yˉ)2+(Yˉk−Yˉ)22∑j=1k(Yˉj−Yˉ)2) C = \sqrt {\frac {k^{2} - 1}{k - 2}} \left(\widehat {\rho_{1}} + \frac {(\bar {Y} _ {1} - \bar {Y}) ^ {2} + (\bar {Y} _ {k} - \bar {Y}) ^ {2}}{2 \sum_{j = 1} ^ {k} (\bar {Y} _ {j} - \bar {Y}) ^ {2}}\right)

If C < zβC \ < \ z_{\beta} then accept the independence of the batch means, where β\beta is the Type I error level of the test, such as 0.1, 0.05, 0.01. Otherwise, extend the replication by 50% to 100% and go to Step 2. If it is not possible to extend the replication, then rebatch the data into approximately k=10k = 10 batches, and form the confidence interval, using k−1k - 1 degrees of freedom for the t distribution and Equation (36) to estimate the variance of Y.

This procedure, including the final check, is conservative in several respects. First, if the lag-1 autocorrelation is substantially negative then we proceed to form the confidence interval anyway. A dominant negative correlation tends to make the confidence interval wider than necessary, which is an error, but not one that will cause us to make incorrect decisions. The requirement that ρ^1<0.2\widehat {\rho} _ {1} < 0 . 2 at 100≤k≤400100 \leq k \leq 400-batches is pretty stringent and will tend to force us to get more data (and therefore create larger batches) if there is any hint of positive dependence. And finally, the hypothesis test at the end has a probability of β\beta of forcing us to get more data when none are really needed. But this conservatism is by design; the cost of an incorrect decision is typically much greater than the cos of some additional computer run time.

The batch-means approach to confidence-interval estimation is illustrated in the next example.

Example 18

Reconsider the FastChip wafer fab simulation of Example 8. Suppose that we want to estimate the steady-state mean cycle time for Chip-C, w, by a 95% confidence interval. To illustrate the method of batch means, assume that one run of the model has been made, simulating 5000 cycle times after the deletion point. We then form batch means from k=100k = 100 batches of size m=50m = 50 and estimate the lag-1 autocorrelation to be ρ^1=0.37>0.2\widehat {\rho} _ {1} = 0 . 37 > 0 . 2. Thus, we decide to extend the simulation to 10,000 customers after the deletion point, and again we estimate the lag-1 autocorrelation. This estimate, based on k=100k = 100 batches of size m=100m = 100, is ρ1^=0.15<0.2\widehat {\rho_{1}} = 0 . 15 < 0 . 2 Having passed the correlation check, we rebatch the data into k=40k = 40 batches of size m=250m = 250 The point estimate is the overall mean

Yˉ=110000∑j=110000Yˉj=47.00hours. \bar {Y} = \frac {1}{10000} \sum_{j = 1} ^ {10000} \bar {Y} _ {j} = 47. 00 \text{hours.}

The variance of Yˉ,{\bar {Y}} , computed from the 40 batch means, is

S2k=∑j=140Yˉj2−40Yˉ240(39)=0.049 \frac {S^{2}}{k} = \frac {\sum_{j = 1} ^ {40} \bar {Y} _ {j} ^ {2} - 40 \bar {Y} ^ {2}}{40 (39)} = 0. 049

Thus, a 95% confidence interval is given by

Yˉ−t0.025,390.049≤w≤Yˉ+t0.025,390.049 \bar {Y} - t_{0. 025, 39} \sqrt {0 . 049} \leq w \leq \bar {Y} + t_{0. 025, 39} \sqrt {0 . 049}

or

46.55=47.00−2.02(0.221)≤w≤47.00+2.02(0.221)=47.45 46. 55 = 47. 00 - 2. 02 (0. 221) \leq w \leq 47. 00 + 2. 02 (0. 221) = 47. 45

Thus, we assert with 95% confidence that true mean cycle time w is between 46.55 and 47.45 hours. If these results are not sufficiently precise, then the run length should be increased to achieve greater precision.

As a further check on the validity of the confidence interval, we can apply the correlation hypothesis test. To do so, we compute the test statistic from the k=40k = 40 batches of size m=250m = 250 used to form the confidence interval. This gives

C=−0.58<1.96=z0.05 C = - 0. 58 < 1. 96 = z_{0. 05}

which confirms the lack of correlation at the 0.05 significance level. Notice that, at this small number of batches, the estimated lag-1 autocorrelation appears to be slightly negative, illustrating our poin about the difficulty of estimating correlation with small numbers of observations.

5.6 Steady-State Quantiles

Constructing confidence intervals for quantile estimates in a steady-state simulation can be tricky, especially if the output process of interest is a continuous-time process, such as LQ(t)L_{Q} ( t )), the number of customers in queue at time t. In this section, we outline the main issues.

Taking the easier case first, suppose that the output process from a single replication, after appropriate deletion of initial data, is Yd+1,…,Yn.Y_{d + 1} , \dots , Y_{n} .. To be concrete,YiY_{i} might be the delay in queue of the ith customer. Then the point estimate of the pth quantile can be obtained as before, either from the histogram of the data or from the sorted values. Of course, only the data after the deletion point are used. Suppose we make RR replications and let θr^\widehat {\theta_{r}} be the quantile estimate from the rth. Then the R quantile estimates,θ1^,…,θR^\widehat {\theta_{1}} , \ldots , \widehat {\theta_{R}}-, are independent and identically distributed. Their average is

θ.^=1R∑i=1Rθi^ \widehat {\theta .} = \frac {1}{R} \sum_{i = 1} ^ {R} \widehat {\theta_{i}}

It can be used as the point estimator of θ;\theta ; and an approximate confidence interval is

θ^.±tα/2,R−1SR \widehat {\theta}. \pm t_{\alpha / 2, R - 1} \frac {S}{\sqrt {R}}

where S2S^{2} is the usual sample variance of θ1^,…,θR^\widehat {\theta_{1}} , \ldots , \widehat {\theta_{R}}- -What if only a single replication is obtained? Then the same reasoning applies if we let θi^\widehat {\theta_{i}} be -the quantile estimate from within the ith batch of data. This requires sorting the data or forming a histogram within each batch. If the batches are large enough, then these within-batch quantile estimates will also be approximately i.i.d.

When we have a continuous-time output process, then, in principle, the same methods apply. However, we must be careful not to transform the data in a way that changes the problem. In particular, we cannot first form batch means, as we have done throughout this chapter, and then estimate the quantile from these batch means. The p quantile of the batch means of LQ(t)L_{Q} ( t ) is not the same as the p quantile of LQ(t)L_{Q} ( t ) itself. Thus, the quantile point estimate must be formed from the histogram of the raw data, either from each run, if we make replications, or within each batch, if we make a single replication.

6 Summary

This chapter emphasized the idea that a stochastic discrete-event simulation is a statistical experiment. Therefore, before sound conclusions can be drawn on the basis of the simulation-generated output data, a proper statistical analysis is required. The purpose of the simulation experiment is to obtain estimates of the performance measures of the system under study. The purpose of the statistica analysis is to acquire some assurance that these estimates are sufficiently precise for the proposed use of the model.

A distinction was made between terminating simulations and steady-state simulations. Steadystate simulation output data are more difficult to analyze, because the simulation analyst must address the problem of initial conditions and the choice of run length. Some suggestions were given regarding these problems, but unfortunately no simple, complete, and satisfactory solution exists. Nevertheless, simulation analysts should be aware of the potential problems, and of the possible solutions—namely, deletion of data and increasing of the run length. More advanced statistical techniques (not discussed in this text) are given in Alexopoulos and Seila [1998], Bratley, Fox, and Schrage [1996], and Law [2007].

The statistical precision of point estimators can be measured by a standard-error estimate or by a confidence interval. The method of independent replications was emphasized. With this method, the simulation analyst generates statistically independent observations, and thus standard statistical methods can be employed. For steady-state simulations, the method of batch means was also discussed.

The main point is that simulation output data contain some amount ofrandom variability; withou some assessment of its size, the point estimates cannot be used with any degree of reliability.

REFERENCES

ALEXOPOULOS, C.,ANDA. F. SEILA [1998], “Output DataAnalysis,” Chapter 7 in Handbook ofSimulation, J. Banks, ed., Wiley, New York.

BRATLEY, P., B. L. FOX, AND L. E. SCHRAGE [1996], A Guide to Simulation, 2d ed., Springer-Verlag, New York.

FISHMAN, G. S.,AND L. S.YARBERRY [1997], “An Implementation ofthe Batch Means Method,” INFORMS Journal on Computing, Vol. 9, pp. 296–310.

GOLDSMAN, D., L. SCHRUBEN, AND J. J. SWAIN [1994], “Tests for Transient Means in Simulated Time Series,” Naval Research Logistics, Vol. 41, pp. 171–187.

KELTON, W. D. [1986], “Replication Splitting and Variance for Simulating Discrete-Parameter Stochastic Processes,” Operations Research Letters, Vol. 4, pp. 275–279.

KELTON, W. D. [1989], “Random Initialization Methods in Simulation,” IIETransactions,Vol. 21, pp. 355–367.

KELTON, W. D., AND A. M. LAW [1983], “A New Approach for Dealing with the Startup Problem in Discrete Event Simulation,” Naval Research Logistics Quarterly, Vol. 30, pp. 641–658.

KLEIJNEN, J. P. C. [1987], Statistical Toolsfor Simulation Practitioners, Dekker, New York.

LADA, E. K., N. M. Steiger, AND J. R. WILSON [2006], “Performance Evaluation of Recent Procedures for Steady-state Simulation Analysis,” IIE Transactions, Vol. 38, pp. 711-–727.

LAW, A. M. [1977], “Confidence Intervals in Discrete Event Simulation: A Comparison of Replication and Batch Means,” Naval Research Logistics Quarterly, Vol. 24, pp. 667–78.

LAW, A. M. [1980], “Statistical Analysis of the Output Data from Terminating Simulations,” Naval Research Logistics Quarterly, Vol. 27, pp. 131–43.

LAW, A. M. [2007], Simulation Modeling and Analysis, 4th ed., McGraw-Hill, New York.

LAW,A. M.,AND J. S. CARSON [1979], “A Sequential Procedure for Determining the Length of a Steady-State Simulation,” Operations Research, Vol. 27, pp. 1011–1025.

NELSON, B. L. [2001], “Statistical Analysis of Simulation Results,” Chapter 94 in Handbook of Industrial Engineering, 3d ed., G. Salvendy, ed., Wiley, New York.

SCHMEISER, B. [1982], “Batch Size Effects in the Analysis of Simulation Output,” Operations Research, Vol. 30, pp. 556–568.

SCHRUBEN, L. [1982], “Detecting Initialization Bias in Simulation Output,” Operations Research, Vol. 30, pp. 569–590.

SNELL, M., AND L. SCHRUBEN [1985], “Weighting Simulation Data to Reduce Initialization Effects,” IIE Transactions, Vol. 17, pp. 354–363

STEIGER, N. M., AND J. R. Wilson [2002], “An Improved Batch Means Procedure for Simulation Output Analysis,” Management Science, Vol. 48, pp. 1569–1586.

WELCH, P. D. [1983], “The StatisticalAnalysis ofSimulation Results,” in The Computer Performance Modeling Handbook, S. Lavenberg, ed., Academic Press, New York, pp. 268–328.

Estimation of Absolute Performance

EXERCISES

  1. For each of the systems described below, under what circumstances would it be appropriate to use a terminating simulation versus a steady-state simulation to analyze this system?

(a) A walk-in medical clinic simulated to determine staffing levels.

(b) A portfolio of stocks, bonds, and derivative securities simulated to estimate long-run return.

(c) A fuel injector assembly plant that runs two shifts per day simulated to estimate throughput.

(d) The United States air traffic control system simulated to evaluate safety.

  1. Suppose that the output process from a queueing simulation is L(t),0≤t≤TL ( t ) , 0 \leq t \leq T, the total number in queue at time t. A continuous-time output process can be converted into the sort of discretetime process Y1,Y2,…Y_{1} , Y_{2} , \ldots. described in this chapter by first forming k=T/mk = T / m batch means of size m time units:
Yj=1m∫(j−1)mjmL(t)dt Y_{j} = \frac {1}{m} \int_{(j - 1) m} ^ {j m} L (t) d t

for j=1,2,…,kj = 1 , 2 , \dots , k. Ensemble averages of these batch means can be plotted to check for initialcondition bias.

(a) Show algebraically that the batch mean over 2m time units can be obtained by averaging two adjacent batch means over m time units. [Hint: This implies that we can start with batch means over rather small time intervals m and build up batch means over longer intervals without reanalyzing all of the data.]

(b) Simulate an M/M/1M / M / 1 queue with λ=1\lambda = 1 and μ=1.25\mu = 1 . 25 for a run length of 4000 time units, computing batch means of the total number in queue with batch size m=4m = 4 time units. Make replications and use a mean plot to determine an appropriate number of batches to delete. Convert this number of batches to delete into a deletion time.

  1. Using the results of Exercise 2 above, design and execute an experiment to estimate the steadystate expected number in this M/M/1M / M / 1 queue, L, to within ±0.5\pm 0 . 5 customers with 95% confidence. Check your estimate against the true value of L=λ/(μ−λ)L = \lambda / ( \mu - \lambda )).

  2. In Example 7, suppose that management desired a 95% confidence interval on the estimate of mean cycle time and that the error allowed was ϵ=0.05\epsilon = 0 . 05 hours (3 minutes). Using the same initial data given in Table 5, estimate the required total sample size. Although we cut the error in half, by how much did the required sample size increase?

  3. Again, simulate an M/M/1M / M / 1 queue with λ=1\lambda = 1 and μ=1.25\mu = 1 . 25, this time recording customer time in system (from arrival to departure) as the performance measure for 4000 customers. Make replications and use a mean plot to determine an appropriate number of customers to delete when starting the system empty, with 4 customers initially in the system, and with 8 customers initially in the system. How does the warmup period change with these different initial conditions? What does this suggest about how to initialize simulations?

  4. Consider an (M, L) inventory system, in which the procurement quantity Q is defined by

Q={M−IifI<L0ifI≥L Q = \left\{\begin{array}{l l} M - I & \text{if} I < L \\ 0 & \text{if} I \geq L \end{array} \right.

where I is the level of inventory on hand plus on order at the end of a month, M is the maximum inventory level, and L is the reorder point. M and L are under management control, so the pair (M, L) is called the inventory policy. Under certain conditions, the analytical solution of such a model is possible, but not always. Use simulation to investigate an (M,L)( M , L ) inventory system with the following properties: The inventory status is checked at the end of each month. Backordering is allowed at a cost of $4 per item short per month. When an order arrives, it will first be used to relieve the backorder. The lead time is given by a uniform distribution on the interval [0.25, 1.25] months. Let the beginning inventory level stand at 50 units, with no orders outstanding. Let the holding cost be $1 per unit in inventory per month. Assume that the inventory position is reviewed each month. If an order is placed, its cost is $60 $5Q, where $60 is the ordering cos and $5 is the cost of each item. The time between demands is exponentially distributed with a mean of 1/15 month. The sizes of the demands follow this distribution:

DemandProbability
11/2
21/4
31/8
41/8

(a) Make ten independent replications, each of run length 100 months preceded by a 12-month initialization period, for the (M, L) (50, 30) policy. Estimate long-run mean monthly cos with a 90% confidence interval.

(b) Using the results of part (a). estimate the total number of replications needed to estimate mean monthly cost within $5.

  1. Reconsider Exercise 6, except that, if the inventory level at a monthly review is zero or negative, a rush order for QQ units is placed. The cost for a rush order is $120+5120\$120+5120, where $120 is the ordering cost and $12 is the cost of each item. The lead time for a rush order is given by a uniform distribution on the interval [0.10, 0.25] months.

(a) Make ten independent replications for the (M, L) policy, and estimate long-run mean monthly cost with a 90% confidence interval.

(b) Using the results of part (a). estimate the total number of replications needed to estimate mean monthly cost within $5.

  1. Suppose that the items in Exercise 6 are perishable, with a selling price given by the following data:
On the Shelf (months)Selling Price
0-1$10
1-25
>20

Thus, any item that has been on the shelf more than 2 months cannot be sold. The age is measured at the time the demand occurs. If an item is outdated, it is discarded, and the next item is brough forward. Simulate the system for 100 months.

(a) Make ten independent replications for the (M, L) (50, 30) policy, and estimate long-run mean monthly cost with a 90% confidence interval.

(b) Using the results of part (a), estimate the total number of replications needed to estimate mean monthly cost within $5.

At first, assume that all the items in the beginning inventory are fresh. Is this a good assumption? What effect does this “all-fresh” assumption have on the estimates of long-run mean monthly cost? What can be done to improve these estimates? Carry out a complete analysis.

  1. Consider the following inventory system:

(a) Whenever the inventory level falls to or below 10 units, an order is placed. Only one order can be outstanding at a time.

(b) The size of each order is Q. Maintaining an inventory costs $0.50 per day per item in inventory. Placing an order incurs a fixed cost of $10.00.

(c) Lead time is distributed in accordance with a discrete uniform distribution between zero and 5 days.

(d) If a demand occurs during a period when the inventory level is zero, the sale is lost at a cost of $2.00 per unit.

(e) The number of customers each day is given by the following distribution:

Number of Customers per DayProbability
10.23
20.41
30.22
40.14

(f) The demand on the part of each customer is Poisson distributed with a mean of 3 units.

(g) For simplicity, assume that all demands occur at noon and that all orders are placed immediately thereafter.

Assume further that orders are received at 5:00 P.M., or after the demand that occurred on tha day. Consider the policy having Q 20. Make ten independent replications, each of length 100

days, and compute a 90% confidence interval for long-run mean daily cost. Investigate the effect of initial inventory level and existence of an outstanding order on the estimate of mean daily cost. Begin with an initial inventory of Q 10 and no outstanding orders.

  1. A store selling Mother’s Day cards must decide 6 months in advance on the number of cards to stock. Reordering is not allowed. Cards cost $0.45 and sell for $1.25. Any cards not sold by Mother’s Day go on sale for $0.50 for 2 weeks. However, sales of the remaining cards is probabilistic in nature according to the following distribution:

32% of the time, all cards remaining get sold.

40% of the time, 80% of all cards remaining are sold.

28% of the time, 60% of all cards remaining are sold.

Any cards left after 2 weeks are sold for $0.25. The card-shop owner is not sure how many cards can be sold, but thinks it is somewhere (i.e., uniformly distributed) between 200 and 400. Suppose that the card-shop owner decides to order 300 cards. Estimate the expected total profit with an error of at most $5.00. [Hint: Make ten initial replications. Use these data to estimate the total sample size needed. Each replication consists of one Mother’s Day.]

  1. A very large mining operation has decided to control the inventory of high-pressure piping by a “periodic review, order up to M” policy, where M is a target level. The annual demand for this piping is normally distributed, with mean 600 and variance 800. This demand occurs fairly uniformly over the year. The lead time for resupply is Erlang distributed of order k 2 with its mean at 2 months. The cost of each unit is $400. The inventory carrying charge, as a proportion of item cost on an annual basis, is expected to fluctuate normally about the mean 0.25 (simple interest), with a standard deviation of 0.01. The cost of making a review and placing an order is $200, and the cost of a backorder is estimated to be $100 per unit backordered. Suppose that the inventory level is reviewed every 2 months, and let M 337.

(a) Make ten independent replications, each of run length 100 months, to estimate long-run mean monthly cost by means of a 90% confidence interval.

(b) Investigate the effects of initial conditions. Calculate an appropriate number of monthly observations to delete, in order to reduce initialization bias to a negligible level.

  1. Consider some number, say N, ofM/M/1 queues in series. The M/M/1 queue has Poisson arrivals at some rate λ customers per hour, exponentially distributed service times with mean 1/µ, and a single server. (Recall that “Poisson arrivals” means that interarrival times are exponentially distributed.) By M/M/1 queues in series, it is meant that, upon completion of service at a given server, a customer joins a waiting line for the next server. The system can be shown as follows:

All service times are exponentially distributed with mean 1/μ,1 / \mu ,, and the capacity of each waiting line is assumed to be unlimited. Assume that λ 8 customers per hour and 1/μ=0.1 / \mu = 0 .1 hour. The measure of performance is response time, which is defined to be the total time a customer is in the system.

(a) By making appropriate simulation runs, compare the initialization bias for N 1 (i.e., one M/M/1 queue) to N=2(i.e.N = 2 ( {\mathrm{i . e .}}, two M/M/1 queues in series). Start each system with all servers idle and no customers present. The purpose of the simulation is to estimate mean response time.

(b) Investigate the initialization bias as a function of N,N , for N=1,2,3,4,N = 1 , 2 , 3 , 4 ,, and 5.

(c) Draw some general conclusions concerning initialization bias for “large” queueing systems when at time 0 the system is assumed to be empty and idle.

  1. Jobs enter a job shop in random fashion according to a Poisson process at a stationary overal rate, two every 8-hour day. The jobs are of four types. They flow from work station to work station in a fixed order, depending on type, as shown below. The proportions of each type are also shown.
TypeFlow through StationsProportion
11, 2, 3, 40.4
21, 3, 40.3
32, 4, 30.2
41, 40.1

Processing times perjob at each station depend on type, but all times are, approximately, normally distributed with mean and s.d. in hours as follows:

TypeStation
1234
1(20, 3)(30, 5)(75, 4)(20, 3)
2(18, 2)(60, 5)(10, 1)
3(20, 2)(50, 8)(10, 1)
4(30, 5)(15, 2)

Station i will have cic_{i} workers,i=1,2,3,i = 1 , 2 , 3 ,4. Each job occupies one worker at a station for the duration of a processing time. All jobs are processed on a first-in–first-out basis, and all queues for waiting jobs are assumed to have unlimited capacity. Simulate the system for 800 hours, preceded by a 200-hour initialization period. Assume that c1=8,c2=8,c3=20,c4=7c_{1} = 8 , c_{2} = 8 , c_{3} = 20 , c_{4} = 7 Based on R=20R = 20 replications, compute a 95% confidence interval for average worker utilization at each of the four stations. Also, compute a 95% confidence interval for mean total response time for each job type, where a total response time is the total time that a job spends in the shop.

  1. Change Exercise 13 to give priority at each station to the jobs by type. Type I jobs have priority over type II, type II over type III, and type III over type IV. Use 800 hours as run length, 200 hours as initialization period, and R=20R = 20 replications. Compute four 95% confidence intervals for mean total response time by type. Also, run the model without priorities and compute the same confidence intervals. Discuss the trade-offs when using first-in-first-out versus a priority system.

  2. Consider a single-server queue with Poisson arrivals at rate λ=10.82\lambda = 10 . 82 per minute and normally distributed service times with mean 5.1 seconds and variance 0.98 seconds^2. It is desired to estimate the mean time in the system for a customer who, upon arrival, finds i other customers in the system; that is, to estimate

wi=E(W∣N=i)fori=0,1,2,… w_{i} = E (W | N = i) \quad \text{for} i = 0, 1, 2, \ldots

where W is a typical system time and N is the number of customers found by an arrival. For example,w0w_{0} is the mean system time for those customers who find the system empty,w1w_{1} is the mean system time for those customers who find one other customer present upon arrival, and so on. The estimate w^i\widehat {w} _ {i} of wiw_{i} will be a sample mean of system times taken over all arrivals who -find i in the system. Plot w^i\widehat {w} _ {i} vs i. Hypothesize and attempt to verify a relation between wiw_{i} and i.

-(a) Simulate for a 10-hour period with empty and idle initial conditions.

(b) Simulate for a 10-hour period after an initialization of one hour. Are there observable differences in the results of (a) and (b)!( \mathsf {b} ) !(c) Repeat parts (a) and (b) with service times exponentially distributed with mean 5.1 seconds.

(d) Repeat parts (a) and (b) with deterministic service times equal to 5.1 seconds.

(e) Find the number of replications needed to estimate w_0,w1,…,w6w_{1} , \ldots , w_{6} with a standard error for each of at most 3 seconds. Repeat parts (a)–(d), but using this number of replications.

  1. At Smalltown U., there is one specialized graphics workstation for student use located across campus from the computer center. At 2:00 A.M. one day, six students arrive at the workstation to complete an assignment. A student uses the workstation for 108 minutes, then leaves to go to the computer center to pick up their graphics output. There is a 25% chance that the run wil be OK and the student will go to sleep. If it is not OK, the student returns to the workstation and waits until it becomes free. The round trip from workstation to computer center and back takes 30±530 \pm 5 minutes. The computer becomes inaccessible at 5:00 A.M. Estimate the probability p that at least five of the six students will finish their assignment in the 3-hour period. First, make R=10R = 10 replications, and compute a 95% confidence interval for p.p . Next, work out the number of replications needed to estimate pp within .02, and make this number of replications. Recompute the 95% confidence interval for p.p .17. Four workers are spaced evenly along a conveyor belt. Items needing processing arrive according to a Poisson process at the rate of 2 per minute. Processing time is exponentially distributed, with mean 1.6 minutes. If a worker becomes idle, then he or she takes the first item to come by on the conveyor. If a worker is busy when an item comes by, that item moves down the conveyor to the next worker, taking 20 seconds between two successive workers. When a worker

finishes processing an item, the item leaves the system. If an item passes by the last worker, i is recirculated on a loop conveyor and will return to the first worker after 5 minutes.

Management is interested in having a balanced workload—that is, management would like worker utilizations to be equal. Let ρi\rho_{i} be the long-run utilization of worker i, and let ρ\rho be the average utilization of all workers. Thus,ρ=(ρ1+ρ2+ρ3+ρ4)/4\rho = ( \rho_{1} + \rho_{2} + \rho_{3} + \rho_{4} ) / 4. According to queueing theory, ρ can be estimated by ρ=λ/cμ.\rho = \lambda / c \mu ., where λ=2\lambda = 2 arrivals per minute,c=4c = 4 servers, and 1/μ=1.61 / \mu = 1 . 6 minutes is the mean service time. Thus,ρ=λ/cμ=(2/4)1.6=0.8;\rho = \lambda / c \mu = ( 2 / 4 ) 1 . 6 = 0 . 8 ; so, on the average, a worker will be busy 80% of the time.

(a) Make 10 independent replications, each of run length 40 hours preceded by a one-hour initialization period. Compute 95% confidence intervals for ρ1\rho_{1} and ρ4\rho_{4}. Draw conclusions concerning workload balance.

(b) Based on the same 10 replications, test the hypothesis H0:ρ1=0.8H_{0} {:} \rho_{1} = 0 . 8 at a level of significance α=0.05\alpha = 0 . 05. If a difference of .05 is important to detect, determine the probability that such a deviation is detected. In addition, if it is desired to detect such a deviation with probability at least 0.9, figure out the sample size needed to do so. [Hint: See any basic statistics textbook for guidance on hypothesis testing.]

(c) Repeat (b) for H0;ρ4=0.8H_{0} ; \rho_{4} = 0 . 8(d) From the results of (a)–(c), draw conclusions for management about the balancing of workloads.

  1. At a small rock quarry, a single power shovel dumps a scoop full of rocks at the loading area approximately every 10 minutes, with the actual time between scoops modeled well as being exponentially distributed, with mean 10 minutes. Three scoops of rocks make a pile; whenever one pile of rocks is completed, the shovel starts a new pile.

The quarry has a single truck that can carry one pile (3 scoops) at a time. It takes approximately 27 minutes for a pile of rocks to be loaded into the truck and for the truck to drive to the processing plant, unload, and return to the loading area. The actual time to do these things altogether is modeled well as being normally distributed, with mean 27 minutes and standard deviation 12 minutes.

When the truck returns to the loading area, it will load and transport another pile if one is waiting to be loaded; otherwise, it stays idle until another pile is ready. For safety reasons, no loading of the truck occurs until a complete pile is waiting.

The quarry operates in this manner for an 8-hour day. We are interested in estimating the utilization of the trucks and the expected number of piles waiting to be transported if an additiona truck is purchased.

  1. Big Bruin, Inc. plans to open a small grocery store in Juneberry, NC. They expect to have two checkout lanes, with one lane being reserved for customers paying with cash. The question they want to answer is: How many grocery carts do they need?

During business hours (6 A.M.–8 P.M.), cash-paying customers are expected to arrive at 8 per hour. All other customers are expected to arrive at 9 per hour. The time between arrivals of each type can be modeled as exponentially distributed random variables.

The time spent shopping is modeled as normally distributed, with mean 40 minutes and standard deviation 10 minutes. The time required to check out after shopping can be modeled as lognormally distributed, with (a) mean 4 minutes and standard deviation 1 minute for cash-paying customers; (b) mean 6 minutes and standard deviation 1 minute for all other customers.

We will assume that every customer uses a shopping cart and that a customer who finishes shopping leaves the cart in the store so that it is available immediately for another customer. We will also assume that any customer who cannot obtain a cart immediately leaves the store, disgusted.

The primary performance measures of interest to Big Bruin are the expected number of shopping carts in use and the expected number of customers lost per day. Recommend a number of carts for the store, remembering that carts are expensive, but so are lost customers.

  1. Develop a simulation model of the total time in the system for an M/M/1 queue with service rate μ=1;\mu = 1 ; therefore, the traffic intensity is ρ=λ/μ=λ\rho = \lambda / \mu = \lambda, the arrival rate. Use the simulation, in conjunction with the technique of plotting ensemble averages, to study the effect of traffic intensity on initialization bias when the queue starts empty. Specifically, see how the initialization phase T0T_{0} changes for ρ=0.5,0.7,0.8,0.9,0.95\rho = 0 . 5 , 0 . 7 , 0 . 8 , 0 . 9 , 0 . 9521. Many simulation-software tools come with built-in support for output analysis. Use the web to research the features of one of these products.

List of Materials Available on www.bcnn.net

SimulationTools.xls

12 Estimation of Relative Performance

This chapter discusses a few of the many statistical methods that can be used to compare the relative performance of two or more system designs. This is one of the most important uses of simulation. Because the observations of the response variables contain random variation, statistical analysis is needed to discover whether any observed differences are due to differences in design or merely to the random fluctuation inherent in the models.

The comparison of two system designs is easier than the simultaneous comparison of multiple system designs. Section 1 discusses the case of two system designs, using two possible statistica techniques: independent sampling and correlated sampling. Correlated sampling is also known as the common random numbers (CRN) technique; simply put, the same random numbers are used to simulate both alternative system designs. If implemented correctly, CRN usually reduces the variance of the estimated difference of the performance measures and thus can provide, for a given sample size, more precise estimates of the mean difference than can independent sampling. Section 2 extends the statistical techniques of Section 1 to the comparison of multiple (more than two) system designs using simultaneous confidence intervals, screening and selection of the best. These approaches are somewhat limited with respect to the number of system designs that can be considered, so Section 3 describes how a large number of complex system designs can sometimes be represented by a simpler

metamodel. Finally, for comparison and evaluation of a very large number of system designs tha are related in a less structured way, Section 4 presents optimization via simulation.

1 Comparison of Two System Designs

Suppose that a simulation analyst desires to compare two possible configurations of a system. In a queueing system, perhaps two possible queue disciplines, or two possible sets of servers, are to be compared. In a supply-chain inventory system, perhaps two possible ordering policies will be compared. A job shop could have two possible scheduling rules; a production system could have in-process inventory buffers of various capacities. Many other examples of alternative system designs can be provided.

The method of replications will be used to analyze the output data. The mean performance measure for system i will be denoted by θi,i=1,2.\theta_{i} , i = 1 , 2 . If it is a steady-state simulation, it will be assumed that deletion of data, or other appropriate techniques, have been used to ensure that the point estimators are approximately unbiased estimators of the mean performance measures θi.\theta_{i} .. The goal of the simulation experiments is to obtain point and interval estimates of the difference in mean performance, namely θ1−θ2\theta_{1} - \theta_{2}. Two methods of computing a confidence interval for θ1−θ2\theta_{1} - \theta_{2} will be discussed, but first an example and a general framework will be given.

Example 1

Software Made Personal (SMP) has a customer support call center where 7 operators handle questions from owners of their software from 8 A.M. to 4 P.M. Eastern Time. When a customer calls they use an automated system to select between the two product lines, finance and contact management. Currently each product line has its own operators (4 for financial, 3 for contact management) and hold queue. SMP wonders if they can reduce the total number of operators needed by cross-training them so that they can answer calls for any product line. This is expected to increase the time to process a call by about 10%. The current system is illustrated in Figure 1(a). and the alternative system design is shown in Figure 1(b). Before considering reducing operators, SMP wants to know what their quality of service would be if they simply cross-train the 7 operators they currently have. Incoming calls have been modeled as a nonstationary Poisson arrival process and distributions have been fit to operator time to answer questions. Comparisons will be based on the average time from call initiation until the customer’s questions are answered.

(a) Figure 1 Current SMP call center (a) and an alternative design (b).

Table 1 Simulation Output Data and Summary Measures for Comparing Two Systems

SystemReplicationSampleMeanSampleVariance
12⋯\cdotsRiR_{i}
1Y11Y_{11}Y21Y_{21}⋯\cdotsYR11Y_{R_{1}1}Yˉ.1\bar{Y}_{.1}S12S_{1}^{2}
2Y12Y_{12}Y22Y_{22}⋯\cdotsYR22Y_{R_{2}2}Yˉ.2\bar{Y}_{.2}S22S_{2}^{2}

When comparing two systems, such as those in Example 1, the simulation analyst must decide on a run length TE(i)T_{E} ^ {( i )} for each model i=1,2.i = 1 , 2 ., a number of replications RiR_{i} to be made of each model, or both. From replication r of system i, the simulation analyst obtains an estimate YriY_{r i} of the mean performance measure θi\theta_{i}. In Example 1,YriY_{r i} would be the average call response time observed during replication r for system i, where r=1,2,…,Ri;r = 1 , 2 , \ldots , R_{i} ; and i=1,2i = 1 , 2. The data, together with the two summary measures, the sample means Yˉ⋅i,{\bar {Y}} _ {\cdot i} ,, and the sample variances Si2S_{i} ^ {2}, are exhibited in Table 1. Assuming that the estimators YriY_{r i} are, at least approximately, unbiased, it follows that

θ1=E(Yr1),r=1,…,R1;θ2=E(Yr2),r=1,…,R2 \theta_{1} = E (Y_{r 1}), \quad r = 1, \ldots , R_{1}; \quad \theta_{2} = E (Y_{r 2}), r = 1, \ldots , R_{2}

In Example 1, SMP is initially interested in a comparison of two system designs (same number of operators, but specialized vs. cross trained), so the simulation analyst decides to compute a confidence intervalfor θ1−θ2\theta_{1} - \theta_{2}, the difference between the two mean performance measures. This will lead to one of three possible conclusions:

  1. If the confidence interval (c.i.) for θ1−θ2\theta_{1} - \theta_{2} is totally to the left of zero, as shown in Figure 2(a), then there is strong evidence for the hypothesis that θ1−θ2<0\theta_{1} - \theta_{2} < 0, or equivalently θ1<θ2\theta_{1} < \theta_{2} In Example 1 ,θ1<θ2, \theta_{1} < \theta_{2} implies that the mean response time for system 1, the original system, is smaller than for system 2, the alternative system.

  2. If the c.i. for θ1−θ2\theta_{1} - \theta_{2} is totally to the right of zero, as shown in Figure 2(b), then there is strong evidence that θ1−θ2>0.\theta_{1} - \theta_{2} > 0 ., or equivalently,θ1>θ2\theta_{1} > \theta_{2} In Example 1,θ1>θ2\theta_{1} > \theta_{2} can be interpreted as system 2 being better than system 1, in the sense tha system 2 has a smaller mean response time.

  3. If the c.i. for θ1−θ2\theta_{1} - \theta_{2} contains zero, then, with the data at hand, there is no strong statistica evidence that one system design is better than the other.

Figure 2 Three confidence intervals that can occur in the comparing of two systems.

Some statistics textbooks say that the weak conclusion θ1=θ2\theta_{1} = \theta_{2} can be drawn, but such statements can be misleading. A “weak” conclusion is often no conclusion at all. Most likely, if enough additional data were collected (i.e.,Ri( \mathrm{i} . \mathrm{e} . , R_{i} increased), the c.i. would shift, and definitely shrink in length, unti conclusion 1 or 2 would be drawn. Since the confidence interval provides a measure of the precision of the estimator of θ1−θ2\theta_{1} - \theta_{2}, we want to shrink it until we can either conclude that there is a difference that matters, or the difference is so small that we do not need to separate them.

In this chapter, a two-sided 100(1 α)% c.i. for θ1−θ2\theta_{1} - \theta_{2} will always be of the form

Yˉ.1−Yˉ.2±tα/2,νs.e.(Yˉ.1−Yˉ.2)(1) \bar {Y} _ {. 1} - \bar {Y} _ {. 2} \pm t_{\alpha / 2, \nu} \mathrm{s.e.} (\bar {Y} _ {. 1} - \bar {Y} _ {. 2})\tag{1}

where Yˉ⋅i{\bar {Y}} _ {\cdot i} is the sample mean performance measure for system i over all replications

Yˉ⋅i=1Ri∑r=1RiYri(2) \bar {Y} _ {\cdot i} = \frac {1}{R_{i}} \sum_{r = 1} ^ {R_{i}} Y_{r i}\tag{2}

ν is the degrees offreedom associated with the variance estimator,tα/2,1t_{\alpha / 2 , 1} is the 100(1−α/2)100 ( 1 {-} \alpha / 2 ) percentage point of a t distribution with ν degrees of freedom, and s.e.(⋅)\mathbf{s . e .} ( \cdot ) represents the standard error of the specified point estimator. To obtain the standard error and the degrees of freedom, the analyst uses one of two statistical techniques. Both techniques assume that the basic data,YriY_{r i} of Table 1, are approximately normally distributed. This assumption is reasonable provided that each YriY_{r i} is itself a sample mean of observations from replication r,r , which is indeed the situation in Example 1.

By design of the simulation experiment,Yr1(r=1,…,R1)Y_{r 1} ( r = 1 , \dots , R_{1} ) are independently and identically distributed (i.i.d.) with mean θ1\theta_{1} and variance σ12,\sigma_{1} ^ {2} ,, say. Similarly,Yr2(r=1,…,R2)Y_{r 2} ( r = 1 , \ldots , R_{2} ) are i.i.d. with mean θ2\theta_{2} and variance σ22.\sigma_{2} ^ {2} ., say. The two techniques for computing the confidence interval in Equation (1), which are based on different sets of assumptions, are discussed in the following subsections.

There is an important distinction between statistically significant differences and practically significant differences in systems performance. Statistical significance answers the following question: Is the observed difference Yˉ⋅1−Yˉ⋅2{\bar {Y}} _ {\cdot 1} - {\bar {Y}} _ {\cdot 2} larger than the variability in Yˉ⋅1−Yˉ⋅2?{\bar {Y}} _ {\cdot 1} - {\bar {Y}} _ {\cdot 2} ? This question can be restated as: Have we collected enough data to be confident that the difference we observed is real, or just chance? Conclusions 1 and 2 above imply a statistically significant difference, while conclusion 3 implies that the observed difference is not statistically significant, even though the systems may indeed be different. Statistical significance is a function of the simulation experiment and the output data.

Practical significance answers the following question: Is the true difference θ1−θ2\theta_{1} - \theta_{2} large enough to matter for the decision we need to make? In Example 1, we may reach the conclusion that θ1>θ2\theta_{1} > \theta_{2} and decide that system 2 is better (smaller expected response time). However, if the actual difference θ1−θ2\theta_{1} - \theta_{2} is very small—say, small enough that a customer would not notice the improvement—then it might not be worth the cost to replace system 1 with system 2. Practical significance is a function of the actual difference between the systems and is independent of the simulation experiment.

Confidence intervals do not answer the question of practical significance directly. Instead, they bound, with probability 1−α1 - \alpha, the true difference θ1−θ2\theta_{1} - \theta_{2} within the range

Yˉ.1−Yˉ.2−tα/2,νs.e.(Yˉ.1−Yˉ.2)≤θ1−θ2≤Yˉ.1−Yˉ.2+tα/2,νs.e.(Yˉ.1−Yˉ.2) \bar {Y} _ {. 1} - \bar {Y} _ {. 2} - t_{\alpha / 2, \nu} \text{s.e.} (\bar {Y} _ {. 1} - \bar {Y} _ {. 2}) \leq \theta_{1} - \theta_{2} \leq \bar {Y} _ {. 1} - \bar {Y} _ {. 2} + t_{\alpha / 2, \nu} \text{s.e.} (\bar {Y} _ {. 1} - \bar {Y} _ {. 2})

Whether a difference within these bounds is practically significant depends on the particular problem.

1.1 Independent Sampling

Independent sampling means that different and independent random number streams will be used to simulate the two systems. This implies that all the observations of simulated system 1, namely {Yr1,r=1,…,R1}\{Y_{r 1} , r = 1 , \ldots , R_{1} \}, are statistically independent of all the observations of simulated system 2, namely {Yr2,r=1,…,R2}\{Y_{r 2} , r = 1 , \dots , R_{2} \}. By Equation (2) and the independence of the replications, the variance of the sample mean Yˉ⋅i{\bar {Y}} _ {\cdot i} is given by

V(Yˉ⋅i)=V(Yri)Ri=σi2Ri,i=1,2 \mathrm{V} (\bar {Y} _ {\cdot i}) = \frac {\mathrm{V} (Y_{r i})}{R_{i}} = \frac {\sigma_{i} ^ {2}}{R_{i}}, \qquad i = 1, 2

For independent sampling,Yˉ⋅1{\bar {Y}} _ {\cdot 1} and Yˉ⋅2{\bar {Y}} _ {\cdot 2} are statistically independent; hence,

V(Yˉ.1−Yˉ.2)=V(Yˉ.1)+V(Yˉ.2)=σ12R1+σ22R2(3) \begin{array}{r l} \mathrm{V} (\bar {Y}. _ {1} - \bar {Y}. _ {2}) & = \mathrm{V} (\bar {Y}. _ {1}) + \mathrm{V} (\bar {Y}. _ {2}) \\ & = \frac {\sigma_{1} ^ {2}}{R_{1}} + \frac {\sigma_{2} ^ {2}}{R_{2}} \end{array}\tag{3}

There are confidence-interval procedures that are appropriate when the two variances are equa but unknown in value; that is,σ12=σ22\sigma_{1} ^ {2} = \sigma_{2} ^ {2}. However, since we would rarely know this to be true in practice, and the advantages of exploiting equal variances are slight provided the number of replications is not too small, we refer the reader to any statistics textbook for this case (for instance Hines et al. [2002]).

An approximate 100(1−α)%100 ( 1 - \alpha ) \% c.i. for θ1−θ2\theta_{1} - \theta_{2} can be computed as follows. The point estimate is computed by

Yˉ.1−Yˉ.2(4) \bar {Y} _ {. 1} - \bar {Y} _ {. 2}\tag{4}

with Yˉ⋅i{\bar {Y}} _ {\cdot i} given by Equation (2), while the sample variance for system i is

Si2=1Ri−1∑r=1Ri(Yri−Yˉ.i)2 S_{i} ^ {2} = \frac {1}{R_{i} - 1} \sum_{r = 1} ^ {R_{i}} (Y_{r i} - \bar {Y} _ {. i}) ^ {2} =1Ri−1(∑r=1RiYri2−RiYˉ⋅i2)(5) = \frac {1}{R_{i} - 1} \left(\sum_{r = 1} ^ {R_{i}} Y_{r i} ^ {2} - R_{i} \bar {Y} _ {\cdot i} ^ {2}\right)\tag{5}

Thus, the standard error of the point estimate is given by

s.e.(Yˉ.1−Yˉ.2)=S12R1+S22R2(6) \text{s.e.} (\bar {Y} _ {. 1} - \bar {Y} _ {. 2}) = \sqrt {\frac {S_{1} ^ {2}}{R_{1}} + \frac {S_{2} ^ {2}}{R_{2}}}\tag{6}

with degrees of freedom ν approximated by the expression

ν=(S12/R1+S22/R2)2[(S12/R1)2/(R1−1)]+[(S22/R2)2/(R2−1)](7) \nu = \frac {(S_{1} ^ {2} / R_{1} + S_{2} ^ {2} / R_{2}) ^ {2}}{[ (S_{1} ^ {2} / R_{1}) ^ {2} / (R_{1} - 1) ] + [ (S_{2} ^ {2} / R_{2}) ^ {2} / (R_{2} - 1) ]}\tag{7}

rounded to an integer. The confidence interval is then given by Expression (1),( 1 ) ,, using the standard error of Equation (6). A minimum number of replications R1≥6R_{1} \geq 6 and R2≥6R_{2} \geq 6 is recommended for this procedure.

1.2 Common Random Numbers (CRN)

CRN (also known as correlated sampling) means that, for each replication, the same random numbers are used to simulate both systems. Therefore,R1R_{1} and R2R_{2} must be equal, say,R1=R2=RR_{1} = R_{2} = R. Thus, for each replication r,r , the two estimates Yr1Y_{r 1} and Yr2Y_{r 2} are no longer independent, but rather are correlated. However, independent random numbers are used on different replications, so the pairs (Yr1,Ys2)( Y_{r 1} , Y_{s 2} ) are mutually independent when r≠s.r \neq s .. For example, in Table 1, the observation Y11Y_{11} is correlated with Y12Y_{12}, but Y11Y_{11} is independent of all other observations. The purpose of using CRN is to induce a positive correlation between Yr1Y_{r 1} and Yr2Y_{r 2} for each r and thus to achieve a variance reduction in the point estimator of mean difference,Yˉ⋅1−Yˉ⋅2{\bar {Y}} _ {\cdot 1} - {\bar {Y}} _ {\cdot 2}. In general, this variance is given by

V(Yˉ.1−Yˉ.2)=V(Yˉ.1)+V(Yˉ.2)−2cov(Yˉ.1,Yˉ.2)=σ12R+σ22R−2ρ12σ1σ2R(8) \begin{array}{c} \mathrm{V} (\bar {Y}. _ {1} - \bar {Y}. _ {2}) = \mathrm{V} (\bar {Y}. _ {1}) + \mathrm{V} (\bar {Y}. _ {2}) - 2 \mathrm{cov} (\bar {Y}. _ {1}, \bar {Y}. _ {2}) \\ = \frac {\sigma_{1} ^ {2}}{R} + \frac {\sigma_{2} ^ {2}}{R} - \frac {2 \rho_{12} \sigma_{1} \sigma_{2}}{R} \end{array}\tag{8}

where ρ12\rho_{12} is the correlation between Yr1Y_{r 1} and Yr2Y_{r 2}. [By definition,ρ12=cov⁡(Yr1,Yr2)/σ1σ2\rho_{12} = \operatorname{c o v} ( Y_{r 1} , Y_{r 2} ) / \sigma_{1} \sigma_{2}, which does not depend on r.]

Now, compare the variance of Yˉ⋅1−Yˉ⋅2{\bar {Y}} _ {\cdot 1} - {\bar {Y}} _ {\cdot 2} arising from the use of CRN [Equation (8):( 8 ) _ {:}, call it VCRN]V_{C R N} ] to the variance arising from the use of independent sampling with equal sample sizes [Equation (3) with R1=R2=RR_{1} = R_{2} = R, call it VIND]V_{I N D} ]. Notice that

VCRN=VIND−2ρ12σ1σ2R(9) V_{C R N} = V_{I N D} - \frac {2 \rho_{12} \sigma_{1} \sigma_{2}}{R}\tag{9}

If CRN works as intended, the correlation ρ12\rho_{12} will be positive; hence, the second term on the righ side of Equation (9) will be positive, and, therefore,

VCRN<VIND V_{C R N} < V_{I N D}

That is, the variance of the point estimator will be smaller with CRN than with independent sampling. A smaller variance, for the same sample size R,R , implies that the estimator based on CRN is more precise, leading to a shorter confidence interval on the difference, which implies that smaller differences in performance can be detected.

To compute a 100(1−α)%100 ( 1 - \alpha ) \% c.i. with correlated data, first compute the differences

Dr=Yr1−Yr2(10) D_{r} = Y_{r 1} - Y_{r 2}\tag{10}

which, by the definition of CRN, are i.i.d.; then compute the sample mean difference as

Dˉ=1R∑r=1RDr(11) \bar {D} = \frac {1}{R} \sum_{r = 1} ^ {R} D_{r}\tag{11}

Thus,Dˉ=Yˉ⋅1−Yˉ⋅2\bar {D} = \bar {Y} _ {\cdot 1} - \bar {Y} _ {\cdot 2}. The sample variance of the differences {Dr}\{D_{r} \} is computed as

SD2=1R−1∑r=1R(Dr−Dˉ)2 S_{D} ^ {2} = \frac {1}{R - 1} \sum_{r = 1} ^ {R} (D_{r} - \bar {D}) ^ {2} =1R−1(∑r=1RDr2−RDˉ2)(12) = \frac {1}{R - 1} \left(\sum_{r = 1} ^ {R} D_{r} ^ {2} - R \bar {D} ^ {2}\right)\tag{12}

which has degrees of freedom ν=R−1\nu = R - 1. The 100(1−α)%c.i100 ( 1 - \alpha ) \% \mathrm{c . i}. for θ1−θ2\theta_{1} - \theta_{2} is given by Expression (1), with the standard error of Yˉ⋅1−Yˉ⋅2=Dˉ{\bar {Y}} _ {\cdot 1} - {\bar {Y}} _ {\cdot 2} = {\bar {D}}, estimated by

s.e.(Dˉ)=s.e.(Yˉ.1−Yˉ.2)=SDR(13) \mathrm{s.e.} (\bar {D}) = \mathrm{s.e.} (\bar {Y}. _ {1} - \bar {Y}. _ {2}) = \frac {S_{D}}{\sqrt {R}}\tag{13}

Because SD/RS_{D} / \sqrt {R} of Equation (13) is an estimate of VCRN\sqrt {V_{C R N}} and Expression (6) is an estimate of VIND\sqrt {V_{I N D}}, CRN typically will produce a c.i. that is shorter for a given sample size than the c.i. produced by independent sampling if ρ12>0.\rho_{12} > 0 .. In fact, the expected length of the c.i. will be shorter with the use of CRN if ρ12>0.1\rho_{12} > 0 . 1, provided R>10R > 10. The larger R is, the smaller ρ12\rho_{12} can be and still yield a shorter expected length [Nelson 1987].

For any problem, there are many ways of implementing common random numbers. It is never enough to simply use the same seed on the random-number generator(s). Each random number used in one model for some purpose should be used for the same purpose in the second model—that is, the use of the random numbers must be synchronized. For example, if the ith random number is used to generate the call service time of an operator for the 5th caller in model 1, then the ith random number should be used for the very same purpose in model 2. For queueing systems or service facilities, synchronization of the common random numbers guarantees that the two systems face identica work loads: both systems face arrivals at the same instants of time, and these arrivals demand equa amounts of service. (The actual service times of a given arrival in the two models may not be equal; they could be proportional if the server in one model were faster than the server in the other model.) For an inventory system, in comparing different ordering policies, synchronization guarantees tha the two systems face identical demand for a given product. For production or reliability systems, synchronization guarantees that downtimes for a given machine will occur at exactly the same times and will have identical durations, in the two models. On the other hand, if some aspect of one o the systems is totally different from the other system, synchronization could be inappropriate—or even impossible to achieve. In summary, those aspects of the two system designs that are sufficiently similar should be simulated with common random numbers in such a way that the two models behave similarly; but those aspects that are totally different should be simulated with independent random numbers.

Implementation of common random numbers is model-dependent, but certain guidelines can be given that will make CRN more likely to yield a positive correlation. The purpose of the guidelines is to ensure that synchronization occurs:

  1. Dedicate a random-number stream to a specific purpose, and use as many different streams as needed. (Different random-number generators, or widely spaced seeds on the same generator, can be used to get two different, nonoverlapping streams.) In addition, assign independently chosen seeds to each stream at the beginning of each replication. It is not sufficient to assign seeds at the beginning of the first replication and then let the random-number generator merely continue for the second and subsequent replications. If simulation is conducted in this manner, the first replication will be synchronized, but subsequent replications might no be.

  2. For systems (or subsystems) with external arrivals: As each entity enters the system, the next interarrival time is generated, and then immediately all random variables (such as service times, order sizes, etc.) needed by the arriving entity and identical in both models are generated in a fixed order and stored as attributes of the entity, to be used later as needed. Apply guideline 1: Dedicate one random-number stream to these external arrivals and all their attributes.

  3. For systems having an entity performing given activities in a cyclic or repeating fashion, assign a random-number stream to this entity. (Example: a machine that cycles between two states: up–down–up–down–. . . . Use a dedicated random-number stream to generate the uptimes and downtimes.)

  4. If synchronization is not possible, or if it is inappropriate for some part of the two models, use independent streams of random numbers for this subset of random variates.

Unfortunately, there is no guarantee that CRN will always induce a positive correlation between comparable runs of the two models. It is known that if, for each input random variate X, the estimators Yr1Y_{r 1} and Yr2Y_{r 2} are increasing functions of the random variate X (or both are decreasing functions o X), then ρ12\rho_{12} will be positive. The intuitive idea is that both models, that is, both Yr1Y_{r 1} and Yr2.Y_{r 2} . respond in the same direction to each input random variate, and this results in positive correlation. This increasing or decreasing nature of the response variables, called monotonicity, with respec to the input random variables, is known to hold for certain queueing systems, such as the GI/G/cG I / G / c queues, when the response variable is customer delay, so some evidence exists that common random numbers is a worthwhile technique for queueing simulations. (For simple queues, customer delay is an increasing function of service times and a decreasing function of interarrival times.) Wrigh and Ramsay [1979] reported a negative correlation for certain inventory simulations, however. In summary, the guidelines recently described should be followed, and some reasonable notion that the response variable of interest is a monotonic function of the random input variables should be evident.

Example 1: (cont.)

SMP’s call center designs in Figure 1 will be compared by simulating them with CRN. To illustrate several issues we will look at two comparisons: the current system with 7 operators vs. cross-trained system with 7 operators; and a cross-trained system with 7 operators vs. cross-trained system with 6 operators. We will also assess how much benefit was obtained by using CRN relative to independent sampling

There are four driving input processes in the SMP problem: The caller interarrival times, the caller type, the call times for financial software callers, and the call times for the contact managemen software callers. By “call time” we mean the time that an operator spends with a caller, excluding the time the caller spends on hold.

To implement CRN, we dedicate a distinct random number stream to each input process. This guarantees that precisely the same sequence of calls and caller types will be seen by each alternative on each replication. The call times could be generated in one of two ways, however: Either generate them as needed (that is, when a caller reaches an operator, generate the call time from the appropriate distribution), or generate the call time at the moment that the caller arrives, save it as an attribute of the caller, and use it when the caller reaches an operator. The latter approach (generate the call time at arrival and save it) provides better synchronization in this case; in fact, if we generate call times for the cross-trained alternative by multiplying call times from the current system by 1.1, then this approach guarantees that each caller in the cross-trained alternatives has call time that is precisely 10% greater than they would have experienced in the current design.

Table 2 shows the first 10 replications from a run of 300 replications of the three system designs (the complete data are available from www.bcnn.net). Figure 3 plots the average response times for the current system and the cross-trained system with 7 operators for these same 10 replications. The desired impact of CRN is apparent in the figure: The response averages from the two system designs tend to go up and down together, making their differences easier to observe. The sample correlation between them, based on the entire 300 replications, is 0.24, showing a modest impac of CRN. The sample correlation, again based on all 300 replications, between the proposed systems with 7 and 6 operators is a substantial 0.94, however. As shown in Figure 4, the responses of these two system designs track distinctly up and down together, revealing a strong positive correlation.

Figure 3 Average response times from the first 10 replications of the current and proposed (7 operators) SMP call center

A more quantitative way to see the impact of CRN is to look at the standard errors, because they directly impact the length of the confidence interval. For instance, the standard error for the comparison of the two proposed systems is 0.88 minutes. We can approximate what the standard error would have been with independent sampling by using the sample variances and Equation (6):

s.e.=4.8610+23.9910=1.70 \mathrm{s.e.} = \sqrt {\frac {4 . 86}{10} + \frac {23 . 99}{10}} = 1. 70

The reduction is almost 50%, making it far easier to detect differences.

Table 2 Comparison of System Designs for the SMP Call Center

Average Response TimeDifferences
ReplicationCurrentProposed 7Proposed 6C - P7P7 - P6
16.246.198.350.05-2.16
29.0610.6418.03-1.59-7.39
38.029.5316.17-1.51-6.64
45.936.157.40-0.22-1.25
58.317.8312.700.48-4.87
65.916.098.26-0.17-2.17
78.747.6212.321.12-4.70
87.787.0311.400.75-4.37
97.1512.7923.04-5.64-10.24
105.727.5714.30-1.85-6.73
Sample mean7.298.1413.20-0.86-5.05
Sample variance1.604.8623.993.877.72
Standard error0.620.88

Figure 4 Average response times from the first 10 replications of the proposed designs with 7 and 6 operators for the SMP call center

Understanding why the strength of the induced correlation due to CRN is different in these two cases helps in understanding when CRN will be most effective. The two proposed designs (6 and 7 operators) are structurally the same system, differing only in the number of operators. Therefore, when the random inputs are such that the system with 7 operators is congested, the system with 6 operators is certain to be at least as congested, and probably more so. The current system is structurally different from the alternatives, having a distinct queue for each type of caller. When congestion occurs in the financial software queue it may not occur in the contact management queue, so long response times for the financial callers could be averaged with shorter response times for the contact management callers. Thus, the relationship with the proposed system that has a single queue is not as strong.

Let the subscript C denote the current call center, P7 the proposal with 7 operators, and P6 the proposal with 6 operators. Then a 95% confidence interval for the difference θC−θP7\theta_{C} - \theta_{P 7} is

$$

    1. 86 \pm 2. 26 (0. 62) $$

or

$$

    1. 26 \leq \theta_{C} - \theta_{P 7} \leq 0. 54\tag{14} $$

Therefore, from these 10 replications we cannot say for certain which design has a lower response time, although we can say with high confidence that the difference is within 1.4 minutes.

On the other hand, and as we might expect, the 7 and 6 operator systems are distinctly different, with 95% confidence interval

$$

    1. 02 \leq \theta_{P 7} - \theta_{P 6} \leq - 3. 06 $$

showing that having a 7th operator is at least 3 minutes faster, on average, than only having 6.

1.3 Confidence Intervals with Specified Precision

Suppose that we want the error in our estimate of θ1−θ2\theta_{1} - \theta_{2} to be less than  (the quantity  migh be a practically significant difference). Therefore, our goal is to find a number of replications R such that

H=tα/2,νs.e.(Yˉ.1−Yˉ.2)≤ϵ(15) H = t_{\alpha / 2, \nu} \text{s.e.} (\bar {Y}. _ {1} - \bar {Y}. _ {2}) \leq \epsilon\tag{15}

We begin by making R0≥10R_{0} \geq 10 replications ofeach system, to obtain an initial estimate ofs.e.(Yˉ⋅1−Yˉ⋅2)( {\bar {Y}} _ {\cdot 1} - {\bar {Y}} _ {\cdot 2} ) We then approximate the total number of replications R ≥ R0R \ \geq \ R_{0} needed to achieve the half-length criterion in Equation (15). Finally, we make an additional R−R0R {-} R_{0} replications (or a fresh R replications) of each system, compute the confidence interval, and check that the half-length criterion has been attained.

Example 1: (cont.)

Recall that R0=10R_{0} = 10 replications and CRN yielded the 95% confidence interval for the difference in expected response time of the current and 7-operator cross-trained system in Equation (14); this interval can be rewritten as−0.86±1.40\mathrm{a s} - 0 . 86 \pm 1 . 40 minutes. Although the current call center design appears to have the smaller expected response time, the difference is not statistically significant, since the confidence interval contains 0. Suppose that a difference larger than 0.25 minutes is considered to be practically significant. We therefore want to make enough replications to obtain H≤ϵ=0.25H \leq \epsilon = 0 . 25 The confidence interval used in Example 1 was of the form Dˉ±tα/2,R0−1SD/R0\bar {D} \pm t _ {\alpha / 2 , R_{0} - 1} S_{D} / \sqrt {R_{0}}, with the specific values Dˉ=−0.86,R0=10,t0.025,9=2.26\bar {D} = - 0 . 86 , R_{0} = 10 , t_{0 . 025 , 9} = 2 . 26, and SD2=3.87S_{D} ^ {2} = 3 . 87. To obtain the desired precision, we need to find R such that

tα/2,R−1SDR≤ϵ \frac {t_{\alpha / 2 , R - 1} S_{D}}{\sqrt {R}} \leq \epsilon

We can approximate this by finding the smallest integer R satisfying R≥R0R \geq R_{0} and

R≥(zα/2SDϵ)2 R \geq \left(\frac {z_{\alpha / 2} S_{D}}{\epsilon}\right) ^ {2}

Substituting z0.025=1.96z_{0 . 025} = 1 . 96 and SD2=3.87S_{D} ^ {2} = 3 . 87, we obtain

R≥(1.96)2(3.87)(0.25)2=238 R \geq \frac {(1 . 96) ^ {2} (3 . 87)}{(0 . 25) ^ {2}} = 238

implying that 238 replications are needed, 228 more than in the initial experiment. There are 300 replications available at www.bcnn.net and the reader is encouraged to check the result.

2 Comparison of Several System Designs

Suppose that a simulation analyst desires to compare K alternative system designs. The comparison will be made on the basis of some specified performance measure θi\theta_{i} of system i, for i=1,2,…,Ki = 1 , 2 , \dots , K Many different statistical procedures have been developed that can be used to analyze simulation data and draw statistically sound inferences concerning the parameters θi\theta_{i}. These procedures can be classified as being either fixed-sample-size procedures or sequential-sampling (or multistage) procedures.

In the first type, a predetermined sample size (i.e., run length and number of replications) is used to draw inferences via hypothesis tests or confidence intervals. Examples of fixed-sample-size procedures include the interval estimation of a mean performance measure and the interval estimation of the difference between mean performance measures of two systems [as by Expression (1) in Section 1]. Advantages of fixed-sample-size procedures include a known or easily estimated cos in terms of computer time before running the experiments. When computer time is limited, or when a pilot study is being conducted, a fixed-sample-size procedure might be appropriate. In some cases, clearly inferior system designs may be ruled out at this early stage. A major disadvantage is that a strong conclusion could be impossible. For example, the confidence interval could be too wide for practical use, since the width is an indication of the precision of the point estimator. A hypothesis test may lead to a failure to reject the null hypothesis, a weak conclusion in general, meaning that there is no strong evidence one way or the other about the truth or falsity of the nul hypothesis.

A sequential sampling scheme is one in which more and more data are collected until an estimator with a prespecified precision is achieved or until one of several alternatives is selected, with the probability of correct selection being larger than a prespecified value. A two-stage (or multistage) procedure is one in which an initial sample is used to estimate how many additional observations are needed to draw conclusions with a specified precision. An example of a two-stage procedure for estimating the performance measure of two systems was given Section 1.3.

The proper procedure to use depends on the goal of the simulation analyst. Some possible goals are the following:

  1. estimation of each parameter,θi;\theta_{i} ;2. comparison of each performance measure θi\theta_{i} to a control θ1\theta_{1}(where θ1\theta_{1} could represent the mean performance of an existing system);

  2. all pairwise comparisons,θi−θj\theta_{i} - \theta_{j}, for i≠j;i \neq j ;4. selection of the best θi\theta_{i}(largest or smallest).

The first three goals will be achieved by the construction of confidence intervals The number of such confidence intervals is C=K,C=K−1C = K , C = K - 1, and C=K(K−1)/2C = K ( K {-} 1 ) / 2, respectively. Hochberg and Tamhane [1987] and Hsu [1996] are comprehensive references for such multiple-comparison procedures. The fourth goal requires the use ofa type ofstatistical procedure known as a multiple ranking and selection procedure. Procedures to achieve these and other goals are discussed by Kleijnen [1975, Chapters II and V], who also discusses their relative merit and disadvantages. Goldsman and Nelson [1998] and Law [2007] discuss those selection procedures most relevant to simulation. A comprehensive reference is Bechhofer, Santner, and Goldsman [1995]. The next subsection presents a fixed-samplesize procedure that can be used to meet goals 1, 2, and 3, and is applicable in a wide range of circumstances. Subsection 2.2 presents a procedure to achieve goal 4.

2.1 Bonferroni Approach to Multiple Comparisons

Suppose that C confidence intervals are computed and that the ith interval has confidence coefficient 1−αi1 - \alpha_{i}. Let Si\boldsymbol {S} _ {i} be the statement that the ith confidence interval contains the parameter (or difference of two parameters) being estimated. This statement might be true or false for a given set of data, but the procedure leading to the interval is designed so that statement Si\boldsymbol {S_{i}} will be true with probability 1−αi1 - \alpha_{i}. When it is desired to make statements about several parameters simultaneously, as in goals 1, 2 and 3, the analyst would like to have high confidence that all statements are true simultaneously. The Bonferroni inequality states that

P(all statementsSiare true,i=1,…,C)≥1−∑j=1Cαj=1−αE(16) P (\text{all statements} \mathcal {S} _ {i} \text{are true}, i = 1, \dots , C) \geq 1 - \sum_{j = 1} ^ {C} \alpha_{j} = 1 - \alpha_{E}\tag{16}

where αE=∑j=1Cαj\begin{array} {r} {\alpha_{E} = \sum_{j = 1} ^ {C} \alpha_{j}} \end{array} is called the overall error probability. Expression (16) can be restated as

P(one or more statementsSiis false,i=1,…,C)≤αE P (\text{one or more statements} \mathcal {S} _ {i} \text{is false}, i = 1, \dots , C) \leq \alpha_{E}

or equivalently,

P(one or more of theCconfidence intervals does notcontain the parameter being estimated)≤αE \begin{array}{l} P (\text{one or more of the} C \text{confidence intervals does not} \\ \text{contain the parameter being estimated}) \leq \alpha_{E} \end{array}

Thus,αE\alpha_{E} provides an upper bound on the probability of a false conclusion. To conduct an experiment that involves making C comparisons, first select the overall error probability, say,αE=0.05or0.10.\alpha_{E} = 0 . 05 \mathrm{o r} 0 . 10 . The individual α may be chosen to be equal (αi=αE/C)( \alpha_{i} = \alpha_{E} / C ), or unequal, as desired. The smaller the value of αj\alpha_{j}, the wider the jth confidence interval will be. For example, if two 95% c.i.s (α1=α2=( \alpha_{1} = \alpha_{2} =0.05) are constructed, the overall confidence level will be 90% or greater (αE=α1+α2=0.10)( \alpha_{E} = \alpha_{1} + \alpha_{2} = 0 . 10 ). If ten 95% c.i.s are constructed (αi=0.05,i=1,…,10)( \alpha_{i} = 0 . 05 , i = 1 , \ldots , 10 ), the resulting overall confidence level could be as low as 50%(αE=∑i=110αi=0.50)\textstyle ( \alpha_{E} = \sum_{i = 1} ^ {10} \alpha_{i} = 0 . 50 ), which is far too low for practical use. To guarantee an overall confidence level of 95%, when 10 comparisons are being made, one approach is to construct ten 99.5% confidence intervals for the parameters (or differences) of interest.

The Bonferroni approach to multiple confidence intervals is based on Expression (16). A major advantage is that it holds whether the models for the alternative designs are run with independen sampling or with common random numbers.

The major disadvantage of the Bonferroni approach in making a large number of comparisons is the increased width of each individual interval. For example, for a given set of data and a large sample size, a 99.5% c.i. will be z0.0025/z0.025=2.807/1.96=1.43z_{0 . 0025} / z_{0 . 025} = 2 . 807 / 1 . 96 = 1 . 43 times longer than a 95% c.i. For smal sample sizes, say, for a sample of size 5,5 , a 99.5% c.i. will be t0.0025,4/t0.025,4=5.598/2.776=1.99t_{0 . 0025 , 4} / t_{0 . 025 , 4} = 5 . 598 / 2 . 776 = 1 . 99 times longer than an individual 95% c.i. The width of a c.i. is a measure of the precision of the estimate. For these reasons, it is recommended that the Bonferroni approach be used only when a small number of comparisons are being made. Twenty or so comparisons appear to be the practica upper limit.

Corresponding to goals 1, 2, and 3, there are at least three possible ways of using the Bonferron Inequality (16) when comparing K alternative system designs:

  1. Individual c.i.s:c . i . s {\mathrm{:}} Construct a 100(1−αi)%100 ( 1 - \alpha_{i} ) \% c.i. for parameter θi\theta_{i} by using the expression H=tα/2,R−1SR,H = t_{\alpha / 2 , R - 1} \frac {S} {\sqrt {R}} , in which case the number of intervals is C=KC = K. If independent sampling were used, the K c.i.s would be mutually independent, and thus the overall confidence level would be (1−α1)×(1−α2)×⋅⋅⋅×(1−αC)( 1 - \alpha_{1} ) \times ( 1 - \alpha_{2} ) \times \cdot \cdot \cdot \times ( 1 - \alpha_{C} ), which is larger, but not by much, than the right side of Expression (16). This type of procedure is most often used to estimate multiple parameters of a single system, rather than to compare systems; because multiple parameter estimates from the same system are likely to be dependent, the Bonferroni inequality typically is needed.

  2. Comparison to an existing system: Compare all designs to one specific design, usually to an existing system. That is, construct a 100(1−αi)% c.i100 ( 1 - \alpha_{i} ) \% \ \mathrm{c . i}. for θi−θ1(i=2,3,…,K)\theta_{i} - \theta_{1} ( i = 2 , 3 , \ldots , K ), using Expression (1). (System 1 with performance measure θ1\theta_{1} is assumed to be the existing system.) In this case, the number of intervals is C=K−1C = K - 1. This type of procedure is most often used to compare several competitors to the present system in order to learn which are better.

  3. All pairwise comparisons: Compare all designs to each other. That is, for any two system designs i≠j,i \neq j , construct a 100(1−αii)%100 ( 1 - \alpha_{i i} ) \% c.i. for θi−θj\theta_{i} - \theta_{j}. With K designs, the number of confidence intervals computed is C=K˙(K−1)/2C = \dot {K} ( K - 1 ) / 2. The overall confidence coefficient would be bounded below by 1−αE=1−∑∑i≠jαij\begin{array} {r} {1 - \alpha_{E} = 1 - \sum \sum_{i \neq j} \alpha_{i j}} \end{array}[which follows by Expression (16)]. It is generally believed that CRN will make the true overall confidence level larger than the right side of Expression (16), and usually larger than will independent sampling. The right side of Expression (16) can be thought of as giving the worst case, that is, the lowest possible overal confidence level.

Example 2

Reconsider the call center design problem of Example 1. The alternative system designs are the following:

a. C: existing system (distinct operator queues);

b. P7: cross-trained system with 7 operators (single queue);

c. P6: cross-trained system with 6 operators (single queue).

Using the data in Table 2, confidence intervals for θC−θP7,θC−θP6\theta_{C} - \theta_{P 7} , \theta_{C} - \theta_{P 6}, and θP7−θP6\theta_{P 7} - \theta_{P 6} will be constructed, having an overall confidence level of 95%. Recall that CRN was used in all models, bu this does not affect the overall confidence level, because, as mentioned, the Bonferroni Inequality (16) holds regardless of the statistical independence or dependence of the data.

Since the overall error probability is αE=0.05\alpha_{E} = 0 . 05 and C=3C = 3 confidence intervals are to be constructed, let αi=0.05/3=0.0167\alpha_{i} = 0 . 05 / 3 = 0 . 0167. Then use Expression (1), with proper modifications, to construct C=3C = 3 confidence intervals with α=αi=0.0167\alpha = \alpha_{i} = 0 . 0167 and degrees of freedom ν=10−1=9\nu = 10 - 1 = 9 The value of tαi/2,R−1=t0.0083,9=2.97t _ {\alpha_{i} / 2 , R - 1} = t_{0 . 0083 , 9} = 2 . 97 is obtained from Table A.5 in the Appendix by interpolation; the point estimates and standard errors are obtained from Table 2

The three confidence intervals, with overall confidence coefficient at least 95%, are given by

θC−θP7:−0.86±2.97(0.62) \theta_{C} - \theta_{P 7}: - 0. 86 \pm 2. 97 (0. 62) θC−θP6:−5.91±2.97(1.42) \theta_{C} - \theta_{P 6}: - 5. 91 \pm 2. 97 (1. 42) θP7−θP6:−5.05±2.97(0.88) \theta_{P 7} - \theta_{P 6}: - 5. 05 \pm 2. 97 (0. 88)

or

θC−θP7:−0.86±1.84 \theta_{C} - \theta_{P 7}: - 0. 86 \pm 1. 84 θC−θP6:−5.91±4.22 \theta_{C} - \theta_{P 6}: - 5. 91 \pm 4. 22 θP7−θP6:−5.05±2.61 \theta_{P 7} - \theta_{P 6}: - 5. 05 \pm 2. 61

The simulation analyst has high confidence (at least 95%) that all three confidence statements are correct. Notice that the c.i. for θC−θP7\theta_{C} - \theta_{P 7} again contains zero; thus, there is no statistically significan difference between the current design and the alternative with 7 cross-trained operators, a conclusion that supports the previous results in Example 1. The other confidence intervals lie completely to the left of 0, indicating that C and P7 both dominate P6.

Some of the exercises at the end of this chapter provide an opportunity to compare CRN and independent sampling and to compute simultaneous confidence intervals under the Bonferroni approach.

2.2 Selection of the Best

Suppose that there are K system designs, and the unknown expected value of the ith system’s performance is θ . We are interested in which system design is best, where “best” means having the maximum or minimum θ_i, depending on the problem. For instance, in Example 3 we will compare K=8K = 8 designs for the semiconductor fabrication facility described in the Estimation of Absolute Performance chapter, in which θi\theta_{i} is the steady-state mean cycle time of one product family for the ith design, and smaller θi\theta_{i} is better. We want a procedure that is capable of handling large K, say, on the order of 100

Let B denote the (unknown) index of the best system design. The smaller the true differences $| \theta_{B} - \theta_{i} | , i \neq B $ are, and the more certain we want to be that we find the best system, the more replications are required to achieve our goal. Therefore, instead of demanding that we find the best design B no matter what, we compromise and ask to find B with high probability whenever the difference between system B and the others is significantly large. More precisely, we want the probability that we select the best system to be at least 1 α whenever $| \theta_{B} - \theta_{i} | \geq \epsilon $ for all i≠B,i \neq B , where  depends on the problem. If there are systems that are within  of the best, then we will be satisfied to select either the best or any one of the near-best designs. Both the probability of correc selection 1−α1 - \alpha and the practically significant difference  will be under our control.

The following procedure accomplishes this goal by undertaking two stages of simulation: In the first stage,R0R_{0} replications are obtained from each of the system designs. Those systems that are

statistically significantly inferior to the others are screened out, meaning that they are eliminated from further consideration, with confidence 1−α/21 - \alpha / 2. If more than one system survives screening, then the survivors receive enough additional replications to select the best, or a system design within  of the best, with confidence 1−α/21 - \alpha / 2. Then, using reasoning related to the Bonferroni inequality, the selected system is the best or a near-best system with confidence at least 1−α1 - \alpha for the combination of screening and selection.

The first-stage screening can be very important because, as Example 3 will illustrate, the number of replications required in the second stage to select the best can be quite large, and there is no reason to waste time and effort on system designs that are obviously not competitive. This is especially important when K is large.

The procedure below is implemented in SimulationTools.xls, which is available at www.bcnn.net. The SimulationTools.xls implementation guides the user as to what data need to be obtained for each stage.

Select-the-Best Procedure

  1. Specify the desired probability ofcorrect selection 1/k<1−α<11 / k < 1 - \alpha < 1, the practically significan difference ϵ>0\epsilon > 0, an initial number of replications R0≥10R_{0} \geq 10, and the number of competing systems K. Set
t=t1−(1−α/2)1k−1,R0−1 t = t _ {1 - (1 - \alpha / 2) ^ {\frac {1}{k - 1}}, R_{0} - 1}

and obtain Rinott’s constant h=h(R0,K,1−α/2)h = h ( R_{0} , K , 1 - \alpha / 2 ). [Hint: Both critical values are calculated automatically by SimulationTools.xls; small tables of t and h are given in the Appendix.]

  1. Make R0R_{0} replications of each system. Calculate the first-stage sample means and sample variances
Yˉ⋅i=1R0∑r=1R0Yri \bar {Y} _ {\cdot i} = \frac {1}{R_{0}} \sum_{r = 1} ^ {R_{0}} Y_{r i} Si2=1n0−1∑r=1n0(Yri−Yˉ.i)2 S_{i} ^ {2} = \frac {1}{n_{0} - 1} \sum_{r = 1} ^ {n_{0}} \left(Y_{r i} - \bar {Y} _ {. i}\right) ^ {2}

for i=1,2,…,K.i = 1 , 2 , \dots , K .3. Calculate the screening thresholds

Wij=t(Si2+Sj2R0)1/2 W_{i j} = t \left(\frac {S_{i} ^ {2} + S_{j} ^ {2}}{R_{0}}\right) ^ {1 / 2}

for all i≠ji \neq j(a) If bigger is better, then form the survivor subset ss containing every system design i such that

Yˉ⋅i≥Yˉ⋅j−max⁡{0,Wij−ϵ}for allj≠i \bar {Y} _ {\cdot i} \geq \bar {Y} _ {\cdot j} - \max \{0, W_{i j} - \epsilon \} \quad \text{for all} j \neq i

That is, retain every system i whose sample mean is no more than max 0,Wij−ϵ}W_{i j} - \epsilon \} smaller than any other system’s sample mean.

(b) If smaller is better, then form the survivor subset containing every system design i such that

Yˉ.i≤Yˉ.j+max⁡{0,Wij−ϵ}for allj≠i \bar {Y} _ {. i} \leq \bar {Y} _ {. j} + \max \{0, W_{i j} - \epsilon \} \quad \text{for all} j \neq i

That is, retain every system i whose sample mean is no more than max 0,Wij−ϵ}W_{i j} - \epsilon \} larger than any other system’s sample mean.

  1. If the set contains only one system, then stop and return that system as the best. Otherwise, for all designs i in , compute the second-stage sample sizes
Ri=max⁡{R0,⌈(hSi/ϵ)2⌉} R_{i} = \max \left\{R_{0}, \lceil (h S_{i} / \epsilon) ^ {2} \rceil \right\}

where means to round up.

  1. Take Ri−R0R_{i} - R_{0} additional replications from all systems i in , or, if it is more convenient, obtain a total of RiR_{i} replications from system i by starting over.

  2. Compute the overall sample means

Yˉˉ⋅i=1Ri∑r=1RiYri \bar {\bar {Y}} _ {\cdot i} = \frac {1}{R_{i}} \sum_{r = 1} ^ {R_{i}} Y_{r i}

for all i in . If bigger is better, then select the system with the largest Yˉˉ⋅i\bar {\bar {Y}} _ {\cdot i} as best. Otherwise select the system with the smallest Yˉˉ⋅i\bar {\bar {Y}} _ {\cdot i} as best.

The critical values t and h cannot usually be obtained directly from tables so interpolation is often required. As an alternative, algorithms for computing quantiles from the t distribution can be found in most numerical analysis and spreadsheet software; unfortunately, this is not the case for Rinott’s constant h. Therefore, use of SimulationTools.xls is highly recommended for this procedure.

Nelson et al. [2001] prove that the Select-the-Best Procedure finds the system with the larges or smallest θ , or one within  of the best θ, with confidence level at least 1 α, provided the data are normally distributed and the systems are simulated independently. The procedure will also work if CRN is applied.

Example 3

Recall the FastChip, Inc. semiconductor manufacturing example from the Estimation of Absolute Performance chapter, in which FastChip, Inc. wants to use simulation to design a new “fab” by evaluating the steady-state mean cycle time (time from wafer release to completion) that they can expect under a particular loading of two distinct products, called C-chip and D-chip. The system design we evaluated in the Estimation of Absolute Performance chapter is actually a base case, and there are seven additional designs that arise by making different choices about how to implemen certain steps in the manufacturing process; these steps are called Clean, Load Quartz, Oxidize, Unload Quartz, Coat, and Develop. The question is, which design leads to the smallest steady-state mean cycle time? We will focus on the cycle time for C-chip, and we will use the warmup period and run length obtained there.

Figure 5 Input form for Select-the-Best Procedure in SimulationTools.xls

Including the base case there are K = 8K \ = \ 8 system designs, and the performance measures θ1,θ2,…,θ8\theta_{1} , \theta_{2} , \ldots , \theta_{8} are the steady-state mean cycle times for C-chip under each design. FastChip decides that even very small improvements in cycle time are important, so they set ϵ=0.15\epsilon = 0 . 15 hours (or 9 minutes). This is a very tight requirement when cycle times average around 45 hours, and we wil see the consequences of this choice below. FastChip would like 95% confidence they have selected the best design, or one within 9 minutes of the best. Figure 5 shows the input screen to set up this problem in SimulationTools.xls, which uses the term “indifference level” for the practically significant difference .

Table 3 contains the first-stage results obtained from R0 = 10R_{0} ~ = ~ 10 replications of each system design. The alternative that adjusts the Oxidize step seems to provide the smallest average cycle time, but all of the alternatives appear close. The complete data from this example are available at www.bcnn.net.

The t value we need for screening is

t=t1−(1−α/2)1k−1,R0−1=t1−(0.975)17,9=t0.0036,9=3.455 t = t _ {1 - (1 - \alpha / 2) ^ {\frac {1}{k - 1}}, R_{0} - 1} = t _ {1 - (0. 975) ^ {\frac {1}{7}}, 9} = t_{0. 0036, 9} = 3. 455

Table 3 First-Stage Data from FastChip Simulation

Scenario iiBase 1Clean 2Load 3Oxidize 4Unload 5Coat 6Step 7Develop 8
Yˉ.i\bar{Y}_{.i}46.8645.7047.2345.1346.8047.8147.4146.94
Si2S_{i}^{2}0.210.370.290.090.280.980.120.28

Table 4 Screening Threshold from FastChip Simulation

ScenarioiBase1Clean2Load3Oxidize4Unload5Coat6Step7Develop8
Yˉ.i\bar{Y}_{.i}46.8645.7047.2345.1346.8047.8147.4146.94
Wi4W_{i4}0.600.740.680.671.130.500.67
≤Y.4+max⁡{Wi4−0.15}\leq Y_{.4} + \max\{W_{i4} - 0.15\}45.5845.7245.6645.6546.1145.4845.65

The subset will always contain the sample best system, which is system i=4i = 4(Oxidize) here. To avoid being screened out, the other systems’ sample means must be small enough to satisfy Yˉ⋅i≤Yˉ⋅j+max⁡{Wij−ϵ}\bar {Y} _ {\cdot i} \leq \bar {Y} _ {\cdot j} + \operatorname* {m a x} \{W_{i j} - \epsilon \} for all j≠i,j \neq i ,, and in particular Yˉ.i≤Yˉ.4+max⁡{0,Wi4−ϵ}\bar {Y} . i \le \bar {Y} . 4 + \operatorname* {m a x} \{0 , W_{i 4} - \epsilon \}. Table 4 contains the thresholds Yˉ⋅4+{\bar {Y}} _ {\cdot 4} + max {0,Wi4−ϵ}\{0 , W_{i 4} - \epsilon \}; only alternative 2 with sample mean 45.70 hours is smal enough to survive, so S={2,4}{\mathcal {S}} = \{2 , 4 \} To determine the second-stage sample sizes for alternatives 2 and 4, we need h=h(R0,K,1−h = h ( R_{0} , K , 1 -α/2)=h(10,8,0.975)=4.635\alpha / 2 ) = h ( 10 , 8 , 0 . 975 ) = 4 . 635, which could be obtained from SimulationTools.xls. Then R2=⌈(hS2/ϵ)2⌉=349R_{2} = \lceil ( h S_{2} / \epsilon ) ^ {2} \rceil = 349 and R4=⌈(hS4/ϵ)2⌉=90R_{4} = \lceil ( h S_{4} / \epsilon ) ^ {2} \rceil = 90. Thus, alternative 2 requires 349−10=339349 - 10 = 339 additional replications, while alternative 4 requires 90−10=8090 - 10 = 80 additional replications. Notice that the number of replications for alternative 2 is quite large. In general, the second-stage sample size is large if the sample variance is large, making it is difficult to detect differences, or if  is small, even small differences matter, as in this example.

After obtaining the additional replications,Yˉˉ⋅2=45.88\bar {\bar {Y}} _ {\cdot 2} = 45 . 88 and Yˉˉ⋅4=45.00\bar {\bar {Y}} _ {\cdot 4} = 45 . 00; therefore, alternative 4, Oxidize, is selected. The procedure guarantees, with 95% confidence, that θ4\theta_{4} is the smallest steadystate mean cycle time of the 8 alternatives,or,^ {\mathrm{o r ,}} if it is not, then it is within ϵ=0.15\epsilon = 0 . 15 hours of being the best.

The Select-the-Best Procedure, as presented here, does both screening and selection. This makes it particularly useful for finding the best system design from among a large number of alternatives since many of them may be screened out in the first stage. The procedure can be used for screening alone, without selection, if the objective is to eliminate designs that are not competitive. This migh be worthwhile when we want to choose from a collection of competitive alternatives based on criteria beyond mean performance alone. For screening only, the procedure stops at Step 3 and can use the critical value

t=t1−(1−α)1k−1,R0−1 t = t _ {1 - (1 - \alpha) ^ {\frac {1}{k - 1}}, R_{0} - 1}

which provides somewhat tighter screening.

Similarly, if the number of system designs K is small, and the goal is to select the best, then screening can be skipped and all systems receive second-stage replications. For selection only, skip Step 3 and use the somewhat smaller critical value h=h(R0,K,1−α)h = h ( R_{0} , K , 1 - \alpha ).

3 Metamodeling

Suppose that there is a simulation output response variable Y that is related to k independent variables, say,x1,x2,…,xkx_{1} , x_{2} , \ldots , x_{k}. The dependent variable Y is a random variable, while the independent variables x1,x2,…,xkx_{1} , x_{2} , \ldots , x_{k} are called design variables and are usually subject to control. The true relationship between the variables Y and x is represented by the often complex simulation model. Our goal is to approximate this relationship by a simpler mathematical function called a metamodel. In some cases, the analyst will know the exact form of the functional relationship between Y and x1,x2,…,xk,say.x_{1} , x_{2} , \ldots , x_{k} , \mathrm{s a y} .Y=f(x1,x2,…,xk)Y = f ( x_{1} , x_{2} , \dots , x_{k} ). However, in most cases, the functional relationship is unknown, and the analys must select an appropriate f containing unknown parameters, and then estimate those parameters from a set of data Y, x . Regression analysis is one method for estimating the parameters.

Example 4

An insurance company promises to process all claims it receives each day by the end of the next day. It has developed a simulation model of its proposed claims-processing system to evaluate how hard it will be to meet this promise. The actual number and types of claims that will need to be processed each day will vary, and the number may grow over time. Therefore, the company would like to have a model that predicts the total processing time as a function of the number of claims received.

The primary value of a metamodel is to make it easy to answer “what-if” questions, such as what the processing time will be if there are x claims. Evaluating a function f, or perhaps its derivatives, at a number of values of x is typically much easier than running a simulation experiment for each value.

3.1 Simple Linear Regression

Suppose that it is desired to estimate the relationship between a single independent variable x and a dependent variable Y, and suppose that the true relationship between Y and x is suspected to be linear. Mathematically, the expected value of Y for a given value of x is assumed to be

E(Y∣x)=β0+β1x(17) E (Y | x) = \beta_{0} + \beta_{1} x\tag{17}

where β0\beta_{0} is the intercept on the Y axis, an unknown constant, and β1\beta_{1} is the slope, or change in Y for a unit change in x, also an unknown constant. It is further assumed that each observation of Y can be described by the model

Y=β0+β1x+ε(18) Y = \beta_{0} + \beta_{1} x + \varepsilon\tag{18}

where ε is a random error with mean zero and constant variance σ2\sigma^{2}. The regression model given by Equation (18) involves a single variable x and is commonly called a simple linear regression model.

Suppose that there are n pairs of observations (Y1,x1),(Y2,x2),…,(Yn,xn)( Y_{1} , x_{1} ) , ( Y_{2} , x_{2} ) , \ldots , ( Y_{n} , x_{n} ). These observations can be used to estimate β0\beta_{0} and β1\beta_{1} in Equation (18). The method of least squares is commonly used to form the estimates. In the method of least squares,β0\beta_{0} and β1\beta_{1} are estimated in such a way that the sum of the squares of the deviations between the observations and the regression line is minimized. The individual observations in Equation (18) can be written as

Yi=β0+β1xi+εi,i=1,2,…,n(19) Y_{i} = \beta_{0} + \beta_{1} x_{i} + \varepsilon_{i}, \qquad i = 1, 2, \dots , n\tag{19}

where ε1,ε2,…\varepsilon_{1} , \varepsilon_{2} , \ldots are assumed to be uncorrelated random variables.

Each εi\varepsilon_{i} in Equation (19) is given by

εi=Yi−β0−β1xi(20) \varepsilon_{i} = Y_{i} - \beta_{0} - \beta_{1} x_{i}\tag{20}

and represents the difference between the observed response YiY_{i} and the expected response β0+β1xi\beta_{0} + \beta_{1} x_{i} predicted by the model in Equation (17). Figure 6 shows how εi\varepsilon_{i} is related to xi,Yi,x_{i} , Y_{i} ,, and $ E ( Y_{i} | x_{i} ) $ The sum of squares of the deviations given in Equation (20) is given by

L=∑i=1nεi2=∑i=1n(Yi−β0−β1xi)2(21) L = \sum_{i = 1} ^ {n} \varepsilon_{i} ^ {2} = \sum_{i = 1} ^ {n} (Y_{i} - \beta_{0} - \beta_{1} x_{i}) ^ {2}\tag{21}

and LL is called the least-squaresfunction. It is convenient to rewrite YiY_{i} as follows:

Yi=β0′+β1(xi−xˉ)+εi(22) Y_{i} = \beta_{0} ^ {\prime} + \beta_{1} (x_{i} - \bar {x}) + \varepsilon_{i}\tag{22}

where β0′=β0+β1xˉ\beta_{0} ^ {\prime} = \beta_{0} + \beta_{1} \bar {x} and xˉ=∑i=1nxi/n\bar {x} = \textstyle \sum_{i = 1} ^ {n} x_{i} / n. Equation (22) is often called the transformed linear regression model. Using Equation (22), Equation (21) becomes

L=∑i=1n[Yi−β0′−β1(xi−xˉ)]2 L = \sum_{i = 1} ^ {n} [ Y_{i} - \beta_{0} ^ {\prime} - \beta_{1} (x_{i} - \bar {x}) ] ^ {2}

Figure 6 Relationship of εi\varepsilon_{i} to xi,Yi,x_{i} , Y_{i} , and $ E ( Y_{i} | x_{i} ) $ To minimize L,L , find ∂L/∂β0′\partial L / \partial \beta_{0} ^ {\prime} and ∂L/∂β1\partial L / \partial \beta_{1}, set each to zero, and solve for β^0′\widehat {\beta} _ {0} ^ {\prime} and β^1{\widehat {\beta}} _ {1}. Taking the partial derivatives and setting each to zero yields

nβ0′^=∑i=1nYi n \widehat {\beta_{0} ^ {\prime}} = \sum_{i = 1} ^ {n} Y_{i} β^1∑i=1n(xi−xˉ)2=∑i=1nYi(xi−xˉ)(23) \widehat {\beta} _ {1} \sum_{i = 1} ^ {n} (x_{i} - \bar {x}) ^ {2} = \sum_{i = 1} ^ {n} Y_{i} (x_{i} - \bar {x})\tag{23}

Equations (23) are often called the normal equations, which have the solutions

β^0′=Yˉ=∑i=1nYin(24) \widehat {\beta} _ {0} ^ {\prime} = \bar {Y} = \sum_{i = 1} ^ {n} \frac {Y_{i}}{n}\tag{24}

and

β^1=∑i=1nYi(xi−xˉ)∑i=1n(xi−xˉ)2(25) \widehat {\beta} _ {1} = \frac {\sum_{i = 1} ^ {n} Y_{i} (x_{i} - \bar {x})}{\sum_{i = 1} ^ {n} (x_{i} - \bar {x}) ^ {2}}\tag{25}

The numerator in Equation (25) is rewritten for computational purposes as

Sxy=∑i=1nYi(xi−xˉ)=∑i=1nxiYi−(∑i=1nxi)(∑i=1nYi)n(26) S_{x y} = \sum_{i = 1} ^ {n} Y_{i} (x_{i} - \bar {x}) = \sum_{i = 1} ^ {n} x_{i} Y_{i} - \frac {\left(\sum_{i = 1} ^ {n} x_{i}\right) \left(\sum_{i = 1} ^ {n} Y_{i}\right)}{n}\tag{26}

where SxyS_{x y} denotes the corrected sum of cross products of x and Y. The denominator of Equation (25) is rewritten for computational purposes as

Sxx=∑i=1n(xi−xˉ)2=∑i=1nxi2−(∑i=1nxi)2n(27) S_{x x} = \sum_{i = 1} ^ {n} (x_{i} - \bar {x}) ^ {2} = \sum_{i = 1} ^ {n} x_{i} ^ {2} - \frac {\left(\sum_{i = 1} ^ {n} x_{i}\right) ^ {2}}{n}\tag{27}

where SxxS_{x x} denotes the corrected sum of squares of x. The value of β^0{\widehat {\beta}} _ {0} can be retrieved easily as

β0^=β0′^−β1^xˉ(28) \widehat {\beta_{0}} = \widehat {\beta_{0} ^ {\prime}} - \widehat {\beta_{1}} \bar {x}\tag{28} β^0 \widehat {\boldsymbol {\beta}} _ {0} β^1 \widehat {\beta} _ {1}

 The simulation model of the claims-processing system in Example 4 was executed with initia conditions x=100x = 100, 150, 200, 250, and 300 claims received the previous day. Three replications were obtained at each setting. The response Y is the number of hours required to process x claims. The results are shown in Table 5. The graphical relationship between the number of claims received and total processing time is shown in Figure 7. Examination of this scatter diagram indicates that there is a strong relationship between number of claims and processing time. The tentative assumption o the linear model given by Equation (18) appears to be reasonable.

Table 5 Simulation Results for Processing Time Given x Claims

Number of Claims xHours of Processing Time Y
1008.1
1007.8
1007.0
1509.6
1508.5
1509.0
20010.9
20013.3
20011.6
25012.7
25014.5
25014.7
30016.5
30017.5
30016.3

Figure 7 Relationship between number of claims and hours of processing time.

With the processing times as the YiY_{i} values (the dependent variables) and the number of claims as the xix_{i} values (the independent variables),β^0\widehat {\beta} _ {0} and β^1{\widehat {\beta}} _ {1} can be found by the following computations:

n=15 n = 15 ∑i=115xi=3000 \sum_{i = 1} ^ {15} x_{i} = 3000 ∑i=115Yi=178 \sum_{i = 1} ^ {15} Y_{i} = 178 ∑i=115xi2=675,000 \sum_{i = 1} ^ {15} x_{i} ^ {2} = 675, 000 ∑i=115xiYi=39080 \sum_{i = 1} ^ {15} x_{i} Y_{i} = 39080

and xˉ=3000/15=200\bar {x} = 3000 / 15 = 200 From Equation (26) SxyS_{x y} is calculated as

Sxy=39,080−(3000)(178)15=3480 S_{x y} = 39, 080 - \frac {(3000) (178)}{15} = 3480

From Equation (27),SxxS_{x x} is calculated as

Sxx=675,000−(3000)215=75,000 S_{x x} = 675, 000 - \frac {(3000) ^ {2}}{15} = 75, 000

Then,β^1{\widehat {\beta}} _ {1} is calculated from Equation (25) as

β^1=SxySxx=348075,000=0.0464 \widehat {\beta} _ {1} = \frac {S_{x y}}{S_{x x}} = \frac {3480}{75 , 000} = 0. 0464

As shown in Equation (24),β0′^\widehat {\beta_{0} ^ {\prime}} is just Yˉ,{\bar {Y}} , or

β0′^=17815≈11.8667 \widehat {\beta_{0} ^ {\prime}} = \frac {178}{15} \approx 11. 8667

To express the model in the original terms, compute β^0{\widehat {\beta}} _ {0} from Equation (28) as

β0^=11.8667−0.0464(200)=2.5867 \widehat {\beta_{0}} = 11. 8667 - 0. 0464 (200) = 2. 5867

Then an estimate of the mean of Y given x,$ E ( Y | x ) $, is given by

y^=β0^+β1^x=2.5867+0.0464x(29) \widehat {y} = \widehat {\beta_{0}} + \widehat {\beta_{1}} x = 2. 5867 + 0. 0464 x\tag{29}

For a given number of claims x this model can be used to predict the number of hours required to process them. The coefficient β^1{\widehat {\beta}} _ {1} has the interpretation that each additional claim received adds an expected 0.0464 hours, or 2.8 minutes, to the expected total processing time.

Regression analysis is widely used and frequently misused. Several of the common abuses are briefly mentioned here. Relationships derived in the manner of Equation (29) are valid for values of the independent variable within the range of the original data. The linear relationship that has been tentatively assumed may not be valid outside the original range. In fact, we know from queueing theory that mean processing time may increase rapidly as the number of claims approaches the capacity of the system. Therefore, Equation (29) can be considered valid only for 100≤x≤300100 \leq x \leq 300 Regression models are not advised for extrapolation purposes.

Care should be taken in selecting variables that have a plausible causal relationship with one another. It is quite possible to develop statistical relationships that are unrelated in a practical sense. For example, an attempt might be made to relate monthly output of a steel mill to the weight of reports appearing on a manager’s desk during the month. A straight line may appear to provide a good mode for the data, but the relationship between the two variables is tenuous. A strong observed relationship does not imply that a causal relationship exists between the variables. Causality can be inferred only when analysis uncovers some plausible reasons for its existence. In Example 4 it is reasonable tha starting with more claims implies that more time is needed to process them. Therefore, a relationship of the form of Equation (29) is at least plausible.

Testing for Significance of Regression

In Section 3.1, it was assumed that a linear relationship existed between Y and x. In Example 4, a scatter diagram, shown in Figure 7, relating number of claims and processing time was prepared, to evaluate whether a linear model was a reasonable tentative assumption prior to the calculation of β^0\widehat {\beta} _ {0} and β^1{\widehat {\beta}} _ {1}. However, the adequacy of the simple linear relationship should be tested prior to using the model for predicting the response YiY_{i} given an independent variable,xi.x_{i} .. There are several tests which may be conducted to aid in determining model adequacy. Testing whether the order of the mode tentatively assumed is correct is commonly called lack-of-fit testing.

Testing for the significance of regression provides another means for assessing the adequacy of the model. In particular, tests to establish that the estimated regression coefficients β^0\widehat {\beta} _ {0} and β^1{\widehat {\beta}} _ {1} are statistically different from 0 are essential, particularly for multiple linear regression, described below, when a large number of design variables x are included in the metamodel but it is not certain that all of them have a substantial explanatory effect.

Tests for significance and lack of fit are included in all regression software. See Box and Draper [1987], Hines et al. [2002], and Montgomery [2000] for details about these tests.

Multiple Linear Regression

If the simple linear regression model of Section 3.1 is inadequate, several other possibilities exist. There could be several independent variables, so that the relationship is of the form

Y=β0+β1x1+β2x2+⋯+βmxm+ε(30) Y = \beta_{0} + \beta_{1} x_{1} + \beta_{2} x_{2} + \dots + \beta_{m} x_{m} + \varepsilon\tag{30}

Notice that this model is still linear, but has more than one independent variable. Regression models having the form shown in Equation (30) are called multiple linear regression models. Another possibility is that the model is of a quadratic form such as

Y=β0+β1x+β2x2+ε(31) Y = \beta_{0} + \beta_{1} x + \beta_{2} x^{2} + \varepsilon\tag{31}

Equation (31) is also a linear model which may be transformed to the form of Equation (30) by letting x1=xx_{1} = x and x2=x2x_{2} = x^{2} Yet another possibility is a model of the form such as

Y=β0+β1x1+β2x2+β3x1x2+ε Y = \beta_{0} + \beta_{1} x_{1} + \beta_{2} x_{2} + \beta_{3} x_{1} x_{2} + \varepsilon

which is also a linear model. The analysis of these three models with the forms just shown, and related models, can be found in Box and Draper [1987], Hines et al. [2002], Montgomery [2000], and other applied statistics texts; and also in Kleijnen [1987, 1998], which is concerned primarily with the application of these models in simulation.

3.2 Metamodeling and Computer Simulation

The material in Section 3.1 applies to regression metamodeling in general, not just computer simulation. However, there are special issues and opportunities that arise when goal is to provide a metamodel for a computer simulation; we describe these below.

Random-Number Assignment for Regression

The assignment of random-number seeds or streams is part of the design of a simulation experiment. (This section is based on Nelson [1992].) Assigning a different seed or stream to different design points (settings for x1,x2,…,xmx_{1} , x_{2} , \ldots , x_{m} in a multiple linear regression) guarantees that the responses Y from different design points will be statistically independent. Similarly, assigning the same seed or stream to different design points induces dependence among the corresponding responses, by virtue of their all having the same source of randomness.

Many textbook experiment designs assume independent responses across design points. To conform to this assumption, we must assign different seeds or streams to each design point. However, it is often useful to assign the same random number seeds or streams to all of the design points, in other words, to use common random numbers.

The intuition behind common random numbers for metamodels is that a fairer comparison among design points is achieved if the design points are subjected to the same experimental conditions, specifically the same source of randomness. The mathematical justification is as follows: Suppose we fit the simple linear regression Yi=β0+β1xi+εiY_{i} = \beta_{0} + \beta_{1} x_{i} + \varepsilon_{i} and obtain least squares estimates β^0\widehat {\beta} _ {0} and β^1{\widehat {\beta}} _ {1}Then an estimator of the expected difference in performance between design points i and j is

β^0+β^1xi−(β^0+β^1xj)=β^1(xi−xj) \widehat {\beta} _ {0} + \widehat {\beta} _ {1} x_{i} - (\widehat {\beta} _ {0} + \widehat {\beta} _ {1} x_{j}) = \widehat {\beta} _ {1} (x_{i} - x_{j})

when xix_{i} and xjx_{j} are fixed design points,β^1{\widehat {\beta}} _ {1} determines the estimated difference between design points i and j,j ,or for that matter between any other two values of x. Therefore, common random numbers can be expected to reduce the variance of β^1{\widehat {\beta}} _ {1} and, more generally, reduce the variance of all of the slope terms in a multiple linear regression. Common random numbers typically do not reduce the variance of the intercept term β^0\widehat {\beta} _ {0}The least-squares estimators β^0{\widehat {\beta}} _ {0} and β^1{\widehat {\beta}} _ {1} are appropriate regardless of whether we use common  random numbers, but the associated statistical analysis is affected by that choice. For statistica analysis of a metamodel under common random numbers, see Kleijnen [1988] and Nelson [1992].

Queueing Simulation

Many computer simulation models are of systems that involve queues or networks of queues, and metamodels of these simulations may include design variables related to capacity (numbers of servers and service rates) and customer load (arrival rates). Such models violate standard regression assumptions as described in Section 3.1. A small example illustrates the difficulties and possible solutions.

Recall the M/M/1M / M / 1 queue: A single-server, first-come-first-served queue with a Poisson arrival process having rate λ customers/time and exponentially distributed service time having rate μ\mu customers/time. Let x=λ/μx = \lambda / \mu, which is called the utilization ρ.\rho .. Then, the steady-state expected number of customers in the queue for 0<x<10 < x < 1 is

L=x1−x=x+x2+x3+…(32) L = \frac {x}{1 - x} = x + x^{2} + x^{3} + \dots\tag{32}

Now, suppose that we did not know the relationship (32) and were trying to build a metamodel for L as a function of 0<x<10 < x < 1 by running simulations of an M/M/1M / M / 1 queue. Clearly the usual low-order polynomial models, including only the terms x and x2x^{2} described above, will not fit very well, particularly for x close to 1, where the higher-order terms matter.

There are at least two solutions to this problem. One is to break up the design space (0<x<1( 0 < x < 1 in this example) into smaller pieces for which low-order polynomials are adequate. The second approach is to fit a nonlinear model motivated by queueing theory. Yang, Ankenman, and Nelson [2007] showed that

Y=∑i=0mβixi(1−x)p+ε(33) Y = \frac {\sum_{i = 0} ^ {m} \beta_{i} x^{i}}{(1 - x) ^ {p}} + \varepsilon\tag{33}

with m ≤ 3.m \ \leq \ 3 ., works well for many queueing outputs Y, including average number in the queue and average time in the queue. Notice that the unknown parameters are m,βi.\beta_{i} ., and p,p , and therefore nonlinear least squares methods are required to fit them (Bates and Watts [1988]). When Y is the average number in queue, an estimator of L, then m=1,β0=0,β1=1m = 1 , \beta_{0} = 0 , \beta_{1} = 1, and p=1p = 1 Unfortunately, the problems go even deeper. If we estimate L by making a simulation run of length T time units and record the average number of customers in queue (call it Y), then it can be shown (Whitt [1989]) that

var⁡(Y)≈2x(1+x)(1−x)4T(34) \operatorname{var} (Y) \approx \frac {2 x (1 + x)}{(1 - x) ^ {4} T}\tag{34}

Thus, instead of the variance being constant across the design space, as assumed in regression, it increases, and increases explosively, as x approaches 1. As a consequence, a run of, say,T=100T = 100 time units may yield a pretty good estimate of L at x=0.1x = 0 . 1 but a very poor estimate at x=0.9x = 0 . 9 The standard statistical inference produced by regression software will be invalid when response variance depends strongly on x, meaning we may not recognize lack of fit or poor fit.

A remedy for unequal response variance in regression is to apply a variance-stabilizing transformation to the data to make the variance more nearly constant across the design space. In simulation we can attack the problem directly by using different run lengths TT or different numbers of replications, depending on x.

We suggest using the M/M/1M / M / 1 result as a rough guide for more general networks of queues. If we let x denote the network utilization, that is, the most heavily utilized queue, then Approximation (34) implies that the run lengths T1T_{1} and T2T_{2} at two design points x1x_{1} and x2x_{2} should satisfy

T2T1=x2x1(1+x21+x1)(1−x11−x2)4 \frac {T_{2}}{T_{1}} = \frac {x_{2}}{x_{1}} \left(\frac {1 + x_{2}}{1 + x_{1}}\right) \left(\frac {1 - x_{1}}{1 - x_{2}}\right) ^ {4}

For instance, if we were to simulate T1=1T_{1} = 1 time unit at utilization x1=0.1x_{1} = 0 . 1, then we would need about T2=10T_{2} = 10 time units at x2=0.3x_{2} = 0 . 3, or T2=72T_{2} = 72 time units at x2=0.5x_{2} = 0 . 5, or T2=876T_{2} = 876 time units at x2=0.7.x_{2} = 0 . 7 ., or T2=101T_{2} = 101, 944 time units at x2=0.9x_{2} = 0 . 9 to stabilize variances.

The central message is this: In queueing simulation, if the metamodel includes decision variables that affect customer load—by changing the arrival rates, service rates, or numbers of servers—then a low-order polynomial may not be a good choice for the metamodel, and equal response variance across the design space cannot be assumed without exercising run-length control

4 Optimization via Simulation

Consider the following examples. (Some of these descriptions are based on Boesel, Nelson, and Ishi [2003].

Example 6: Materials Handling System (MHS)

Engineers need to design an MHS consisting of a large automated storage and retrieval device, automated guided vehicles (AGVs),AGV stations, lifters, and conveyors.Among the design variables they can control are the number ofAGVs, the load perAGV, and the routing algorithm used to dispatch the AGVs. Alternative designs will be evaluated according to AGV utilization, transportation delay for material that needs to be moved, and overall investment and operation costs.

Example 7: Liquefied Natural Gas (LNG) Transportation

An LNG transportation system will consist of LNG tankers and of loading, unloading, and storage facilities. In order to minimize cost, designers can control tanker size, number of tankers in use, number of jetties at the loading and unloading facilities, and capacity of the storage tanks.

Example 8: Automobile Engine Assembly

In an assembly line, a large buffer (queue) between workstations could increase station utilization— because there will tend to be something waiting to be processed—but drive up space requirements and work-in-process inventory. An allocation of buffer capacity that minimizes the sum of these competing costs is desired.

Example 9: Traffic Signal Sequencing

Civil engineers want to sequence the traffic signals along a busy section of road to reduce driver delay and the congestion occurring along narrow cross streets. For each traffic signal, the length of the red, green, and green-turn-arrow cycles can be set individually.

Example 10: Online Services

A company offering online information services over the Internet is changing its computer architecture from central mainframe computers to distributed workstation computing. The numbers and types of CPUs, the network structure, and the allocation of processing tasks all need to be chosen. Response time to customer queries is the key performance measure.

What do these design problems have in common? Clearly, a simulation model could be useful in each, and all have an implied goal of finding the best design relative to some performance measures (cost, delay, etc.). In each example, there are potentially a very large number of alternative designs, ranging from tens to thousands, and certainly more than the 2 to 100 we considered in Section 2.2. Some of the examples contain a diverse collection of decision variables: discrete (number of AGVs, number of CPUs), continuous (tanker size, red-cycle length), and qualitative (routing strategy, algorithm for allocating processing tasks). This makes developing a metamodel, as described in Section 3, difficult.

All of these problems fall under the general topic of “optimization via simulation,” where the goal is to minimize or maximize some measures of system performance, and system performance can be evaluated only by running a computer simulation. Optimization via simulation is a relatively new but already vast topic, and commercial software has become widely available. In this section, we describe the key issues that should be considered in undertaking optimization via simulation, provide some pointers to the available literature, and give one example algorithm.

4.1 What Does ‘‘Optimization via Simulation’’ Mean?

Optimization is a key tool used by operations researchers and management scientists, and there are well-developed algorithms for many classes of problems, the most famous being linear programming. Much of the work on optimization deals with problems in which all aspects of the system are treated as being known with certainty; most critically, the performance of any design (cost, profit, makespan, etc.) can be evaluated exactly.

In stochastic, discrete-event simulation, the result of any simulation run is a random variable. For notation, let x1,x2,…,xmx_{1} , x_{2} , \ldots , x_{m} be the m controllable design variables and let Y(x1,x2,…,xm)Y ( x_{1} , x_{2} , \dots , x_{m} ) be the observed simulation output performance on one run. To be concrete,x1,x2,x3x_{1} , x_{2} , x_{3} might denote

the number of AGVs, the load per AGV, and the routing algorithm used to dispatch the AGVs, respectively, in Example 6, while Y(x1,x2,x3)Y ( x_{1} , x_{2} , x_{3} ) could be total MHS acquisition and operation cost.

What does it mean to “optimiz ∵Y(x1,x2,…,xm)\because Y ( x_{1} , x_{2} , \ldots , x_{m} ) with respect to x1,x2,…,xm?x_{1} , x_{2} , \dots , x_{m} ? Since Y is a random variable we cannot optimize the actual value of Y. The most common definition of optimization is

maximize or minimizeE(Y(x1,x2,…,xm))(35) \text{maximize or minimize} E \left(Y (x_{1}, x_{2}, \dots , x_{m})\right)\tag{35}

In other words, the mathematical expectation, or long-run average, of performance is maximized or minimized. This is the default definition of optimization used in all commercial packages of which we are aware. In our example,E(Y(x1,x2,x3))E \left( Y ( x_{1} , x_{2} , x_{3} ) \right) is the expected, or long-run average cost of operating the MHS with x1AGVs,x2x_{1} \mathrm{A G V s} , x_{2} load per AGV⁡,\operatorname{A G V} , and routing algorithm x .

It is important to note that Formulation (35) is not the only possible definition, however. For instance, we might want to select the MHS design that has the best chance of costing less than $ D to purchase and operate, changing the objective to

maximizePr⁡(Y(x1,x2,x3)≤D) \text{maximize} \operatorname * {P r} (Y (x_{1}, x_{2}, x_{3}) \leq D)

We can fit this objective into formulation (35) by defining a new performance measure

Y′(x1,x2,x3)={1,ifY(x1,x2,x3)≤D0,otherwise Y^{\prime} (x_{1}, x_{2}, x_{3}) = \left\{\begin{array}{l l} 1, & \text{if} Y (x_{1}, x_{2}, x_{3}) \leq D \\ 0, & \text{otherwise} \end{array} \right.

and maximizing E(Y′(x1,x2,x3))E \left( Y^{\prime} ( x_{1} , x_{2} , x_{3} ) \right) instead.

A more complex optimization problem occurs when we want to select the system design that is most likely to be the best. Such an objective is relevant when one-shot, rather than long-run average, performance matters. Examples include a Space Shuttle launch, or the delivery of a unique, large order of products. Bechhofer, Santner, and Goldsman [1995] address this problem under the topic “multinomial selection”.

We have been assuming that a system design x1,x2,…,xmx_{1} , x_{2} , \ldots , x_{m} can be evaluated in terms of a single performance measure Y, such as cost. Obviously, this may not always be the case. In the MHS example, we might also be interested in some measure of system productivity, such as throughput or cycle time. At present, multiple objective optimization via simulation is not well developed. Therefore, one of three strategies is typically employed:

  1. Combine all of the performance measures into a single measure, the most common being cost. For instance, the revenue generated by each completed product in the MHS could represent productivity and be included as a negative cost.

  2. Optimize with respect to one key performance measure, but then evaluate the top solutions with respect to secondary performance measures. For instance, the MHS could be optimized with respect to expected cost, and then the cycle time could be compared for the top 5 designs. This approach requires that information on more than just the best solution be maintained.

  3. Optimize with respect to one key performance measure, but consider only those alternatives that meet certain constraints on the other performance measures. For instance, the MHS could be optimized with respect to expected cost for those alternatives whose expected cycle time is less than a given threshold.

Finally, there are typically constraints on the system design variables x1,x2,…,xm.x_{1} , x_{2} , \ldots , x_{m} .. In the online services in Example 10 there will be a budget constraint that limits the number of workstations tha can be purchased. Complex, and especially nonlinear, constraints make the feasible space more difficult to search. In some cases the constraints, like the objective function, cannot be evaluated with certainty and must be estimated from the simulation. For instance, while the online services company may want to minimize overall customer response time, they may have to do so subject to a constraint that the average response time for a particular, say, government, customer be below a certain level.

4.2 Why is Optimization via Simulation Difficult?

Even when there is no uncertainty, optimization can be very difficult if the number of design variables is large, if the problem contains a diverse collection of design variable types, or if little is known about the structure of the performance function. Optimization via simulation adds an additiona complication: The performance of a particular design cannot be evaluated exactly, but instead mus be estimated. Because we have estimates, it is not possible to conclude with assurance that one design is better than another, and this uncertainty frustrates optimization algorithms that try to move in improving directions. In principle, one can eliminate this complication by making so many replications, or such long runs, at each design point that the performance estimate has essentially no variance. In practice, this could mean that very few alternative designs will be explored because o the time required to simulate each one.

The existence of sampling variability forces optimization via simulation to make compromises. The following are the standard ones:

  1. Guarantee a prespecified probability of correct selection. The Select-the-Best Procedure in Section 2.2 is an example of this approach, which allows the analyst to specify the desired chance of being right. Such algorithms typically require either that every possible design be simulated or that a strong functional relationship among the designs (such as a metamodel) apply. Other algorithms can be found in Goldsman and Nelson [1998] and Kim and Nelson [2006].

  2. Guarantee asymptotic convergence. There are many algorithms that guarantee convergence to the global optimal solution as the simulation effort (number of replications, length o replications) becomes infinite. These guarantees are useful because they indicate that the algorithm tends to get to where the analyst wants it to go. However, convergence can be slow, and there is often no guarantee as to how good the reported solution is when the algorithm is terminated in finite time (as it must be, in practice). See Andrad´ottir [1998] for specific algorithms that apply to discrete- or continuous-variable problems.

  3. Optimal for deterministic counterpart. The idea here is to use an algorithm that would find the optimal solution if the performance of each design could be evaluated with certainty. An example might be applying a standard nonlinear programming algorithm to the simulation optimization problem. It is typically up to the analyst to make sure that enough simulation effort is expended (replications or run length) to ensure that such an algorithm is not misled by sampling variability. Direct application of an algorithm that assumes deterministic evaluation to a stochastic simulation is not recommended.

  4. Robust heuristics. Many heuristics have been developed for deterministic optimization problems that do not guarantee finding the optimal solution, but nevertheless have been shown to be very effective on difficult, practical problems. Some of these heuristics use randomness as part of their search strategy, so one might argue that they are less sensitive to sampling variability than other types of algorithms. Nevertheless, it is still important to make sure that enough simulation effort is expended (replications or run length) to ensure that such an algorithm is not misled by sampling variability.

Robust heuristics are the most common algorithms found in commercial optimization via simulation software. We provide some guidance on their use in the next section. See Fu [2002] for a comprehensive discussion of optimization theory versus practice and Olafsson [2006] for more´ about robust heuristics.

4.3 Using Robust Heuristics

By a “robust heuristic” we mean a procedure that does not depend on strong problem structure— such as continuity or convexity of E(Y(x1,…,xm))E \left( Y ( x_{1} , \ldots , x_{m} ) \right)—to be effective, can be applied to problems with mixed types of decision variables, and, ideally, is tolerant of some sampling variability. Genetic algorithms (GA) and tabu search (TS) are two prominent examples, but there are many others and many variations of them. Such heuristics form the core of most commercial implementations. To give a sense of these heuristics, we describe GA and TS next. We caution the reader that only a high-leve description of the simplest version of each procedure is provided. The commercial implementations are much more sophisticated.

Suppose that there are kk possible solutions to the optimization via simulation problem. Let X={x1,x2,…,xk}\mathbf{X} = \{\mathbf{x} _ {1} , \mathbf{x} _ {2} , \ldots , \mathbf{x} _ {k} \} denote the solutions, where the ith solution xi=(xi1,xi2,…,xim)\mathbf{x} _ {i} = ( x_{i 1} , x_{i 2} , \dots , x_{i m} ) provides specific settings for the m decision variables. The simulation output at solution xi\mathbf{x} _ {i} is denoted Y(xi)Y ( \mathbf{x} _ {i} ) this could be the output of a single replication, or the average of several replications. Our goal is to find the solution x∗\mathbf{x} ^ {*} that minimizes E(Y(x))E \left( Y ( \mathbf{x} ) \right)).

On each iteration, known as a generation, a GA operates on a “population” of pp solutions. Denote the population of solutions on thejth iteration as P(j)={x1(j),x2(j),…,xp(j)}\mathbf{P} ( j ) = \{\mathbf{x} _ {1} ( j ) , \mathbf{x} _ {2} ( j ) , \ldots , \mathbf{x} _ {p} ( j ) \}. There may be multiple copies of the same solution in P(j)\mathbf{P} ( j ), and P(j)\mathbf{P} ( j ) may contain solutions that were discovered on previous iterations. From iteration to iteration, this population evolves in such a way that good solutions tend to survive and give birth to new, and hopefully better, solutions, while inferior solutions tend to be removed from the population. The basic GA is given here.

Basic Genetic Algorithms (GA)

Step 1. Set the iteration counter j=0j = 0, and select, perhaps randomly, an initial population of pp solutions P(0)={x1(0),…,xp(0)}\mathbf{P} ( 0 ) = \{\mathbf{x} _ {1} ( 0 ) , \ldots , \mathbf{x} _ {p} ( 0 ) \}.

Step 2. Run simulation experiments to obtain performance estimates Y(x)Y ( \mathbf{x} ) for all p solutions x(j)\mathbf{x} ( j ) in P(j)\mathbf{P} ( j ).

Step 3. Select a population of p solutions from those in P(j)\mathbf{P} ( j ) in such a way that those with smaller Y(x)Y ( \mathbf{x} ) values are more likely, but not certain, to be selected. Denote this population of solutions as P(j+1)\mathbf{P} ( j + 1 )).

Step 4. Recombine the solutions in P(j+1)\mathbf{P} ( j + 1 ) via crossover (which joins parts of two solutions xi(j+1)\mathbf x_{i} ( j + 1 ) and xℓ(j+1)\mathbf{x} _ {\ell} ( j + 1 ) to form a new solution) and mutation (which randomly changes a part of a solution xi(j+1),\mathbf{x} _ {i} ( j + 1 ) ,).

Step 5. Set j=j+1j = j + 1 and go to Step 2.

The GA can be terminated after a specified number of iterations, when little or no improvement is noted in the population, or when the population containsp copies ofthe same solution.At termination, the solution x∗\mathbf{x} ^ {*} that has the smallest Y(x)Y ( \mathbf{x} ) value in the last population is chosen as best, or alternatively, the solution with the smallest Y(x)Y ( \mathbf{x} ) over all iterations could be chosen.

GAs are applicable to almost any optimization problem, because the operations of selection, crossover, and mutation can be defined in a very generic way that does not depend on specifics o the problem. However, when these operations are not tuned to the specific problem,aGA⁡′s\mathrm{a} \operatorname{G A} ^ {\prime} \mathrm{s} progress can be very slow. Commercial versions are often self-tuning, meaning that they update selection, crossover, and mutation parameters during the course of the search. There is some evidence that GAs are tolerant of sampling variability in Y(x)Y ( \mathbf{x} ) because they maintain a population of solutions rather than focusing on improving a current-best solution. In other words, it is not critical that the GA rank the solutions in a population of solutions perfectly, because the next iteration depends on the entire population, not on a single solution.

Tabu search (TS), on the other hand, identifies a current best solution on each iteration and then tries to improve it. Improvements occur by changing the solution via “moves.” For example, the solution (x1,x2,x3)( x_{1} , x_{2} , x_{3} )) could be changed to the solution (x1+1,x2,x3)( x_{1} + 1 , x_{2} , x_{3} ) by the move of adding 1 to the first decision variable (perhaps x1x_{1} represents the number of AGVs in Example 6,^ {6 ,} so the move would add one more AGV). The “neighbors” of solution x are all of those solutions that can be reached by legal moves. TS finds the best neighbor solution and moves to it. However, to avoid making moves that return the search to a previously visited solution, moves may become “tabu” (not usable) for some number of iterations. Conceptually, think about how you would find your way through a maze: If you took a path that lead to a dead end, then you would avoid taking that path again—it would be tabu.

The basic TS algorithm is given next. The description is based on Glover [1989].

Basic Tabu Search (TS)

Step 1. Set the iteration counter j=0j = 0 and the list of tabu moves to empty. Select an initial solution x∗\mathbf{x} ^ {*} in X, perhaps randomly.

Step 2. Find the solution x′\mathbf{x} ^ {\prime} that minimizes Y(x)Y ( \mathbf{x} ) over all of the neighbors of X∗\mathbf{X} ^ {*} that are not reached by tabu moves, running whatever simulations are needed to do the optimization

Step 3. I Y(x′)<Y(x∗)Y ( \mathbf{x} ^ {\prime} ) < Y ( \mathbf{x} ^ {*} ), then x∗=x′;x^{*} = x^{\prime} ;; move the current best solution to x′x^{\prime} Step 4. Update the list of tabu moves and go to Step 2.

The TS can be terminated when a specified number of iterations have been completed, when some number of iterations has passed without changing X∗\mathbf{X} ^ {*}, or when there are no more feasible moves. At termination, the solution x∗\mathbf{x} ^ {*} is chosen as best.

TS is fundamentally a discrete-decision-variable optimizer, but continuous decision variables can be discretized, as described in Section 4.4. TS aggressively pursues improving solutions, and therefore tends to make rapid progress. However, it is more sensitive to random variability in Y(x), because x∗ is taken to be the true best solution so far and attempts are made to improve it. There are probabilistic versions ofTS that should be less sensitive, however.An important feature ofcommercial implementations of TS, which is not present in the Basic TS, is a mechanism for overriding the tabu list when doing so is advantageous.

Next, we offer three suggestions for using commercial products that employ a GA, TS, or other robust heuristic: controlling sampling variability, restarting, and clean up.

Control Sampling Variability

In many cases, it will up to the user to determine how much sampling (replications or run length) will be undertaken at each potential solution. This is a difficult problem in general. Ideally, sampling should increase as the heuristic closes in on the better solutions, simply because it is much more difficult to distinguish solutions that are close in expected performance from those that differ widely. Early in the search, it may be easy for the heuristic to identify good solutions and search directions, because clearly inferior solutions are being compared to much better ones; however, late in the search this might not be the case.

If the analyst must specify a fixed number of replications per solution that will be used through the search, then a preliminary experiment should be conducted. Simulate several designs, some at the extremes of the solution space and some nearer the center. Compare the apparent best and apparent worst of these designs, using the approaches in Section 1. Using the technique described in Section 1.3, find the minimum for the number of replications required to declare these designs to be statistically significantly different. This is the minimum number of replications that should be used.

Restarting

Because robust heuristics provide no guarantees that they converge to the optimal solution for optimization via simulation, it makes sense to run the optimization two or more times to see which run yields the best solution. Each optimization run should use different random number seeds or streams and, ideally, should start from different initial solutions. Try starting the optimization at solutions on the extremes of the solution space, in the center of the space, and at randomly generated solutions. If people familiar with the system suspect that certain designs will be good, be sure to include them as possible starting solutions for the heuristic.

Clean Up

After the optimization run or runs have completed, it is critical to perform a second set of experiments on the top designs identified by the heuristic, to avoid two types of errors: Failing to recognize the best system design that was simulated during the search, and poorly estimating the performance of the design that is selected at the end. These errors occur because no optimization algorithm can hope to make any progress while at the same time maintaining statistical error control every step of the way. Therefore, we recommend cleaning up after the search, by which we mean performing a rigorous statistical analysis employing the comparison techniques in Section 2, and specifically the

Select-the-Best Procedure in Section 2.2, to evaluate which are the best or near-best of the designs discovered during the search. The top 5 to 10% of the system designs simulated during the search should be subjected to this controlled experiment. The “clean up” concept was introduced in Boesel, Nelson and Kim [2003].

In this section, we present an algorithm for optimization via simulation known as random search. The specific implementation is based on Algorithm 2 in Andrad´ottir [1998], which provides guaranteed asymptotic convergence under certain conditions. Thus, it will find the true optimal solution if permitted to run long enough. However, in practice, convergence can be slow, and the memory requirements of this particular version of random search can be quite large. Even though random search is not a robust heuristic, we will also use it to demonstrate some strategies we would employ in conjunction with such heuristics and to demonstrate why optimization via simulation is tricky even with what appears to be an uncomplicated algorithm.

The random-search algorithm that we present requires that there be a finite number of possible system designs, although that number may be quite large. This might seem to rule out problems with continuous decision variables, such as conveyor speed. In practice, however, apparently continuous decision variables can often be discretized in a reasonable way. For instance, if conveyor speed can be anything from 60 to 120 feet per minute, little may be lost by treating the possible conveyor speeds as 60,61,62,⋯ ,12060 , 61 , 62 , \cdots , 120 feet per minute (61 possible values). Note, however, that there are algorithms designed specifically for continuous-variable problems (Andrad´ottir [1998]).

Again, let the k possible solutions to the optimization via simulation problem be denoted {x1,x2,…,xk}\{\mathbf{x} _ {1} , \mathbf{x} _ {2} , \ldots , \mathbf{x} _ {k} \}, where the ith solution xi=(xi1,xi2,…,xim)\mathbf{x} _ {i} = ( x_{i 1} , x_{i 2} , \ldots , x_{i m} ) provides specific settings for the m decision variables. The simulation output at solution xi\mathbf{x} _ {i} is denoted Y(xi)Y ( \mathbf{x} _ {i} ); this could be the output of a single replication or the average of several replications. Our goal is to find the solution x∗\mathbf{x} ^ {*} that minimizes E(Y(x)),E \left( Y ( \mathbf{x} ) \right) ,).

On each iteration of the random-search algorithm, we compare a current good solution to a randomly chosen competitor. If the competitor is better, then it becomes the current good solution. When we terminate the search, the solution we choose is the one that has been visited most often— which means that we expect to revisit solutions many times.

Random-Search Algorithm

Step 1. Initialize counter variables C(i)=0fori=1,2,…,kC ( i ) = 0 \mathrm{f o r} i = 1 , 2 , \ldots , k. Select an initial solution i0.i^{0} ., and set C(i0)=1.[Hint:C(i)C ( i^{0} ) = 1 . [ H i n t {:} C ( i ) counts the number of times we visit solution i.]

Step 2. Choose another solution i from the set of all solutions except i0i^{0} in such a way that each solution has an equal chance of being selected.

Step 3. Run simulation experiments at the two solutions i0i^{0} and i′i^{\prime} to obtain outputs Y(i0)Y ( i^{0} ) and Y(i′)Y ( i^{\prime} ) If Y(i′)<Y(i0)Y ( i^{\prime} ) < Y ( i^{0} ), then set i0=i′i^{0} = i^{\prime}. (See note following Step 4.)

Step 4. Set C(i0)=C(i0)+1C ( i^{0} ) = C ( i^{0} ) + 1. If not done, then go to Step 2. If done, then select as the estimated optimal solution xi∗x _ {i^{*}} such that C(i∗)C ( i^{*} ) is the largest count.

Note that, if the problem is a maximization problem, then replace Step 3 with

Step 3 . Run simulation experiments at the two solutions i0i^{0} and i′i^{\prime} to obtain outputs Y(i0)Y ( i^{0} ) and Y(i′)Y ( i^{\prime} ) If Y(i′)>Y(i0)Y ( i^{\prime} ) > Y ( i^{0} ), then set i0=i′i^{0} = i^{\prime} One of the difficult problems with many optimization-via-simulation algorithms is knowing when to stop. (Exceptions include algorithms that guarantee a probability of correct selection.) Typical rules might be to stop after a certain number of iterations, stop when the best solution has not changed much in several iterations, or stop when all time available to solve the problem has been exhausted. Whatever rule is used, we recommend applying a statistical selection procedure, such as the Select-the-Best Procedure in Section 2.2, to the top 5 to 10% of the apparently best solutions. This is done to evaluate which among them is the true best with guaranteed confidence, and to precisely estimate their performance. If the raw data from the search have been saved, then these data can be used as the first-stage sample for a two-stage selection procedure.

Suppose that a manufacturing system consists of 4 stations in series. The zeroth station always has raw material available. When the zeroth station completes work on a part, it passes the part along to the first station, then the first passes the part to the second, and so on. Buffer space between stations 0 and 1, 1 and 2, and 2 and 3 is limited to 50 parts in total. If, say, station 2 finishes a part but there is no buffer space available in front of station 3, then station 2 is blocked, meaning that it cannot do any further work. The question is how to allocate these 50 spaces to minimize the expected cycle time per part over one shift.

Let xix_{i} be the number of buffer spaces in front of station i. Then the decision variables are x1,x2,x3x_{1} , x_{2} , x_{3} with the constraint that x1+x2+x3=50x_{1} + x_{2} + x_{3} = 50(it makes no sense to allocate fewer buffer spaces than we have available). This implies a total of 1326 possible designs (can you figure out how this number is computed?).

To simplify the presentation ofthe random-search algorithm, let the counter for solution (x1,x2,x3)( x_{1} , x_{2} , x_{3} ) be denoted as C(x1,x2,x3)C ( x_{1} , x_{2} , x_{3} )

Random-Search Algorithm

Step 1. Initialize 1326 counter variables C(x1,x2,x3) = 0.C ( x_{1} , x_{2} , x_{3} ) ~ = ~ 0 ., one for each of the possible solutions (x1,x2,x3)( x_{1} , x_{2} , x_{3} ). Select an initial solution, say,(x1=20,x2=15,x3=15)( x_{1} = 20 , x_{2} = 15 , x_{3} = 15 ) and set C(20, 15, 15) 1.

Step 2. Choose another solution from the set of all solutions except (20, 15, 15) in such a way tha each solution has an equal chance of being selected. Suppose (11, 35, 4) is chosen.

Step 3. Run simulation experiments at the two solutions to obtain estimates of the expected cycle time Y(20, 15, 15) and Y(11, 35, 4). Suppose that Y(20,15,15) < Y(11,35,4)Y ( 20 , 15 , 15 ) ~ < ~ Y ( 11 , 35 , 4 ). Then (20, 15, 15) remains as the current good solution.

Step 4. Set C(20,15,15)=C(20,15,15)+1C ( 20 , 15 , 15 ) = C ( 20 , 15 , 15 ) + 1

Step 2. Choose another solution from the set of all solutions except (20, 15, 15) in such a way that each solution has an equal chance of being selected. Suppose (28, 12, 10) is chosen.

Step 3. Run simulation experiments at the two solutions to obtain estimates of the expected cycle time Y(20, 15, 15) and Y(28, 12, 10). Suppose that Y(28,12,10) :< :Y(20,15,15)Y ( 28 , 12 , 10 ) \ : < \ : Y ( 20 , 15 , 15 ). Then (28, 12, 10) becomes the current good solution.

Step 4. Set C(28,12,10)=C(28,12,10)+1,C ( 28 , 12 , 10 ) = C ( 28 , 12 , 10 ) + 1 , Step 2. Choose another solution from the set of all solutions except (28, 12, 10) in such a way tha each solution has an equal chance of being selected. Suppose (0, 14, 36) is chosen.

Step 3. Continue…

When the search is terminated, we select the solution (x1,x2,x3)( x_{1} , x_{2} , x_{3} ) that gives the largest C(x1,x2,x3)C ( x_{1} , x_{2} , x_{3} ) count. As we discussed earlier, the top 5 to 10 solutions should then be subjected to a separate statistical analysis to determine which among them is the true best, with high confidence. In this case, the solutions with the largest counts would receive the second analysis.

Despite the apparent simplicity of the Random-Search Algorithm, we have glossed over a subtle issue that often arises in algorithms with provable performance. In Step 2, the algorithm must randomly choose a solution such that all are equally likely to be selected (except the current one). How can this be accomplished in Example 11? The constraint that x1+x2+x3=50x_{1} + x_{2} + x_{3} = 50 means that x1,x2x_{1} , x_{2} and x cannot be sampled independently. One might be tempted to sample x as a discrete uniform random variable on 0 to 50, then sample x2x_{2} as a discrete uniform on 0to50−x10 \mathrm{t o} 50 - x_{1}, and finally set x3=50−x1−x2x_{3} = 50 - x_{1} - x_{2}. But this method does not make all solutions equally likely, as the following illustration shows: Suppose that x1x_{1} is randomly sampled to be 50. Then the trial solution must be (50,0,0)( 50 , 0 , 0 ); there is only one choice. But if x1=49x_{1} = 49, then both (49, 1, 0) and (49,0,1)( 49 , 0 , 1 ) are possible. Thus,x1=49x_{1} = 49 should be more likely than x1=50x_{1} = 50 if all solutions with x1+x2+x3=50x_{1} + x_{2} + x_{3} = 50 are to be equally likely.

5 Summary

This chapter provided a basic introduction to the comparative evaluation of alternative system designs based on data collected from simulation runs. It was assumed that a fixed set of alternative system designs had been selected for consideration. Comparisons based on confidence intervals and the use of common random numbers were emphasized. A brief introduction to metamodels—whose purpose is to describe the relationship between design variables and the output response—and to optimization via simulation—whose purpose is to select the best from among a large and diverse collection o system designs—was also provided. There are many additional topics of potential interest, beyond the scope of this text, in the realm of statistical analysis techniques relevant to simulation. Some o these topics are:

a. experimental design models, whose purpose is to discover which factors have a significan impact on the performance of system alternatives;

b. output-analysis methods other than the methods of replication and batch means;

c. variance-reduction techniques, which are methods to improve the statistical efficiency of simulation experiments (common random numbers being an important example).

The reader is referred to Banks [1998] and Law [2007] for discussions of these topics and of others relevant to simulation.

The most important idea is that simulation output data require a statistical analysis in order to be interpreted correctly. In particular, a statistical analysis can provide a measure of the precision of the results produced by a simulation and can provide techniques for achieving a specified precision.

REFERENCES

ANDRADOTTIR, S. [1998], “Simulation Optimization,” Chapter 9 in´ Handbook ofSimulation, J. Banks, ed., Wiley, New York.

ANDRADOTTIR, S. [1999], “Accelerating the Convergence ofRandom Search Methods for Discrete Stochastic´ Optimization,” ACM TOMACS, Vol. 9, pp. 349–380.

BANKS, J., ed. [1998], Handbook ofSimulation, Wiley, New York.

BATES, D. M., AND D. G. WATTS [1988], Nonlinear Regression Analysis and its Applications, Wiley, New York.

BECHHOFER, R. E., T. J. SANTNER, AND D. GOLDSMAN [1995], Design and Analysis for Statistical Selection, Screening and Multiple Comparisons, Wiley, New York.

BOESEL, J., B. L. NELSON, AND N. ISHII [2003], “A Framework for Simulation-Optimization Software,” IIE Transactions, Vol. 35, pp. 221–229.

BOESEL, J., B. L. NELSON,AND S. KIM [2003], “Using Ranking and Selection to ‘Clean Up’After Simulation Optimization,” Operations Research, Vol. 51, pp. 814–825.

BOX, G. E. P., AND N. R. DRAPER [1987], Empirical Model-Building and Response Surfaces, Wiley, New York.

FU, M. C. [2002], “Optimization for Simulation: Theory vs. Practice,” INFORMS Journal on Computing, Vol. 14, pp. 192–215.

GLOVER, F. [1989], “Tabu Search—Part I,” ORSA Journal on Computing, Vol. 1, pp. 190–206.

GOLDSMAN, D., AND B. L. NELSON [1998], “Comparing Systems via Simulation,” Chapter 8 in Handbook ofSimulation, J. Banks, ed., Wiley, New York.

HINES, W. W., D. C. MONTGOMERY, D. M. GOLDSMAN, AND C. M. BORROR [2002], Probability and Statistics in Engineering, 4th ed., Wiley, New York.

HOCHBERG, Y., AND A. C. TAMHANE [1987], Multiple Comparison Procedures, Wiley, New York.

HSU, J. C. [1996], Multiple Comparisons: Theory and Methods, Chapman & Hall, New York.

KIM, S., AND B. L. NELSON [2006], “Selecting the Best System,” Chapter 17 in Handbooks in Operations Research and Management Science: Simulation, S. G. Henderson and B. L. Nelson, eds., North-Holland, New York.

KLEIJNEN, J. P. C. [1975], Statistical Techniques in Simulation, Parts I and II, Dekker, New York

KLEIJNEN, J. P. C. [1987], Statistical Toolsfor Simulation Practitioners, Dekker, New York.

KLEIJNEN, J. P. C. [1988], “Analyzing Simulation Experiments with Common Random Numbers,” Management Science, Vol. 34, pp. 65–74.

KLEIJNEN, J. P. C. [1998], “Experimental Design for Sensitivity Analysis, Optimization, and Validation of Simulation Models,” Chapter 6 in Handbook ofSimulation, J. Banks, ed., Wiley, New York.

LAW, A. M. [2007], Simulation Modeling and Analysis, 4th ed., McGraw-Hill, New York.

MONTGOMERY, D. C. [2000], Design and Analysis ofExperiments, 5th ed., Wiley, New York.

NELSON, B. L., J. SWANN, D. GOLDSMAN, AND W.-M. T. SONG [2001], “Simple Procedures for Selecting the Best System when the Number of Alternatives is Large,” Operations Research, Vol. 49, pp. 950–963.

NELSON, B. L. [1987], “Some Properties of Simulation Interval Estimators Under Dependence Induction,” Operations Research Letters, Vol. 6, pp. 169–176.

NELSON, B. L. [1992], “Designing Efficient Simulation Experiments,” Proceedings ofthe 1992 Winter Simu lation Conference, J. J. Swain, D. Goldsman, R. C. Crain, and J. R. Wilson, eds., Arlington, VA, Dec. 13–16, pp. 126–132.

OLAFSSON, S. [2006], “Metaheuristics,” Chapter 21 in´ Handbooks in Operations Research and Management Science: Simulation, S. G. Henderson and B. L. Nelson, eds., North-Holland, New York.

WHITT, W. [1989], “Planning Queueing Simulations,” Management Science, Vol. 35, pp. 1341–1366.

WRIGHT, R. D., AND T. E. RAMSAY, JR. [1979], “On the Effectiveness of Common Random Numbers,” Management Science, Vol. 25, pp. 649–656.

YANG, F., B. ANKENMAN, AND B. L. NELSON [2007], “Efficient Generation of Cycle Time-Throughput Curves through Simulation and Metamodeling,” Naval Research Logistics, Vol. 54, pp. 78–93.

EXERCISES

  1. A company has dump trucks that repeatedly go through three activities: loading, weighing, and traveling. Assume that there are eight trucks and that, at time 0, all eight are at the loaders. Weighing time per truck on the single scale is uniformly distributed between 1 and 9 minutes, and travel time per truck is exponentially distributed with mean 85 minutes. An unlimited queue is allowed before the loader(s) and before the scale. All trucks can be traveling at the same time. Management desires to compare one fast loader against the two slower loaders currently being used. Each of the slow loaders can fill a truck in from 1 to 27 minutes, uniformly distributed. The new fast loader can fill a truck in from 1 to 19 minutes, uniformly distributed. The basis for comparison is mean system response time over a 40-hour time horizon, where a response time is defined as the duration of time from a truck arrival at the loader queue to that truck’s departure from the scale. Perform a statistically valid comparison of the two options simulated using common random numbers.

  2. In Exercise 6 from the Estimation of Absolute Performance chapter, consider the following alternative (M, L) policies:

L
Low30High40
MLow50(50,30)(50, 40)
High100(100,30)(100, 40)

Investigate the relative costs of these policies, using suitable modifications of the simulation model developed in Exercise 6 from the Estimation of Absolute Performance chapter. Compare the four system designs on the basis of long-run mean monthly cost. First, make four replications of each (M, L) policy, using common random numbers to the greatest extent possible. Each replication should have a 12-month initialization phase followed by a 100-month data-collection phase. Compute confidence intervals having an overall confidence level of90% for mean monthly cost for each policy. Then estimate the additional replications needed to achieve confidence intervals that do not overlap. Draw conclusions as to which is the best policy.

  1. Reconsider Exercise 7 from the Estimation of Absolute Performance chapter. Compare the four inventory policies studied in Exercise 2, taking the cost of rush orders into account when computing monthly cost.

  2. Reconsider Exercise 8 from the Estimation of Absolute Performance chapter. Compare the four monthly inventory policies studied in Exercise 2, taking into account the selling price of the perishable items.

  3. In Exercise 9 from the Estimation of Absolute Performance chapter, investigate the effect of the order quantity on long-run mean daily cost. Each order arrives on a pallet on a delivery truck, so the permissible order quantities Q are multiples of 10; that is, Q may equal 10, or 20, or 30, . . . . In Exercise 9, the policy Q 20 was investigated.

(a) First, investigate the two policies Q 10 and Q 50. Use the run lengths, and so on, suggested in Exercise 9 from the Estimation of Absolute Performance chapter. On the basis of these runs, decide whether the optimal Q, say, Q∗, is between 10 and 50 or is greater than 50. (The cost curve as a function of Q should have what kind of shape?)

(b) Using the results in part (a), suggest two additional values for Q and simulate the two policies. Draw conclusions. Include an analysis of the strength of your conclusions.

  1. In Exercise 10 from the Estimation of Absolute Performance chapter, find the number of cards Q that the card-shop owner should purchase to maximize the profit within an error (for tota profit) of approximately $5.00 at most. First, make runs for the policy of ordering Q 250 and Q 350 cards. With these results, plus the results of Exercise 10 for ordering Q=300Q = 300 cards, decide on a range of Q worth considering further: 200 Q 250, or 250≤Q≤300.250 \leq Q \leq 300 ., etc. Then investigate this restricted range for two additional policies: Q 200 and Q=225,Q = 225 ,, or Q 265 and Q 285, etc.

  2. In Exercise 11 from the Estimation of Absolute Performance chapter, investigate the effec of target level M and review period N on mean monthly cost. Consider two target levels M, determined by 10 from the target level used in Exercise 11, and consider review periods N of 1 month and 3 months. Which (N, M) pair is best, according to these simulations?

  3. Reconsider Exercises 13 and 14 from the Estimation of Absolute Performance chapter, which involved the scheduling rules (or queue disciplines) first-in–first-out (FIFO) and priority-by-type (PR) in a job shop. In addition to these two rules, consider a shortest imminent operation (SIO) scheduling rule: For a given station, all jobs of the type with the smallest mean processing time are given highest priority. For example, when using an SIO rule at station 1, jobs are processed in the following order: type II first, then type I, and type III last. Two jobs of the same type are processed on a FIFO basis. Develop a simulation experiment to compare the FIFO, PR, and SIO rules on the basis of mean total response time over all jobs.

  4. In Exercise 13 from the Estimation of Absolute Performance chapter (the job shop with FIFO rule), find the minimum number of workers needed at each station to avoid bottlenecks. A bottleneck occurs when average queue lengths at a station increase steadily over time. [Hint: Do not confuse increasing average queue length due to an inadequate number of servers with increasing average queue length due to initialization bias. In the former case, average queue length continues to increase indefinitely and server utilization is 1.0. In the latter case, average queue length eventually levels off and server utilization is less than 1.] Report on utilization of workers and total time it takes for a job to get through the job shop, by type, and over all types.

[Hint: If server utilization at a work station is 1.0, and if average queue length tends to increase linearly as simulation run length increases, it is a good possibility that the work station is unstable and therefore is a bottleneck. In this case, at least one additional worker is needed at the work station. Use queueing theory, namely λ/ciμ<1\lambda / c_{i} \mu < 1, to suggest the minimum number of workers needed at station 1. Recall that λ is the arrival rate,1/μ1 / \mu is the overall mean service time for one job with one worker, and cic_{i} is the number of workers at station i. Attempt to use the same basic condition,λ/ciμ<1\lambda / c_{i} \mu < 1, to suggest an initial number of servers at station i for i=2,3,4.]i = 2 , 3 , 4 . ]10. (a) Repeat Exercise 9 for the PR scheduling rule (see Exercise 14 from the Estimation of Absolute Performance chapter).

(b) Repeat Exercise 9 for the SIO scheduling rule (see Exercise 8).

(c) Compare the minimum required number of workers for each scheduling rule: FIFO vs. PR vs. SIO.

  1. With the minimum number of workers found in above Exercises 9 and 10 for the job shop of Exercise 13 from the Estimation of Absolute Performance chapter, consider adding one worker to the entire shop. This worker can be trained to handle the processing at only one station. At which station should this worker be placed? How does this additional worker affect mean tota response time over all jobs? Over type I jobs? Investigate the job shop with and without the additional worker for each scheduling rule: FIFO, PR, SIO.

  2. In Exercise 17 from the Estimation of Absolute Performance chapter, suppose that a buffer of capacity one item is constructed in front of each worker. Design an experiment to investigate whether this change in system design has a significant impact upon individual worker utilizations ρ1,ρ2,ρ3\rho_{1} , \rho_{2} , \rho_{3}, and ρ4.\rho_{4} . At the very least, compute confidence intervals for ρ10−ρ11\rho_{1} ^ {0} - \rho_{1} ^ {1}^1 and ρ40−ρ41\rho_{4} ^ {0} - \rho_{4} ^ {1}, where ρis\rho_{i} ^ {s} is utilization for worker i when the buffer has capacity s.

  3. A clerk in the admissions office at Small State University processes requests for admissions materials. The time to process requests depends on the program of interest (e.g., industria engineering, management science, computer science, etc.) and on the level of the program (Bachelor’s, Master’s, Ph.D.). Suppose that the processing time is modeled well as normally distributed, with mean 7 minutes and standard deviation 2 minutes. At the beginning of the day it takes the clerk some time to get set to begin working on requests; suppose that this time is modeled well as exponentially distributed, with mean 20 minutes. The admissions office typically receives between 40 and 60 requests per day.

Let x be the number of applications received in a day, and let Y be the time required to process them (including the set-up time). Fit a metamodel for $\operatorname{E} ( Y | x ) $ by making n replications at the design points x=40,50x = 40 , 50, 60. Notice that, in this case, we know that the correct model is

E⁡(Y∣x)=β0+β1x=20+7x \operatorname{E} (Y | x) = \beta_{0} + \beta_{1} x = 20 + 7 x

(Why?) Begin with n=2n = 2 replications at each design point and estimate β0\beta_{0} and β1\beta_{1}. Gradually increase the number of replications and observe how many are required for the estimates to be close to the true values.

  1. Repeat the previous exercise using CRN. How do the results change?

  2. Consider the simple linear regression model Y=β0+β1x+εY = \beta_{0} + \beta_{1} x + \varepsilon. Find a statistics textbook that covers regression modeling. There you will find a test for the hypothesis β1=0\beta_{1} = 0(rejecting this hypothesis is evidence that x and Y are linearly related). The usual assumptions behind this test do not hold if we use CRN. Where do they break down?

  3. Riches and Associates retains its cash reserves primarily in the form of certificates of deposit (CDs), which earn interest at an annual rate of 8%. Periodically, however, withdrawals must be made from these CDs in order to pay suppliers, etc. These cash outflows are made through a checking account that earns no interest. The need for cash cannot be predicted with certainty. Transfers from CDs to checking can be made instantaneously, but there is a “substantial penalty” for early withdrawal from CDs. Therefore, it might make sense for R&A to make use of the overdraft protection on their checking account, which charges interest at a rate of $0.00033 per dollar per day (i.e., 12% per year) for overdrafts.

R&A likes simple policies in which it transfers a fixed amount, a fixed number of times, per year. Currently, it makes 6 transfers per year, of $18,250 each time. Your job is to find a policy that reduces its long-run cost per day.

Judging from historical patterns, demands for cash arrive a rate of about 1 per day, with the arrivals being modeled well as a Poisson process. The amount of cash needed to satisfy each demand is reasonably represented by a lognormally distributed random variable with mean $300 and standard deviation $150.

The penalty for early withdrawal is different for different CDs. It averages $150 for each withdrawal, regardless of size, but the actual penalty can be modeled as a uniformly distributed random variable with range $100 to $200.

Use cash level in checking to determine the length of the initialization phase. Make enough replications that your confidence interval for the difference in long-run cost per day does not contain zero. Be sure to use CRN in your experiment design.

  1. If you have access to commercial optimization-via-simulation software, test how well it works as the variability of the simulation outputs increases. Use a simple model, such as Y=x2+ε,Y = x^{2} + \varepsilon , where ε is a random variable with a N(0,σ2)\mathrm{N} ( 0 , \sigma^{2} ) distribution, and for which the optimal solution is known (x=0( x = 0 for minimization, in this case). See how quickly, or whether, the software can

find the true optimal solution as σ2\sigma^{2} increases. Next, try more complex models with more than one design variable.

  1. For Example 11, show why there are 1326 solutions. Then derive a way to sample x_1, x_2, and x_3 such that x1+x2+x3=50x_{1} + x_{2} + x_{3} = 50 and all outcomes are equally likely.

  2. A critical electronic component with mean time to failure of x years can be purchased for 2x thousand dollars (thus, the more reliable the component, the more expensive it is). The value of x is restricted to being between 1 to 10 years, and the actual time to failure is modeled as exponentially distributed. The mission for which the component is to be used lasts one year; if the component fails in less than one year, then there is a cost of $20,000 for early failure. What value of x should be chosen to minimize the expected total cost (purchase plus early failure)?

To solve this problem, develop a simulation that generates a total cost for a component with mean time to failure of x years. This requires sampling an exponentially distributed random variable with mean x, and then computing the total cost as 2000x plus 20,000 if the failure time is less than 1. Fit a quadratic metamodel in x and use it to find the value of x that minimizes the fitted model. [Hints: Select several values of x between 1 and 10 as design points. At each value of x, let the response variable Y(x) be the average of at least 30 observations of total cost.]

  1. Use optimization-via-simulation software to solve Exercise 19. If you do not have access to such software, use the random-search algorithm, and let the possible values of x be 1.00, 1.25, 1.50, . . . , 10.00 .

  2. Suppose that demand for a certain product has a Poisson distribution with mean 10 units. Use optimization-via-simulation software (or the random-search algorithm, if you do not have access to such software) to find the order size x that maximizes the probability that demand equals x units, assuming that 0≤x≤1000 \leq x \leq 100, and x is an integer. (This problem is based in Andrad´ottir [1999].) [Hint: On each replication of the simulation for a trial value of x, a random demand is generated from the Poisson distribution with mean 10. If this random demand equals x, then the response is Y(x) 1; otherwise it is Y(x) 0.]

  3. In Exercise 16, consider the following 5 policies: 6 transfers of $18,250; 5 transfers of $21,900; 4 transfers of $27,375; 3 transfers of $36,500; and 2 transfers of $54,750. Make 10 replications of each policy and construct simultaneous confidence intervals for the differences in expected cost of all pairs of policies.

  4. In Exercise 16, consider the following 5 policies: 6 transfers of $18,250; 5 transfers of $21,900; 4 transfers of $27,375; 3 transfers of $36,500; and 2 transfers of $54,750. Make 10 replications of each policy and then apply the Select-the-Best Procedure to select the policy with the leas expected cost per day. Use  $2 per day.

List of Materials Available on www.bcnn.net

SimulationTools.xls

13 Simulation of Manufacturing and Material-Handling Systems

Manufacturing and material-handling systems provide one of the most important applications of simulation. Simulation has been used successfully as an aid in the design of new production facilities, warehouses, and distribution centers. It has also been used to evaluate suggested improvements to existing systems. Engineers and analysts using simulation have found it valuable for evaluating the impact of capital investments in equipment and physical facility and of proposed changes to material handling and layout. They have also found it useful to evaluate staffing and operating rules and proposed rules and algorithms to be incorporated into production control systems, warehousemanagement control software, and material-handling controls. Managers have found simulation useful in providing a “test drive” before making capital investments, without disrupting the existing system with untried changes.

Section 1 provides an introduction and discusses some of the features of simulation models of manufacturing and material-handling systems. Section 2 discussed the goals of manufacturing simulation and the most common measures of system performance. Section 3 discusses a number of the issues common to many manufacturing and material-handling simulations, including the treatment of downtimes and failure, and trace-driven simulations using actual historical data or historical order files. Section 4 provides brief abstracts of a number of reported simulation projects, with references for additional reading. Section 5 gives an extended example of a simulation of a smal production line, emphasizing the experimentation and analysis of system performance to achieve a desired throughput.

1 Manufacturing and Material-Handling Simulations

As do all modeling projects, manufacturing and material-handling simulation projects need to address the issues of scope and level of detail. Consider scope as analagous to breadth and level of detail as analagous to depth. Scope describes the boundaries of the project: what’s in the model, and what’s not. For a subsystem, process, machine, or other component, the project scope determines whether the object is in the model. Then, once a component or subsystem is treated as part of a model, often it can be simulated at many different levels of detail.

The proper scope and level of detail should be determined by the objectives of the study and the questions being asked. On the other hand, level of detail could be constrained by the availability o input data and the knowledge of how system components work. For new, nonexistent systems, data availability might be limited, and system knowledge might be based on assumptions.

Some general guidelines can be provided, but the judgment of experienced simulation analysts, working with the customer to define, early in the project, the questions the model is being designed to address, provides the most effective basis for selecting a proper scope and a proper level of detail.

Should the model simulate each conveyor section or vehicle movement, or can some be replaced by a simple time delay? Should the model simulate auxiliary parts, or the handling of purchased parts, or can the model assume that such parts are always available at the right location when needed for assembly?

At what level ofdetail does the control system need to be simulated? Many modern manufacturing facilities, distribution centers, baggage-handling systems, and other material-handling systems are computer controlled by a management-control software system. The algorithms built into such contro software play a key role in system performance. Simulation is often used to evaluate and compare the effectiveness of competing control schemes and to evaluate suggested improvements. It can be used to debug and fine-tune the logic of a control system before it is installed.

These questions are representative of the issues that need to be addressed in choosing the proper scope and level of detail for a modeling project. In turn, the scope and level of model detail limit the type of questions that can be addressed by the model. In addition, models can be developed in an iterative fashion, adding detail for peripheral operations at later stages if such operations are later judged to affect the main operation significantly. It is good advice to start as simply as possible and add detail only as needed.

1.1 Models of Manufacturing Systems

Models of manufacturing systems might have to take into account a number of characteristics of such systems, including some of the following:

  1. Physical layout 2. Labor a. Shift schedules b. Job duties and certification

  2. Equipment a. Rates and capacities b. Breakdowns i.Time to failure ii. Time to repair iii. Resources needed for repair

  3. Maintenance a. Preventative maintenance (PM) schedule b. Time and resources required c. Tooling and fixtures

  4. Workcenters a. Processing b. Assembly c. Disassembly

  5. Product a. Product flow, routing, and resources needed b. Bill of materials

  6. Production schedules a. Made-to-stock b. Made-to-order i. Customer orders ii. Line items and quantities

  7. Production control a. Assignment of jobs to work areas b. Task selection at workcenters c. Routing decisions

  8. Supplies a. Ordering b. Receipt and storage c. Delivery to workcenters

  9. Storage a. Supplies b. Spare parts c. Work-in-process (WIP) d. Finished goods

  10. Packing and shipping a. Order consolidation b. Paperwork c. Loading of trailers

1.2 Models of Material Handling Systems

In manufacturing systems, it is not unusual for 80 to 85% of an item’s total time in system to be expended on material handling or on waiting for material handling to occur. This work-in-process (WIP) represents a vast investment, and reductions in WIP and associated delays can result in large cost savings. Therefore, for some studies, detailed material-handling simulations are cost effective.

In some production lines, the material-handling system is an essential component. For example, automotive paint shops typically consist of a power-and-free conveyor system that transports automobile bodies or body parts through the paint booths.

In warehouses, distribution centers, and flow-through and cross-docking operations, material handling is clearly a key component of any material-flow model. Manual warehouses typically use manual fork trucks to move pallets from receiving dock to storage and from storage to shipping dock. More automated distribution centers might use extensive conveyor systems to support putaway, order picking, order sortation, and consolidation.

Models of material-handling systems often have to contain some of the following types of subsystems:

  1. Conveyors a. Accumulating b. Nonaccumulating c. Indexing and other special purpose d. Fixed window or random spacing e. Power and free

  2. Transporters

a. Unconstrained vehicles (e.g., manually guided fork trucks) b. Guided vehicles (automated or operator controlled, wire guided chemical paths, rail guided)

c. Bridge cranes and other overhead lifts

  1. Storage systems

a. Pallet storage

b. Case storage

c. Small-part storage (totes)

d. Oversize items

e. Rack storage or block stacked

f. Automated storage and retrieval systems (AS/RS) with storage–retrieval machines (SRM)

1.3 Some Common Material-Handling Equipment

There are numerous types of material-handling devices common to manufacturing, warehousing, and distribution operations. They include unconstrained transporters, such as carts, manually driven fork-lift trucks, and palletjacks; guided path transporters, such asAGVs (automated guided vehicles); and fixed-path devices, such as various types of conveyor.

The class of unconstrained transporters, sometimes called free-path transporters, includes carts, fork-lift trucks, pallet jacks, and other manually driven vehicles that are free to travel throughout a facility unconstrained by a guide path of any kind. Unconstrained transporters are not confined to a network of paths and may choose an alternate path or move around an obstruction. In contrast, the guided-path transporters move along a fixed path, such as chemical trails on the floor, wires embedded in the floor, or infrared lights placed strategically, or by self-guidance, using radio communications, laser guidance and dead reckoning, and rail. Guided-path transporters sometimes contend with one another for space along their paths and usually have limited options upon meeting obstacles and congestion. Examples of guided-path transporters include the automated guided vehicle (AGV), a rail-guided turret truck for storage and retrievals of pallets in rack storage, and a crane in an AS/RS (automated storage and retrieval system).

The conveyor is a fixed-path device for moving entities from point to point, following a fixed path with specific load, stopping or processing points, and unload points. A conveyor system can consist of numerous connected sections with merges and diverts. Each section can be of one of a number of different types. Examples of conveyor types include belt, powered and gravity roller, bucket, chain, tilt tray, and power-and-free, each with its own characteristics that must be modeled accurately.

Most conveyor sections can be classified as either accumulating or nonaccumulating. An accumulating conveyor section runs continuously. If the forward progress of an item is halted while on the accumulating conveyor, slippage occurs, allowing the item to remain stationary and items behind i to continue moving until they reach the stationary item. Some belt and most roller conveyors operate in this manner. Only items that will not be damaged by bumping into each other can be placed on an accumulating conveyor.

In contrast, after an item is on a nonaccumulating conveyor section, its spacing relative to other items does not change. If one item stops moving, the entire section stops moving, and hence al items on the section stop. For example, nonaccumulating conveyor is used for moving televisions not yet in cartons, for they must be kept at a safe distance from one another while moving from one assembly or testing station to the next. Bucket conveyors, tilt-tray conveyors, some belt conveyors, and conveyors designed to carry heavy loads (usually pallets) are nonaccumulating conveyors.

Conveyors can also be classified as fixed-window or random spacing. In fixed-window spacing, items on the conveyor must always be within zones of equal length, which can be pictured as lines drawn on a belt conveyor or trays pulled by a chain. For example, in a tilt-tray conveyor, continuously moving trays of fixed size are used to move items. The control system is designed to induct items in such a way that each item is in a separate tray; thus it is a nonaccumulating fixed-window conveyor. In contrast, with random spacing, items can be anywhere on the conveyor section relative to other items. To be inducted, they simply require sufficient space.

Besides these basic types, there are innumerable types of specialized conveyors for special purposes. For example, a specialized indexing conveyor may move forward in increments, always maintaining a fixed distance between the trailing edge of the load ahead and the leading edge of the load behind. Its purpose is to form a “slug” of items, equally spaced apart, to be inducted all together onto a transport conveyor. For the local behavior of some systems—that is, the performance at a particular workstation or induction point—a detailed understanding and accurate model of the physical workings and the control logic are essential for accurate results.

2 Goals and Performance Measures

The purpose of simulation is insight, not numbers. Those who purchase and use simulation software and services want to gain insight and understanding into how a new or modified system will work. Will it meet throughput expectations? What happens to response time at peak periods? Is the system resilient to short-term surges? What is the recovery time when short-term surges cause congestion and queueing? What are the staffing requirements? What problems occur? If problems occur, wha is their cause and how do they arise? What is the system capacity? What conditions and loads cause a system to reach its capacity?

Simulations are expected to provide numeric measures of performance, such as throughput under a given set ofconditions, but the major benefit ofsimulation comes from the insight and understanding gained regarding system operations. Visualization through animation and graphics provides major assistance in the communication of model assumptions, system operations, and model results. Often, visualization is the major contributor to a model’s credibility, which in turn leads to acceptance o the model’s numeric outputs. Of course, a proper experimental design that includes the right range of experimental conditions plus a rigorous analysis and, for stochastic simulation models, a proper statistical analysis, is of utmost importance for the simulation analyst to draw correct conclusions from simulation outputs.

The major goals of manufacturing-simulation models are to identify problem areas and quantify system performance. Common measures of system performance include the following:

throughput under average and peak loads;

system cycle time (how long it takes to produce one part);

utilization of resources, labor, and machines;

bottlenecks and choke points;

queueing at work locations;

queueing and delays caused by material-handling devices and systems;

WIP storage needs;

staffing requirements;

effectiveness of scheduling systems;

effectiveness of control systems.

Often, material handling is an important part of a manufacturing system and its performance. Non-manufacturing material-handling systems include warehouses, distribution centers, crossdocking operations, baggage-handling systems at airports and container terminals. The major goals of these nonmanufacturing material-handling systems are similar to those identified for manufacturing systems. Some additional considerations are the following:

how long it takes to process one day of customer orders;

effect of changes in order profiles (for distribution centers);

truck/trailer queueing and delays at receiving and shipping docks;

effectiveness of material-handling systems at peak loads;

recovery time from short-term surges (for example, with baggage-handling).

3 Issues in Manufacturing and Material-Handling Simulations

There are a number of modeling issues especially important for the achievement of accurate and valid simulation models of manufacturing and material-handling systems. Two of these issues are the proper modeling of downtimes and whether, for some inputs, to use actual system data or a statistical model of those inputs.

3.1 Modeling Downtimes and Failures

Unscheduled random downtimes can have a major effect on the performance of manufacturing systems. Many authors have discussed the proper modeling of downtime data (Williams [1994]; Clark [1994]; Law and Kelton [2000]). This section discusses the problems that can arise when downtime is modeled incorrectly and suggests a number of ways to model machine and system downtimes correctly.

Scheduled downtime, such as for preventive maintenance, or periodic downtime, such as for too replacement, also can have a major effect on system performance. But these downtimes are usually (or should be) predictable and can be scheduled to minimize disruptions. In addition, engineering efforts or new technology might be able to reduce their duration.

There are a number of alternatives for modeling random unscheduled downtime, some better than others:

  1. Ignore it.

  2. Do not model it explicitly, but increase processing times in appropriate proportion.

  3. Use constant values for time to failure and time to repair.

  4. Use statistical distributions for time to failure and time to repair.

Of course, alternative (1) generally is not the suggested approach. This is certainly an irresponsible modeling technique if downtimes have an impact on the results, as they do in almost al situations. One situation in which ignoring downtimes could be appropriate, with the full knowledge of the customer, is to leave out those catastrophic downtimes that occur rarely and leave a production line or plant down for a long period of time. In other words, the model would incorporate normal downtimes but ignore those catastrophic downtimes, such as general power failures, snow storms, cyclones, and hurricanes, that occur rarely but stop all production when they do occur. The documented scope of the project should clearly state the assumed operating conditions and those conditions that are not included in the model. If it is generally known that a plant will be closed for some number of snow days per year, then the simulation need not take these downtimes into account, for the effect of any given number of days can easily be factored into the simulation results when making annual projections.

The second possibility, to factor into the model the effect of downtimes by adjusting processing times applied to each job or part, might be an acceptable approximation under limited circumstances. If eachjob or part is subject to a large number of small delays associated with downtime of equipmen or tools, then the total of such delays may be added to the pure processing time to arrive at an adjusted processing time. If total delay time and pure processing time are random in nature, then an appropriate statistical distribution should be used for the total adjusted processing time. If the pure processing time is constant while the total delay time in one cycle is random and variable, it is almost never accurate to adjust the processing time by a constant factor. For example, if processing time is usually 10 minutes but the equipment is subject to downtimes that cause about a 10% loss in capacity, it is not appropriate to merely change the processing time to a constant 11 minutes. Such a deterministic adjustment might provide reasonably accurate estimates of overall system throughput, but will no provide accurate estimates of such local behavior as queue and buffer space needed at peak times. Queueing and short-term congestion are strongly influenced by randomness and variability.

The third possibility, using constant durations for time to failure and time to repair, might be appropriate when, for example, the downtime is actually due to preventive maintenance that is on a fixed schedule. In almost all other circumstances, the fourth possibility, modeling time to failure and time to repair by appropriate statistical distributions, is the appropriate technique. This requires either actual data for choosing a statistical distribution based on estimation of absolute performance techniques, or, when data is lacking, a reasonable assumption based on the physical nature of the causes of downtimes.

The nature of time to failure is also important. Are times to failure completely random in nature, a situation due typically to a large number of possible causes of failure? In this case, exponentia distribution might provide a good statistical model. Or are times to failure, rather, more regular— typically, due to some major component, say, a tool, wearing out? In this case, a uniform or (truncated) normal distribution could be more nearly appropriate. In the latter case, the mean of the distribution represents the average time to failure, and the distribution places a plus or minus around the mean.

Time to failure can be measured in a number of different ways:

  1. by wall-clock time;

  2. by machine or equipment busy time;

  3. by number of cycle times;

  4. by number of items produced.

Breakdowns or failures can be based on clock time, actual usage, or cycles. Note that the word breakdown orfailure is used, even though preventive maintenance could be the reason for a downtime. As mentioned, breakdowns or failures can be probabilistic or deterministic in duration.

Actual usage breakdowns are based on the time during which the resource is used. For example, wear on a machine tool occurs only when the machine is in use. Time to failure is measured agains machine-busy time and not against wall-clock time. If the time to failure is 90 hours, then the model keeps track of total busy time since the last downtime ended, and, when 90 hours is reached, processing is interrupted and a downtime occurs.

Clock-time breakdowns might be associated with scheduled maintenance; for example, changes of fluids every three months when a complete lubrication is required. Downtimes based on wall-clock time may also be used for equipment that is always busy or equipment that runs even when it is no processing parts.

Cycle breakdowns or failures are based on the number of times the resource is used. For example, after every 50 uses of a tool, it needs to be sharpened. Downtimes based on number of cycle times or number of items produced are implemented by generating the number of times or items and, in the model, simply counting until this number is reached. Typical uses of downtimes based on busy time or cycle times may be for maintenance or tool replacement.

Another issue is what happens to a part at a machine when the breakdown or failure occurs. Possibilities include scrapping the part, rework, or simply continuing processing after repair. In some cases—for example, when preventive maintenance is due—the part in the machine may complete processing before the repair (or maintenance activity) begins.

Time to repair can also be modeled in two fundamentally different ways:

  1. as a pure time delay (no resources required);

  2. as a wait time for a resource (e.g., maintenance person) plus a time delay for actual repair.

Of course, there are many variations on these methods in actual modeling situations. When a repair or maintenance person is a limited resource, the second approach will be a more accurate model and provide more information.

The next example illustrates the importance of using the proper approach for modeling downtimes and the consequences and inaccurate results that sometimes result from inappropriate assumptions.

Example 1: Effect of Downtime on Queueing

Consider a single machine that processes a wide variety of parts that arrive in random mixes at random times. Data analysis has shown that an exponentially distributed processing time with a mean of 7.5 minutes provides a fairly accurate representation. Parts arrive at random, time between arrivals being exponentially distributed with mean 10 minutes. The machine fails at random times. Downtime studies have shown that time-to-failure can be reasonably approximated by an exponentia distribution with mean time 1000 minutes. The time to repair the resource is also exponentially distributed, with mean time 50 minutes. When a failure occurs, the current part in the machine is removed from the machine; when the repair has been completed, the part resumes its processing.

When a part arrives, it queues and waits its turn at the machine. It is desired to estimate the size of this queue. An experiment was designed to estimate the average number of parts in the queue. To illustrate the effect of an accurate treatment of downtimes, the model was run under a number o different assumptions. For each case and replication, the simulation run length was 100,000 minutes.

Table 1 shows the average number of parts in the queue for six different treatments of the time between breakdowns. For each treatment that involves randomness, five replications of those treatments and the average for those five replications are shown.

Case A ignores the breakdowns. The average number in the queue is 2.31 parts. Across the 5 independent replications, the averages range from 2.05 to 2.70 parts. This treatment of breakdowns is not recommended.

Case B increases the average service time from 7.5 minutes to 8.0 minutes in an attempt to approximate the effect of downtimes. On average, each downtime and repair cycle is 1050 minutes, with the machine down for 50 minutes. Thus the machine is down, on the average in the long run, 50/10504.8% of total time. Thus, some have argued that downtime has approximately the same effect as increasing the processing time of each part by 4.8%, which is about 7.86 minutes. Therefore, an assumed constant 8 minutes per part should be (it is argued) a conservative approach. For this treatment of downtimes, the average number of parts in the queue, over the five replications, is abou 3.26 parts. Across the 5 replications, the range is from 2.81 to 4.03 parts. (Note that the variability as shown in the range of values is very small compared to the other cases.) The treatment in Case B might be appropriate under some limited circumstances, but, as was discussed in a previous section, it is not appropriate under the assumptions of this example.

Table 1 Average Number of Parts in Queue for Machines with Breakdowns

Case1st Rep2nd Rep3rd Rep4th Rep5th RepAvg Rep
A. Ignore the breakdowns2.362.052.382.052.702.31
B. Increase service time to 8.03.322.823.322.814.033.26
C. All random4.053.774.363.954.434.11
D. Random processing, deterministic breakdowns3.242.853.283.053.793.24
E. All deterministic0.52
F. Deterministic processing,random breakdowns1.061.041.101.321.161.13

The proper treatment, shown as Case C, treats the randomness in processing and breakdowns properly, with the assumed correct exponential distributions. The average value is about 4.11 parts waiting for the machine. Across the 5 replications, the average queue length ranges from 3.77 to 4.43 parts. The average number waiting differs from that of Case B by almost one part.

Case D is a simplification that treats the processing randomly, but treats the breakdowns as deterministic. The results average about 3.24 parts in the queue. The range of averages is from 2.85 to 3.79 parts, quite a reduction in variability from Case C.

Case E treats all of the times as deterministic. Only one replication is needed, because additiona replications (using the same seed) will reproduce the result. The average value in the queue is 0.52 parts, well below the value in Case C, or any other case for that matter. The conclusion: Ignoring randomness is dangerous and leads to totally unrealistic results.

Case F treats arrivals and processing as deterministic, but breakdowns are random. The average number of parts in the queue at the machine is about 1.13. The range is from 1.04 to 1.32 parts. For some machines and processing in manufacturing environments, Case F is the realistic situation: Processing times are constant, and arrivals are regulated—that is, are also constant. The reader is lef to consider the inaccuracies that would result from making faulty assumptions regarding the nature of time to failure and time to repair.

In conclusion, there can be significant differences between the estimated average numbers in a queue, based on the treatment of randomness. The results using the correct treatment of randomness can be far different from those using alternatives. Often, one is tempted by the unavailability of detailed data and the availability of averages to want to use average time to failure as if it were a constant. Example 1 illustrates the dangers of inappropriate assumptions. Both the appropriate technique to use and the appropriate statistical distribution depend on the available data and on the situation at hand.

As discussed by Williams [1994], the accurate treatment of downtimes is essential for achieving valid models of manufacturing systems. Some of the essential ingredients are the following:

  1. avoidance of oversimplified and inappropriate assumptions;

  2. careful collection of downtime data;

  3. accurate representation of time to failure and time to repair by statistical distributions;

  4. accurate modeling of system logic when a downtime occurs, in terms both of the repair-time logic and of what happens to the part currently processing.

3.2 Trace-Driven Models

A model driven by actual historical data is called a trace-driven model. In this section, we provide an example and a description of some modeling situations in which a trace-driven approach for some input data items is beneficial compared to other approaches.

Consider a model of a distribution center that receives customer orders that must be processed and shipped in one day. One modeling question is how to represent the day’s set of orders. A typical order will contain one or more line items, and each line item can have a quantity of one or more pieces. For example, when you buy a new stereo, you might purchase an amplifier, a tuner, and a CD player (all separate line items, each having a quantity of one piece), and 4 identical speakers (another line item with a quantity of 4 pieces). The overall order profile can have a major impact on the performance of a particular system design. A system designed to handle large orders going to a small number of customers might not perform well if order profiles shift toward a larger number o customers (or larger number of separate shipments) with one or two items per order.

One approach is to characterize the order profile by using a discrete statistical distribution for each variable in an order:

  1. the number of line items;

  2. for each line item, the number of pieces.

If these two variables are statistically independent, then this approach might provide a valid mode of the order profile. For many applications, however, these two variables may be highly correlated in ways that could be difficult to characterize statistically. For example, an apparel and shoe company has six large customers (the large department stores and discount chains), representing 50% of sales volume, which typically order dozens or hundreds of line items and large quantities of many of the items. At the opposite pole, on any given day approximately 50% of the orders are for one or two pairs of shoes (just-in-time with a vengeance!). For this company, the number of line items in an order is highly positively correlated with the quantity ordered; that is, large orders with a large number o line items also usually have large quantities of many of the line items. And small orders with only a few line items typically order small quantities of each item.

What would happen if the two variables, number of line items and quantity per line item, were modeled by independent statistical distributions? When an order began processing, the model would make two random uncorrelated draws, which could result in order profiles quite different from those found in practice. Such an erroneous assumption could result, for example, in far too large a proportion of orders having one or two line items with large unrealistic quantities.

Another common but more serious error is to assume that there is an average order and to simulate only the number of orders in a day with each being the typical order. In the author’s experience, analyses of many order profiles have shown (1) that there is no such thing as a typica order and (2) that there is no such thing as a typical order profile.

An alternative approach, and one that has proven successful in many studies, is for the company to provide the actual orders for a sample of days over the previous year. Usually, it is desirable to simulate peak days. A model driven in this manner is called a trace-driven model.

A trace-driven model eliminates all possibility of error due to ignoring or misestimating correlations in the data. One apparent limitation could be a customer’s desire, at times, to be able to simulate hypothesized changes to the order profile, such as a higher proportion of smaller orders in terms o both line items and quantities. In practice, this limitation can be removed by adding “dials” to the order-profile portion of the model, so that a simulation analyst can dial up more or less of certain characteristics, as desired. One approach is to treat the day’s orders as a statistical population from which the model draws samples in a random fashion. This approach makes it easy to change overal order volume without modifying the profile. A second related approach would be to subdivide a day’s orders into subgroups based on number of line items, quantities or other numeric parameters, and then sample in a specified proportion from each subgroup. By changing the proportion of each subgroup, different order profiles can be “dialed up” and fed into the model. A third approach is to use factors to adjust the number of daily orders, the number of line items, and/or the quantities. In practice one of these approaches might be as accurate as can be expected for hypothesized future order profiles and might provide a cost effective and reasonably accurate model, especially for testing the robustness of a system design for assumed changes in order characteristics.

Other examples of input variables that may be used in trace-driven models include the following:

orders to a custom job shop, using actual historical orders;

product mix and quantities, and production sequencing, for an assembly line making 100 styles and sizes of hot-water heaters;

time to failure and downtime, using actual maintenance records;

truck arrival times to a warehouse, using gate records.

Whether to make an input variable trace-driven or to characterize it as a statistical distribution depends on a number of issues, including the nature of the variable itself, whether it is correlated with or independent of other variables, the availability of accurate data, and the questions being addressed.

4 Case Studies of the Simulation of Manufacturing and Material Handling Systems

The Winter Simulation Conference Proceedings, IIE Magazine, Modern Material Handling and other periodicals are excellent sources of information for short cases in the simulation of manufacturing and material-handling systems.

An abstract of some of the papers from past Winter Simulation Conference Proceedings wil provide some insight into the types of problems that can be addressed by simulation. These abstracts have been paraphrased and shortened where appropriate; our goal is to provide an indication of the breadth of real-world applications of simulation.

Session: Semiconductor Wafer Manufacturing

Paper: Modeling and Simulation of Material Handling for Semiconductor Wafer Fabrication

Authors: Neal G. Pierce and Richard Stafford [1994]

Abstract: This paper presents the results of a design study to analyze the interbay material-handling systems for semiconductor wafer manufacturing. The authors developed discrete-event simulation models of the performance of conventional cleanroom material handling including manual and automated systems. The components of a conventional cleanroom material-handling system include an overhead monorail system for interbay (bay-to-bay) transport, work-in-process stockers for lot storage, and manual systems for intrabay movement. The authors constructed models and experiments that assisted with analyzing cleanroom material-handling issues such as designing conventional automated material-handling systems and specifying requirements for transport vehicles.

Session: Simulation in Aerospace Manufacturing

Paper: Modeling Aircraft Assembly Operations

Authors: Harold A. Scott [1994]

Abstract: A simulation model is used to aid in the understanding of complex interactions of aircraft assembly operations. Simulation helps to identify the effects of resource constraints on dynamic process capacity and cycle time. To analyze these effects, the model must capture job and crew interactions at the control code level. This paper explores five aspects of developing simulation models to analyze crew operations on aircraft assembly lines:

Representing job precedence relationships;

Simulating crew members with different skill and job proficiency levels;

Reallocating crew members to assist ongoing jobs;

Depicting shifts and overtime;

Modeling spatial constraints and crew movements in the production area.

Session: Control of Manufacturing Systems

Paper: Discrete Event Simulation for Shop Floor Control

Authors: J. S. Smith, R. A. Wysk, D. T. Sturrock, S. E. Ramaswamy,

G. D. Smith, S. B. Joshi [1994]

Abstract: This paper describes an application of simulation to shop floor control of a flexible manufacturing system. The simulation is used not only as an analysis and evaluation tool, but also as a task generator for the specification of shop floor control tasks. Using this approach, the effort applied to the development of control logic in the simulation is not duplicated in the development of the control system. Instead, the same control logic is used for the control system as was used for the simulation. Additionally, since the simulation implements the control, it provides very high fidelity performance predictions. The paper describes implementation experience in two flexible manufacturing laboratories.

Session: Flexible Manufacturing

Paper: Developing and Analyzing Flexible Cell Systems Using Simulation Authors: Edward F. Watson and Randall P. Sadowski [1994]

Abstract: This paper develops and evaluates flexible cell alternatives to support an agile production environment at a mid-sized manufacturer of industrial equipment. Three work-cell alternatives were developed, based on traditional flow-analysis studies, past experience, and common sense. The simulation model allowed the analyst to evaluate each cell alternative under current conditions as well as anticipated future conditions that included changes to product demand, product mix, and process technology.

Session: Modeling of Production Systems

Paper: Inventory Cost Model for “Just-in-Time” Production

Authors: Mahesh Mathur [1994]

Abstract: This paper presents a simulation model used to compare setup and inventory carrying costs with varying lot sizes. While reduction of lot sizes is a necessary step towards implementation of Just-in-Time (JIT) production in a job shop environment, a careful cost study is required to determine the optimum lot size under the present set up conditions. The simulation model graphically displays the fluctuation of carrying costs and accumulation of set up costs on a time scale in a dynamic manner. The decision of the optimum lot size can then be based on realistic cost figures.

Session: Analysis of Manufacturing Systems

Paper: Modelling Strain of Manual Work in Manufacturing Systems

Authors: I. Ehrhardt, H. Herper, and H. Gebhardt [1994]

Abstract: This paper describes a simulation model that considers manual oper ations for increasing the effectiveness of planning logistic systems. Even though there is ever-increasing automation, there are vital tasks in production and logistics that are still assigned to humans. Present simulation modeling efforts rarely concentrate on the manual activities assigned to humans.

Session: Manufacturing Case Studies

Paper: Simulation Modeling for Quality and Productivity in Steel Cord Manufacturing

Authors: C. H. Turkseven and G. Ertek [2003]

Abstract: The paper describes the application of simulation modeling to esti mate and improve quality and productivity performance of a steel cord manufacturing system. It focuses on wire fractures, which can be an important source of system disruption.

Session: Manufacturing Analysis and Control

Paper: Shared Resource Capacity Analysis in Biotech Manufacturing

Author: P. V. Saraph [2003]

Abstract: This paper discusses an application of simulation in analyzing the capacity needs of a shared resource, the Blast Freezer, at one of the Bayer Corporation’s manufacturing facilities. The simulation model was used to analyze the workload patterns, run different workload scenarios (taking into consideration uncertainty and variability), and provide recommendations on a capacity increase plan. This analysis also demonstrated the benefits of certain operational scheduling policies. The analysis outcome was used to determine capital investments for 2002.

Session: Manufacturing Analysis and Control

Paper: Behavior of an Order Release Mechanism in a Make-to-Order Manufacturing System with Selected Order Acceptance

Authors: A. Nandi and P. Rogers [2003]

Abstract: The authors used a simulation model to evaluate a controversial policy, namely, holding orders in a preshop pool prior to their release to the factory floor. In a make-to-order manufacturing system, if capacity is fixed and exogenous due dates are inflexible, having orders wait in a preshop pool may cause the overall due-date performance of the system to deteriorate. The model was used to evaluate an alternative approach, the selective rejection of orders for dealing with surges in demand while maintaining acceptable due-date performance.

5 Manufacturing Example: An Assembly-line Simulation

This section describes a model of a production line for the final assembly of “gizmos”. It then focuses on how simulation can be used to analyze system performance.

5.1 System Description and Model Assumptions

At a manufacturing facility, an engineering team has designed a new production line for the fina assembly of gizmos. Before making the investment to install the new system, some team members propose using simulation to analyze the system’s performance, specifically to predict system throughput (gizmos per 8-hour shift, on the average). In addition, the engineers desire to evaluate potentia improvements to the designed system. One such potential improvement is adding buffer space for holding work-in-process (WIP) between adjacent workstations.

The team decides to develop a simulation model and conduct an analysis. Their primary objective is to predict throughput (completed gizmos per shift, on the average) for the given system design and to evaluate whether it meets the desired throughput. In addition, should throughput be less than expected, the team wants to use the model to help in identifying bottlenecks, gaining insight into the system’s dynamic behavior, and evaluating potential design improvements.

The proposed production line has six workstations and a special rack for WIP storage between adjacent stations. There are four manual stations, each having its own operator, and two automated stations, which share a single operator. The six stations perform production tasks in the following sequence:

Station 1: initial manual station begins final assembly of a new gizmo

Station 2: manual assembly station

Station 3: manual assembly station

Station 4: automated assembly station

Station 5: automated testing station

Station 6: manual packing station

At each manual station, an operator loads a gizmo onto a workbench, performs some tasks, and on completion unloads the gizmo and places it into the WIP storage for the next workstation. The operator takes 10 seconds and 5 seconds, respectively, for the loading and unloading tasks.

The WIP storage racks between each pair of adjacent stations have limited capacity. If a station completes its tasks on a gizmo but the downstream rack is full, the gizmo must remain in the station, blocking any further work. In the initial design, the WIP storage racks have the capacities shown in Table 2. (By assumption, the WIP storage preceding Station 1 is always kept full at 4 units; since it is assumed to always be full, its specific capacity plays no role.) The system design with capacities given in Table 2 is called the Baseline configuration.

From time to time, a tool will fail, causing unscheduled downtime or unexpected extra work at a manual or automated station. In addition, all operators are scheduled to take a 30-minute lunch break at the same time. Work is interrupted and resumes where it left off after lunch. This interrupt/resume rule applies to operator tasks including assembly work, parts resupply, and repairs during a downtime.

At the automatic stations, a machine performs an assembly or testing task. The automatic stations might have unscheduled (random) downtimes, but they continue to operate during the operator’s lunch break. One operator services both machines to load and unload gizmos (10 seconds and 5 seconds, respectively). After being loaded, a machine processes the gizmo without further operator intervention unless a downtime occurs. At all stations, the operator performs repairs as needed whenever the station experiences a downtime.

Table 2 Capacity of WIP Storage Buffers for Baseline Configuration

Rack Before Station123456
Buffer Capacity422212

Table 3 Assembly and Parts Resupply Times

StationAssembly per Gizmo (seconds)Part NumberParts Resupply Time (seconds per batch)No. of Parts per batch
140A1015
B1510
238C208
D1514
338E3025
435
535
640FaF^a3032

a At Station 6, the part number (F) represents the shipping containers.

Table 3 gives the total assembly time and parts resupply times for each station, plus the number of parts in a batch. The assembly time for the manual stations is assumed to vary by plus/minus 2 seconds (uniformly distributed) from the times given in Table 3. Parts resupply time does not occur for each gizmo, but rather after a batch of parts has been assembled onto the gizmo. The machines at stations 4 and 5 do not consume parts.

Each station is subject to unscheduled (random) downtime. Manual Stations 1, 2, and 3 have tool failures or other unexpected problems. The automatic stations occasionally jam or have some other problem that requires the assigned operator to fix it. Station 6 (packing) is not subject to these downtimes. Table 4 shows time-to-failure (TTF) and time-to-repair (TTR) distributional assumptions and the assumed mean-time-to-failure (MTTF), mean-time-to-repair (MTTR) and spread ( / ) o repair times. For example, at Station 1, repair time is uniformly distributed with mean 4.0 minutes plus or minus 1.0 minutes; that is, uniformly distributed between 3.0 and 5.0 minutes. Failure can only occur when an operator or machine is working; hence, TTF is modeled by measuring only busy or processing time until a failure occurs.

The primary model output or response is average throughput during the assumed 7.5 working hours per 8-hour shift. The model also measures detailed station utilization, including busy or processing time, idle or starved time (no parts ready for processing), blocked time (part cannot leave station, because downstream WIP buffer is full), unscheduled downtime, and time waiting for an operator.

Table 4 Assumptions and Data for Unscheduled Downtimes

StationTTFMTTF(Minutes)TTRMTTR(Minutes)+/-ExpectedAvailability
1Exponential36.0Uniform4.01.090%
2Exponential4.5Uniform0.50.190%
3Exponential27.0Uniform3.01.090%
4Exponential9.0Uniform1.00.590%
5Exponential18.0Uniform2.01.090%

Station starvation occurs when the operator and station are ready to work on the next gizmo, the just-completed gizmo leaves the station, but upstream conditions cause no gizmo to be ready for this production step. In short, the upstream WIP buffer is empty.

Station blockage occurs when a station completes all tasks on a gizmo, but cannot release the part because the downstream WIP buffer is full. For both starvation and blockage, production time is lost at the given station and cannot be made up.

When an operator services more than one station, as does the operator servicing Stations 4 and 5, it is possible for both stations to need the operator at the same time. This could cause additional delay a the station and is measured by a “wait-for-operator” state. Blockage, starvation, and wait-for-operator at each station will be measured in order to help explain any throughput shortfall, should it occur, and to assist in identifying potential system improvements.

5.2 Presimulation Analysis

A presimulation analysis, taking into account the average station cycle time as well as expected station availability (90%), indicates that each station, if unhindered, can achieve the desired throughput. This initial analysis is carried out as described in this section.

From the assumed downtime data, the team was able to estimate expected station availability, under the (ideal) assumption of no interaction between stations. The expected availability shows each station’s individual availability during working (nonlunch, nonbreak) hours, assuming that the operator can always place a completed gizmo into the downstream rack storage and the next gizmo is ready to begin work at the station. Expected availability is computed by MTTF/(MTTF MTTR), or expected busy time during a downtime cycle divided by the length of a downtime cycle (a busy cycle plus a repair cycle), and is given in Table 4. This calculation ignores certain aspects of the problem, including the parts resupply times and any delay caused by having only one operator to service both Stations 4 and 5.

The design goal for the modeled system is 390 finished gizmos per 8-hour shift.After taking lunch into account, each shift has up to 7.5 hours of available work time. With unscheduled (random) downtime expected to be 10% of available time, this further reduces working time to 0.90×7.50 . 90 \times 7 . 5 hours 6.75 hours. This implies that the station with the slowest total cycle time must be able to produce 390 gizmos in the available 6.75 hours. Therefore, the total cycle time per gizmo at each station must not exceed 6.75 hours/390 62.3 seconds.

Now, total cycle time consists of assembly, testing or packing time, and parts resupply time (as given in Table 3), plus gizmo loading time of 10 seconds and unload time of 5 seconds. Parts resupply is not taken on every gizmo, but rather after a given number of gizmos corresponding to using al parts in a given batch of parts. For example, using the values in Table 3 for Station 1, parts resupply will take 10 seconds every 15 gizmos for Part A, plus 15 seconds every 10 gizmos for Part B, for a total time, on the average, of 10/15+15/1010 / 15 + 15 / 10 seconds per gizmo.

Using this information, the (minimum) total cycle time for each station is estimated in Table 5. These presimulation estimates indicate, first, that each theoretical cycle time is well below the requirement of 62.3 seconds. Secondly, they indicate that Stations 1 and 2 are potential bottlenecks, if there are any.

Table 5 Estimated Total Cycle Time at Each Station

StationFormula to Estimate Cycle Time (seconds)Estimate (seconds)
110+40+5+10/15+15/1010 + 40 + 5 + 10/15 + 15/1057.2
210+38+5+20/8+15/1410 + 38 + 5 + 20/8 + 15/1456.6
310+38+5+30/2510 + 38 + 5 + 30/2554.2
410+35+510 + 35 + 550.0
510+35+510 + 35 + 550.0
610+40+5+30/3210 + 40 + 5 + 30/3255.9

As the simulation analysis will later show, Station 1 experiences blockage due to Station 2 downtime, and Station 2 occasionally experiences starvation due to downtime at Station 1 and blockage due to downtime at Station 3. These blockage and starvation conditions reduce the available work time below the calculated 90%; hence, for the Baseline Configuration, they reduce the design throughput well below the desired value: 390 gizmos per shift. In summary, a presimulation analysis, although valuable, at best can provide a rough estimate of system performance. As the simulation wil show, ignoring blockage and starvation gives an overly optimistic estimate of system throughput.

5.3 Simulation Model and Analysis of the Designed System

Using the simulation model, the first experiment was conducted to estimate system performance of the system as designed. The simulation analyst on the team made 10 replications of the model, each having a 2-hour warm-up or initialization followed by a 5-day simulation (each day being 24 hours). A 95% confidence interval (CI) was computed for mean throughput per shift:

95% CI for mean throughput: (364.5, 366.8), or 365.71.14.

With 95% confidence, the model predicts that mean (or long-run average) throughput will be between 364.5 and 366.8 gizmos per 8-hour shift with the system as designed. This is well below the design throughput of 390 gizmos per shift.

The team decided to conduct further analyses to identify possible bottlenecks and potential areas of improvement.

5.4 Analysis of Station Utilization

At this point, the team desired to have some explanation of the shortfall in throughput. They suspected that perhaps it had to do with the small WIP buffer capacity and the resulting blockage and starvation. The same model was used to estimate detailed workstation utilization in hopes that it would provide an explanation of throughput shortfall. Table 6 contains 95% confidence-interval estimates for the first five workstations for percent of time down, blocked, starved, and waiting for an operator. (Waiting for operator affects only Stations 4 and 5, as these two stations share one operator. The other stations have a dedicated operator. In addition to the utilization statistics in Table 6, the operators have a 30-minute lunch per 8-hour shift, representing 6.25% of available time.)

Table 6 Confidence Intervals for Station Utilizations for the Baseline Configuration

Station% Down% Blocked% Starved% Wait for Operator
1(8.8,9.6)(11.4,12.5)(0.0,0.0)(0.0,0.0)
2(8.2,8.4)(8.0,8.8)(4.9,5.6)(0.0,0.0)
3(7.9,8.6)(9.9,10.4)(6.1,6.9)(0.0,0.0)
4(8.9,9.6)(2.0,2.8)(7.5,8.2)(13.1,14.4)
5(8.3,9.0)(0.0,0.2)(19.4,20.4)(3.9,4.7)

From the results in Table 6, it appears that blockage and starvation explain some portion of the shortfall in throughput. In addition, another possible explanation surfaces: Station 4 experiences a significant time waiting for the single operator that services Stations 4 and 5. This delay at Station 4 could result in a full WIP buffer, which in turn would help explain the blockage at Station 3 preceding it. Percent of time blocked is higher than percent starved for Stations 1 to 3, so it appears that downstream delays could be a significant bottleneck.

The team proposed some possible system improvements:

  1. having two operators to service Stations 4 and 5 (instead of the currently proposed one operator);

  2. increasing the capacity of some of the WIP buffers;

  3. a combination of both.

The expense of additional WIP storage space prompted the team to want to keep total buffer space as small as possible, and to require an additional operator only if absolutely necessary, while achieving the design goal of 390 gizmos per shift.

5.5 Analysis of Potential System Improvements

To evaluate the addition of an operator and larger WIP buffers, the model was revised appropriately to allow these changes, and a new analysis was conducted. In this analysis, the capacity of each WIP buffer for Stations 2–6 was allowed to increase by one unit above the Baseline value given in Table 2. In addition, the effect of a second operator at Stations 4 and 5 is considered. These possibilities result in a total of 64 scenarios or model configurations. (Why?) Making 10 replications per scenario results in a total of 640 simulation runs.

To facilitate the analysis, the team decided to use a Common Random Number technique. To implement it with proper synchronization, each source of random variability was identified and assigned a dedicated random-number stream. In this model, processing time, TTF, and TTR are modeled by statistical distributions at each of the six workstations. Therefore, a total of 18 randomnumber streams were defined, with 3 used at each workstation. In this way, in each set of runs, each workstation experienced the same workload and random downtimes no matter which configuration was being simulated. For a given number of replications the CRN technique, also known as correlated sampling, is expected to give shorter confidence intervals for differences in system performance.

Table 7 Improvement in System Throughput for Alternative Configurations

Number of Operators at Stations 4 & 5Buffer CapacitiesIncrease in Mean Throughput per Shift (compared to baseline) Ave.
Buffer 2Buffer 3Buffer 4Buffer 5Buffer 6TotalDiff.CI LowCI High
2333221331.730.333.1
2333231431.730.433.0
2332231330.028.631.3
2333131329.828.631.0
2332221229.728.131.3
2333121229.528.131.0
2332131226.625.427.9
2233221226.625.128.1
2233231326.625.028.1
2323231326.525.028.0
2323221226.425.327.5
2332121126.325.127.5

The model configurations with the most improvement in system throughput, compared with the Baseline Configuration, are shown in Table 7. These configurations were chosen for further evaluation because each shows a potential improvement in throughput of approximately 25 units or more; tha is, the lower end of the 95% confidence interval is 25 or higher. The values shown for “Ave Diff.” represent the increase in throughput compared to the Baseline Configuration. Recall that the Baseline throughput was previously estimated, with 95% confidence, to be in the interval (364.5, 366.8). Being conservative, the engineering team would like to see an improvement of 390 364.5 25.5 gizmos per shift. The top six configurations in Table 7 have a lower confidence interval larger than 25.5 and hence are likely candidates for achieving the desired throughput. Interpreted statistically: The lower end of the confidence interval is larger than 25.5, so the results yield a 95% confidence that mean throughput will increase by 25.5 or more in the top six configurations listed in Table 7.

Note that all the most improved configurations include two operators at Stations 4 and 5. The simulation results for configurations with one operator (not shown here) indicate that a 390 throughpu cannot be achieved with one operator, at least not with the buffer sizes considered.

Some configurations can be ruled out because a less expensive option achieves a similar throughput. Consider, for example, the first two configurations in Table 7. They are identical except for Buffer 6 capacity. Since WIP buffer capacity is expensive, the smaller total buffer capacity will be the less expensive option. Clearly, there is no need to expand from 2 to 3 units at Buffer 6. The “Total” column can assist in quickly ruling out configurations that do no better than a similar one with smaller tota buffer capacity.

The model configuration that increases throughput by 25.5 or better and has the smallest tota buffer capacity is the fifth one in Table 7, with capacities of (3,3,2,2,2) for Buffers 2 to 6, respectively. On these considerations, this system design becomes the team’s top candidate for further evaluation. The next step (not included here) would be to conduct a financial analysis of each alternative configuration.

5.6 Concluding Words: The Gizmo Assembly-Line Simulation

Real-life examples similar to this example model include assembly lines for automotive parts and automobile bodies, automotive pollution-control assemblies, consumer items such as washing machines, ranges, and dishwashers, and any number of other assembly operations with a straigh flow and limited buffer space between workstations. Similar models and analyses may also apply to a job shop with multiple products, variable routing, and limited work-in-process storage.

6 Summary

This chapter introduced some of the ideas and concepts most relevant to manufacturing and material handling simulation. Some of the key points are the importance of modeling downtimes accurately, the advantages of trace-driven simulations with respect to some of the inputs, and the need in some models for accurate modeling of material-handling equipment and the control software.

REFERENCES

BANKS, J. [1994], “Software for Simulation,” in Proceedings ofthe 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds., Lake Buena Vista, Fl, Dec. 11–14, pp. 26–33.

CLARK, G. M. [1994], “Introduction to Manufacturing Applications,” in Proceedings of the 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds., Lake Buena Vista, Fl, Dec. 11–14, pp. 15–21.

EHRHARDT, I., H. HERPER, AND H. GEBHARDT [1994], “Modelling Strain of Manual Work in Manufacturing Systems,” in Proceedings ofthe 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds., Lake Buena Vista, Fl, Dec. 11–14, pp. 1044–1049.

LAW, A. M. AND W. D. KELTON [2000], Simulation Modeling andAnalysis, 3d ed., McGraw–Hill, NewYork.

MATHUR, M. [1994], “Inventory Cost Model for ‘Just-in-time” Production,” in Proceedings ofthe 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds., Lake Buena Vista, Fl, Dec. 11–14, pp. 1020–1026.

NANDI, A., AND P. ROGERS [2003], “Behavior of an Order Release Mechanism in a Make-to-Order Manufac turing System with Selected Order Acceptance,” in Proceedings ofthe 2003 Winter Simulation Conference, S. E. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, eds., New Orleans, La, Dec. 7–10, pp. 1251–1259.

PIERCE, N. G., AND R. STAFFORD [1994], “Modeling and Simulation of Material Handling for Semi conductor Wafer Fabrication,” in Proceedings of the 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds., Lake Buena Vista, Fl, Dec. 11–14, pp. 900–906.

SARAPH, P. V. [2003], “Shared Resource Capacity Analysis in Biotech Manufacturing,” in Proceedings of the 2003 Winter Simulation Conference, S. E. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, eds, New Orleans, La, Dec. 7–10, pp. 1247–1250.

SCOTT, H. A. [1994], “Modeling Aircraft Assembly Operations,” in Proceedings ofthe 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D.A. Sadowski, andA. F. Seila, eds., Lake BuenaVista, Fl, Dec. 11–14, pp. 920–927.

SMITH, J. S., et al. [1994], “Discrete Event Simulation for Shop Floor Control,” in Proceedings of the 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds, Lake Buena Vista, Fl, Dec. 11–14, pp. 962–969.

TURKSEVEN, C. H., AND G. ERTEK [2003], “Simulation Modeling for Quality and Productivity in Steel Cord Manufacturing,” in Proceedings ofthe 2003 Winter Simulation Conference, S. E. Chick, P. J. S´anchez, D. Ferrin, and D. J. Morrice, eds., New Orleans, La, Dec. 7–10, pp. 1225–1229.

WATSON, E. F., AND R. P. SADOWSKI [1994], “Developing and Analyzing Flexible Cell Systems Using Simulation,” in Proceedings of the 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds., Lake Buena Vista, Fl, Dec. 11–14, pp. 978–985.

WILLIAMS, E. J. [1994], “Downtime Data— Its Collection, Analysis, and Importance,” in Proceedings ofthe 1994 Winter Simulation Conference, J. D. Tew, S. Manivannan, D. A. Sadowski, and A. F. Seila, eds., Lake Buena Vista, Fl, Dec. 11–14, pp. 1040–1043.

EXERCISES

Instructions to the student: Many ofthe following exercises contain material-handling equipment such as conveyors and vehicles. The student is expected to use any simulation language or simulator that supports modeling conveyors and vehicles at a high level.

Some of the following exercises use the uniform, exponential, normal, or triangular distributions. Virtually all simulation languages and simulators support these, plus other distributions.

  1. A case sortation system consists of one infeed conveyor and 12 sortation lanes, as shown in the following schematic (not to scale):

Cases enter the system from the left at a rate of 50 per minute at random times. All cases are 18 by 12 inches and travel along the 18-inch dimension. The incoming mainline conveyor is 20 inches

wide and 60 feet in length (as shown). The sortation lanes are numbered 1 to 12 from left to right, and are 18 inches wide and 15 feet in length, with 2 feet of spacing between adjacent lanes. (Estimate any other dimensions that are needed.) The infeed conveyor runs at 180 feet/minute, the sortation lanes at 90 feet/minute. All conveyor sections are accumulating, but, upon entrance at the left, incoming cases are at least 2 feet apart from leading edge to leading edge. On the sortation lanes, the cases accumulate with no gap between them.

Incoming cases are distributed to the 12 lanes in the following proportions:

16%711%
26%86%
35%95%
424%105%
515%113%
614%120%

The 12th lane is an overflow lane; it is used only if one of the other lanes fill and a divert is not possible.

At the end of the sortation lanes, there is a group of operators who scan each case with a barcode scanner, apply a label, and then place it on a pallet. Operators move from lane to lane as necessary to avoid allowing a lane to fill. There is one pallet per lane, each holding 40 cases. When a pallet is full, assume a new empty one is immediately available. If a lane fills to 10 cases and another case arrives at the divert point, this last case continues to move down the 60-foo mainline conveyor and is diverted into lane 12, the overflow lane.

Assume that one operator can handle 8.5 cases per minute, on the average. Ignore walking time and assignment of an operator to a particular lane; in other words, assume the operators work as a group uniformly spread over all 12 lanes.

(a) Set up an experiment that varies the number of operators and addresses the question: How many operators are needed? The objective is to have the minimum number of operators bu also to avoid overflow.

(b) For each experiment in part (a), report the following output statistics:

operator utilization;

total number of cases palletized;

number of cases palletized by lane;

number of cases to the overflow lane.

(c) For each experiment in part (a), verify that all cases are being palletized. In other words, verify that the system can handle 50 cases per minute, or explain why it cannot.

  1. Redo Exercise 1 to a greater level of detail by modeling operator walking time and operator assignment to lanes. Assume that operators walk at 200 feet per minute and that the walking distance from one lane to the next is 5 feet. Handling time per case is now assumed to be 7.5 cases per minute. Devise a set of rules that can be used by operators for lane changing. (Hint: For example, change lanes to that lane with the greatest number of cases only when the current lane is empty or the other lane reaches a certain level.) Assume that each operator is assigned to a certain number of adjacent lanes and handles only those lanes. However, if necessary, two operators (but no more) may be assigned to one lane; that is, operator assignments may overlap.

(a) If your lane-changing rule has any numeric parameters, experiment to find the best settings. Under these circumstances, how many operators are needed? What is the average operator utilization?

(b) Does a model that has more detail, as does Exercise 2(a) when compared to Exercise 1, always have greater accuracy? How about this particular model? Compare the results of Exercise 2(a) to the results for Exercise 1. Are the same or different conclusions drawn?

(c) Devise a second lane-changing rule. Compare results between the two rules. Compare tota walking time or percent of time spent walking between the two rules.

Suggestion: A lane-changing rule could have one or two “triggers.” A one-trigger rule might state that, if a lane reached a certain level, the operator moved to that lane. (Hint: Withou modification, such a rule could lead to excessive operator movement, if two lanes had about the same number of cases near the trigger level.) A two-trigger rule might state that, if a lane reached a certain level and the operator’s current lane became empty, then change to the new lane; but if a lane reaches a specified higher critical level, then the operator immediately changes lanes.

(d) Compare your results with those of other students who may have used a different lanechanging rule.

  1. Redo Exercise 2 with a different operator-assignment rule. Basically, operators can be assigned to any lane as conditions warrant, but, as before, no more than two operators can be assigned to a lane at the same time. Address the same questions (a)–(d) as in Exercise 2.

  2. A package-sortation system consists of one in-feed conveyor, 12 sortation lanes (or chutes), and a take-away conveyor, as shown in the following schematic (not to scale):

Packages enter the system from the left (at point E) at a rate of 100 per minute at random times. A package is diverted to a sortation lane on the basis of its shipping destination; in the model, a given percentage of the packages chosen randomly, according to the proportions in the nex table, are assigned to each lane. The percentages for each lane/destination is as follows:

16%710%
26%86%
35%94%
424%104%
515%113%
614%123%

After a slug of 8 packages has accumulated, they are all released together onto a 50-foot section of takeaway conveyor and head toward the point labeled T; they transfer there (at conveyor speed) onto a second section of takeaway conveyor at the end of which is a bar-code scanner (at the point labeled B). A slug cannot be released until the previous slug has cleared the point T. In this model, packages disappear at point B.

All packages are 18 by 12 inches and travel along their 18-inch dimension. The incoming mainline conveyor is 20 inches wide and 60 feet in length (as shown). The 12 sortation lanes are 18 inches wide and 15 feet in length with 2 feet of spacing between adjacent lanes. (Estimate any other dimensions that are needed.) The infeed conveyor runs at 240 feet/minute, the sortation lanes at 90 feet/minute. The infeed and sortation conveyor sections are accumulating, but, upon entrance at the left, incoming packages are at least 2 feet apart from leading edge to leading edge. On the sortation lanes, the packages accumulate with no gap between them. The 50-foo section of takeaway conveyor is a nonaccumulating belt-type conveyor; the 30-foot section is accumulating.

When a lane contains 8 packages, no more diverts are allowed until the lane is released and the slug completely clears the bottom of the chute. When a lane is full or before the slug has cleared, if another package arrives to divert, the affected package does not divert, but rather moves to the end of the infeed conveyor and then recirculates to the start of the infeed conveyor on a conveyor that is not shown in the schematic. Simulate recirculation as a time delay of 45 seconds withou explicitly modeling the recirculation conveyor itself.

(a) Set up an experiment to discover the minimum speed required of the takeaway conveyor to minimize or eliminate recirculation. Conveyors available from vendors have speeds starting at 60 feet/minute and increasing in increments of 30 feet/minute. (Faster conveyor is more expensive, so minimizing the speed will reduce costs, provided that recirculation is not a problem.)

(b) Could destination assignment to available lane be modified in such a way as to improve system performance? Devise a better assignment rule and test it, using the simulation model.

  1. A fleet of AGVs (Automated Guided Vehicles) services 5 workstations in series by transporting parts on fixtures from one workstation to the next, remaining with a part from the pickup point through all workstations to the offload point. The incoming staging conveyor, theAGV guidepath, the five workstations (A–E), and the offload conveyor are shown in the following schematic (not to scale):

AGVs travel in a clockwise direction. Initially, all are empty and queued at the incoming conveyor at the “On” point. The workstations are labeled A–E. Parts on fixtures are staged on the incoming conveyor and picked up by an AGV at the point labeled “On”. The AGV then travels to machine A and stops at the point marked on the guidepath. The part and fixture remain on the AGV during processing, then travel together to the next workstation. After processing is completed at workstation E, the AGV travels to the point labeled “Off” the part with fixture is automatically unloaded onto the offload conveyor, and the empty AGV queues at the point labeled “On” for the next part.

Assume that the incoming conveyor remains full. It is 15 feet long and can hold 3 parts with fixtures, each taking 5 feet of conveyor space. Therefore, when one part with fixture is picked up by an AGV, another part and fixture are placed on the end of the conveyor. Pickup time is 30 seconds. The incoming conveyor runs at 30 feet per minute.

When a part has completed processing at all workstations and has been transported to the offload point labeled “Off” the offload operation takes 45 seconds. The offload conveyor itself runs at 30 feet per minute. The parts and fixtures, although taking up a space of 3 feet by 3 feet, require 5 feet on the conveyor.

Initial workstation placements are shown in approximate fashion, with no exact locations given. Constraints are that each workstation must be placed along the straight section of guidepath on which they are shown on the schematic, with the AGV stopping point no closer than 5 feet from the entrance to or exit from a curve. The incoming and offload conveyor must be placed as shown, with the offload point 20 feet from the end of the preceding curve and the pickup poin 40 additional feet to the right. Otherwise, AGV stopping points at workstations can be placed at any desired location on the straight section of guidepath.

AGVs travel at 15 feet per second and accelerate and decelerate at 3 ft/sec/sec. They are 7 feet in length and queue 8 feet apart (1 foot gap between two AGVs) when waiting for the processing position at a workstation and when in the pickup/offload position at a conveyor.

At each of the workstations, processing-time-per-part, mean-time-to-failure (MTTF), and meantime-to-repair (MTTR) are as follows:

WorkstationProcessing Time (sec.)MTTF (min.)MTTR (min.)
A120903.1
B100824.0
C1401104.5
D45205.0
E1002409.0

Detailed data is not available, so certain assumptions regarding time to failure and time to repair are made: Assume that actual time to failure is exponentially distributed, with the specified mean (MTTF). Assume that repair time requires a maintenance person and that there is only one available. Actual repair times are uniformly distributed, with the mean as shown and a halfwidth of one-half the mean. Time to failure is measured against wall-clock time, not agains station-busy time. After a repair, any remaining processing time is taken, and the part continues.

There are three basic questions:

(1) What is maximum system throughput?

(2) How many AGVs are needed?

(3) What is the best workstation placement (within the stated constraints)?

For each set of experiments in parts (a) and (b), consider the following issues:

(1) Should there be a warmup period for loading the system during which no statistics are collected?

(2) How long should the simulation run?

(One suggestion: The warmup period should last at least until several parts have completed processing. The run length should allow for at least 10 downtimes on each machine. Simulate with as many AGVs as will reasonably fit on the guidepath and then try to reduce the number without reducing throughput.)

Your experiments should vary the number of AGVs and the workstation placement. Before simulating, make your best estimate regarding workstation placement, and justify that choice. Also, make a reasonable estimate regarding the likely range for number of AGVs.

(a) In the first set of experiments, use a rough-cut model that does not model theAGVs explicitly. Compute the approximate travel time between adjacent workstations and use this value as a time delay in the model. Assume there are sufficient AGVs. (Hint: Use this model to address the question of maximum throughput, but not the number of AGVs needed.) What are the advantages and limitations of this approach?

(b) In the second set of experiments, model the AGVs and guidepath explicitly. Design an experiment to find out the maximum system throughput (in parts per hour) with the smallest number of AGVs.

  1. More accurate information has been obtained on failure times for the workstations in Exercise 5. Redo Exercise 5 with the new information. Failures appear to be related more closely to the number of parts processed than to the amount of time passed. The new data is as follows:
WorkstationMTTF (parts)MTTR (min.)
A453.1
B494.0
C474.5
D275.0
E1449.0

Note that MTTF (mean-time-to-failure) is measured in terms of number of parts, but assumptions about time to repair are unchanged from Exercise 5. For example, for Workstation A, if time to failure happened to be 45 parts, then after a failure, the 45th part would experience the next failure. In reality, failure occurs during processing, but for modeling purposes, assume the failure occurs just as processing begins. (Does this make any difference?)

For the distribution of time to failure, assume a discrete uniform distribution with mean (MTTF) over the range from 1 to 2*MTTF 1. For example, for Workstation A, the actual times to failure are equally likely to be any value from 1 to 89 parts.

Address the same questions as in Exercise 5. Do these new assumptions make any difference? How many failures are there per 8-hour shift for the first set of assumptions as compared with those for the revised assumptions?

  1. For the problem in Exercises 5 and 6, a study was done to evaluate the repair times more accurately for each workstation. It was found that a triangular distribution provided a closer fi

to the actual repair times. Assume the following parameters for the triangular distribution:

WorkstationRepair Time (Triangular Distribution)
Minimum(min.)Most Likely(min.)Maximum(min.)Average(min.)
A1.02.36.03.1
B2.03.07.04.0
C2.53.57.54.5
D2.04.09.05.0
E4.07.016.09.0

Note that the average repair times are identical to the assumed averages (MTTR) in Exercises 5 and 6, but the distribution is triangular instead of uniform. (Most simulation languages or simulators have a built-in triangular distribution that requires specification ofthe minimum value, most likely value or mode, and maximum value. The average value is given for informational purposes only; it is the sum of the other three parameters divided by 3.)

(a) Redo Exercise 5, but with the new assumptions for repair times.

(b) Redo Exercise 6, but with the new assumptions for repair times.

  1. One approach to modeling downtimes discussed in this chapter, but not recommended, was to replace the processing time with a larger adjusted processing time and to leave out the downtimes. The adjusted processing time is meant to account for downtimes, at least in the long run and on the average. How would this method have affected the results for Exercise 5?

(a) For Exercise 5, compute the adjusted processing times for each workstation.

(b) For Exercise 5, use the adjusted processing times and leave out all explicit downtimes due to failure. How does this change the results? Is this a good approach for this model?

  1. Suppose that improved maintenance and better machines could totally eliminate downtime due to failure for the system in Exercise 5. By how much would throughput improve?

  2. Develop a model for Example 1 and attempt to reproduce qualitatively the results found in the text regarding different assumptions for simulating downtimes. Do not attempt to get exactly the same numerical results, but rather to show the same qualitative results.

(a) Do your models support the conclusions discussed in the text? Provide a discussion and conclusions.

(b) Make a plot of the number of entities in the queue versus time. Can you tell when failures occurred? After a repair, about how long does it take for the queue to get back to normal?

  1. In Example 1, the failures occurred at low frequency compared with the processing time of an entity. Time to failure was 1000 minutes, and interarrival time was 10 minutes, implying that few entities would experience a failure. But, when an entity did experience a failure (of 50 minutes, on average), it was several times longer than the processing time of 7.5 minutes.

Redo the model for Example 1, assuming high-frequency failures. Specifically, assume that the time to failure is exponentially distributed, with mean 2 minutes, and the time to repair is exponentially distributed, with mean 0.1 minute or 6 seconds. As compared with the lowfrequency case, entities will tend to experience a number of short downtimes.

For low-frequency versus high-frequency downtimes, compare the average number of downtimes experienced per entity, the average duration of downtime experienced, the average time to complete service (including downtime, if any), and the percent of time down.

Note that the percentage of time the machine is down for repair should be the same in both cases:

50/(1000+50)=4.76%6sec⁡/(2min⁡+6sec⁡)=4.76% \begin{array}{r} {50 / (1000 + 50) = 4. 76 \%} \\ {6 \sec / (2 \min + 6 \sec) = 4. 76 \%} \end{array}

Verify percentage downtime from the simulation results. Are the results identical? . . . close? Should they be identical, or just close? As the simulation run length increases, what should happen to the percentage of time down?

With high-frequency failures, do you come to the same conclusions as were drawn in the text regarding the different ways to simulate downtimes? Make recommendations regarding how to model low-frequency versus high-frequency failures.

  1. Redo Exercise 11 (based on Example 1), but with one change: When an entity experiences a downtime, it must be reprocessed from the beginning. If service time is random, take a new draw from the assumed distribution. If service time is constant, it starts over again. How does this assumption affect the results?

  2. Redo Exercise 11 (based on Example 1), but with one change: When an entity experiences a downtime, it is scrapped. How does scrapping entities on failure affect the results in both the low-frequency and in the high-frequency situations? What are your recommendations regarding the handling of low- versus high-frequency downtimes when parts are scrapped?

  3. Sheets of metal pass sequentially through 4 presses: shear, punch, form, and bend. Each machine is subject to downtime and die change. The parameters for each machine are as follows:

PressProcess Rate (per min.)Time to Failure (min.)Time to Repair (min.)No. of Sheets to a Die Change (no. sheets)Time to Change Die (min.)
Shear4.5100850025
Punch5.5901040025
Form3.8180975025
Bend3.22402060025

Note that processing time is given as a rate; for example, the shear press works at a rate of 4.5 sheets per minute. Assume that processing time is constant. The automated equipment makes the time to change a die fairly constant, so it is assumed to be always 25 minutes. Die changes occur between stamping of two sheets after the number shown in the table have gone through a machine. Time to failure is assumed to be exponentially distributed, with the mean given in the table. Time to repair is assumed to be uniformly distributed, with the mean taken from the table and a half-width of 5 minutes. When a failure occurs, 20% of the sheets are scrapped. The remaining 80% are reprocessed at the failed machine after the repair.

Assume that an unlimited supply of material is available in front of the shear press, which processes one sheet after the next as long as there is space available between itself and the next machine, the punch press. In general, one machine processes one sheet after another continuously, stopping only for a downtime, for a die change, or because the available buffer space between itself and the next machine becomes full. Assume that sheets are taken away after bending at the bend press. Buffer space is divided into 3 separate areas, one between the shear and the punch presses, the second between the punch and form presses, and the last between form and bend.

(a) Assume that there is an unlimited amount of space between machines. Run the simulation for 480 hours (about 1 month with 24-hour days, 5 days per week). Where do backups occur? If the total buffer space for all three buffers is limited to 15 sheets (not counting before shear or after bend), how would you recommend dividing this space among the three adjacent pairs of machines? Does this simulation provide enough information to make a reasonable decision?

(b) Modify the model so that there is a finite buffer between adjacent machines. When the buffer becomes full and the machine feeding the buffer completes a sheet, the sheet is not able to exit the machine. It remains in the machine, blocking additional work. Assume that tota buffer space is 15 sheets for the 3 buffers.

Use the recommendation from part (a) as a starting point for each buffer size.Attempt to minimize the number of runs. You are allowed to experiment with a maximum of 3 buffer sizes for each buffer. (How many runs does this make?) Run a set of experiments to determine the allocation of buffer space that maximizes production. Simulate each alternative for at least 1000 hours.

Report total production per hour on the average, press utilization (broken down by percentage of time busy, down, changing dies, and idle), and average number of sheets in each buffer.