Contents
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:
- Simulation enables the study of, and experimentation with, the internal interactions of a complex system or of a subsystem within a complex system.
- Informational, organizational, and environmental changes can be simulated, and the effect of these alterations on the model’s behavior can be observed.
- The knowledge gained during the designing of a simulation model could be of great value toward suggesting improvement in the system under investigation.
- Changing simulation inputs and observing the resulting outputs can produce valuable insights about which variables are the most important and how variables interact.
- Simulation can be used as a pedagogical device to reinforce analytic solution methodologies.
- Simulation can be used to experiment with new designs or policies before implementation, so as to prepare for what might happen.
- Simulation can be used to verify analytic solutions.
- Simulating different capabilities for a machine can help determine its requirements.
- Simulation models designed for training make learning possible, without the cost and disruption of on-the-job instruction.
- Animation can show a system in simulated operation so that the plan can be visualized.
- 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:
- New policies, operating procedures, decision rules, information flows, organizational procedures, and so on can be explored without disrupting ongoing operations of the real system.
- New hardware designs, physical layouts, transportation systems, and so on can be tested without committing resources for their acquisition.
- Hypotheses about how or why certain phenomena occur can be tested for feasibility.
- Time can be compressed or expanded to allow for a speed-up or slow-down of the phenomena under investigation.
- Insight can be obtained about the interaction of variables.
- Insight can be obtained about the importance of variables to the performance of the system.
- Bottleneck analysis can be performed to discover where work in process, information, materials, and so on are being delayed excessively.
- A simulation study can help in understanding how the system operates rather than how individuals think the system operates.
- “What if” questions can be answered. This is particularly useful in the design of new systems.
Some disadvantages are these:
- 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.
- 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.
- 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.
- 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:
- 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.”
- Many simulation software vendors have developed output-analysis capabilities within their packages for performing very thorough analyses.
- 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.
- 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: 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
| System | Entities | Attributes | Activities | Events | State Variables |
|---|---|---|---|---|---|
| Banking | Customers | Checking-account balance | Making deposits | Arrival; departure | Number of busy tellers; number of customers waiting |
| Rapid rail | Riders | Origin; destination | Traveling | Arrival at station; arrival at destination | Number of riders waiting at each station; number of riders in transit |
| Production | Machines | Speed; capacity; breakdown rate | Welding; stamping | Breakdown | Status of machines (busy, idle, or down) |
| Communications | Messages | Length; destination | Transmitting | Arrival at destination | Number waiting to be transmitted |
| Inventory | Warehouse | Capacity | Withdrawing | Demand | Levels of inventory; backlogged demands |

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.
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.
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.
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
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
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.
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.
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?
What are the events and activities associated with the use of your checkbook?
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)
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.
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.
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.
Locate one of the cases in Section 12 and describe the methodology used.
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?
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?
What is the procedure for contributing a paper to the WSC?
Classify the list of vendors at a recent WSC as software vendors and others.
What is the purpose and history of the WSC Foundation?
Using your favorite search engine, search the web for ‘discrete event simulation output analysis’ and prepare a report discussing what you find.
Using your favorite search engine, search the web for ‘supply chain simulation’ and prepare a report discussing what you find.
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:
The numbers should be uniformly distributed between 0 and 1.
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:
- 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:
or in a more complex expression such as the following for generating one of two values, 0 or 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.
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.
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().)
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.
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.
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:
Rnd01(), to generate a random number between 0 and 1;
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;
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;
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;
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:
On each click, the ‘Generate New Trial’ button makes a new run of the simulation, using a new sequence of random numbers each time.
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:
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.
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
| B | C | D | E | F | G | H | I | |
|---|---|---|---|---|---|---|---|---|
| 11 | Solution #1A | Solution #1B | Solution #2A | Solution #2B | ||||
| 12 | Toss | RAND() | Solution using RN from ColC | Solution using RAND() | Toss | Rnd01() | Solution using RN from ColG | Solution using Rnd01() |
| 13 | ||||||||
| 14 | ||||||||
| 15 | 1 | 0.7317089 | T | T | 1 | 0.9871114 | T | T |
| 16 | 2 | 0.8285837 | T | T | 2 | 0.0225598 | H | H |
| 17 | 3 | 0.0701168 | H | T | 3 | 0.0008356 | H | T |
| 18 | 4 | 0.2147295 | H | H | 4 | 0.2127686 | H | T |
| 19 | 5 | 0.8613179 | T | H | 5 | 0.8586159 | T | H |
| 20 | 6 | 0.4159098 | H | H | 6 | 0.5503362 | T | T |
| 21 | 7 | 0.7492317 | T | H | 7 | 0.5243730 | T | H |
| 22 | 8 | 0.9671661 | T | T | 8 | 0.8884351 | T | H |
| 23 | 9 | 0.4823089 | H | T | 9 | 0.2111118 | H | T |
| 24 | 10 | 0.6738897 | T | H | 10 | 0.7680427 | T | H |
The spreadsheet logic for coin tossing is simple. The second solution (Column E) is:
while the fourth solution (Column I) is:
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 . 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
| A | B | C | D | |
|---|---|---|---|---|
| 4 | Service Time | Probability | Cumulative Probability | |
| 5 | ||||
| 6 | ||||
| 7 | 3 | 0.30 | 0.30 | |
| 8 | 6 | 0.45 | 0.75 | |
| 9 | 10 | 0.25 | 1.00 | |
| 10 | ||||
| 11 | Number of Callers= | 25 | ||
| 12 | Simulation Table | |||
| 13 | Step | Activity | ||
| 14 | Caller | Service Time | ||
| 15 | ||||
| 16 | 1 | 6 | ||
| 17 | 2 | 6 | ||
| 18 | 3 | 10 | ||
| 19 | 4 | 6 |
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:
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:
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:
or
The DiscreteUniform(low, high) function is implemented by a single line of VBA code, as follows:
which becomes, for this example:
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.
| A | B | C | D | |
|---|---|---|---|---|
| 4 | Interarrival Times(minutes) | |||
| 5 | ||||
| 6 | Minimum | 1 | ||
| 7 | Maximum | 4 | ||
| 8 | ||||
| 9 | Number of Callers= | 25 | ||
| 10 | Simulation Table | |||
| 11 | Step | Activity | Clock | |
| 12 | Caller | Interarrival Time | Arrival Time | |
| 13 | ||||
| 14 | 1 | 0 | ||
| 15 | 2 | 2 | 2 | |
| 16 | 3 | 1 | 3 | |
| 17 | 4 | 3 | 6 |
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:
An activity time associated with a model input;
Any other random variable defined by a model input;
A system state;
An event, or the clock time of an event;
A model output;
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
| Step | Activities and System States | Outputs | |||||
|---|---|---|---|---|---|---|---|
| 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:
Determine the characteristics of each of the inputs to the simulation. Often encountered types of inputs include constants as well as probability distributions.
Determine the activities, events, and system states relevant to the problem.
Determine model responses or summary performance measures, depending on objectives and specific questions to meet those objectives.
Determine the model outputs needed for computing model responses.
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,, and one output, y_i, for each simulation step . 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.
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.
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
| A | B | C | D | |
|---|---|---|---|---|
| 4 | Coin | Probability | Cumulative Probability | |
| 5 | ||||
| 6 | ||||
| 7 | Head | 0.50 | 0.50 | |
| 8 | Tail | 0.50 | 1.00 | |
| 9 | ||||
| 10 | Numer of Tosses = 100 | |||
| 11 | Simulation Table | |||
| 12 | Step | State | Output | |
| 13 | Toss | Result of Toss | Harry's Winnings | |
| 14 | 1 | T | -$1 | |
| 15 | 2 | H | 0 | |
| 16 | 3 | T | -1 | |
| 17 | 4 | H | 0 | |
| 18 | 5 | H | 1 | |
| 19 | 6 | T | 0 | |
| 20 | 7 | H | 1 | |
| 21 | 8 | T | 0 | |
| 22 | 9 | T | -1 | |
| 23 | 10 | H | 0 | |
| 24 | 11 | T | -1 | |
| 25 | 12 | H | 0 | |
| 26 | 13 | T | -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
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 3 | Number of Trials: 400 | |||||
| 4 | Link to Measure of Performance: | |||||
| 5 | Name of Measure: Link | |||||
| 6 | Number of Tosses out of 100 on which Harry is Ahead. 31 | |||||
| 7 | ||||||
| 8 | ||||||
| 9 | Response Table | Multi-Trial Summary | ||||
| 10 | Trial | Number Tosses w/ Harry Ahead | Bins | Frequency | Relative Frequency | |
| 11 | 1 | 2 | 0 to 5 | 73 | 18.3% | |
| 12 | 2 | 91 | 45 to 55 | 28 | 7.0% | |
| 13 | 3 | 1 | 95 to 100 | 46 | 11.5% | |
| 14 | 4 | 76 | ||||
| 15 | 5 | 17 | ||||
| 16 | 6 | 11 | Average | 48.2 | ||
| 17 | 7 | 94 | Median | 50 | ||
| 18 | 8 | 95 | ||||
| 19 | 9 | 78 | Minimum | 0 | ||
| 20 | 10 | 0 | Maximum | 100 | ||
| 21 | 11 | 40 |
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 empty | Empty | ||
| Server status | Busy | Enter queue | Enter queue |
| Idle | Impossible | Enter service | |
| Server outcomes | Busy | Impossible | |
| Idle | Impossible |
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
| A | B | C | D | E |
|---|---|---|---|---|
| Customer Number | Arrival Time (Clock) | Time Service Begins (Clock) | Service Time (Activity) | Time Service Ends (Clock) |
| 1 | 0 | 0 | 2 | 2 |
| 2 | 2 | 2 | 1 | 3 |
| 3 | 6 | 6 | 3 | 9 |
| 4 | 7 | 9 | 2 | 11 |
| 5 | 9 | 11 | 1 | 12 |
| 6 | 15 | 15 | 4 | 19 |
Table 8 Chronological Ordering of Events
| Event Type | Customer Number | Clock Time |
|---|---|---|
| Arrival | 1 | 0 |
| Departure | 1 | 2 |
| Arrival | 2 | 2 |
| Departure | 2 | 3 |
| Arrival | 3 | 6 |
| Arrival | 4 | 7 |
| Departure | 3 | 9 |
| Arrival | 5 | 9 |
| Departure | 4 | 11 |
| Departure | 5 | 12 |
| Arrival | 6 | 15 |
| Departure | 6 | 19 |
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
| G | H | |
|---|---|---|
| 4 | Interarrival Times(minutes) | |
| 5 | ||
| 6 | Minimum | 1 |
| 7 | Maximum | 8 |
Table 10 Distribution of Service Times
| A | B | C | D | |
|---|---|---|---|---|
| 4 | Service Times (Minutes) | Probability | Cumulative Probability | |
| 5 | ||||
| 6 | ||||
| 7 | 1 | 0.10 | 0.10 | |
| 8 | 2 | 0.20 | 0.30 | |
| 9 | 3 | 0.30 | 0.60 | |
| 10 | 4 | 0.25 | 0.85 | |
| 11 | 5 | 0.10 | 0.95 | |
| 12 | 6 | 0.05 | 1.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
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 15 | TOTALS | 420 | 320 | 163 | 483 | 106 | ||||
| 16 | AVERAGES | 4.24 | 3.20 | 1.63 | 4.83 | 1.07 | ||||
| 17 | Number of Customers= | 100 | ||||||||
| 18 | Simulation Table | |||||||||
| 19 | Step | Activity | Clock | Activity | Clock | Output | Clock | Output | Output | |
| 20 | Customer | Interarrival Time (Minutes) | Arrival Time | Service Time (Minutes) | Time Service Begins | Waiting Time in Queue (Minutes) | Time Service Ends | Time Customer Spends in System (Minutes) | Idle Time of Server (Minutes) | |
| 21 | ||||||||||
| 22 | ||||||||||
| 23 | 1 | 0 | 0 | 2 | 0 | 0 | 2 | 2 | ||
| 24 | 2 | 5 | 5 | 2 | 5 | 0 | 7 | 2 | 3 | |
| 25 | 3 | 5 | 10 | 4 | 10 | 0 | 14 | 4 | 3 | |
| 26 | 4 | 4 | 14 | 4 | 14 | 0 | 18 | 4 | 0 | |
| 27 | 5 | 2 | 16 | 3 | 18 | 2 | 21 | 5 | 0 | |
| 28 | 6 | 8 | 24 | 2 | 24 | 0 | 26 | 2 | 3 | |
| 29 | 7 | 7 | 31 | 3 | 31 | 0 | 34 | 3 | 5 | |
| 30 | 8 | 8 | 39 | 5 | 39 | 0 | 44 | 5 | 5 | |
| 31 | 9 | 5 | 44 | 1 | 44 | 0 | 45 | 1 | 0 | |
| 32 | 10 | 2 | 46 | 6 | 46 | 0 | 52 | 6 | 1 | |
| 33 | 11 | 1 | 47 | 4 | 52 | 5 | 56 | 9 | 0 |
- The average waiting time for a customer is 1.63 minutes, computed as follows:
- The probability that a customer has to wait in the queue is 0.46, computed as follows:
- The server is idle about 25% of the time, computed as follows:
Therefore, the server is busy about 75% of the time.
- The average service time is 3.20 minutes, computed as follows:
This result can be compared with the expected service time by finding the mean of the service-time distribution, using the equation
Applying the expected-value equation to the distribution in Table 10 gives
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.
- The average time between arrivals is 4.24 minutes, computed as follows:
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 The mean is given by
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,6. The average waiting time of those who wait is 3.54 minutes, computed as follows:
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 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.
- The average time a customer spends in the system is 4.83 minutes, computed in two ways. First:
The second way is to realize that the following relationship must hold:
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
| B | C | D | |
|---|---|---|---|
| 4 | Interarrival Distribution of Calls | ||
| 5 | Interarrival Time (Minutes) | Probability | Cumulative Probability |
| 6 | |||
| 7 | |||
| 8 | 1 | 0.25 | 0.25 |
| 9 | 2 | 0.40 | 0.65 |
| 10 | 3 | 0.20 | 0.85 |
| 11 | 4 | 0.15 | 1.00 |
Table 13 Distribution of Able’s Service Time
| F | G | H | |
|---|---|---|---|
| 4 | Able's Service Time Distribution | ||
| 5 | Service Times (Minutes) | Probability | Cumulative Probability |
| 6 | |||
| 7 | |||
| 8 | 2 | 0.30 | 0.30 |
| 9 | 3 | 0.28 | 0.58 |
| 10 | 4 | 0.25 | 0.83 |
| 11 | 5 | 0.17 | 1.00 |
Table 14 Distribution of Baker’s Service Time
| I | J | K | |
|---|---|---|---|
| 4 | Baker's Service Time Distribution | ||
| 5 | Service Times (Minutes) | Probability | Cumulative Probability |
| 6 | |||
| 7 | |||
| 8 | 3 | 0.35 | 0.35 |
| 9 | 4 | 0.25 | 0.60 |
| 10 | 5 | 0.20 | 0.80 |
| 11 | 6 | 0.20 | 1.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)
| B | C | D | E | F | G | H | I | J | K | L | M | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 13 | TOTALS | 73 | 432 | |||||||||
| 14 | Number of Callers= | 100 | Seed for Random Numbers | 12,345 | ||||||||
| 15 | Simulation Table | |||||||||||
| 16 | Step | Activity | Clock | Clock | Clock | State | Activity | Clock | Clock | Clock | Output | Output |
| 17 | Caller Number | Interarrival Time (Minutes) | Arrival Time | When Able Available | When Baker Available | Server Chosen | Service Time (Minutes) | Time Service Begins | Service Completion Time | Caller Delay (Minutes) | Time in System (Minutes) | |
| 18 | Able | Baker | ||||||||||
| 19 | ||||||||||||
| 20 | 1 | 0 | 0 | 0 | Able | 4 | 0 | 4 | 0 | 4 | ||
| 21 | 2 | 1 | 1 | 4 | 0 | Baker | 4 | 1 | 5 | 0 | 4 | |
| 22 | 3 | 1 | 2 | 4 | 5 | Able | 3 | 4 | 7 | 2 | 5 | |
| 23 | 4 | 3 | 5 | 7 | 5 | Baker | 3 | 5 | 8 | 0 | 3 | |
| 24 | 5 | 2 | 7 | 7 | 8 | Able | 5 | 7 | 12 | 0 | 5 | |
| 25 | 6 | 2 | 9 | 12 | 8 | Baker | 5 | 9 | 14 | 0 | 5 | |
| 26 | 7 | 1 | 10 | 12 | 14 | Able | 5 | 12 | 17 | 2 | 7 | |
| 27 | 8 | 2 | 12 | 17 | 14 | Baker | 4 | 14 | 18 | 2 | 6 | |
| 28 | 9 | 4 | 16 | 17 | 18 | Able | 2 | 17 | 19 | 1 | 3 | |
| 29 | 10 | 1 | 17 | 19 | 18 | Baker | 3 | 18 | 21 | 1 | 4 |
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,, 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:
Revenue from sales;
Cost of items sold;
Carrying cost, the cost of carrying stock in inventory;
Ordering cost, the cost associated with placing orders;
Cost of lost sales or backorders;
Cost due to scrap;
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:
The maximum inventory level, M
The review period, N
The order quantity (for replenishment), Q
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
| B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|
| 4 | Distribution of Newspapers Demanded | ||||||
| 5 | Demand | Demand Probabilities | Cumulative Probabilities | ||||
| 6 | Good | Fair | Poor | Good | Fair | Poor | |
| 7 | 40 | 0.03 | 0.10 | 0.44 | 0.03 | 0.10 | 0.44 |
| 8 | 50 | 0.05 | 0.18 | 0.22 | 0.08 | 0.28 | 0.66 |
| 9 | 60 | 0.15 | 0.40 | 0.16 | 0.23 | 0.68 | 0.82 |
| 10 | 70 | 0.20 | 0.20 | 0.12 | 0.43 | 0.88 | 0.94 |
| 11 | 80 | 0.35 | 0.08 | 0.06 | 0.78 | 0.96 | 1.00 |
| 12 | 90 | 0.15 | 0.04 | 0.00 | 0.93 | 1.00 | 1.00 |
| 13 | 100 | 0.07 | 0.00 | 0.00 | 1.00 | 1.00 | 1.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:
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
| J | K | L | |
|---|---|---|---|
| 4 | Type of Newsday | ||
| 5 | Type | Probability | Cumulative Probability |
| 6 | |||
| 7 | Good | 0.35 | 0.35 |
| 8 | Fair | 0.45 | 0.80 |
| 9 | Poor | 0.20 | 1.00 |
Table 18 Simulation Table for Purchase of 70 Newspapers
| B | C | D | E | F | G | HI | I | |
|---|---|---|---|---|---|---|---|---|
| 16 | Simulation Table | |||||||
| 17 | Day | Type of Newsday | Demand | Revenue from Sales | Lost Profit from Excess Demand | Salvage from Sale of Scrap | Daily Cost | Daily Profit |
| 18 | ||||||||
| 19 | ||||||||
| 20 | 1 | Fair | 50 | $25.00 | $0.00 | $1.00 | $23.10 | $2.90 |
| 21 | 2 | Fair | 50 | $25.00 | $0.00 | $1.00 | $23.10 | $2.90 |
| 22 | 3 | Fair | 70 | $35.00 | $0.00 | $0.00 | $23.10 | $11.90 |
| 23 | 4 | Good | 80 | $35.00 | $1.70 | $0.00 | $23.10 | $10.20 |
| 24 | 5 | Poor | 40 | $20.00 | $0.00 | $1.50 | $23.10 | -$1.60 |
| 25 | 6 | Fair | 50 | $25.00 | $0.00 | $1.00 | $23.10 | $2.90 |
| 26 | 7 | Poor | 50 | $25.00 | $0.00 | $1.00 | $23.10 | $2.90 |
| 27 | 8 | Fair | 70 | $35.00 | $0.00 | $0.00 | $23.10 | $11.90 |
| 28 | 9 | Good | 40 | $20.00 | $0.00 | $1.50 | $23.10 | -$1.60 |
| 29 | 10 | Good | 100 | $35.00 | $5.10 | $0.00 | $23.10 | $6.80 |
| 30 | 11 | Fair | 70 | $35.00 | $0.00 | $0.00 | $23.10 | $11.90 |
| 31 | 12 | Poor | 50 | $25.00 | $0.00 | $1.00 | $23.10 | $2.90 |
| 32 | 13 | Fair | 50 | $25.00 | $0.00 | $1.00 | $23.10 | $2.90 |
| 33 | 14 | Poor | 40 | $20.00 | $0.00 | $1.50 | $23.10 | -$1.60 |
| 34 | 15 | Good | 80 | $35.00 | $1.70 | $0.00 | $23.10 | $10.20 |
| 35 | 16 | Good | 70 | $35.00 | $0.00 | $0.00 | $23.10 | $11.90 |
| 36 | 17 | Good | 80 | $35.00 | $1.70 | $0.00 | $23.10 | $10.20 |
| 37 | 18 | Poor | 40 | $20.00 | $0.00 | $1.50 | $23.10 | -$1.60 |
| 38 | 19 | Fair | 70 | $35.00 | $0.00 | $0.00 | $23.10 | $11.90 |
| 39 | 20 | Good | 100 | $35.00 | $5.10 | $0.00 | $23.10 | $6.80 |
| 40 | TOTAL 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:
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:
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
| B | C | D | |
|---|---|---|---|
| 4 | Distribution of Daily Demand | ||
| 5 | Demand | Probability | Cumulative Probability |
| 6 | |||
| 7 | 0 | 0.10 | 0.10 |
| 8 | 1 | 0.25 | 0.35 |
| 9 | 2 | 0.35 | 0.70 |
| 10 | 3 | 0.21 | 0.91 |
| 11 | 4 | 0.09 | 1.00 |
Table 20 Distribution of Lead Time
| F | G | H | |
|---|---|---|---|
| 4 | Distribution of Lead Time | ||
| 5 | Lead Time (days) | Probability | Cumulative Probability |
| 6 | |||
| 7 | 1 | 0.60 | 0.60 |
| 8 | 2 | 0.30 | 0.90 |
| 9 | 3 | 0.10 | 1.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
| B | C | D | E | F | G | H | I | J | K | |
|---|---|---|---|---|---|---|---|---|---|---|
| 13 | Simulation Table | |||||||||
| 14 | Step | State | State | State | Input | State | State | State | Activity | State |
| 15 | Clock | Cycle | Day within Cycle | Beginning Inventory | Demand | Ending Inventory | Shortage Quantity | Pending Order (Quantity) | Lead Time (days) | Days until Order Arrives |
| 16 | Day | |||||||||
| 17 | ||||||||||
| 18 | 0 | 0 | 5 | - | - | 3 | 0 | 8 | 2 | 2 |
| 19 | 1 | 1 | 1 | 3 | 2 | 1 | 0 | 8 | 1 | |
| 20 | 2 | 1 | 2 | 1 | 1 | 0 | 0 | |||
| 21 | 3 | 1 | 3 | 8 | 2 | 6 | 0 | |||
| 22 | 4 | 1 | 4 | 6 | 1 | 5 | 0 | |||
| 23 | 5 | 1 | 5 | 5 | 2 | 3 | 0 | 8 | 1 | 1 |
| 24 | 6 | 2 | 1 | 3 | 3 | 0 | 0 | |||
| 25 | 7 | 2 | 2 | 8 | 2 | 6 | 0 | |||
| 26 | 8 | 2 | 3 | 6 | 3 | 3 | 0 | |||
| 27 | 9 | 2 | 4 | 3 | 2 | 1 | 0 | |||
| 28 | 10 | 2 | 5 | 1 | 3 | 0 | 2 | 13 | 2 | 2 |
| 29 | 11 | 3 | 1 | 0 | 1 | 0 | 3 | 13 | 1 | |
| 30 | 12 | 3 | 2 | 0 | 2 | 0 | 5 | |||
| 31 | 13 | 3 | 3 | 13 | 2 | 6 | 0 | |||
| 32 | 14 | 3 | 4 | 6 | 3 | 3 | 0 | |||
| 33 | 15 | 3 | 5 | 3 | 1 | 2 | 0 | 9 | 1 | 1 |
| 34 | 16 | 4 | 1 | 2 | 0 | 2 | 0 | |||
| 35 | 17 | 4 | 2 | 11 | 4 | 7 | 0 | |||
| 36 | 18 | 4 | 3 | 7 | 2 | 5 | 0 | |||
| 37 | 19 | 4 | 4 | 5 | 3 | 2 | 0 | |||
| 38 | 20 | 4 | 5 | 2 | 3 | 0 | 1 | 12 | 1 | 1 |
| 39 | 21 | 5 | 1 | 0 | 2 | 0 | 3 | |||
| 40 | 22 | 5 | 2 | 12 | 1 | 8 | 0 | |||
| 41 | 23 | 5 | 3 | 8 | 4 | 4 | 0 | |||
| 42 | 24 | 5 | 4 | 4 | 1 | 3 | 0 | |||
| 43 | 25 | 5 | 5 | 3 | 1 | 2 | 0 | 9 | 1 | 1 |
| 44 | TOTAL | 69 | 14 | |||||||
| 45 | AVERAGE | 2.04 | 2.76 | 0.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:
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
| B | C | D | |
|---|---|---|---|
| 3 | Distribution of Bearing-Life | ||
| 4 | Bearing Life | Probability | Cumulative Probability |
| 5 | |||
| 6 | 1000 | 0.10 | 0.1 |
| 7 | 1100 | 0.13 | 0.23 |
| 8 | 1200 | 0.25 | 0.48 |
| 9 | 1300 | 0.13 | 0.61 |
| 10 | 1400 | 0.09 | 0.70 |
| 11 | 1500 | 0.12 | 0.82 |
| 12 | 1600 | 0.02 | 0.84 |
| 13 | 1700 | 0.06 | 0.90 |
| 14 | 1800 | 0.05 | 0.95 |
| 15 | 1900 | 0.05 | 1.00 |
Table 23 Distribution of Delay until Mechanic Arrives
| F | G | H | |
|---|---|---|---|
| 4 | Distribution of Delay Time | ||
| 5 | Delay Time | Probability | Cumulative Probability |
| 6 | |||
| 7 | 5 | 0.60 | 0.60 |
| 8 | 10 | 0.30 | 0.90 |
| 9 | 15 | 0.10 | 1.00 |
Table 24 Bearing Replacement under Current Method
| B | C | D | E | F | G | H | |
|---|---|---|---|---|---|---|---|
| 17 | Simulation Table | ||||||
| 18 | Step | Bearing 1 | Bearing 2 | Bearing3 | |||
| 19 | Life (Hours) | Delay (minutes) | Life (Hours) | Delay (minutes) | Life (Hours) | Delay (minutes) | |
| 20 | |||||||
| 21 | 1 | 1000 | 5 | 1700 | 10 | 1300 | 10 |
| 22 | 2 | 1200 | 5 | 1100 | 5 | 1100 | 5 |
| 23 | 3 | 1200 | 10 | 1000 | 10 | 1300 | 10 |
| 24 | 4 | 1500 | 5 | 1000 | 10 | 1100 | 15 |
| 25 | 5 | 1700 | 5 | 1900 | 15 | 1200 | 5 |
| 26 | 6 | 1200 | 5 | 1200 | 10 | 1500 | 10 |
| 27 | 7 | 1300 | 5 | 1500 | 5 | 1100 | 10 |
| 28 | 8 | 1700 | 5 | 1700 | 5 | 1400 | 15 |
| 29 | 9 | 1000 | 5 | 1300 | 5 | 1800 | 15 |
| 30 | 10 | 1800 | 10 | 1300 | 5 | 1200 | 5 |
| 31 | 11 | 1200 | 5 | 1100 | 5 | 1500 | 5 |
| 32 | 12 | 1100 | 5 | 1800 | 5 | 1100 | 10 |
| 33 | 13 | 1300 | 10 | 1200 | 5 | 1700 | 10 |
| 34 | 14 | 1300 | 10 | 1100 | 5 | 1300 | 10 |
| 35 | 15 | 1100 | 5 | 1300 | 5 | 1300 | 10 |
| 36 | TOTALS | 19,600 | 95 | 20,200 | 105 | 19,900 | 145 |
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:
The total life of all 45 bearings is 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
| B | C | D | E | F | G | |
|---|---|---|---|---|---|---|
| 17 | Simulation Table | |||||
| 18 | Step | Bearing 1 | Bearing 2 | Bearing 3 | FirstFailure(Hours) | |
| 19 | Life(Hours) | Life(Hours) | Life(Hours) | Delay(minutes) | ||
| 20 | ||||||
| 21 | 1 | 1300 | 1100 | 1300 | 1,100 | 10 |
| 22 | 2 | 1100 | 1200 | 1500 | 1,100 | 5 |
| 23 | 3 | 1100 | 1400 | 1800 | 1,100 | 15 |
| 24 | 4 | 1200 | 1500 | 1100 | 1,100 | 10 |
| 25 | 5 | 1700 | 1300 | 1300 | 1,300 | 5 |
| 26 | 6 | 1700 | 1100 | 1000 | 1,000 | 10 |
| 27 | 7 | 1000 | 1900 | 1200 | 1,000 | 10 |
| 28 | 8 | 1500 | 1700 | 1300 | 1,300 | 15 |
| 29 | 9 | 1300 | 1100 | 1800 | 1,100 | 5 |
| 30 | 10 | 1200 | 1100 | 1300 | 1,100 | 5 |
| 31 | 11 | 1000 | 1200 | 1200 | 1,000 | 15 |
| 32 | 12 | 1500 | 1700 | 1200 | 1,200 | 10 |
| 33 | 13 | 1300 | 1700 | 1000 | 1,000 | 10 |
| 34 | 14 | 1800 | 1200 | 1100 | 1,100 | 10 |
| 35 | 15 | 1300 | 1300 | 1100 | 1,100 | 10 |
| 36 | TOTALS | 16600 | 145 |
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:
The total life of the bearings is 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 , having mean 0 and standard deviation 1, is distributed as
where is a normal random variable, is the mean of the distribution of X, and σ is the standard deviation of X. Then, with mean zero and standard deviations given by and , we have
where (X, Y) are the simulated coordinates where the bomb hits.
Table 26 Simulated Bombing Run
| F | G | H | I | J | K | L | M | N | O | P | Q | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 3 | Point of Impact of Each Bomb(1-10) | |||||||||||
| 4 | Bomb | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | NumberHits |
| 5 | X | 891.8 | -1257.3 | 429.6 | 24.5 | -321.0 | -77.3 | 131.4 | 304.5 | -442.7 | -403.9 | |
| 6 | Y | -400.7 | -159.4 | 25.3 | 243.6 | 146.5 | 260.7 | -228.3 | -62.0 | 49.7 | 51.0 | |
| 7 | Hit ? | Miss | Miss | Hit | Hit | Hit | Hit | Hit | Hit | Miss | Miss | 6 |
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:
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 , where T is the lead time and 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) | 3 | 4 | 5 | 6 |
|---|---|---|---|---|
| Probability | 0.20 | 0.35 | 0.30 | 0.15 |
Table 27 Simulation Table for Lead-Time Demand
| B | C | D | E | F | G | |
|---|---|---|---|---|---|---|
| 13 | Simulation Table | |||||
| 14 | Cycle | Lead Time | Demand Day1 | Demand Day2 | Demand Day3 | Lead Time Demand |
| 15 | ||||||
| 16 | ||||||
| 17 | 1 | 2 | 3 | 5 | 8 | |
| 18 | 2 | 1 | 4 | 4 | ||
| 19 | 3 | 2 | 3 | 5 | 8 | |
| 20 | 4 | 3 | 4 | 5 | 4 | 13 |
| 21 | 5 | 3 | 4 | 5 | 6 | 15 |
| 22 | 6 | 1 | 3 | 3 | ||
| 23 | 7 | 1 | 6 | 6 | ||
| 24 | 8 | 2 | 5 | 6 | 11 | |
| 25 | 9 | 2 | 5 | 3 | 8 | |
| 26 | 10 | 3 | 4 | 3 | 5 | 12 |
| 27 | 11 | 1 | 4 | 4 | ||
| 28 | 12 | 1 | 5 | 5 | ||
| 29 | 13 | 3 | 4 | 4 | 14 | |
| 30 | 14 | 1 | 6 | 6 | ||
| 31 | 15 | 1 | 3 | 3 | ||
| 32 | 16 | 2 | 5 | 3 | 8 | |
| 33 | 17 | 2 | 4 | 6 | 10 | |
| 34 | 18 | 3 | 4 | 5 | 5 | 14 |
| 35 | 19 | 3 | 4 | 3 | 6 | 13 |
| 36 | 20 | 2 | 5 | 6 | 11 |
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) | 1 | 2 | 3 |
|---|---|---|---|
| Probability | 0.36 | 0.42 | 0.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:
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:
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.
- 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?
- 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/Day | 8 | 10 | 12 | 14 |
|---|---|---|---|---|
| Probability | 0.35 | 0.30 | 0.25 | 0.10 |
Customers order 1, 2, 3, or 4 dozen bagels according to the following probability distribution
| Number of Dozen Ordered/Customer | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| Probability | 0.4 | 0.3 | 0.2 | 0.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?
Develop and interpret flow diagrams analogous to Figures 4 and 5 for a queueing system with i channels.
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) | 15 | 20 | 25 | 30 | 35 |
|---|---|---|---|---|---|
| Probability | 0.14 | 0.22 | 0.43 | 0.17 | 0.04 |
The distribution of time to complete a service is as follows:
| Service Time (Minutes) | 5 | 15 | 25 | 35 | 45 |
|---|---|---|---|---|---|
| Probability | 0.12 | 0.35 | 0.43 | 0.06 | 0.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.
- The random variables X, Y, and Z are distributed as follows:
Simulate 50 values of the random variable
Prepare a histogram of the resulting values, using class intervals of width equal to 3.
- Given A, B, and C, which are uncorrelated random variables. Variable A is normally distributed with and . Variable B is discrete uniformly distributed with a probability distribution given by with b 0, 1, 2, 3 and 4. Variable C is distributed in accordance with the following table:
| Value of C | Probability |
|---|---|
| 10 | .10 |
| 20 | .25 |
| 30 | .50 |
| 40 | .15 |
Use simulation to estimate the mean of a new variable D, that is defined as
Use a sample of size 100.
- 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.
- 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:
| Material | Weight (kilograms) | Interarrival Time (Minutes) |
|---|---|---|
| A | 200 | 5 ± 2 (uniform) |
| B | 100 | 6 (constant) |
| C | 50 | P(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?
- The random variables X and Y are real-valued (not integers) and uniformly distributed over intervals as follows:
(a) Simulate 200 values of the random variable
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
- 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.
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
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.)
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.
Two theorems from statistics are as follows:
Theorem 1 Let be normally and independently distributed random variables with mean and variance . Then the random variable
is said to follow the chi-squared distribution with k degrees of freedom, abbreviated Theorem 2 Let and V be a chi-squared random variable with k degrees of freedom. If Z and V are independent, then the random variable
is said to follow the t distribution with k degrees of freedom, abbreviated 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 numbers | random normal numbers |
|---|---|
| 0.6729 | 1.06 |
| 0.1837 | -0.72 |
| 0.2572 | 0.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?
- 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) | Probability | Service Time (Minutes) | Probability |
|---|---|---|---|
| 0 | 0.09 | 1 | 0.20 |
| 1 | 0.17 | 2 | 0.40 |
| 2 | 0.27 | 3 | 0.28 |
| 3 | 0.20 | 4 | 0.12 |
| 4 | 0.15 | ||
| 5 | 0.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?
- 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.)
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?
In Example 12, why isn’t each path represented about 1/3 of the time?
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.)
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
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.
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?
In Example 5, let the service-time distribution be changed to the following:
| Service Time (Minutes) | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Probability | 0.05 | 0.10 | 0.20 | 0.30 | 0.25 | 0.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?
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?
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?
In Example 6, conduct an experiment of400 trials. Explain the large spread between the minimum average delay and the maximum average delay.
In Example 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.
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?
In Example 7, determine the best policy for ordering newspapers based on experiments of 50 trials.
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?
Use the spreadsheet for Example 8. For 100 trials, what is the average ending inventory ifM 11 and N 4, 5, 6?
Use the spreadsheet for Example 8. For 100 trials, what is the average ending inventory if N 5 and M 10, 11, 12?
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.
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.
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?
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?
Set meters and meters in the spreadsheet for Example 10. Leave the target intact. Conduct a simulation with 200 trials. What was the average number of hits?
Set meters and meters in the spreadsheet for Example 10. Leave the targe intact. Conduct a simulation with 200 trials. What was the average number of hits?
Set meters and 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.
Set meters in the spreadsheet for Example 10. Leave the target intact. What is the value of if the average number of hits is to be about 6.0, based on one experiment of 400 trials
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.
In Example 11, suppose you wanted a better estimate of the mean lead-time demand? Wha would you do?
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.
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.
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?
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?
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?
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.
- 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.
Using Excel, generate a table that can be used instead of Table A.1, using the formula =INT(RAND()*100000).
Use Excel to devise a Monte Carlo experiment to estimate the value of π, as in the equation for the area of a circle,
Hint: Consider a quarter circle with unit radius inside a unit square. Throw a random dart onto the unit square.
- 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.
- The 22-stop Bally 1090 slot machine had the following number of symbols on each reel:
| Symbols | Reel 1 | Reel 2 | Reel 3 |
|---|---|---|---|
| Cherries | 2 | 5 | 2 |
| Oranges | 2 | 3 | 7 |
| Plums | 5 | 1 | 10 |
| Bells | 10 | 2 | 1 |
| Bars | 2 | 10 | 1 |
| 7's | 1 | 1 | 1 |
Payoffs were as follows:
| Combination | Payoff | Combination | Payoff |
|---|---|---|---|
| Left cherry | 2 | Three plums | 20 |
| Right cherry | 2 | Plum plum bar | 14 |
| Any two cherries | 5 | Bar plum plum | 14 |
| Three cherries | 20 | Three bells | 20 |
| Three oranges | 20 | Bell bell bar | 18 |
| Orange orange bar | 10 | Bar bell bell | 18 |
| Bar orange orange | 10 | Three bars | 50 |
| Three 7's | 100 |
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 , the number of callers waiting to be served at time ;, 0 or 1 to indicate Able as being idle or busy at time ;, 0 or 1 to indicate Baker as being idle or busy at time .
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:
How does each event affect system state, entity attributes, and set contents?
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.)
Which events trigger the beginning (and end) of each type of delay? Under what conditions does a delay begin or end?
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 in Figure 1). The FEL is ordered by event time, meaning that the events are arranged chronologically—that is, the event times satisfy
Time t is the value of CLOCK, the current value of simulated time. The event associated with time 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 , 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 is created, one based on the old snapshot at time t and the nature of the imminent event. At time , new future
| CLOCK | System state | Entities and attributes | Set 1 | Set 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 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 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 is generated at Step 4, one possible way to determine its correct position on the FEL is to conduct a top-down search:
(In Figure 2, it was assumed that was between and ) 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 , 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 , is
Old system snapshot at time t
| CLOCK | System state | Future event list | ||
|---|---|---|---|---|
| (5, 1, 6) |
Event-scheduling/time-advance algorithm
Step 1. Remove the event notice for the imminent event (event 3, time 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 Step 5. Update cumulative statistics and counters.
New system snapshot at time | CLOCK | System state || Future event list || | — | — | — | — | — | || (5, 1, 5) | || |
Figure 2 Advancing simulation time and updating system image.
generated; it is added to the current time, the resulting (future) event time, 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 if the next customer is present, then a new service time,, will be generated for the next customer. The next service completion event will be scheduled to occur at future time , 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:
At time 0, schedule a stop simulation event at a specified future time . Thus, before simulating, it is known that the simulation will run over the time interval . Example: Simulate a job shop for hours.
Run length is determined by the simulation itself. Generally, is the time of occurrence of some specified event E. Examples: could be the time of the 100th service completion
at a certain service center. could be the time of breakdown of a complex system. could be the time of disengagement or total kill (whichever occurs first) in a combat simulation. could be the time at which a distribution center ships the last carton in a day’s orders.
In case 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:
| Activity | Condition |
|---|---|
| Service time by Able | A caller is in queue and Able is idle |
| Service time by Baker | A 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 Times | 1 | 1 | 6 | 3 | 7 | 5 | 2 | 4 | 1··· |
|---|---|---|---|---|---|---|---|---|---|
| Service Times | 4 | 2 | 5 | 4 | 1 | 5 | 4 | 1 | 4··· |
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 , with , 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 ). 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 and 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 . The CLOCK is advanced to time 1, and is removed from the FEL. Because for , the server was busy for 1 minute), the cumulative busy time is increased from to . By the event logic in Figure 6, set (the
Table 1 Simulation Table for Checkout Counter
| CLOCK | System state | Future event list | Comment | Cumulative statistics | ||
|---|---|---|---|---|---|---|
| B | MQ | |||||
| 0 | 0 | 1 | (A, 1) (D, 4) (E, 60) | First A occurs Schedule next A Schedule first D | 0 | 0 |
| 1 | 1 | 1 | (A, 2) (D, 4) (E, 60) | Second A occurs: (A, 1) Schedule next A(Customer delayed) | 1 | 1 |
| 2 | 2 | 1 | (D, 4) (A, 8) (E, 60) | Third A occurs: (A, 2) Schedule next A(Two customers delayed) | 2 | 2 |
| 4 | 1 | 1 | (D, 6) (A, 8) (E, 60) | First D occurs: (D, 4) Schedule next D(Customer delayed) | 4 | 2 |
| 6 | 0 | 1 | (A, 8) (D, 11) (E, 60) | Second D occurs: (D, 6) Schedule next D | 6 | 2 |
| 8 | 1 | 1 | (D, 11) (A, 11) (E, 60) | Fourth A occurs: (A, 8) Schedule next A(Customer delayed) | 8 | 2 |
| 11 | 1 | 1 | (D, 15) (A, 18) (E, 60) | Fifth A occurs: (A, 11) Schedule next AThird D occurs: (D, 11) Schedule next D(Customer delayed) | 11 | 2 |
| 15 | 0 | 1 | (D, 16) (A, 18) (E, 60) | Fourth D occurs: (D, 15) Schedule next D | 15 | 2 |
| 16 | 0 | 0 | (A, 18) (E, 60) | Fifth D occurs: (D, 16) | 16 | 2 |
| 18 | 0 | 1 | (D, 23) (A, 23) (E, 60) | Sixth A occurs Schedule next A Schedule next D | 16 | 2 |
| 23 | 0 | 1 | (A, 25) (D, 27) (E, 60) | Seventh A occurs: (A, 23) Schedule next ArrivalSixth D occurs: (D, 23) | 21 | 2 |
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 , 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
| CLOCK | System state | CHECKOUT LINE | Future event list | Cumulative statistics | |||
|---|---|---|---|---|---|---|---|
| S | F | ||||||
| 0 | 0 | 1 | (C1,0) | (A,1,C2) (D,4,C1) (E,60) | 0 | 0 | 0 |
| 1 | 1 | 1 | (C1,0) (C2,1) | (A,2,C3) (D,4,C1) (E,60) | 0 | 0 | 0 |
| 2 | 2 | 1 | (C1,0) (C2,1) (C3,2) | (D,4,C1) (A,8,C4) (E,60) | 0 | 0 | 0 |
| 4 | 1 | 1 | (C2,1) (C3,2) | (D,6,C2) (A,8,C4) (E,60) | 4 | 1 | 0 |
| 6 | 0 | 1 | (C3,2) | (A,8,C4) (D,11,C3) (E,60) | 9 | 2 | 1 |
| 8 | 1 | 1 | (C3,2) (C4,8) | (D,11,C3) (A,11,C5) (E,60) | 9 | 2 | 1 |
| 11 | 1 | 1 | (C4,8) (C5,11) | (D,15,C4) (A,18,C6) (E,60) | 18 | 3 | 2 |
| 15 | 0 | 1 | (C5,11) | (D,16,C5) (A,18,C6) (E,60) | 25 | 4 | 3 |
| 16 | 0 | 0 | (A,18,C6) (E,60) | 30 | 5 | 4 | |
| 18 | 0 | 1 | (C6,18) | (D,23,C6) (A,23,C7) (E,60) | 30 | 5 | 4 |
| 23 | 0 | 1 | (C7,23) | (A,25,C8) (D,27,C7) (E,60) | 35 | 6 | 5 |
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 . 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. 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
Then S is incremented by 5 minutes, and F and by one customer.
For a simulation run length of 23 minutes, the average response time was minutes, and the observed proportion of customers who spent 5 or more minutes in the system was . 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 and 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 Time | Probability | Cumulative Probability | Random Number Interval |
|---|---|---|---|
| 5 | 0.30 | 0.30 | |
| 10 | 0.50 | 0.80 | |
| 15 | 0.20 | 1.00 |
Table 4 Distribution of Weighing Time for the Dump Trucks
| Weighing Time | Probability | Cumulative Probability | Random Number Interval |
|---|---|---|---|
| 12 | 0.70 | 0.70 | |
| 16 | 0.30 | 1.00 |
Table 5 Distribution of Travel Time for the Dump Trucks
| Travel Time | Probability | Cumulative Probability | Random Number Interval |
|---|---|---|---|
| 40 | 0.40 | 0.40 | |
| 60 | 0.30 | 0.70 | |
| 80 | 0.20 | 0.90 | |
| 100 | 0.10 | 1.00 |
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 Time | 10 | 5 | 5 | 10 | 15 | 10 | 10 |
|---|---|---|---|---|---|---|---|
| Weighing Time | 12 | 12 | 12 | 16 | 12 | 16 | |
| Travel Time | 60 | 100 | 40 | 40 | 80 |
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 , 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 , 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) 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
Both loaders are busy from time 0 to time , so at time t 20—but, from time 20 to time 24, only one loader is busy; thus, increases by only 4 minutes over the time interval [20, 24]. Similarly, from time 25 to time 36, both loaders are idle , so does not change. For the relatively short simulation in Table 6, the utilizations are estimated as follows:
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 , 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 | System state | Lists | Future event list | Cumulative statistics | |||||
|---|---|---|---|---|---|---|---|---|---|
| Loader queue | Weigh queue | ||||||||
| LQ(t) | L(t) | WQ(t) | W(t) | ||||||
| 0 | 3 | 2 | 0 | 1 | DT4DT5DT6 | (EL, 5, DT3)(EL, 10, DT2)(EW, 12, DT1) | 0 | 0 | |
| 5 | 2 | 2 | 1 | 1 | DT5DT6 | DT3 | (EL, 10, DT2)(EL, 5 + 5, DT4)(EW, 12, DT1) | 10 | 5 |
| 10 | 1 | 2 | 2 | 1 | DT6 | DT3DT2 | (EL, 10, DT4)(EW, 12, DT1)(EL, 10 + 10, DT5) | 20 | 10 |
| 10 | 0 | 2 | 3 | 1 | DT3DT2DT4 | (EW, 12, DT1)(EL, 20, DT5)(EL, 10 + 15, DT6) | 20 | 10 | |
| 12 | 0 | 2 | 2 | 1 | DT2DT4 | (EL, 20, DT5)(EW, 12 + 12, DT3)(EL, 25, DT6)(ALQ, 12 + 60, DT1) | 24 | 12 | |
| 20 | 0 | 1 | 3 | 1 | DT2DT4DT5 | (EW, 24, DT3)(EL, 25, DT6)(ALQ, 72, DT1) | 40 | 20 | |
| 24 | 0 | 1 | 2 | 1 | DT4DT5 | (EL, 25, DT6)(EW, 24 + 12, DT2)(ALQ, 72, DT1)(ALQ, 24 + 100, DT3) | 44 | 24 | |
| 25 | 0 | 0 | 3 | 1 | DT4DT5DT6 | (EW, 36, DT2)(ALQ, 72, DT1)(ALQ, 124, DT3) | 45 | 25 | |
| 36 | 0 | 0 | 2 | 1 | DT5DT6 | (EW, 36 + 16, DT4)(ALQ, 72, DT1)(ALQ, 36 + 40, DT2)(ALQ, 124, DT3) | 45 | 36 | |
| 52 | 0 | 0 | 1 | 1 | DT6 | (EW, 52 + 12, DT5)(ALQ, 72, DT1)(ALQ, 76, DT2)(ALQ, 52 + 40, DT4)(ALQ, 124, DT3) | 45 | 52 | |
| 64 | 0 | 0 | 0 | 1 | (ALQ, 72, DT1)(ALQ, 76, DT2)(EW, 64 + 16, DT6)(ALQ, 92, DT4)(ALQ, 124, DT3)(ALQ, 64 + 80, DT5) | 45 | 64 | ||
| 72 | 0 | 1 | 0 | 1 | (ALQ, 76, DT2)(EW, 80, DT6)(EL, 72 + 10, DT1)(ALQ, 92, DT4)(ALQ, 124, DT3)(ALQ, 144, DT5) | 45 | 72 | ||
| 76 | 0 | 2 | 0 | 1 | (EW, 80, DT6)(EL, 82, DT1)(EL, 76 + 10, DT2)(ALQ, 92, DT4)(ALQ, 124, DT3)(ALQ, 144, DT5) | 49 | 76 |
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
| Delay | Loading | Delay | Weigh | Travel time | |
|---|---|---|---|---|---|
| ALQ | EL | EW | ALQ |
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 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:
Then, at CLOCK time 10 in the simulation in Table 6, the list of entities in the weigh queue would be defined by
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,
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:
In this example, we get
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
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 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:
system state;
system entities and their attributes;
sets, and the entities that may be put into the sets;
events and activities; event notices;
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 are the only possible values; that is, the activity time is a discrete random variable. The discreteness assumption will simplify the manual simulation.
- (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.
Construct the event-logic diagrams for the dump-truck problem, Example 5.
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.
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: | 1 | 5 | 6 | 3 | 8 |
|---|---|---|---|---|---|
| Service times: | 3 | 5 | 4 | 1 | 5 |
Continue Table 2 until caller C7 departs.
The data for Table 2 are changed to the following:
| Interarrival times: | 4 | 5 | 2 | 8 | 3 | 7 |
|---|---|---|---|---|---|---|
| Service times: | 5 | 3 | 4 | 6 | 2 | 7 |
Prepare a table in the manner of Table 2 with a stopping event at time 25.
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.
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.
Redo Example 9 from the Simulation Examples in a Spreadsheet chapter (the bearing-replacement problem) by a manual simulation, using the event-scheduling approach.
Rework Example 5, but using the following data:
| Loading times: | 10 | 5 | 10 | 10 | 5 | 10 | 5 |
|---|---|---|---|---|---|---|---|
| Weigh times: | 12 | 16 | 12 | 12 | 16 | 12 | 12 |
| Travel times: | 40 | 60 | 40 | 80 | 100 | 40 |
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:
1955–1960 The Period of Search
1961–1965 The Advent
1966–1970 The Formative Period
1971–1978 The Expansion Period
1979–1986 The Period of Consolidation and Regeneration
1987–2008 The Period of Integrated Environments
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:
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.
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.
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.
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
| Feature | Description |
|---|---|
| Modeling worldview | Process interaction, event perspectives, and continuous modeling, depending on needs |
| Input-data analysis capability | Estimate empirical or statistical distributions from raw data |
| Graphical model building | Process-flow, block-diagram, or network approach |
| Conditional routing | Route entities based on prescribed conditions or attributes |
| Simulation programming | Capability to add procedural logic through a high-level powerful simulation language |
| Syntax | Easily understood, consistent, unambiguous, English-like |
| Input flexibility | Accepts data from external files, databases, spreadsheets, or interactively |
| Modeling conciseness | Powerful actions, blocks, or nodes |
| Randomness | Random-variate generators for all common distributions, e.g., exponential triangular uniform normal |
| Specialized components and templates | Material handling: vehicles, conveyors, bridge cranes, AS/RS, etc. Handling of liquids and bulk materials Communication systems Computer systems Call centers Others |
| User-built custom objects | Reusable objects, templates, and submodels |
| Continuous flow | Tanks and pipes or bulk conveyors |
| Interface with general-programming language | Link code in C, C++, Java, or other general-programming language |
Table 2 Runtime Environment
| Feature | Description |
|---|---|
| Execution speed | Many runs needed for scenarios and replications. Impacts development as well as experimentation |
| Model size; number of variables and attributes | Should have no built-in limits |
| Interactive debugger | Monitor the simulation in detail as it progresses. Ability to break, trap, run until, step; to display status, attributes and variables; etc. |
| Model status and statistics | Display at any time during simulation |
| Runtime license | Ability to change parameters and run a model (but not to change logic or build a new model) |
- 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
| Feature | Description |
|---|---|
| Type of animationImport drawing and object files | True to scale or iconic (such as process-flow diagram)From CAD (vector formats) drawings or icons (bit-mapped or raster graphics) |
| Dimension | 2-D, 2-D with perspective, 3-D |
| Movement | Motion of entities or status indicators |
| Quality of motion | Smooth or jerky |
| Libraries of common objects | Extensive predrawn graphics |
| Navigation | Panning, zooming, rotation |
| Views | User defined, named |
| Display step | Control of animation speed |
| Selectable objects | Dynamic status and statistics displayed upon selection |
| Hardware requirements | Standard or special video card |
Table 4 Output Features
| Feature | Description |
|---|---|
| Scenario manager | Create user-defined scenarios to simulate |
| Run manager | Make all runs (scenarios and replications) and save results for future analyses |
| Warmup capability | For steady-state analysis |
| Independent replications | Using a different set of random numbers |
| Optimization | Genetic algorithms, tabu search, etc. |
| Standardized reports | Summary reports including averages, counts, minimum and maximum, etc. |
| Customized reports | Tailored presentations for managers |
| Statistical analysis | Confidence intervals, designed experiments, etc. |
| Business graphics | Bar charts, pie charts, time lines, etc. |
| Costing module | Activity-based costing included |
| File export | Input to spreadsheet or database for custom processing and analysis |
| Database maintenance | Store output in an organized manner |
Table 5 Vendor Support and Product Documentation
| Feature | Description |
|---|---|
| Training | Regularly scheduled classes of high quality |
| Documentation | Quality, completeness, online |
| Help system | General or context-sensitive |
| Tutorials | For learning the package or specific features |
| Support | Telephone, e-mail, web |
| Upgrades, maintenance | Regularity of new versions and maintenance releases that address customer needs |
| Track record | Stability, history, customer relations |
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.
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
| Variables | Description |
|---|---|
| System state | |
| QueueLength | Number of customers queued (but not in service) at current simulated time |
| NumberInService | Number being served at current simulated time |
| Entity attributes and sets | |
| Customers | FCFS queue of customers in system |
| Future event list | |
| FutureEventList | Priority-ordered list of pending events |
| Activity durations | |
| MeanInterArrivalTime | The interarrival time between the previous customer’s arrival and the next arrival |
| MeanServiceTime | The service time of the most recent customer to begin service |
| Input parameters | |
| MeanInterarrivalTime | Mean interarrival time (4.5 minutes) |
| MeanServiceTime | Mean service time (3.2 minutes) |
| SIGMA | Standard deviation of service time (0.6 minute) |
| TotalCustomers | The stopping criterion—number of customers to be served (1000) |
| Simulation variables | |
| Clock | The current value of simulated time |
| Statistical Accumulators | |
| LastEventTime | Time of occurrence of the last event |
| TotalBusy | Total busy time of server (so far) |
| MaxQueueLength | Maximum length of waiting line (so far) |
| SumResponseTime | Sum of customer response times for all customers who have departed (so far) |
| NumberOfDepartures | Number of departures (so far) |
| LongService | Number of customers who spent 4 or more minutes at the checkout counter (so far) |
| Summary statistics | |
| RHO =BusyTime/Clock | Proportion of time server is busy (here the value of Clock is the final value of simulated time) |
| AVGR | Average response time (equal to SumResponseTime/TotalCustomers) |
| PC4 | Proportion of customers who spent 4 or more minutes at the checkout counter |
| Functions | Description |
| 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 |
| Methods | Description |
| InitializationProcessArrivalProcessDepartureReportGeneration | Initialization 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.
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.
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.
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
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).
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.
Figure 8 Random-variate generators for the single-server queue simulation.
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 time | 4.50 minutes |
|---|---|
| Mean service time | 3.20 minutes |
| Standard deviation of service time | 0.60 minutes |
| Number of customers to be served | 1000 |
| Server utilization | 0.676 |
| Maximum line length | 7 |
| Average response time | 6.33 minutes |
| Proportion who spend four minutes or more in the system | 0.646 |
| Simulation runlength | 4767.27 minutes |
| Number of departures | 1000 |
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 CURRENT | TOTAL | BLOCK | CURRENT | TOTAL | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1003 | TER | 1000 | |||||||
| 2 | 1003 | |||||||||
| 3 | 3 | 1003 | ||||||||
| 4 | 1000 | |||||||||
| 5 | 1000 | |||||||||
| 6 | 1000 | |||||||||
| 7 | 1000 | |||||||||
| 8 | 1000 | |||||||||
| 9 | 1000 | |||||||||
| 10 | 646 | |||||||||
| –AVG-UTIL-DURING– | ||||||||||
| FACILITY | TOTAL | AVAIL | UNAVL | ENTRIES | AVERAGE | CURRENT | PERCENT | SEIZING | PREEMPTING | |
| TIME | TIME | TIME | TIME/XACT | STATUS | AVAIL | XACT | XACT | |||
| CHECKOUT | 0.676 | 1000 | 3.224 | AVAIL | ||||||
| QUEUE | MAXIMUM | AVERAGE | TOTAL | ZERO | PERCENT | AVERAGE | $ AVERAGE | QTABLE | CURRENT | |
| CONTENTS | CONTENTS | ENTRIES | ENTRIES | ZEROS | TIME/UNIT | TIME/UNIT | NUMBER | CONTENTS | ||
| SYSTIME | 8 | 1.331 | 1003 | 0 | 6.325 | 6.235 | 3 | |||
| LINE | 7 | 0.655 | 1003 | 334 | 33.3 | 3.111 | 4.665 | 3 | ||
| RANDOM | ANTITHETIC | INITIAL | CURRENT | SAMPLE | CHI-SQUARE | |||||
| STREAM | VARIATES | POSITION | POSITION | COUNT | UNIFORMITY | |||||
| 1 | OFF | 100000 | 103004 | 3004 | 0.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.
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
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 . 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 , where a and b are the endpoints of the interval, or by where m is the mean and h is the “spread” of the distribution. These four parameters are related by the equations
Some of the uniform-random-variate generators available require specification of a and others require m and h.
Some problems have activities that are assumed to be normally distributed, as denoted by , where is the mean and the variance. (Since activity times are nonnegative, the normal distribution is appropriate only if , 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.
Make the necessary modifications to the Java model of the checkout counter (Example 2) so that the simulation will run for exactly 60 hours.
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.
Implement the changes in Exercises 1 and 2 in any of the simulation packages.
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 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.
In Exercise 4, estimate the mean time that an ambulance takes to complete a call.
(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 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.
There are four agents at the check-in counter for Drafty Airlines at the Dusty Plains Airport. Passengers arrive for check-in every seconds. It takes seconds to check in a passenger. Drafty Airlines is going to replace the agents with automatic passenger check-in devices (APCID).AnAPCID takes 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.
A superhighway connects one large metropolitan area to another. A vehicle leaves the first city every 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 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?
People arrive at a meat counter at a rate of one every 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 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?
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?
In Exercise 9, simulate with x butchers, where . When all butchers are busy, a line forms. For each value of x, estimate the mean number of busy butchers.
A one-chair unisex hair shop has arrivals at the rate of one every 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 minutes, a style cut takes minutes, and a trim takes 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?
An airport has two concourses. Concourse 1 passengers arrive at a rate of one every seconds. Concourse 2 passengers arrive at a rate of one every seconds. It takes seconds to walk down concourse 1 and seconds to walk down concourse 2. Both concourses empty into the main lobby, adjacent to the baggage claim. It takes seconds to reach the baggage claim area from the main lobby. Only 60% of the passengers 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 . How close is the simulation estimate to the expected number? Why the difference if a difference exists?
In a multiphasic screening clinic, patients arrive at a rate of one every minutes to enter the audiology section. The examination takes 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 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.”)
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 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 minutes to complete, and general accounts take 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?
Repeat Exercise 15, but assume that customers join the shortest line for the teller handling their type of account.
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.
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:
| Machine | Time to Machine One Part |
|---|---|
| 1 | 20 ± 4 seconds |
| 2 | 10 ± 3 seconds |
| 3 | 15 ± 5 seconds |
Assume that parts arrive by conveyor at a rate of one every 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?
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 seconds. Al customers must pay a single cashier, which takes seconds. For all customers, eating takes minutes. After eating, 10% of the people go back for dessert, spending an additiona 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?
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 hours for a truck to make the trip. Forty percent of the drivers stop for coffee, which takes an additional 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?
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 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.
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 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 minutes and 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.
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.
U of LA (University of Lower Altoona) has only one color printer for student use. Students arrive at the color printer every minutes to use it for 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.
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 minutes; medium, every 15 minutes; and large, every minutes. If no cartons are removed, use simulation to determine how long will it take to fill an empty warehouse?
Go Ape! buys a Banana II computer to handle all of its web-browsing needs. Web-browsing employees arrive every minutes to use the computer. Web-browsing takes minutes. The monkeys that run the computer cause a system failure every minutes. The failure lasts for 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.
Able, Baker, and Charlie are three carhops at the Sonic Drive-In (service at the speed of sound!). Cars arrive every minutes. The carhops service customers at the rate of one every 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).
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 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.
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 minutes to handle a requisition. Al requisitions are then passed to a single cashier, who spends 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?
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 minutes. The others leave and do not return. One barber gives a haircut in 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?
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?
Two machines are available for drilling parts (A-type and B-type). A-type parts arrive at a rate of one every 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 minutes to complete. Simulate the completion of 100 A-type parts. Estimate the mean number ofA-type parts waiting to be drilled.
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 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.
Parts are machined on a drill press. They arrive at a rate of one every minutes, and it takes minutes to machine them. Every minutes, a rush job arrives, which takes 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.)
E-mail messages are generated at a rate of one every seconds for transmission one at a time. Transmission takes seconds. At intervals of minutes, urgent e-mail messages with transmission times of 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.
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 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.
A patient arrives at the Emergency Room at Hello Hospital about 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 minutes, but then their priority is reduced to 2 and they wait until a doctor is free again, when they receive further treatment for minutes and are then discharged. CW patients initially receive the priority 1 and are treated (when their turn comes) for minutes; their priority is then increased to 2, they wait again until a doctor is free and receive 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.)
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.
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.
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 Type | Percent | Mean (seconds) | σ (seconds) |
|---|---|---|---|
| 1 | 50 | 48 | 8 |
| 2 | 30 | 55 | 9 |
| 3 | 20 | 85 | 12 |
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.
- Shopping times at a department store have been found to have the following distribution:
| Shopping Time (minutes) | Number of Shoppers |
|---|---|
| 0–10 | 90 |
| 10–20 | 120 |
| 20–30 | 270 |
| 30–40 | 145 |
| 40–50 | 88 |
| 50–60 | 28 |
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.
- The interarrival time for parts needing processing is given as follows:
| Interarrival Time (seconds) | Proportion |
|---|---|
| 10–20 | 0.20 |
| 20–30 | 0.30 |
| 30–40 | 0.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 Type | Proportion | Mean | Standard Deviation |
|---|---|---|---|
| A | 0.5 | 30 seconds | 3 seconds |
| B | 0.3 | 40 seconds | 4 seconds |
| C | 0.2 | 50 seconds | 7 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?
- 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 Type | Percentage | Service Time (minutes) |
|---|---|---|
| A | 40 | N(6.1, 1.3) |
| B | 30 | N(9.1, 2.9) |
| C | 20 | N(11.8, 4.1) |
| D | 10 | N(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.
- 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 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 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 minutes requiring 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 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.
- 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 minutes. Rush jobs arrive every 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:
| Station | Number of Machines or Workers | Processing and/or Repair Times (minutes) | Description |
|---|---|---|---|
| A | 1 | Receiving clerk | |
| B | 3 | Disassembly and parts replacement | |
| C | 1 | 20 | Degreaser |
| D | 4 | Reassembly and adjustments | |
| E | 3 | Packing and shipping |
The times listed above hold for all jobs that follow one of the two sequences A B . However, about 10% of the jobs coming out of station D are sent back to B for further work (which takes 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?
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.)
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.
Forty people are waiting to pass through a turnstile that takes 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.
People borrow Gone with the Wind from the local library and keep it for 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.
Jobs arrive every 300 30 seconds to be handled by a process that consists of four operations: OP10 requires seconds, OP20 requires seconds, OP30 require seconds, OP40 requires seconds. Simulate this process until 250 jobs are completed; then combine the four operations of the job into one with the distribution seconds and simulate the process with this distribution. Does the average time in the system change for the two alternatives?
Two types ofjobs arrive to be processed on the same machine. Type 1 jobs arrive every seconds and require seconds for processing. Type 2 jobs arrive every seconds and require seconds for processing. For an 8-hour simulation, what is the average number of jobs waiting to be processed?
Two types ofjobs arrive to be processed on the same machine. Type 1 jobs arrive every 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 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.
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?
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 , where R is a uniformly distributed random number from 0 to 1 and LOG is the natural logarithm.]
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 . 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
The possible values of X are given by the range space of X, which is denoted by . Here Let X be a discrete random variable. With each possible outcome in , a number gives the probability that the random variable equals the value of x . The numbers must satisfy the following two conditions:
a., for all i
The collection of pairs . is called the probability distribution of X, and 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 . 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
| 1 | 2 | 3 | 4 | 5 | 6 | |
|---|---|---|---|---|---|---|
| 1/21 | 2/21 | 3/21 | 4/21 | 5/21 | 6/21 |
The conditions stated earlier are satisfied—that is, for and . 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 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
The function is called the probability density function (pdf) of the random variable X. The pdf satisfies the following conditions:
a. for all x in b. c. if x is not in As a result of Equation (1), for any specified value , because
Figure 2 Graphical interpretation of also means that the following equations hold:
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 . The pdf of the device’s lifetime, in years, is as follows:
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
Figure 3 pdf for inspection-device life.
1.3 Cumulative distribution function
The cumulative distribution function (cdf), denoted by , measures the probability that the random variable X assumes a value less than or equal to x, that is,.
If X is discrete, then
If X is continuous, then
Some properties of the cdf are listed here:
a. F is a nondecreasing function. If , then ).
b. lim c. lim All probability questions about X can be answered in terms of the cdf. For example,
For continuous distributions, not only does Equation (5) hold, but also the probabilities in Equation (2) are equal to
Example 4
The die-tossing experiment described in Example 2 has a cdf given as follows:
| x | |||||||
|---|---|---|---|---|---|---|---|
| F(x) | 0 | 1/21 | 3/21 | 6/21 | 10/21 | 15/21 | 21/21 |
where [a,. The cdf for this example is shown graphically in Figure 4.
If X is a discrete random variable with possible values , where , the cdf is a step function. The value of the cdf is constant in the interval and then takes a step, or jump, of size at . Thus, in Example 4,, which is the size of the step when
Figure 4 cdf for loaded-die example.
Example 5
The cdf for the device described in Example 3 is given by
The probability that the device will last for less than 2 years is given by
The probability that the life of the device is between 2 and 3 years is calculated as
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 , for discrete and continuous variables, is defined as follows:
and
The expected value E(X) of a random variable X is also referred to as the mean,, or the first moment of X. The quantity , is called the nth moment of X, and is computed as follows:
and
The variance of a random variable X denoted by V(X) or var(X) or , is defined by
A useful identity in computing V(X) is given by
The mean 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,, is a measure of the spread or variation of the possible values of X around the mean . The standard deviation, σ, is defined to be the square root of the variance,. The mean,, and the standard deviation,, 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:
To compute from Equation (10), first compute from Equation (8) as follows:
Thus,
and
Example 7
The mean and variance of the life of the device described in Example 3 are computed as follows:
To compute from Equation (10), first compute ) from Equation (9) as follows:
Thus,
giving
Statistical Models in Simulation
and
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 the second mechanic at time 7:13 (7 minutes, 13 seconds), and so on.
Table 1 Mechanics’ Arrival Data
| Arrival Number | Arrival (hour:minutes::seconds) | Interarrival Time (minutes::seconds) |
|---|---|---|
| 1 | 10:05::03 | — |
| 2 | 10:12::16 | 7::13 |
| 3 | 10:15::48 | 3::32 |
| 4 | 10:24::27 | 8::39 |
| 5 | 10:32::19 | 7::52 |
| 6 | 10:35::43 | 3::24 |
| 7 | 10:39::51 | 4::08 |
| 8 | 10:40::30 | 0::39 |
| 9 | 10:41::17 | 0::47 |
| 10 | 10:44::12 | 2::55 |
| 11 | 10:45::47 | 1::35 |
| 12 | 10:50::47 | 5::00 |
| 13 | 11:00::05 | 9::18 |
| 14 | 11:04::58 | 4::53 |
| 15 | 11:06::12 | 1::14 |
| 16 | 11:11::23 | 5::11 |
| 17 | 11:16::31 | 5::08 |
| 18 | 11:17::18 | 0::47 |
| 19 | 11:21::26 | 4::08 |
| 20 | 11:24::43 | 3::17 |
| 21 | 11:31::19 | 6::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 Period | Number of Arrivals | Time Period | Number of Arrivals |
|---|---|---|---|
| 1 | 1 | 6 | 1 |
| 2 | 2 | 7 | 3 |
| 3 | 1 | 8 | 3 |
| 4 | 3 | 9 | 2 |
| 5 | 4 | — | — |
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 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 if the jth experiment resulted in a success, and let 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,
and
For one trial, the distribution given in Equation (11) is called the Bernoulli distribution. The mean and variance of are calculated as follows:
and
3.2 Binomial distribution
The random variable X that denotes the number of successes in n Bernoulli trials has a binomia distribution given by , where
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 failures, each denoted by an F—that is,
where . There are
outcomes having the required number of and . 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 and variance . Then,
and the mean, E(X), is given by
and the variance V(X) is given by
Example 10
A production process manufactures computer chips on the average at 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 Bernoulli trials, each with ; then the total number of nonconforming chips in the sample, X, would have a binomial distribution given by
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:
The probability is calculated from
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
and the variance is given by
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 ). Under certain conditions on n and 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
The event occurs when there are failures followed by a success. Each of the failures has an associated probability of , and each success has probability Thus,
The mean and variance are given by
and
More generally, the negative binomial distribution is the distribution of the number of trials unti the kth success, for has a negative binomial distribution with parameter and k, then the distribution of Y is given by
Because we can think of the negative binomial random variable Y as the sum of independen geometric random variables, it is easy to see that and
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 and yields
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),
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
where α. One of the important properties of the Poisson distribution is that the mean and variance are both equal to α, that is,
The cumulative distribution function is given by
The pmf and cdf for a Poisson distribution with 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 per hour. The probability of three beeps in the next hour is given by Equation (19) with , as follows:
This same result can be read from the left side of Figure 7 or from Table A.4 by computing
Example 13
In Example 12, find the probability of two or more beeps in a 1-hour period.
The cumulative probability,, 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
where is the lead-time demand, is the demand during the ith time period, and T is the number of time periods during the lead time. Both and 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 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
The desired result occurs at , which can be found by using Table A.4 or by computation of
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
The cdf is given by

Figure 8 pdf and cdf for uniform distribution.
Note that
is proportional to the length of the interval, for all and satisfying The mean and variance of the distribution are given by
and
The pdf and cdf when and 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 and 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
Now, X is a uniform random variable on (0, 30). Therefore, the desired probability is given by
4.2 Exponential distribution
A random variable X is said to be exponentially distributed with parameter if its pdf is given by
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
Thus, the mean and standard deviation are equal. The cdf can be exhibited by integrating Equation (26) to obtain
Example 17
Suppose that the life of an industrial lamp, in thousands of hours, is exponentially distributed with failure rate (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 Equation (28) is used to compute F(3), obtaining
Regardless of the value of , 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 The probability that the industrial lamp will last between 2000 and 3000 hours is computed as
Again, from the cdf given by Equation (28),
One of the most important properties of the exponential distribution is that it is “memoryless,” which means that, for all and
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 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 , then the distribution of the remaining amount of time that it survives, namely , 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
Equation (28) can be used to determine the numerator and denominator of Equation (30), yielding
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:
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 as
By integrating Equation (31) by parts, it can be shown that
If is an integer, then, by using and applying Equation (32), it can be seen that
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 and θ if its pdf is given by
is called the shape parameter, and is called the scale parameter. Several gamma distributions for and various values of are shown in Figure 11.
The mean and variance of the gamma distribution are given by
and
The cdf of X is given by
Figure 11 pdfs for several gamma distributions with When 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 independent, exponentially distributed random variables, each with parameter , then X has a gamma distribution with parameters and θ. Thus, i
where the pdf of is given by
and the are mutually independent, then X has the pdf given in Equation (34). Note that, when , an exponential distribution results. This result follows from Equation (38) or from letting 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 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 . However, when 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,
The expected value of each of the exponentially distributed is given by . Thus,
If the random variables are independent, the variance of their sum is the sum of the variances, or
When , a positive integer, the cdf given by Equation (37) may be integrated by parts, giving
which is the sum of Poisson terms with mean . 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 :
In this case, the total system lifetime is given by Equation (38) with bulbs and per hour, so per hour. Thus, can be determined from Equation (39) as follows:
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, stages and , so that per minute. Thus, can be calculated from Equation (39) as follows:
The cumulative Poisson distribution, shown in Table A.4, can be used to calculate that
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):
In addition, the variance of X is minutes^2—incidentally, the mode of the Erlang distribution is given by
Thus, the modal value in this example is
4.5 Normal distribution
A random variable X with mean and variance has a normal distribution if it has the pdf
Figure 12 pdf of the normal distribution.
The normal distribution is used so often that the notation ) has been adopted by many authors to indicate that the random variable X is normally distributed with mean and variance The normal pdf is shown in Figure 12.
Some of the special properties of the normal distribution are listed here:
a. lim and lim the value off(x) approaches zero as x approaches negative infinity and, similarly, as x approaches positive infinity.
b.; the pdf is symmetric about .
c. The maximum value of the pdf occurs at the mean and mode are equal.
The cdf for the normal distribution is given by
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 . However, a transformation of variables,, allows the evaluation to be independent of and . If , let to obtain
Figure 13 pdf of the standard normal distribution.
The pdf
is the pdf of a normal distribution with mean 0 and variance 1. Thus, and it is said tha has a standard normal distribution. The standard normal distribution is shown in Figure 13. The cdf for the standard normal distribution is given by
Equation (45) has been widely tabulated. The probabilities for 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 . Compute ). Using Equation (43), we get
from Table A.3. The intuitive interpretation is shown in Figure 14. Figure shows the pdf of with the specific value,, marked. The shaded portion is the desired probability. Figure 14(b) shows the standard normal distribution o ) with the value 2 marked; is 2σ (where 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 . The probability that the vessel will be loaded in less than 10 hours is given by , where
The value of is looked up in Table A.3 by using the symmetry property of the normal distribution. Note that . 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 [From this logic, it can be seen that and . In general, 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 ]. Now,. The standardized normal in Figure 16(b) is used to evaluate . Thus,. (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
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 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 The probability that an arriving customer waits between 14 and 17 minutes is computed as follows:
The shaded area shown in Figure 18(a) represents the probability . The shaded area shown in Figure 18(b) represents the equivalent probability,), for the standardized normal distribution. From Table A.3,. Now,
(b)
Figure 18 Transformation to standard normal for cafeteria problem.. Thus,. 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 such that , as shown by the shaded area in Figure 19(a). The equivalent problem is shown as the shaded area in Figure 19(b). Now,
or, equivalently,
From Table A.3, it can be seen that (1.645) 0.95. Thus, can be found by solving
(a)
Figure 19 Finding for lead-time-demand problem.
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
The three parameters of the Weibull distribution are ν, which is the location parameter; α, which is the scale parameter; and , which is the shape parameter. When , the Weibull pdf becomes
Figure ^20 Weibull pdfs for ν = 0; α = 1; β = ^1 , 1, 2, 4.
Figure 20 shows several Weibull densities when and . When , the Weibul distribution is reduced to
which is an exponential distribution with parameter The mean and variance of the Weibull distribution are given by the following expressions:
where 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
Example 25
The time to failure for a component is known to have a Weibull distribution with and . The mean time to failure is given by Equation (48) as
The probability that a unit fails before 2000 hours is computed from Equation (50) as
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 minutes, minutes, and . Find the probability that an incoming airplane will take more than 1.5 minutes to land and clear the runway. In this case is computed as follows:
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
where . The mode occurs at . A triangular pdf is shown in Figure 21. The parameters can be related to other measures, such as the mean and the mode, as follows:
Figure 21 pdf of the triangular distribution.
From Equation (52) the mode can be determined as
Because
The mode is used more often than the mean to characterize the triangular distribution. As is shown in Figure 21, its height is above the x axis. The variance,, of the triangular distribution is left as an exercise for the student. The cdf for the triangular distribution is given by
Example 27
The central processing unit requirements, for programs that will execute, have a triangular distribution with milliseconds, milliseconds, and 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
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 , and the value of b can be found from Equation (53):
The height of the mode is . 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
Thus, the median is between b and c. Setting in Equation (54) and solving for x median yields
with
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
where . The mean and variance of a lognormal random variable are
Three lognormal pdfs, all having mean 1, but variances , 1, and 2, are shown in Figure 23.
Notice that the parameters and are not the mean and variance of the lognormal. These parameters come from the fact that when Y has a ) distribution then has a lognorma distribution with parameters and . If the mean and variance of the lognormal are known to be and , respectively, then the parameters and are given by
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 and . Thus, from Equations (58) and (59),
4.9 Beta distribution
A random variable X is beta distributed with parameters and if its pdf is given by
where . 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 , with , rather than (0, 1). This is easily accomplished by defining a new random variable
The mean and variance of Y are given by
and
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 defined for all . 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 , the value is an observation of a random variable where the only possible values that can be assumed by N(t) are the integers The counting process,, is said to be a Poisson process with mean rate λ if the following assumptions are fulfilled:
a. Arrivals occur one at a time.
b. has stationary increments: The distribution of the number of arrivals between t and 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. 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 is equal to n is given by
Comparing Equation (63) to Equation (19), it can be seen that has the Poisson distribution with parameter . Thus, its mean and variance are given by
For any times s and t such that the assumption of stationary increments implies that the random variable , representing the number of arrivals in the interval from s to t, is also Poisson-distributed with mean . Thus,
and
Now, consider the time at which arrivals occur in a Poisson process. Let the first arrival occur at time , the second occur at time , and so on, as shown in Figure 25.
Thus,. 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
and, therefore,
the last equality following from Equation (63). Thus, the probability that the first arrival will occur in [0, t] is given by
which is the cdf for an exponential distribution with parameter λ. Hence, is distributed exponentially with mean . It can also be shown that all interarrival times, are
Figure 25 Arrival process.
exponentially distributed and independent with mean . 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 , 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 jobs per hour. Therefore, the interarrival times are distributed exponentially, with the expected time between arrivals being 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 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 and type II event with probability , independently of all other events.
Let and be random variables that denote, respectively, the number of type I and type II events occurring in [0, t]. Note that ). It can be shown that and are both Poisson processes having rates and , 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 and are as just defined, both variables follow the Poisson process, with rates and , respectively.
Example 32
The rate in Example 31 is per hour. The probability that no high-priority jobs will arrive in a 2-hour period is given by the Poisson distribution with parameter . Thus,
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 are random variables representing independent Poisson processes with rates , for and 2, then is a Poisson process with rate
Figure 27 Pooled process.
Example 33: Pooled Process
A Poisson arrival stream with arrivals per hour is combined (or pooled) with a Poisson arrival stream with arrivals per hour. The combined process is a Poisson process with 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 , 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
To be useful as an arrival-rate function, λ(t) must be nonnegative and integrable. For a stationary Poisson process with rate λ we have , as expected.
Let . be the arrival times of stationary Poisson process with , and let . be the arrival times for an NSPP with arrival rate ). The fundamental relationship for working with NSPPs is the following:
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
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 correspond to 8 A.M. Then this situation could be modeled as an NSPP with rate function
The expected number of arrivals by time t is therefore
Notice that computing the expected number of arrivals for 4 requires that the integration be done in two parts:
Since 2 P.M. and 11 A.M. correspond to times 6 and 3, respectively, we have
where 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 Party | Frequency | Relative Frequency | Cumulative Relative Frequency |
|---|---|---|---|
| 1 | 30 | 0.10 | 0.10 |
| 2 | 110 | 0.37 | 0.47 |
| 3 | 45 | 0.15 | 0.62 |
| 4 | 71 | 0.24 | 0.86 |
| 5 | 12 | 0.04 | 0.90 |
| 6 | 13 | 0.04 | 0.94 |
| 7 | 7 | 0.02 | 0.96 |
| 8 | 12 | 0.04 | 1.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) | Frequency | Relative Frequency | Cumulative Frequency |
|---|---|---|---|
| 0 < x ≤ 0.5 | 21 | 0.21 | 0.21 |
| 0.5 < x ≤ 1.0 | 12 | 0.12 | 0.33 |
| 1.0 < x ≤ 1.5 | 29 | 0.29 | 0.62 |
| 1.5 < x ≤ 2.0 | 19 | 0.19 | 0.81 |
| 2.0 < x ≤ 2.5 | 8 | 0.08 | 0.89 |
| 2.5 < x ≤ 3.0 | 11 | 0.11 | 1.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
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?
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?
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.
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?
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?
For the random variables and , which are exponentially distributed with parameter compute 7. Show that the geometric distribution is memoryless.
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?
- 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?
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?
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?
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%.
A random variable X that has pmf given by ) over the range is said to have a discrete uniform distribution.
(a) Find the mean and variance of this distribution. Hint:
(b) If , compute the mean and variance of .
- The lifetime, in years, of a satellite placed in orbit is given by the following pdf:
(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?
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.
(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 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?
For an exponentially distributed random variable X, find the value of λ that satisfies the following relationship:
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?
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?
- 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.
- 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?
Determine the variance V(X) of the triangular distribution.
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?
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?
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.
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?
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?
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?
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?
- 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?
- A random variable X is beta distributed if its pdf is given by
Show that the beta distribution becomes the uniform distribution over the unit interval when 32. 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?
Lifetime of an inexpensive video card for a PC, in months, denoted by the random variable X, is gamma distributed with and . What is the probability that the card will last for at least 2 years?
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.]
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
Given the following distributions:
Normal (10, 4)
Triangular (4, 10, 16)
Uniform (4, 16)
find the probability that for each of the distributions.
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.
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?
- 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 are n independent normal random variables, and if has mean and variance , then the sum
is normal with mean and variance 40. The circumferences of battery posts in a nickel-cadmium battery are Weibull-distributed with centimeters, centimeters, and (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?
- The time to failure of a nickel-cadmium battery is Weibull-distributed with parameters ν 0, α 1/2 years, and (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?
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.
The time to failure on an electronic subassembly can be modeled by a Weibull distribution whose location parameter is 0, α 1000 hours, and (a) What is the mean time to failure?
(b) What fraction of these subassemblies will fail by 3000 hours?
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.
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?
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 Place | N(38, 16) |
|---|---|
| Windsor Parkway | N(99, 29) |
| Knob Hill Apartments | N(85, 25) |
| Evergreen Drive | N(73, 20) |
| Chastain Shopping Center | N(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.]
The time to failure of a WD-1 computer chip is known to be Weibull-distributed with parameters , and . Find the fraction expected to survive 600 days.
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.
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.
(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?
- The time to failure of Eastinghome light bulbs is Weibull-distributed with hours, hours, and (a) What fraction of bulbs are expected to last longer than the mean lifetime?
(b) What is the median lifetime of a light bulb?
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?
Let time 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
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
| System | Customers | Server(s) |
|---|---|---|
| Reception desk | People | Receptionist |
| Repair facility | Machines | Repair person |
| Garage | Trucks | Mechanic |
| Airport security | Passengers | Baggage x-ray |
| Hospital | Patients | Nurses |
| Warehouse | Pallets | Fork-lift Truck |
| Airport | Airplanes | Runway |
| Production line | Cases | Case-packer |
| Warehouse | Orders | Order-picker |
| Road network | Cars | Traffic light |
| Grocery | Shoppers | Checkout station |
| Laundry | Dirty linen | Washing machines/dryers |
| Job shop | Jobs | Machines/workers |
| Lumberyard | Trucks | Overhead crane |
| Sawmill | Logs | Saws |
| Computer | CPU, disk | |
| Telephone | Calls | Exchange |
| Ticket office | Football fans | Clerk |
| Mass transit | Riders | Buses, 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 represents the interarrival time between customer n 1 and customer n is the actual arrival time of the firs customer), then, for a Poisson arrival process, is exponentially distributed with mean 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 . be the successive runtimes of customer i; let . be the corresponding successive service times; and let . be the corresponding waiting times for service to begin on each visit to the queueing system. Thus, 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 , 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 . They may be constant or of random duration. In the latter case, 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 , multiple server , 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 . 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),(Erlang of order k), PH (phase-type), H (hyperexponential), G (arbitrary or general), and GI (genera independent).
For example, 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, is often shortened to . The nurse attending 5 hospital patients might be represented by 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
| Steady-state probability of having n customers in system | |
|---|---|
| Probability of n customers in system at time t | |
| Arrival rate | |
| Effective arrival rate | |
| Service rate of one server | |
| Server utilization | |
| Interarrival time between customers n - 1 and n | |
| Service time of the nth arriving customer | |
| Total time spent in system by the nth arriving customer | |
| Total time spent waiting in queue by customer n | |
| The number of customers in system at time t | |
| The number of customers in queue at time t | |
| L | Long-run time-average number of customers in system |
| Long-run time-average number of customers in queue | |
| w | Long-run average time spent in system per customer |
| Long-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 , the long-run average time spent in system (w) and in the queue 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 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 customers.
This section defines the major measures of performance for a general 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 , and let denote the number of customers in the system at time t. A simulation of such a system is shown in Figure Let denote the total time during [0, T] in which the system contained exactly i customers. In Figure it is seen that , and . (The line segments whose lengths tota
Figure 6 Number in system, L(t), at time t. are labeled in Figure 6, etc.) In general,. The time-weighted-average number in a system is defined by
For Figure customers. Notice that is the proportion of time the system contains exactly i customers. The estimator is an example of a time-weighted average.
By considering Figure it can be seen that the total area under the function can be decomposed into rectangles of height i and length . For example, the rectangle of area has base running from (thus however, most of the rectangles are broken into parts, such as the rectangle of area which has part of its base between and and the remainder from to (thus . It follows that the total area is given by , and, therefore, that
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 gets large, the observed time-average number in the system approaches a limiting value, say which is called the long-run time-average number in system—that is, with probability 1,
The estimator is said to be strongly consistent for L. If simulation run length T is sufficiently long, the estimator becomes arbitrarily close to L. Unfortunately, for 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 denotes the number of customers waiting in queue, and denotes the tota time during in which exactly i customers are waiting in queue, then
where is the observed time-average number of customers waiting in queue from time 0 to time T and is the long-run time-average number waiting in queue.
Example 3
Suppose that Figure 6 represents a single-server queue—that is, a queueing system . Then the number of customers waiting in queue is given by , defined by
and shown in Figure 7. Thus,, and . Therefore,
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 , 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
For stable systems, as
with probability 1, where w is called the long-run average system time.
Figure 7 Number waiting in queue,, at time t.
If the system under consideration is the queue alone, Equations (5) and (6) are written as
where is the total time customer i spends waiting in queue, is the observed average time spent in queue (called delay), and is the long-run average delay per customer. The estimators w and are influenced by initial conditions at time 0 and the run length T, analogously to
Example 4
For the system history shown in Figure 6, customers arrive,, and but , and 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 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 , and therefore
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 , and thus,
Equation (8) can also be derived by reconsidering Figure 6 in the following manner: Figure 8 shows system history,, exactly as in Figure 6, with each customer’s time in the system, 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 for each . 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,
Therefore, by combining Equations (2) and (5) with , it follows that
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 for single-server FIFO system.
Technical note: If is the system time for customer i during [0, T], then Equation (10) and hence Equation (8) hold exactly. Some authors choose to define as total system time for customer i; this change will affect the value of 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 , 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 is defined over a specified time interval [0, T]. Long-run server utilization is denoted by For systems that exhibit long-run stability,
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 (total busy time)
Server utilization in G/G/1/∞/∞ queues
Consider any single-server queueing system with average arrival rate λ customers per time unit, average service time time units, and infinite queue capacity and calling population. Notice that implies that, when busy, the server is working at the rate customers per time unit, on the average; 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),, can be applied to the server. For stable systems, the average arrival rate to the server, say , must be identical to the average arrival rate to the system, λ (certainly stomers cannot be served faster than they arrive—but, if , then the waiting line would tend to grow in length at an average rate of customers per time unit, and so we would have an unstable system). For the server subsystem, the average system time is . 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,, is given by
In this case, 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 . Combining these results into for the server subsystem yields
Figure 9 Number being served,, at time t.
that 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
or
If the arrival rate is greater than the service rate , 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 customers per time unit, because departures will be occurring at rate per time unit. For stable single-server systems , long-run measures o performance such as average queue length (and also , and are well defined and have meaning. For unstable systems , long-run server utilization is 1, and long-run average queue length is infinite; that is,
Similarly,. Therefore these long-run measures of performance are meaningless for unstable queues. The quantity 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 customers per time unit. From Equation (9),, 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 , is given by
Clearly,. The long-run average server utilization is defined by
and so . The utilization can be interpreted as the proportion of time an arbitrary server is busy in the long run.
The maximum service rate of the system is , 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 that is, the system is stable if and only if
or, equivalently, if the offered load is less than the number of servers c., 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 customers per time unit. Such a system is unstable, and the long-run performance measures , and 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 given by Equation (13) is still the average number o busy servers, but as given by Equation (14), cannot be applied to an individual server. Instead, must be interpreted as the average utilization of all servers.
Example 6
Customers arrive at random to a license bureau at a rate of customers per hour. Currently, there are 20 clerks, each serving customers per hour on the average. Therefore the long-run, or steady-state, average utilization of a server, given by Equation (14), is
and the average number of busy servers is
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
or . Thus, possibilities for the manager to consider include or . Notice that guarantees long-run stability only in the sense that all servers, when busy, can handle the incoming work load on average. The office manager could well desire to have more than the minimum number of servers 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
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,. Consider a queue, that is, a single-server queue with arrival rate , service rate , and utilization At one extreme, consider the queue, which has deterministic arrival and service times. Then all interarrival times are equal to , and all service times are equal to 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 , and . By varying and 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 minutes with the ith patient, where
Thus, arrivals are deterministic but services are stochastic (or probabilistic), with mean and variance given by
Figure 11 Number of patients in the doctor’s office at time t.
and
Here,, 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,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 . The occurrence of a relatively long service time (here 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 hours in the queue, then is the tota cost of the N customers who arrive during the simulation. Thus, the average cost per customer is
by Equation (7). If customers per hour arrive (on the average), the average cost per hour is
the last equality following by Equation (8). An alternative way to derive the average cost per hour is to consider Equation (2). If is the total time over the interval [0, T] that the system contains exactly i customers, then $10 is the cost incurred by the system during the time exactly i customers are present. Thus, the total cost is ), and the average cost per hour is
by Equation (2). In these cost expressions, may be replaced by (if the long-run number in queue is known), or by L or (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 have utilization and each server imposes a cost of $5 per hour while busy, the total server cost per hour is
because 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
because 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,, 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 . 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,
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 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 , the time-average number of customers in the system, can be computed as
where 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:
where is the arrival rate and is the service rate per server.
For the queues considered in this section to have a statistical equilibrium, a necessary and sufficient condition is that , where λ is the arrival rate, 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,), satisfies For models with finite system capacity or finite calling population, the quantity may assume any positive value.
Table 3 Steady-State Parameters of the Queue
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 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 hour, the service rate is per hour and minutes^2 1/9 hour^2. The “customers” are the people needing shoe repair, and the appropriate model is the queue, because only the mean and variance of service times are
known, not their distribution. The proportion of time the worker is busy is and, by Table 3, the steady-state time average number of customers in the shop is
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 queue. For example, may be rewritten as
The first term involves only the ratio of the mean arrival rate λ to the mean service rate . As shown by the second term, if λ and are held constant, the average length of the waiting line depends on the variability,, 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 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 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, per minute, minutes, minutes^2,, and the average queue length is computed as
For Baker, per minute, minutes, minutes^2, and the average queue length is
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,, Baker wins. On the other hand, the proportion of arrivals who would find Able idle and thus experience no delay is , but the proportion who would find Baker idle and thus experience no delay is One case of the 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 queue are exponentially distributed, with mean then the variance as given by Equation and The mean and standard deviation of the exponential distribution are equal, so the 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 into the formulas in Table 3. Alternatively, L may be computed by Equation (16) from the steady-state probabilities given in Table 4, and then w,, and may be computed from the equation in (17). The student can show that the two expressions for each parameter are equivalen by substituting into the right-hand side of each equation in Table 4.
Table 4 Steady-State Parameters of the Queue
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 are 2 per hour and 3 per hour, respectively—that is, the time between arrivals averages hour, exponentially distributed, and the service time averages 20 minutes, also exponentially distributed. The server utilization and the probabilities for , and 4 or more customers in the shop are computed as follows:
From the calculations, the probability that the hair stylist is busy is ; 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
The average time an arrival spends in the system can be obtained from Table 4 or Equation (17) as
The average time the customer spends in the queue can be obtained from Equation (17) as
From Table 4, the time-average number in the queue is given by
Finally, notice that multiplying through by and using Little’s equation (9) yields
Example 11
For the queue with service rate 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 || 5.0 | 6.0 | 7.2 | 8.64 | 10.0 |
| 0.500 | 0.600 | 0.720 | 0.864 | 1.0 | |
|---|---|---|---|---|---|
| 1.00 | 1.50 | 2.57 | 6.35 | ||
| 0.20 | 0.25 | 0.36 | 0.73 |
For any queue, if , waiting lines tend to continually grow in length; the long-run measures of performance, w, and are all infinite ; and a steadystate probability distribution does not exist. As is shown here for , if 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 . 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 per hour, and management has a choice of two servers, one who works at rate customers per hour and the second at rate customers per hour, the respective utilizations are and . If the queue is used as an approximate model, then, with the first server, the average number in the system would be, by Table 4,
and, with the second server, the average number in the system would be
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 queue, if lines are too long, they can be reduced by decreasing the server utilization or by decreasing the service time variability . These remarks hold for almost all queues, notjust the queue. The utilization factor can be reduced by decreasing the arrival rate , by increasing the service rate or by increasing the number of servers, because, in general,), 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
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,, so . For Erlang service times of order and , so . For exponentia service times at service rate , the mean service time is and the variance is so . If service times have standard deviation greater than their mean ), 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 for any queue can be rewritten in terms of the coefficient of variation by noticing that . Therefore,
The first term,, is for an queue. The second term,, corrects the formula to account for a nonexponential service-time distribution. The formula for can be obtained from the corresponding formula by applying the same correction factor. These factors, and , provide some insight into the relative impact of server utilization and server variability on queue congestion: explodes as while increasing linearly in for fixed
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 . 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 , an arrival will enter an available channel. However, when , a queue will build if arrivals occur.
The offered load is defined by , 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 , the waiting line grows in length at the rate customers per time unit, on the average. Customers are entering the system at rate per time unit but are leaving the system at a maximum rate of per time unit.
For the queue to have statistical equilibrium, the offered load must satisfy , in which case , 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 , the probability that the system is empty,, the probability that all servers are busy, denoted by , where is a random variable representing the number in system in statistical equilibrium (after a very long time). Thus, The value of is necessary for computing all the measures of performance, and the equation for 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 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-ρ) |
| L | cρ + (cρ)c+1P0/c(c!(1-ρ)2) = cρ + ρP(L(∞)≥c)/1-ρ |
| w | L/λ |
| wQ | w - 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 , 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
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, per minute, and per minute. The offered load is greater than 1:
so more than one server is needed if the system is to have a statistical equilibrium. The requirement for steady state is that . Thus at least attendants are needed. The quantity 4/3 is the expected number of busy servers, and for is the long-run proportion of time each server is busy. (What would happen if there were only server?)
Let there be attendants. First, is calculated as
Next, the probability that all servers are busy is computed as
Thus, the time-average length of the waiting line of mechanics is
and the time-average number in system is given by
From Little’s relationships, the average time a mechanic spends at the tool crib is
and the average time spent waiting for an attendant is
An Approximation for the M/G/c/∞ Queue
Recall that formulas for and for the queue can be obtained from the corresponding formulas by multiplying them by the correction factor , as in Equation (18). Approximate formulas for the queue can be obtained by applying the same correction factor to the formulas for and (no exact formula exists for . 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 model, rather than an . The mean service time is 40 seconds, so the coefficient o variation of the service time is
Therefore, the accuracy of and can be improved by the correction factor
For example, when there are attendants,
Notice that, because the coefficient of variation of the service time is less than 1, the congestion in the system, as measured by , is less than in the corresponding model.
The correction factor applies only to the formulas for and . Little’s formula can then be used to calculate L and w. Unfortunately, there is no general method for correcting the steady-state probabilities,
when each customer is its own server—in other words, in a self-service system;
when service capacity far exceeds service demand, as in a so-called ample-server system; and
when we want to know how many servers are required so that customers will rarely be delayed.
The steady-state parameters for the queue are listed in Table 6. In the table, λ is the arrival rate of the Poisson arrival process, and is the expected service time of the general service-time distribution (including exponential, constant, or any other).
Table 6 Steady-State Parameters for the Queue
| 0 | |
| 0 | |
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 per hour, according to a Poisson process, and stay connected for an average of 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 model of the system implies that the expected number of simultaneous users is , 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
The capacity simultaneous users satisfies this requirement.
Table 7 Steady-State Parameters for the Queue
The effective arrival rate is defined as the mean number of arrivals per time unit who enter and remain in the system. For all systems,; for the unlimited-capacity systems,; but, for systems such as the present one, which turn customers away when full,. The effective arrival rate is computed by
because 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 , λ must be replaced by
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 To calculate the performance measures, first compute
The probability that there are three customers in the system (the system is full) is
Then, the average length of the queue (customers waiting for a haircut) is given by
Now, the effective arrival rate is given by
Therefore, from Little’s equation, the expected time spent waiting in queue is
and the expected total time in the shop is
One last application of Little’s equation gives the expected number of customers in the shop (in queue and getting a haircut) as
Notice that 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
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 can assume any positive value and no longer equals the server utilization . 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 time units; service times are also exponentially distributed, with mean 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 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 Queue
The effective arrival rate 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, and . Compute the various measures of performance for this system.
All of the performance measures depend on , which is
Figure 14 MATLAB procedure to calculate for the queue.
From we can obtain the other , from which we can compute the average number of machines waiting for service,
the effective arrival rate,
and the average waiting time in the queue,
Similarly, we can compute the expected number of machines being serviced or waiting to be serviced,
The average number of machines being serviced is given by
Each machine must be running, waiting to be serviced, or in service, so the average number of running machines is given by
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
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
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 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:
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.
If customers arrive to queue i at rate , and a fraction of them are routed to queue j upon departure, then the arrival rate from queue i to queue , over the long run.
The overall arrival rate into queue , is the sum of the arrival rate from all sources. If customers arrive from outside the network at rate then
- If queue j has parallel servers, each working at rate , then the long-run utilization of each server is
and is required for the queue to be stable.
- If, for each queuej, arrivals from outside the network form a Poisson process with rate and if there are identical servers delivering exponentially distributed service times with mean (where may be , then, in steady state, queuej behaves like an queue with arrival rate
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 per hour, and the arrival rate to service center 2 is per hour. Suppose that each of the clerks at service center 2 works at the rate customers per hour. Then the long-run utilization of the clerks is
All customers must see the cashier at service center 3. The overall arrival rate to service center 3 is 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 per hour, then the utilization of the cashier is
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 servers, each working at rate drivers per hour drivers per minute), the written test station being queue 2 (with servers, because any number of people can be taking the written test simultaneously, and mean service time minutes), and with the photo station being queue 3 (with server working at rate 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 arrivals per hour throughou the day.
The arrival rates to each queue are as follows:
Notice that arrivals from outside the network occur only at queue 1, so and Solving this system of equations gives and . The analyst chooses to work in minutes, and so converts these to per minute and 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 , since the manager believes the picture-taking times are quite variable, and harmless for queue 2 because the results for infinite-server queues depend only on the service rate, not the distribution. However, the coefficient of variation of the check-in time is so the analyst decides to also apply the correction 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 queue, the testing station as an queue, and the photo station as an queue. Thus, under the current set-up, the check-in station is an ; using the formulas in Table 5 and multiplying by 0.52 gives 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 queue, giving minutes; adding a second photo station 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 queue in Table 6. For instance, the expected number of people taking the test at any time is , which will be unaffected by changes in the number of clerks or photo stations, since they do not change or
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 , w,, and , 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 are generally increasing functions of the variance of interarrival times and service times (recall the 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, 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 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 for the number of servers, 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 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
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?
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?
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?
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?
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?
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, for this system. [Hint: The variance of the sum of independent random variables is the sum of the variance.]
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.
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.
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?
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?
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?
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?
Consider the following information for a finite calling population problem with exponentially distributed runtimes and service times:
Compute and . Find the value of λ such that 14. 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.
- Repeat Exercise 14, but assuming that
(a) Figure 6 represents a FIFO system with servers.
(b) Figure 6 represents a LIFO system with servers.
- Consider an queue with the following type of service distribution: Customers request one of two types of service, in the proportions and . Type-i service is exponentially distributed at rate . Let denote a type-i service time and X an arbitrary service time. Then and
The random variable X is said to have a hyperexponential distribution with parameters (a) Show that (b) Use to show (c) For any hyperexponential random variable, if and , show that its coefficient of variation is greater than 1; that is,. 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 , by using parts (a) and (b), can be manipulated into the form (d) Many choices of , andp lead to the same overall mean and . If a distribution with mean and coefficient of variation is desired, find values of and to achieve this. [Hint: Choose arbitrarily; then solve the following equations for and ]
In Example compare the systems with , and servers on the basis of server utilization (the proportion of time a typical server is busy).
In Example 17, increase the number of machines by 2, then compare the systems with , and servers on the basis of server utilization (the proportion of time a typical server is busy).
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.
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.]
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.]
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?
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.
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.
Find examples of queueing models used in real applications. A good source is the journal Interfaces.
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 queue with arrival rate 2λ and service rate µ for each server.
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?
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?
- 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,, must have two important statistical properties: uniformity and independence. Each random number must be an independent sample drawn from a continuous uniform distribution between zero and 1—that is, the pdf is given by
This density function is shown in Figure 1. The expected value of each is given by
Figure 1 pdf for random numbers.
and the variance is given by
Some consequences of the uniformity and independence properties are the following:
If the interval [0, 1] is divided into n classes, or subintervals of equal length, the expected number of observations in each interval is where N is the total number of observations.
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:
The generated numbers might not be uniformly distributed.
The generated numbers might be discrete-valued instead of continuous-valued.
The mean of the generated numbers might be too high or too low.
The variance of the generated numbers might be too high or too low.
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:
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.
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.
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.
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.
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,. between zero and by following a recursive relationship:
The initial value is called the seed, a is called the multiplier, c is the increment, and m is the modulus. If in Equation (1), then the form is called the mixed congruential method. When , the form is known as the multiplicative congruential method. The selection of the values for , and 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 . Random numbers between zero and 1 can then be generated by setting
An example will illustrate how this technique operates.
Example 1
Use the linear congruential method to generate a sequence of random numbers with , and The sequence of seeds and subsequent random numbers , is computed as follows:
Recall that mod m provided that is divisible by m with no remainder; otherwise, the mod operation returns the remainder of . Thus, mod 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 . 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 , because each X is an integer in the set . Thus, each 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 and are in common use in generators appearing in many simulation languages.) By maximum density is meant that the values assumed by , 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 , and [Law 2007].
For m a power of , say , and , the longest possible period is which is achieved whenever c is relatively prime to m (that is, the greatest common factor of c and m is 1) and , where k is an integer.
For m a power of , and , the longest possible period is which is achieved if the seed is odd and if the multiplier a is given by or , for some , 1, . . . .
For m a prime number and , the longest possible period is , which is achieved whenever the multiplier a has the property that the smallest integer k such that is divisible by m is
Example 2
Using the multiplicative congruential method, find the period of the generator for 64, and , 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, and . The maximal period is therefore . Notice that this period is achieved by using odd seeds, and ; even seeds, and yield the periods 8 and 4, respectively, both less than the maximum. Notice that is of the form with , as is required to achieve maximal period.
When , the generated sequence assumes values from the set The gaps in the sequence of generated random numbers are quite large (i.e., the gap is 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 and Table 1 Period Determination Using Various Seeds
| i | ||||
|---|---|---|---|---|
| 0 | 1 | 2 | 3 | 4 |
| 1 | 13 | 26 | 39 | 52 |
| 2 | 41 | 18 | 59 | 36 |
| 3 | 21 | 42 | 63 | 20 |
| 4 | 17 | 34 | 51 | 4 |
| 5 | 29 | 58 | 23 | |
| 6 | 57 | 50 | 43 | |
| 7 | 37 | 10 | 47 | |
| 8 | 33 | 2 | 35 | |
| 9 | 45 | 7 | ||
| 10 | 9 | 27 | ||
| 11 | 53 | 31 | ||
| 12 | 49 | 19 | ||
| 13 | 61 | 55 | ||
| 14 | 25 | 11 | ||
| 15 | 5 | 15 | ||
| 16 | 1 | 3 |
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 . After ordinary arithmetic yields a value for is obtained by dropping the leftmost binary digits in and then using only the b rightmost binary digits. The following example illustrates, by analogy, this operation using , because most human beings think in decimal representation.
Let , and generate a sequence of random integers using Equation (1).
When m is a power of 10, say , the modulo operation is accomplished by saving the b rightmost (decimal) digits. By analogy, the modulo operation is most efficient for binary computers when for some
Example 4
The last example in this section is in actual use. It has been extensively tested [Learmonth and Lewis, 1973; Lewis et , 1969]. The values for and m have been selected to ensure that the characteristics desired in a generator are most likely to be achieved.
Let , and (a prime number). These choices satisfy the conditions that ensure a period of (well over 2 billion). Further, specify the seed . The first few numbers generated are as follows:
Notice that this method divides by instead of however, for such a large value of 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 , 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 are any independent, discrete-valued random variables (not necessarily identically distributed), but one of them, say , is uniformly distributed on the integers from 0 to then
is uniformly distributed on the integers from 0 to To see how this result can be used to form combined generators, let be the ith output from k different multiplicative congruential generators, where thejth generator has prime modulus and the multiplier is chosen so that the period is . Then the jth generator is producing integers that are approximately uniformly distributed on the integers from 1 to and is approximately uniformly distributed on the integers from 0 to . L’Ecuyer therefore suggests combined generators of the form
with
Notice that the coefficient implicitly performs the subtraction for example, if then The maximum possible period for such a generator is
which is achieved by the generator described in the next example.
Example 5
For 32-bit computers, L’Ecuyer [1988] suggests combining generators with , and . This leads to the following algorithm:
- Select seed in the range [1, 2,147,483,562] for the first generator, and seed in the range [1, 2,147,483,398] for the second.
- Evaluate each individual generator.
- Set.
- Return.
- Set and go to Step 2.
This combined generator has period . 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 . 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 that initializes the random-number sequence. Since the sequence of integers X , 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 (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
for . Values of were common in older generators, but values as large as 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:
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.
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:
The null hypothesis,, 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:
This null hypothesis,, 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:
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 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 , 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.
- The Kolmogorov–Smirnov test. This test compares the continuous cdf of the uniform distribution with the empirical cdf of the sample of N observations. By definition,
If the sample from the random-number generator is , then the empirical cdf is defined by
As N becomes larger, should become a better approximation to , 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 and over the range of the random variable—that it is based on the statistic
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 denote the ith smallest observation, so that
Step 2. Compute
Step 3. Compute Step 4. Locate the critical value 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 , the null hypothesis that the data are a sample from a uniform distribution is rejected. I , conclude that no difference has been detected between the true distribution of 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 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 to largest . The computations for , namely , and for , namely , are easily accomplished by using Table 2. The statistics are computed as and . Therefore, Table 2 Calculations for Kolmogorov–Smirnov Test
| 0.05 | 0.14 | 0.44 | 0.81 | 0.93 | |
|---|---|---|---|---|---|
| 0.20 | 0.40 | 0.60 | 0.80 | 1.00 | |
| 0.15 | 0.26 | 0.16 | — | 0.07 | |
| 0.05 | — | 0.04 | 0.21 | 0.13 |
The critical value of obtained from Table A.8 in the Appendix for and , 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 is compared to the uniform cdf . It can be seen that is the largest deviation of above ), and that is the largest deviation of below . For example, at , the value of is given by , and that of is given by 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 ; thus, the deviation at other values of x need not be considered.
- The chi-square test. The chi-square test uses the sample statistic
where is the observed number in the ith class, is the expected number in the ith class, and n is the number of classes. For the uniform distribution , the expected number in each class is given by
for equally spaced classes, where N is the total number of observations. It can be shown that the sampling distribution of is approximately the chi-square distribution with n 1 degrees offreedom.
Example 7
Use the chi-square test with to test for whether the data shown next are uniformly distributed. Table 3 contains the essential computations. The test uses intervals of equal length, namely . The value of is 3.4. This is compared with the critical value from Table A.6. Since is much smaller than the tabulated value of , the null hypothesis of a uniform distribution is not rejected.
Figure 2 Comparison of F(x) and | 0.34 | 0.90 | 0.25 | 0.89 | 0.87 | 0.44 | 0.12 | 0.21 | 0.46 | 0.67 |
| 0.83 | 0.76 | 0.79 | 0.64 | 0.70 | 0.81 | 0.94 | 0.74 | 0.22 | 0.74 |
|---|---|---|---|---|---|---|---|---|---|
| 0.96 | 0.99 | 0.77 | 0.67 | 0.56 | 0.41 | 0.52 | 0.73 | 0.99 | 0.02 |
| 0.47 | 0.30 | 0.17 | 0.82 | 0.56 | 0.05 | 0.45 | 0.31 | 0.78 | 0.05 |
| 0.79 | 0.71 | 0.23 | 0.19 | 0.82 | 0.93 | 0.65 | 0.37 | 0.39 | 0.42 |
| 0.99 | 0.17 | 0.99 | 0.46 | 0.05 | 0.66 | 0.10 | 0.42 | 0.18 | 0.49 |
| 0.37 | 0.51 | 0.54 | 0.01 | 0.81 | 0.28 | 0.69 | 0.34 | 0.75 | 0.49 |
| 0.72 | 0.43 | 0.56 | 0.97 | 0.30 | 0.94 | 0.96 | 0.58 | 0.73 | 0.05 |
| 0.06 | 0.39 | 0.84 | 0.24 | 0.40 | 0.64 | 0.40 | 0.19 | 0.79 | 0.62 |
| 0.18 | 0.26 | 0.97 | 0.88 | 0.64 | 0.47 | 0.60 | 0.11 | 0.29 | 0.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 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 Table 3 Computations for Chi-Square Test
| Interval | |||||
|---|---|---|---|---|---|
| 1 | 8 | 10 | -2 | 4 | 0.4 |
| 2 | 8 | 10 | -2 | 4 | 0.4 |
| 3 | 10 | 10 | 0 | 0 | 0.0 |
| 4 | 9 | 10 | -1 | 1 | 0.1 |
| 5 | 12 | 10 | 2 | 4 | 0.4 |
| 6 | 8 | 10 | -2 | 4 | 0.4 |
| 7 | 10 | 10 | 0 | 0 | 0.0 |
| 8 | 14 | 10 | 4 | 16 | 1.6 |
| 9 | 10 | 10 | 0 | 0 | 0.0 |
| 10 | 11 | 10 | 1 | 1 | 0.1 |
| 100 | 100 | 0 | 3.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.12 | 0.01 | 0.23 | 0.28 | 0.89 | 0.31 | 0.64 | 0.28 | 0.83 | 0.93 |
|---|---|---|---|---|---|---|---|---|---|
| 0.99 | 0.15 | 0.33 | 0.35 | 0.91 | 0.41 | 0.60 | 0.27 | 0.75 | 0.88 |
| 0.68 | 0.49 | 0.05 | 0.43 | 0.95 | 0.58 | 0.19 | 0.36 | 0.69 | 0.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 , starting with the ith number. Thus, the autocorrelation between the following numbers would be of interest:. The value M is the largest integer such that , where N is the total number of values in the sequence. (Thus, a subsequence of length 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:
For large values of M, the distribution of the estimator of , denoted , is approximately normal if the values are uncorrelated. Then the test statistic can be formed as follows:
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 , in a slightly different form, and the standard deviation of the estimator are given by Schmidt and Taylor [1970] as follows:
and
After computing do not reject the null hypothesis of independence where α is the level of significance and is obtained from Table A.3. Figure 3 illustrates this test.
If , 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 , high random numbers in the subsequence followed by high, and low followed by low). On the other hand, if 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 . Here, i 3 (beginning with the third number),(every five numbers),(30 numbers in the sequence), and (largest integer such tha . Then,
and
Then, the test statistic assumes the value
Now, the critical value from Table A.3 is
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 were equal to zero. Then 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 , 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 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
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.]
List applications, other than systems simulation, for pseudo-random numbers—for example, video gambling games.
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]?
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.
Do we encounter a problem in the previous exercise if 6. Use the multiplicative congruential method to generate a sequence of four three-digit random integers and corresponding random numbers. Let , a 43, and m 1000.
The sequence ofnumbers 0.54, 0.73, 0.98, 0.11, and 0.68 has been generated. Use the Kolmogorov– Smirnov test with to learn whether the hypothesis that the numbers are uniformly distributed on the interval [0, 1] can be rejected.
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 to learn whether the hypothesis that the numbers are uniformly distributed on the interval [0, 1] can be rejected.
Figure out whether these linear congruential generators can achieve a maximum period; also, state restrictions on to obtain this period:
(a) the mixed congruential method with
(b) the multiplicative congruential generator with
(c) the mixed congruential generator with
(d) the multiplicative congruential generator with
Use the mixed congruential method to generate a sequence of three two-digit random integers and corresponding random numbers with , and 11. Use the mixed congruential method to generate a sequence of three two-digit random integers between 0 and 24 and corresponding random numbers with , and 12. Write a computer program that will generate four-digit random numbers, using the multiplicative congruential method. Allow the user to input values of , and 13. If in Exercise , generate the first random number in the sequence. Compute the random number to four-place accuracy.
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.
- Consider the multiplicative congruential generator under the following circumstances:
(a) (b) (c)
Generate enough values in each case to complete a cycle. What inferences can be drawn? Is maximum period achieved?
L’Ecuyer [1988] provides a generator that combines three multiplicative generators, with 157,, and . The period of this generator is approximately . Generate 5 random numbers with the combined generator, using the initial seeds and , for the individual generators.
Apply the tests described in this chapter to the generator given in the previous exercise.
Use the principles described in this chapter to develop your own linear congruential randomnumber generator.
Use the principles described in this chapter to develop your own combined linear congruentia random-number generator.
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.
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 , show that mod .
(b) Next, show that mod mod mod m (this result is useful because 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 , starting with . Check your answer by computing in the usual way.
- 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,. is readily available, where each has pdf
and cdf
Throughout this chapter R and . 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)
and the cumulative distribution function (cdf)
The parameter λ can be interpreted as the mean number of occurrences per time unit. For example, if interarrival times . 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,
and so is the mean interarrival time. The goal here is to develop a procedure for generating values . 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,), is of a form so simple that its inverse,, can be computed easily. (The notation denotes the solution of the equation for x; it does not denote 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 For the exponential distribution, the cdf is Step 2. Set on the range of X.
For the exponential distribution, it becomes on the range X is a random variable (with the exponential distribution in this case), so 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 for X in terms of R.
For the exponential distribution, the solution proceeds as follows:
Equation (1) is called a random-variate generator for the exponential distribution. In general, Equation (1) is written as . Generating a sequence of values is accomplished through Step 4.
Step 4. Generate (as needed) uniform random numbers . and compute the desired random variates by
For the exponential case, by Equation (1), so
for . One simplification that is usually employed in Equation (2) is to replace by to yield
This alternative is justified by the fact that both and 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,, given by Equation (2) with the value . Figure 1(a) is a histogram of 200 values, from the uniform distribution, and Figure 1(b) is a histogram of the 200 values,, 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 with Mean 1, given Random Numbers | i | 1 | 2 | 3 | 4 | 5 |
| 0.1306 | 0.0422 | 0.6597 | 0.7965 | 0.7696 | |
|---|---|---|---|---|---|
| 0.1400 | 0.0431 | 1.078 | 1.592 | 1.468 |
Figure 2 gives a graphical interpretation of the inverse-transform technique. The cdf shown is , an exponential distribution with rate . To generate a value with cdf a random number between 0 and 1 is generated, then a horizontal line is drawn from to the graph of the cdf, then a vertical line is dropped to the x axis to obtain , the desired result. Notice the inverse relation between and , namely
and
In general, the relation is written as
and
Why does the random variable generated by this procedure have the desired distribution? Pick a value and compute the cumulative probability
To see the first equality in Equation (4), refer to Figure 2, where the fixed numbers and are drawn on their respective axes. It can be seen that when and only when ). Since , the second equality in Equation (4) follows immediately from the fact that is uniformly distributed on [0,1]. Equation (4) shows that the cdf of is hence, 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
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
The derivation of Equation (5) follows Steps 1 through 3 of Section 1.1:
Step 1. The cdf is given by
Step 2. Set Step 3. Solving for X in terms of R yields , 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:
where and 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 Step 2. Set Step 3. Solving for X in terms of R yields
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 is an exponential variate with mean Conversely, if Y is an exponential variate with mean , then is a Weibull variate with shape parameter and scale parameter
1.4 Triangular Distribution
Consider a random variable X that has pdf
as shown in Figure 3. This distribution is called a triangular distribution with endpoints and mode at 1. Its cdf is given by
For
Figure 3 Density function for a particular triangular distribution.
and for
In Equation implies that , in which case . By Equation (8), implies that , in which case . Thus, X is generated by
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
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 , where c is unknown, but will be estimated by , where are the raw data and is the number of observations.
Arrange the data from smallest to largest and let denote these sorted values. The smallest possible value is believed to be 0, so define . Assign the probability to each interval , as shown in Table 2. The resulting empirical cdf, is illustrated in Figure 4. The slope of the ith line segment is given by
The inverse cdf is calculated by
when For example, if a random number is generated, then is seen to lie in the fourth interval (between and ; so, by Equation (10),
The reader is referred to Figure 4 for a graphical view of the generation procedure.
Table 2 Summary of Fire-Crew Response-Time Data
| i | Interval | Probability | Cumulative Probability, i/n | Slope |
|---|---|---|---|---|
| 1 | 0.2 | 0.2 | 4.00 | |
| 2 | 0.2 | 0.4 | 2.20 | |
| 3 | 0.2 | 0.6 | 1.05 | |
| 4 | 0.2 | 0.8 | 1.90 | |
| 5 | 0.2 | 1.0 | 4.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:
where is the cumulative probability of the first i intervals of the frequency distribution and is the ith interval. The inverse cdf is calculated as
when 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 hours always. Then we set , as shown in Table 3 and Figure 5.
Table 3 Summary of Repair-Time Data
| i | Interval (Hours) | Frequency | Relative Frequency | Cumulative Frequency, | Slope |
|---|---|---|---|---|---|
| 1 | 0.25 ≤ x ≤ 0.5 | 31 | 0.31 | 0.31 | 0.81 |
| 2 | 0.5 < x ≤ 1.0 | 10 | 0.10 | 0.41 | 5.0 |
| 3 | 1.0 < x ≤ 1.5 | 25 | 0.25 | 0.66 | 2.0 |
| 4 | 1.5 < x ≤ 2.0 | 34 | 0.34 | 1.00 | 1.47 |
Figure 5 Generating variates from the empirical distribution function for repair-time data For example, suppose the first random number generated is . Then, since is between and
As another illustration, suppose that . Since
The point is also shown in Figure 5.
Now reconsider the data of Table 3. The data are restricted in the range 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,. 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 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:
- 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 values to find the interval i in which R lies, namely the interval i satisfying
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].
- In Example 2, it was assumed that response times X satisfied . This assumption led to the inclusion of the points and 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,
—then the points and would be used to estimate the empirical cdf of response times. Notice that, because of inclusion of the new point , there are now six intervals instead of five, and each interval is assigned probability . 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 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]:
This approximation gives at least one-decimal-place accuracy for 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
| R | Approximate Inverse | Exact Inverse |
|---|---|---|
| 0.01 | -2.3263 | -2.3373 |
| 0.10 | -1.2816 | -1.2813 |
| 0.25 | -0.6745 | -0.6713 |
| 0.50 | 0.0000 | 0.0000 |
| 0.75 | 0.6745 | 0.6713 |
| 0.90 | 1.2816 | 1.2813 |
| 0.99 | 2.3263 | 2.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
| x | p(x) | F(x) |
|---|---|---|
| 0 | 0.50 | 0.50 |
| 1 | 0.30 | 0.80 |
| 2 | 0.20 | 1.00 |
The probability mass function (pmf), p(x), is given by
and the cdf,, is given by
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 , of size , and of size at
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 is generated. Graphically, as illustrated in Figure first locate on the vertical axis, next draw a horizontal line segment until it hits a in the cdf, and then drop a perpendicular to the horizontal axis to get the generated variate. Here is transformed to . 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 is generated, first find the interval in which lies. In general, for , if
then set . Here, are the possible values of the random variable; and For this example,, and hence,, and . (Notice that in all cases.)
Table 6 Table for Generating the Discrete Variate X
| Input, | Output, | |
|---|---|---|
| 1 | 0.50 | 0 |
| 2 | 0.80 | 1 |
| 3 | 1.00 | 2 |
Since , set . The generation scheme is summarized as follows:
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 with pmf and cdf given by
and
Let and . Then, from Inequality (13), it can be seen that, if the generated random number R satisfies
then is generated by setting . Now Inequality (14) can be solved for i:
Let y denote the smallest integer . For example,, and For is a function that rounds up. This notation and Inequality (15) yield a formula for generating X, namely
For example, consider the generating of a random variate X that is uniformly distributed on . 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 yields
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
where . Its cdf is given by
for . Using the inverse-transform technique [i.e., Inequality (13)], recall that a geometric random variable X will assume the value x whenever
where R is a generated random number assumed . Solving Inequality (17) for x proceeds as follows:
But implies that ln , so that
Thus, for that integer value of x satisfying Inequality (18). In brief, and using the round-up function , we have
Since is a fixed parameter, let . Then and, by Equation (19),. By Equation is an exponentially distributed random variable with mean so one way of generating a geometric variate with parameter is to generate (by any method) an exponential variate with parameter , subtract one, and round up.
Occasionally, there is needed a geometric variate X that can assume values q with pm . Such a variate X can be generated, via Equation (19), by
One of the most common cases is
Example 7
Generate three values from a geometric distribution on the range with mean 2. Such a geometric distribution has pmf with mean Thus, X can be generated by Equation (20) with , and . Using Table , and yields
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 , accept , then go to Step 3.
Step 2b. I , 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 is satisfied. When the condition is finally satisfied, the desired random variate X (here uniform on can be computed . 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 does have the desired distribution. To show this, take ; then
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 , set 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 , so that the number of rejections is a geometrically distributed random variable with probability of “success” being and mean number of rejections . (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 . 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 . 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 has pmf
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,. 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:
if and only if
Equation (22),, 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 t arrival occurred after time 1. Clearly, these two statements are equivalent. Proceed now by generating exponential interarriva times until some arrival, say , occurs after time 1; then set For efficient generation purposes, Inequality (23) is usually simplified by first using Equation (3), ln R , to obtain
Next multiply through , which reverses the sign of the inequality, and use the fact that a sum of logarithms is the logarithm of a product, to get
Finally, use the relation for any number x to obtain
which is equivalent to Inequality (23). The procedure for generating a Poisson random variate, N, is given by the following steps:
Step 1. Set
Step 2. Generate a random number , and replace P by Step 3. If , then accept . 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 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
which is quite large if the mean α of the Poisson distribution is large.
Example 8
Generate three Poisson variates with mean . First, compute . Next, get a sequence of random numbers R from Table A.1 and follow the previously described Steps 1 to 3:
Step 1. Step 2. Step 3. Since , accept N 0.
Step 1–3. Step 1. Set Step 2. Step 3. Since , reject n 0 and return to Step 2 with n 1.
Step 2. Step 3. Since , reject n 1 and return to Step 2 with n 2.
Step 2. Step 3. Since , accept N 2.
The calculations required for the generation of these three Poisson random variates are summarized as follows:
| n | P | Accept/Reject | Result | |
|---|---|---|---|---|
| 0 | 0.4357 | 0.4357 | (accept) | N=0 |
| 0 | 0.4146 | 0.4146 | (accept) | N=0 |
| 0 | 0.8353 | 0.8353 | (reject) | |
| 1 | 0.9952 | 0.8313 | (reject) | |
| 2 | 0.8004 | 0.6654 | (accept) | N=2 |
It took five random numbers R to generate three Poisson variates here , and but in the long run, to generate, say, 1000 Poisson variates with mean , it would require approximately 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. N is Poisson distributed with a mean of four buses per hour. First, compute . Using a sequence of 12 random numbers from Table A.1 yields the following summarized results:
| n | P | Accept/Reject | Result | |
|---|---|---|---|---|
| 0 | 0.4357 | 0.4357 | (reject) | |
| 1 | 0.4146 | 0.1806 | (reject) | |
| 2 | 0.8353 | 0.1508 | (reject) | |
| 3 | 0.9952 | 0.1502 | (reject) | |
| 4 | 0.8004 | 0.1202 | (reject) | |
| 5 | 0.7945 | 0.0955 | (reject) | |
| 6 | 0.1530 | 0.0146 | (accept) | N = 6 |
It is immediately seen that a larger value of α (here usually requires more random numbers; if 1000 Poisson variates were desired, approximately random numbers would be required.
When α is large, say,, 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
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
where is the round-up function described in Section 1.7., then set The 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 . 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 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 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 be the maximum of the arrival rate function and set and Step 2. Generate E from the exponential distribution with rate and let (this is the arrival time of the stationary Poisson process).
Step 3. Generate random number R from the distribution. If then and 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) |
|---|---|---|
| 0 | 15 | 1/15 |
| 60 | 12 | 1/12 |
| 120 | 7 | 1/7 |
| 180 | 5 | 1/5 |
| 240 | 8 | 1/8 |
| 300 | 10 | 1/10 |
| 360 | 15 | 1/15 |
| 420 | 20 | 1/20 |
| 480 | 20 | 1/20 |
Example 10
For the arrival-rate function in Table 7, generate the first two arrival times.
Step 1. 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 . Since , do not generate the arrival.
Step 4. Go to Step 2.
Step 2. For random number Step 3. Generate t 16.09 and i i 12.
Step 4. Go to Step 2.
Step 2. For random number 62.14.
Step 3. Generate . Since , 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 If the shape parameter is an integer, say,, 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 were large. The routine generates gamma random variates with scale parameter θ and shape parameter —that is, with mean and variance The steps are as follows
Step 1. Compute Step 2. Generate and . Set Step 3. Compute Step 4a. If ), reject X and return to Step 2.
Step 4b. If , use X as the desired variate.
The generated variates from Step 4b will have mean and variance both equal to . If it is desired to have mean and variance , then include Step 5.
(Step 5. Replace X by )
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, 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, and , 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 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
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 and variance . Once we have a method (this or any other) for generating from an distribution, then we can generate a lognorma random variate with parameters and by using the direct transformation . (Recall that and are not the mean and variance of the lognormal.)
Consider two standard normal random variables, and , plotted as a point in the plane as shown in Figure 7 and represented in polar coordinates as
Figure 7 Polar representation of a pair of standard normal variables.
It is known that 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):
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 are mutually independent. Combining Equations (26) and (27) gives a direct method for generating two independent standard normal variates. and , from two independent random numbers, and
To illustrate the generation scheme, consider Equation (28) with and Two standard normal random variates are generated as follows:
To obtain normal variates X_i with mean and variance , we then apply the transformation
to the standard normal variates. For example, to transform the two standard normal variates into normal variates with mean and variance , we compute
Recall that to obtain a lognormal variate Y from a normal variate X we set . 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 can be shown to be the sum of k independen exponential random variables,, each having mean —that is,
The convolution approach is to generate , then sum them to get X. In the case of the Erlang, each X can be generated by Equation (3) with . Therefore, an Erlang variate can be generated by
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 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 and mean hour. To generate the variate first obtain random numbers from Table A.1, say and . Then, by Equation (30),
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 has a gamma distribution with shape parameter and scale parameter , while has a gamma distribution with shape parameter and scale parameter and that these two random variables are independent. Then
has a beta distribution with parameters and on the interval [0, 1]. If, instead, we want to be defined on the interval , then set
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.
- Develop a random-variate generator for a random variable X with the pdf
- Develop a generation scheme for the triangular distribution with pdf
Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution.
Develop a generator for a triangular distribution with range (1, 10) and mode at Generate 1000 values of the random variate, compute the sample mean, and compare it to the true mean of the distribution.
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.
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.
Given the cdf , 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.
Given the pdf , 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.
Develop a generator for a random variable whose pdf is
Generate 1000 values and plot a histogram.
- The cdf of a discrete random variable X is given by
When , generate three values of X, using , and 10. Times to failure for an automated production process have been found to be randomly distributed with a Weibull distribution with parameters and . Derive Equation (6), and then use it to generate five values from this Weibull distribution, using five random numbers taken from Table A.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–30 | 10 |
| 30–45 | 20 |
| 45–60 | 25 |
| 60–90 | 35 |
| 90–120 | 30 |
| 120–180 | 20 |
| 180–300 | 10 |
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.
In Example 2, assume that fire-crew response times satisfy . Modify Table 2 to accommodate this assumption. Then generate five values of response time, using four-digi uniform random numbers from Table A.1.
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.
Develop a method for generating values from a negative binomial distribution with parameters p and k. Generate 3 values when and . [Hint: Think about the definition of the negative binomial as the number of Bernoulli trials until the kth success.]
The weekly demand X for a slow-moving item has been found to be approximated well by a geometric distribution on the range 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 with parameter p, the mean is 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.
Lead times have been found to be exponentially distributed with mean 3.7 days. Generate five random lead times from this distribution.
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.
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 , and ν 0. Thus, the time until the machine is taken out of production can be represented as . Develop a step-by-step procedure for generating Y.
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 represents the component runtimes, then 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 :, for . Use the equivalence and and the independence of , and . After finding ), proceed with the inversetransform technique.]
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.
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,, where and 23. Develop an acceptance-rejection technique for generating a geometric random variable X with parameter p on the range . [Hint: X can be thought of as the number of failures before the first success occurs in a sequence of independent Bernoulli trials.]
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,, that a value lies in to the actual observed relative frequency that values were , and 4.
Write a computer routine to generate gamma variates with shape parameter and scale parameter θ. Generate 1000 values with and and compare the true mean,, to the sample mean.
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).
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?
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.]
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
Derive a thinning algorithm for generating arrivals from this NSPP and generate the first 100 arrival times.
Generate 10 values from a beta distribution on the interval [0, 1] with parameters and . Next transform them to be on the interval [ 10, 20]
Suppose that a discrete distribution can take values . These values are equally likely, but are not . 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.]
Suppose that the arrival rate of hits to a web site is 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:
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.
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.
Choose parameters that determine a specific instance of the distribution family. When data are available, these parameters may be estimated from the data.
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 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.
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.
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.
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).
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.
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.
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.
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:
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.)
Label the horizontal axis to conform to the intervals selected.
Find the frequency of occurrences within each interval.
Label the vertical axis so that the total occurrences can be plotted for each interval.
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 Period | Frequency | Arrivals per Period | Frequency |
|---|---|---|---|
| 0 | 12 | 6 | 7 |
| 1 | 10 | 7 | 5 |
| 2 | 19 | 8 | 5 |
| 3 | 17 | 9 | 3 |
| 4 | 10 | 10 | 3 |
| 5 | 8 | 11 | 1 |
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.919 | 3.081 | 0.062 | 1.961 | 5.845 |
|---|---|---|---|---|
| 3.027 | 6.505 | 0.021 | 0.013 | 0.123 |
| 6.769 | 59.899 | 1.192 | 34.760 | 5.009 |
| 18.387 | 0.141 | 43.565 | 24.420 | 0.433 |
| 144.695 | 2.663 | 17.967 | 0.091 | 9.003 |
| 0.941 | 0.878 | 3.371 | 2.157 | 7.579 |
| 0.624 | 5.380 | 3.148 | 7.078 | 23.960 |
| 0.590 | 1.928 | 0.300 | 0.002 | 0.543 |
| 7.004 | 31.764 | 1.005 | 1.147 | 0.219 |
| 3.217 | 14.382 | 1.008 | 2.336 | 4.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 |
|---|---|
| 23 | |
| 10 | |
| 5 | |
| 1 | |
| 1 | |
| 2 | |
| 0 | |
| 1 | |
| 1 | |
| 0 | |
| 1 | |
| 1 | |
| . | . |
| . | . |
| . | . |
| 1 | |
| . | . |
| . | . |
| . | . |
| 1 | |
| . | . |
| . | . |
| . | . |
| 1 | |
| . | . |
| . | . |
| . | . |
| 1 |
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 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 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 such that , for . When F has an inverse, we write Now let be a sample of data from X. Order the observations from the smallest to the largest, and denote these as , where . Let j denote the ranking or order number. Therefore, for the smallest and for the largest. The plot is based on the fact that is an estimate of the quantile of X. In other words,
Now, suppose that we have chosen a distribution with cdf as a possible representation of the distribution of X. If is a member of an appropriate family of distributions, then a plot of versus ) 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.79 | 99.56 | 100.17 | 100.33 |
|---|---|---|---|
| 100.26 | 100.41 | 99.98 | 99.83 |
| 100.23 | 100.27 | 100.02 | 100.47 |
| 99.55 | 99.62 | 99.65 | 99.82 |
| 99.96 | 99.90 | 100.06 | 99.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:
| j | Value | j | Value | j | Value | j | Value |
|---|---|---|---|---|---|---|---|
| 1 | 99.55 | 6 | 99.82 | 11 | 99.98 | 16 | 100.26 |
| 2 | 99.56 | 7 | 99.83 | 12 | 100.02 | 17 | 100.27 |
| 3 | 99.62 | 8 | 99.85 | 13 | 100.06 | 18 | 100.33 |
| 4 | 99.65 | 9 | 99.90 | 14 | 100.17 | 19 | 100.41 |
| 5 | 99.79 | 10 | 99.96 | 15 | 100.23 | 20 | 100.47 |
The ordered observations are then plotted versus , for , 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 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). are a sample of the random variable , and are a sample of the random variable 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 , the sample mean is defined by
and the sample variance is defined by
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
and the sample variance as
where k is the number of distinct values of X and is the observed frequency of the value of X.
Example 8: Grouped Data
The data in Table 1 can be analyzed to obtain , and . From Equation (3),
and, from Equation (4),
The sample standard deviation S is just the square root of the sample variance. In this case,. Equations (1) and (2) would have yielded exactly the same results for and 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:
and
where is the observed frequency in the jth class interval, 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 , Equations (5) and (6) are used. The following values are created: and . With , X is approximated from Equation (5) as
Then, is approximated from Equation (6) as
and
Applying Equations (1) and (2) to the original data in Example 6 results in and . Thus, when the raw data are either discarded or lost, inaccuracies could result
Table 3 Suggested Estimators for Distributions Often Used in Simulation
| Distribution | Parameter(s) | Suggested Estimator(s) |
|---|---|---|
| Poisson | ||
| Exponential | ||
| Gamma | (see Table A.9) | |
| Normal | (unbiased) | |
| Lognormal | (after taking ln of the data) (after taking ln of the data) | |
| Weibullwith | See Equations (11) and (14)for and Iterate until convergence | |
| Beta | where is the digamma function, and |
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 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
for . If are i.i.d., and each have this exponential distribution, then their join distribution is
The joint distribution represents, roughly, the likelihood of any collection of values.
The maximum likelihood method turns this around in the sense that, if we have a sample of data, say , but λ is not known, then the maximum-likelihood estimator (MLE) is the value of that maximizes the likelihood of the sample, as measured by Equation (7). Thus, the MLE of λ for the exponential distribution maximizes the likelihood function
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
Taking the derivative with respect to and setting it equal to we get
giving the MLE where 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 as
Suppose that a random sample of size n , has been taken and that the observations are assumed to come from a Weibull distribution. The likelihood function can be shown to be
The maximum-likelihood estimates are those values of and that maximize or, equivalently, maximize ln , denoted by . The maximum value of is obtained by taking the partial derivatives and , setting each to zero, and solving the resulting equations, which, after substitution, become
and
where
The maximum-likelihood estimates, and , are the solutions of Equations (9) and (10). First,is found via the iterative procedure explained below. Then is found from Equation (10), with Equation (9) is nonlinear, so it is necessary to use a numerical-analysis technique to solve it. In Table , a suggested iterative method for computing is given as
Equation (12) employs Newton’s method in reaching where is thejth iteration, beginning with an initial estimate for , given in Table 3, as follows:
If the initial estimate,, is sufficiently close to the solution , then approaches In Newton’s method, is approached through increments of size . Equation (11) is used to compute and Equation (14) is used to compute , as follows:
Equation (14) can be derived from Equation (11) by differentiating with respect to . The iterative process continues until , 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 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 . For the data in Example , and ; so is found by Equation (2) to be
and . Thus,
To compute by using Equation (12) requires the calculation of from Equations (11) and (14). The following additional values are needed:, and . Thus,
and
Then, by Equation (12),
After four iterations,$| f ( \widehat {\beta} _ {3} ) | \le 0 . 001 $, at which point , is the approximate solution to Equation (9). Table 4 contains the values needed to complete each iteration.
Now, can be computed from Equation (10) with , as follows:
Table 4 Iterative Estimation of Parameters of the Weibull Distribution
| j | |||||||
|---|---|---|---|---|---|---|---|
| 0 | 0.477 | 115.125 | 292.629 | 1057.781 | 16.024 | -356.110 | 0.522 |
| 1 | 0.522 | 129.489 | 344.713 | 1254.111 | 1.008 | -313.540 | 0.525 |
| 2 | 0.525 | 130.603 | 348.769 | 1269.547 | 0.004 | -310.853 | 0.525 |
| 3 | 0.525 | 130.608 | 348.786 | 1269.614 | 0.000 | -310.841 | 0.525 |
If is sufficiently close to the procedure converges quickly, usually in four to five iterations. However, if the procedure appears to be diverging, try other initial guesses for 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 which was found in Example 8. Thus,. Recall that the true mean and variance are equal for the Poisson distribution. In Example 8, the sample variance was estimated as . 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 and
Example 14: Normal Distribution
The parameters of the normal distribution, and , are estimated by X¯ and , as shown in Table 3. The 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 and seconds^2.
Example 15: Gamma Distribution
The estimator for the gamma distribution is chosen by referring to Table A.9. Table A.9 requires the computation of the quantity , where
Also, it can be seen in Table 3 that is given by
Lead time is often gamma-distributed. Suppose that the lead times (in days) associated with 20 orders have been accurately measured as follows:
| Order | Lead Time (days) | Order | Lead Time (days) |
|---|---|---|---|
| 1 | 70.292 | 11 | 30.215 |
| 2 | 10.107 | 12 | 17.137 |
| 3 | 48.386 | 13 | 44.024 |
| 4 | 20.480 | 14 | 10.552 |
| 5 | 13.053 | 15 | 37.298 |
| 6 | 25.292 | 16 | 16.314 |
| 7 | 14.713 | 17 | 28.073 |
| 8 | 39.166 | 18 | 39.019 |
| 9 | 17.421 | 19 | 32.330 |
| 10 | 13.905 | 20 | 36.547 |
To estimate and it is first necessary to compute M from Equation (15). Here, is found, from Equation (1), to be
Then
Next
Then
and
By interpolation in Table A.9 in the Appendix,. Finally, Equation (16) results in
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 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 and ```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;
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
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.)
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.)
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.
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.)
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.)
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.
On one figure, draw the pdfs of the Erlang distribution where and , and 8.
On one figure, draw the pdfs of the Erlang distribution where θ 2 and k 1, 2, 4, and 8.
Draw the pmf of the Poisson distribution that results when the parameter α is equal to the following:
On one figure, draw the two exponential pdfs that result when the parameter λ equals 0.6 and 1.2.
On one figure, draw the three Weibull pdfs that result when ν 0,, and , and 4.
The following data are generated randomly from a gamma distribution:
| 1.691 | 1.437 | 8.221 | 5.976 |
|---|---|---|---|
| 1.116 | 4.435 | 2.345 | 1.782 |
| 3.810 | 4.589 | 5.313 | 10.90 |
| 2.649 | 2.432 | 1.581 | 2.432 |
| 1.843 | 2.466 | 2.833 | 2.361 |
Compute the maximum-likelihood estimators and 13. The following data are generated randomly from a Weibull distribution where | 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 (This exercise requires a programmable calculator, a computer, or a lot of patience.)
- 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.3 | 40.7 | 36.3 | 27.3 | 36.8 |
|---|---|---|---|---|
| 91.7 | 67.3 | 7.0 | 45.2 | 23.3 |
| 98.8 | 90.1 | 17.2 | 23.7 | 97.4 |
| 32.4 | 87.8 | 69.8 | 62.6 | 99.7 |
| 20.6 | 73.1 | 21.6 | 6.0 | 45.3 |
| 76.6 | 73.2 | 27.3 | 87.6 | 87.2 |
Use the Kolmogorov–Smirnov test to discover whether the distribution of location of accidents is uniformly distributed for the month of September.
- Show that the Kolmogorov–Smirnov test statistic for Example 19 is 16. 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 Month | Frequency of Occurrence |
|---|---|
| 0 | 35 |
| 1 | 40 |
| 2 | 13 |
| 3 | 6 |
| 4 | 4 |
| 5 | 1 |
| 6 | 1 |
(a) Apply the chi-square test to these data to test the hypothesis that the underlying distribution is Poisson. Use the level of significance (b) Apply the chi-square test to these data to test the hypothesis that the distribution is Poisson with mean 1.0. Again let (c) What are the differences between parts (a) and (b), and when might each case arise?
- 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:
| Employee | Time (minutes) | Employee | Time (minutes) |
|---|---|---|---|
| 1 | 1.88 | 26 | 0.04 |
| 2 | 0.54 | 27 | 1.49 |
| 3 | 1.90 | 28 | 0.66 |
| 4 | 0.15 | 29 | 2.03 |
| 5 | 0.02 | 30 | 1.00 |
| 6 | 2.81 | 31 | 0.39 |
| 7 | 1.50 | 32 | 0.34 |
| 8 | 0.53 | 33 | 0.01 |
| 9 | 2.62 | 34 | 0.10 |
| 10 | 2.67 | 35 | 1.10 |
| 11 | 3.53 | 36 | 0.24 |
| 12 | 0.53 | 37 | 0.26 |
| 13 | 1.80 | 38 | 0.45 |
| 14 | 0.79 | 39 | 0.17 |
| 15 | 0.21 | 40 | 4.29 |
| 16 | 0.80 | 41 | 0.80 |
| 17 | 0.26 | 42 | 5.50 |
| 18 | 0.63 | 43 | 4.91 |
| 19 | 0.36 | 44 | 0.35 |
| 20 | 2.03 | 45 | 0.36 |
| 21 | 1.42 | 46 | 0.90 |
| 22 | 1.28 | 47 | 1.03 |
| 23 | 0.82 | 48 | 1.73 |
| 24 | 2.16 | 49 | 0.38 |
| 25 | 0.05 | 50 | 0.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.95 | 232.75 | 212.80 | 231.10 | 215.95 |
|---|---|---|---|---|
| 237.55 | 235.45 | 228.25 | 218.65 | 212.80 |
| 230.35 | 228.55 | 216.10 | 229.75 | 229.00 |
| 199.75 | 225.10 | 208.15 | 213.85 | 205.45 |
| 219.40 | 208.15 | 198.40 | 238.60 | 219.55 |
| 243.10 | 198.85 | 224.95 | 212.20 | 222.90 |
| 218.80 | 203.35 | 223.45 | 213.40 | 206.05 |
| 229.30 | 239.20 | 201.25 | 216.85 | 207.25 |
| 204.85 | 219.85 | 226.15 | 230.35 | 211.45 |
| 227.95 | 229.30 | 225.25 | 201.25 | 216.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?
- 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.3 | 92.8 | 106.8 | 108.9 | 106.6 |
|---|---|---|---|---|
| 115.2 | 94.8 | 106.4 | 110.0 | 90.9 |
| 104.6 | 72.0 | 86.0 | 102.4 | 99.8 |
| 87.5 | 111.4 | 105.9 | 90.7 | 99.2 |
| 97.8 | 88.3 | 97.5 | 97.4 | 93.7 |
| 99.7 | 122.7 | 100.2 | 106.5 | 105.5 |
| 80.7 | 107.9 | 103.2 | 116.4 | 101.7 |
| 84.8 | 101.9 | 99.1 | 102.2 | 102.5 |
| 111.7 | 101.5 | 95.1 | 92.8 | 88.5 |
| 74.4 | 98.9 | 111.9 | 96.5 | 95.9 |
How are these run times distributed? Develop and test a suitable model.
- 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.936 | 4.612 | 2.407 | 4.278 | 5.132 |
|---|---|---|---|---|
| 4.599 | 5.224 | 2.003 | 1.857 | 2.696 |
| 5.259 | 7.563 | 3.937 | 6.908 | 5.002 |
| 6.212 | 2.759 | 7.172 | 6.513 | 3.326 |
| 8.761 | 4.502 | 6.188 | 2.566 | 5.515 |
| 3.785 | 3.742 | 4.682 | 4.346 | 5.359 |
| 3.535 | 5.061 | 4.629 | 5.298 | 6.492 |
| 3.502 | 4.266 | 3.129 | 1.298 | 3.454 |
| 5.289 | 6.805 | 3.827 | 3.912 | 2.969 |
| 4.646 | 5.963 | 3.829 | 4.404 | 4.924 |
How are the transmission times distributed? Develop and test an appropriate model.
- 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.661 | 4.910 | 8.989 | 12.801 | 20.249 |
|---|---|---|---|---|
| 5.124 | 15.033 | 58.091 | 1.543 | 3.624 |
| 13.509 | 5.745 | 0.651 | 0.965 | 62.146 |
| 15.512 | 2.758 | 17.602 | 6.675 | 11.209 |
| 2.731 | 6.892 | 16.713 | 5.692 | 6.636 |
| 2.420 | 2.984 | 10.613 | 3.827 | 10.244 |
| 6.255 | 27.969 | 12.107 | 4.636 | 7.093 |
| 6.892 | 13.243 | 12.711 | 3.411 | 7.897 |
| 12.413 | 2.169 | 0.921 | 1.900 | 0.315 |
| 4.370 | 0.377 | 9.063 | 1.875 | 0.790 |
How are the times between requests for service distributed? Develop and test a suitable model.
- Daily demands for transmission overhaul kits for the D-3 dragline were maintained by Earth Moving Tractor Company, with the following results:
| 0 | 2 | 0 | 0 | 0 |
|---|---|---|---|---|
| 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 0 | 0 | 0 |
| 2 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 2 |
| 1 | 0 | 1 | 0 | 0 |
| 0 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 0 | 0 | 3 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 |
How are the daily demands distributed? Develop and test an appropriate model.
- 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:
| Order | Milling Time (minutes) | Planing Time (minutes) | Order | Milling Time (minutes) | Planing Time (minutes) |
|---|---|---|---|---|---|
| 1 | 12.3 | 10.6 | 14 | 24.6 | 16.6 |
| 2 | 20.4 | 13.9 | 15 | 28.5 | 21.2 |
| 3 | 18.9 | 14.1 | 16 | 11.3 | 9.9 |
| 4 | 16.5 | 10.1 | 17 | 13.3 | 10.7 |
| 5 | 8.3 | 8.4 | 18 | 21.0 | 14.0 |
| 6 | 6.5 | 8.1 | 19 | 19.5 | 13.0 |
| 7 | 25.2 | 16.9 | 20 | 15.0 | 11.5 |
| 8 | 17.7 | 13.7 | 21 | 12.6 | 9.9 |
| 9 | 10.6 | 10.2 | 22 | 14.3 | 13.2 |
| 10 | 13.7 | 12.1 | 23 | 17.0 | 12.5 |
| 11 | 26.2 | 16.0 | 24 | 21.2 | 14.2 |
| 12 | 30.4 | 18.9 | 25 | 28.4 | 19.1 |
| 13 | 9.9 | 7.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.
Write a computer program to compute the maximum-likelihood estimators of the Weibull distribution. Inputs to the program should include the sample size the observations 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 , additional output would be printed, as in Table 4, showing convergence. Make the program as “user friendly” as possible.
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.
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.
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.
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:
| Day | Number of Jobs | Number of As |
|---|---|---|
| 1 | 83 | 53 |
| 2 | 93 | 62 |
| 3 | 112 | 66 |
| 4 | 65 | 41 |
| 5 | 78 | 55 |
Develop an input model for the number of new arrivals of each type each day.
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.
For the arrival-count data shown here, estimate the arrival-rate function λ(t) for an NSPP in arrivals per hour:
| Time Period | Number of Arrivals | |||
|---|---|---|---|---|
| Day 1 | Day 2 | Day 3 | Day 4 | |
| 8:00–10:00 | 22 | 24 | 20 | 28 |
| 10:00–12:00 | 23 | 26 | 32 | 30 |
| 12:00–2:00 | 40 | 33 | 32 | 38 |
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?
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.
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.
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. |
|---|---|---|---|---|---|---|---|
| 27 | 37 | 58 | 68 | 65 | 33 | 37 | 21 |
| 27 | 35 | 67 | 93 | 74 | 42 | 39 | 21 |
| 25 | 39 | 58 | 75 | 82 | 34 | 46 | 19 |
| 18 | 42 | 48 | 75 | 62 | 51 | 49 | 14 |
| 29 | 42 | 65 | 88 | 70 | 43 | 45 | 22 |
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:
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?
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:
Have the operational model checked by someone other than its developer, preferably an expert in the simulation software being used.
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.
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.
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.
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.
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.
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.
- 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 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 . Note that, at simulation time CLOCK 3, the number of customers in the system is , 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 , the reader can verify that was computed correctly from the data is the time-average value of NCUST minus STATUS):
as previously mentioned. Thus, the output measure 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
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
interarrival times of customers during several 2-hour periods of peak loading (“rush-hour” traffic);
interarrival times during a slack period;
service times for commercial accounts;
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:
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;
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;
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;
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 and interarrival times 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:
interarrival times, exponentially distributed (i.e., a Poisson arrival process) at rate per hour;
service times, assumed to be Each input variable has a level: the rate 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 , mean service time minutes, and one line for waiting cars 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 Variables | Model Output Variables, Y |
|---|---|
| D = decision variables | Variables of primary interest to management (Y1, Y2, Y3) |
| X = other variables | |
| Y1 = teller's utilization | |
| Poisson arrivals at rate = 45/hour | Y2 = 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 namely
or
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 and customer n is denoted by . (Do not confuse with ; 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 . The set of decision variables, or policy, is ) for current operations. The output, or response, variables are denoted by 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 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 , average delay , and maximum line length 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 minutes. For the purpose of validation, we will consider this to be the true mean value
Figure 5 Model input-output transformation.
When the model is run with generated random variates and , it is expected that observed values of average delay should be close to minutes. The generated input values and cannot be expected to replicate the actual input values and of the real system exactly, but they are expected to replicate the statistical pattern of the actual inputs. Hence, simulation-generated values of are expected to be consistent with the observed system variable 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 and sample average service time 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 minutes, to the model responses . Formally, a statistical test of the null hypothesis
versus
is conducted. If is not rejected, then, on the basis of this test, there is no reason to consider the model invalid. If 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
Compute the sample mean and the sample standard deviation S over the n replications, by using:
and
where , 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 for a one-sided test, use , as appropriate (n 1 being the degrees of freedom). From Table for a two-sided test.
Table 2 Results of Six Replications of the Bank Model
| Replication | (arrivals/hour) | (minutes) | $ Y_2 = Average Delay $(minutes) |
|---|---|---|---|
| 1 | 51 | 1.07 | 2.79 |
| 2 | 40 | 1.12 | 1.12 |
| 3 | 45.5 | 1.06 | 2.24 |
| 4 | 50.5 | 1.10 | 3.45 |
| 5 | 53 | 1.09 | 3.13 |
| 6 | 49 | 1.07 | 2.38 |
| Sample mean | 2.51 | ||
| Standard deviation | 0.82 |
Compute the test statistic
where is the specified value in the null hypothesis . Here minutes, so that
For the two-sided test,$\mathrm{i f} \left| t_{0} \right| > t_{\alpha / 2 , n - 1} ,$, reject . Otherwise, do not reject . [For the one-sided test with , reject if with , reject if Since $| t | = 5 . 34 > t_{0 . 025 , 5} = 2 . 571 $, reject , 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 is a strong conclusion, because
and the level of significance α is chosen small, say , as was done here. Equation says that the probability is low of making the error of rejecting when 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 are normally and independently distributed. Are these assumptions met in the present case?
The ith observation 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 is approximately normally distributed, provided that the number of customers it is based on is not too small.
The observations , are statistically independent by design—that is, by choosing the random-number seeds independently for each replication or by using nonoverlapping streams.
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 . 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:
When a car arrived to find the window immediately available, the teller began service immediately.
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 minutes was again conducted, according to the procedure previously outlined.
Choose and (sample size).
Compute minutes, minutes.
Look in Table A.5, the critical value Compute the test statistic Since $| t_{0} | < t_{0 . 025 , 5} = 2 . 571 $, do not reject , and thus tentatively accept the model as valid.
Failure to reject 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 were not sufficient to reject the hypothesis minutes. In other words, this test detects no inconsistency between the sample data and the specified mean The power of a test is the probability of detecting a departure from 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 error, where 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
| Replication | (arrivals/hour) | (minutes) | $ Y_2 = Average Delay $(minutes) |
|---|---|---|---|
| 1 | 51 | 1.07 | 5.37 |
| 2 | 40 | 1.11 | 1.98 |
| 3 | 45.5 | 1.06 | 5.29 |
| 4 | 50.5 | 1.09 | 3.82 |
| 5 | 53 | 1.08 | 6.74 |
| 6 | 49 | 1.08 | 5.49 |
| Sample mean | 4.78 | ||
| Standard deviation | 1.66 |
To consider failure to reject as a strong conclusion, the modeler would want to be small. Now, depends on the sample size n and on the true difference between and minutes—that is, on
where the population standard deviation of an individual , 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 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 (model validity) with probability at least 0.90 if the true mean delay of the model,, differed from the average delay in the system, minutes, by 1 minute. Then δ is estimated by
For the two-sided test with , use of Table A.10 results in
To guarantee that , as was desired by the modeler, Table A.10 reveals that a sample size of approximately independent replications would be required—that is, for a sample size 6 and assuming that the population standard deviation is 1.66, the probability of accepting (mode validity), when, in fact, the model is invalid $( | E ( Y_{2} ) - \mu_{0} | = 1 $ minute), is , 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 replications is required to achieve a power of 0.9. If this sample size is too high, either a higher risk (lower power) or a larger difference δ must be considered.
In general, it is always best to control the Type II error, or 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.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 , the probability of a Type II error. Once α is set, and the critical difference to be detected is selected, the only way to decrease 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 that are not close enough to real system behavior , 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 Terminology | Modeling Terminology | Associated Risk |
|---|---|---|
| Type I: rejecting when is true | Rejecting a valid model | |
| Type II: failure to reject when is true | Failure to reject an invalid model |
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 , and an unknown performance measure of the simulation,, that we hope is close. The hypothesis-testing formulation tested whether the confidence-interval formulation tries to bound the difference $| \mu - \mu_{0} |$ to see whether it is , 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 is the simulation output and , then we execute the simulation and form a confidence interval for , such as . 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.
- Suppose the confidence interval does not contain . [See Figure 6(a).]
(a) If the best-case error is 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 , then we can accept the simulation model as close enough to be considered valid.
(c) If the best-case error is , but the worst-case error is then additional simulation replications are necessary to shrink the confidence interval until a conclusion can be reached.
- Suppose the confidence interval does contain . [See Figure (a) If either the best-case or worst-case error is then additional simulation replications are necessary to shrink the confidence interval until a conclusion can be reached.
(b) If the worst-case error , then we can accept the simulation model as close enough to be considered valid.
In Example minutes, and “close enough” was minute of expected customer delay. A 95% confidence interval, based on the 6 replications in Table 2, is
(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), 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 for interarriva and service times were generated, and replicates of the output data 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,, to drive the simulation model and then to compare model output with system data.
To implement this technique for the bank model, the data . and . 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 , customer n 1 would be scheduled on the future event list to arrive at future time (without any random numbers being generated). If customer n were to begin service at time , a service completion would be scheduled to occur at time 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 and all the system response data, such as average delay , 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 to that in the system , could be misleading. The responses and depend both on the inputs and 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
were collected. For machine is the jth runtime (or time to failure), and is the successive downtime. A runtime 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 , and the number and time of occurrence of operator interventions—were recorded for comparison with model predictions.
The system input data and 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 were collected for comparison to the corresponding system response variables 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 of some system response variable are collected, such that the output measure corresponds to thejth input set, an objective statistical test becomes possible. For example, 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 corresponding to . Continuing the same example, 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 i | System | Model |
|---|---|---|
| 1. Production level | 897,208 | 883,150 |
| 2. Number of operator interventions | 3 | 3 |
| 3. Time of occurrence | 7:22, 8:41, 10:10 | 7:24, 8:42, 10:14 |
Table 6 Comparison of System and Model Output Measures for Identical Historical Inputs
| Input Data Set | System Output | Model Output | Observed Difference | Squared Deviation from Mean |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| . | . | . | . | . |
| . | . | . | . | . |
| . | . | . | . | . |
| K | ||||
If the K input data sets are fairly homogeneous, it is reasonable to assume that the K observed differences , 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 are statistically independent and, hence, that the differences constitute a random sample. In many cases, each and is a sample average over customers, and so (by the Central Limit Theorem) the differences are approximately normally distributed with some mean and variance . The appropriate statistical test is then a t test of the null hypothesis of no mean difference:
versus the alternative of significant difference:
The proper test is a paired t test is paired with , each having been produced by the first input data set, and so on). First, compute the sample mean difference, d¯ , and the sample variance,, by the formulas given in Table 6. Then, compute the t statistic as
(with , and get the critical value from Table A.5, where α is the prespecified significance level and is the number of degrees of freedom. If $| t_{0} | > t_{\alpha / 2 , K - 1} ,$, reject the hypothesis of no mean difference, and conclude that the model is inadequate. If t do not reject , 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 , or equivalently,, where is the system production level and is the production level predicted by the simulated model. Let the level of significance be . Using the results in Table 7, the test statistic, as given by equation (4), is
From Table A.5, the critical value is . 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 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 j | System Production | Model Production | Observed Difference | Squared Deviation from Mean |
|---|---|---|---|---|
| 1 | 897,208 | 883,150 | 14,058 | |
| 2 | 629,126 | 630,550 | -1,424 | |
| 3 | 735,229 | 741,420 | -6,191 | |
| 4 | 797,263 | 788,230 | 9,033 | |
| 5 | 825,430 | 814,190 | 11,240 | |
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
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.
Conduct simple statistical tests of input data for homogeneity, for randomness, and for goodness of fit to assumed distributional forms.
Conduct a Turing test. Have knowledgeable people (engineers, managers) compare mode output to system output and attempt to detect the difference.
Compare model output to system output by means of statistical tests.
After model development, collect new system data and repeat techniques 2 to 4.
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).
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
- 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 (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 )
- 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 (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 )
- 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 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 were collected, with these results:
| i | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| 21.7 | 19.2 | 22.8 | 19.4 | |
| 24.6 | 21.1 | 19.7 | 24.9 |
(a) Conduct a statistical test to check the consistency of system output and model output. Use the level of significance (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.)
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.
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.]
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.]
(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.
- 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 the result ofa set ofsimulation experiments will be an estimator θ ofθ. The precision of the estimator can be measured by the standard error of -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,, 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 has some influence on the value of . Thus, the sequence of random variables 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 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 , the total cost for week 1. Because of the autocorrelation, these initial conditions would also influence the costs 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 , 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 . 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 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 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 , until the system fails. The stopping event E is defined by 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 minutes is known, but in Example 3, the stopping time is generally unpredictable in advance; in fact, 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 , 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 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 , 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 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 . (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,(even longer than 13 shifts). That is, 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 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,. 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 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 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,r | Average Waiting Time,(minutes) | Average on Hold,(people) |
|---|---|---|
| 1 | 0.88 | 0.68 |
| 2 | 5.04 | 4.18 |
| 3 | 4.13 | 3.26 |
| 4 | 0.52 | 0.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 and . 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 , and constitute a random sample—that is, they are independent and identically distributed. In addition, is the parameter being estimated, so each is an unbiased estimate of the true mean waiting time 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 for estimating 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 for estimating φ; we refer to such output data as continuous-time data, because the index t is continuous valued. For example, might be the delay of customer i, or the total cost in week might be the queue length at time t, or the number of backlogged orders at time t. The parameter is an ordinary mean; will be referred to as a time-weighted mean. Whether we call the performance parameter or 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 , is defined by
where 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 that if
In general, however,
and is called the bias in the point estimator It is desirable to have estimators that are -unbiased,-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 and of equations and as , in which case is the time spent in the (sub)system by customer i. The point estimator of based on the data , where is the simulation run length, is defined by
and is called a time average of over . Simulation languages may refer to this as a “continuous-time,” “discrete-change,” or “time-persistent” statistic. In general,
and is said to be biased for φ. Again, we would like to obtain unbiased or low-bias estimators. -Examples of time averages include and of Equations as and as and 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
With n equal to the total number of days , as defined by Equation (1), is a point estimator of , 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 represents simulated queue length at time then (in the simulation) define
Then as defined by Equation (4), is a point estimator of , 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 For instance, suppose that Y represents the delay in queue that a customer experiences in a service system, measured in minutes. Then the quantile of Y is the value θ such that
As a percentage, 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, is given and the probability is to be estimated; however, in estimating a quantile, 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 such that 100p% of the histogram is to the left of (smaller than) For instance, if we observe customer delays -, then an estimate of the 85th percentile of delay is a value such that of the observed values are less than or equal to -An obvious estimate is, therefore, to set 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 , 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 such that 100p% of the histogram is to the left of .
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 , both unknown. To make the example concrete, let be the average cycle time for parts produced on the ith replication (representing a day of production) of the simulation. Therefore, is the mathematical expectation of , 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 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 is the overall sample mean of n independent replications,. But is not θ, it is an estimate, based on a sample, and it has error. A confidence interva is a measure of that error. Let
be the sample variance across the R replications. The usual confidence interval, which assumes the are normally distributed, is
where is the quantile of the t distribution with degrees of freedom that cuts off the area of each tail. (See Table A.5 in the Appendix). We cannot know for certain exactly how far is from 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 and our confidence interval reflects that because 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 , 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
The length of this interval will not go to 0 as n increases. In fact, in the limit it becomes
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 , a 95% confidence interval for the long-run expected daily average cycle time is or 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
or 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 and results in observations . 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 . A common goal in simulation is to estimate
When the output data are of the form , the goal is to estimate
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 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 Data | Across-Rep Data | |||
|---|---|---|---|---|
The across-replication data are formed by summarizing within-replication data:^1 is the sample mean of the cycle times from the ith replication, is the sample variance of the same data, and
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
the sample variance of the daily cycle time averages
and finally, the confidence-interval half-width
The quantity is the standard error, which is sometimes interpreted as the average error in as an estimator of θ. Notice that is not the average of the within-replication sample variances ; rather, it is the sample variance of the within-replication averages Table 3 Within and Across-Replication WIP Data
| Within-Rep Data | Across-Rep Data |
|---|---|
Within a replication, work in process is a continuous-time output, denoted . The stopping time for the ith replication 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:
and
A definition for is more problematic, but, to be concrete, take it to be
It is difficult to conceive of a situation in which 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 and the individual replication sample averages 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 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, and , which are computed under the assumption of independent and identically distributed data, tend not to be useful, although there are exceptions.
There are situations in which Y¯ and 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 is valid, and is not. The difficulty occurs because is a reasonable estimator of the variance of the cycle time, but and are not good estimators of the 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 replications given in Table 1. The four number-on-hold estimates are time averages of the form of Equation (11), where -, the number of customers on hold at time t. Similarly, the four average system times are analogous to of Table 2, where is the actual time spent on hold by - -customer i on replication Suppose that the analyst desires a 95% confidence interval for the mean time spent on hold, Using Equation (8), compute an overall point estimator
Using Equation (9), compute its estimated variance:
Thus, the standard error of is estimated by . Obtain - -3.18 from Table A.5, and compute the 95% confidence interval half-width by Equation (10) as
giving minutes with 95% confidence. Clearly 4 replications are far too few to make any sort of useful estimate of , 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 confidence interval for a mean θ, based on the t distribution, is given by
where 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 to within with high probability—say, at least 1 α. Thus, it is desired that a sufficiently large sample size R be taken to satisfy
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 , 6 minutes, or 1 customer) can be specified.
Assume that an initial sample of size replications has been observed—that is, the simulation analyst initially makes independent replications. We must have , with 10 or more being desirable. The replications will be used to obtain an initial estimate of the population variance . To meet the half-length criterion, a sample size R must be chosen such that and
Solving for R in Inequality (14) shows that R is the smallest integer satisfying and
An initial estimate for R is given by
where is the percentage point of the standard normal distribution from Table A.3 in the Appendix. And since for large R, say,, the second inequality for R is adequate when R is large. After determining the final sample size R, collect additional observations (i.e., make additional replications, or start over and make R total replications) and form the 100(1 α)% confidence interval for θ by
where and are computed on the basis of all R replications, by Equation (8), and by Equation (9). The half-length of the confidence interval given by Inequality (17) should be approximately or smaller; however, with the additional observations, the variance estimator could differ somewhat from the initial estimate 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 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 is taken, and the program determines that is the smallest integer satisfying Inequality (16). Therefore, 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 minutes
Figure 3 Input Dialog for the ‘‘Get Sample Size’’ utility of SimulationTools.xls
| Get Sample Size | Completed | Data Column | Minimum Sample Size | ||||
|---|---|---|---|---|---|---|---|
| 1 | 0.880897931 | 175 | |||||
| Number of Observations | 20 | 2 | 5.04340304 | ||||
| Alpha | 0.05 | 3 | 4.132638545 | ||||
| Precision Type | 1 | 4 | 0.517418075 | ||||
| Precision Value | 0.5 | 5 | 2.584490259 | ||||
| 6 | 0.860547939 | ||||||
| 7 | 1.544612493 | ||||||
| 8 | 1.762676832 | ||||||
| 9 | 6.925242515 | ||||||
| 10 | 2.201491896 | ||||||
| 11 | 2.915438392 | ||||||
| 12 | 0.486246064 | ||||||
| 13 | 1.792947434 | ||||||
| 14 | 1.244455641 | ||||||
| 15 | 4.278579049 | ||||||
| 16 | 13.91696167 | ||||||
| 17 | 0.235565331 | ||||||
| 18 | 0.685156864 | ||||||
| 19 | 1.577792626 | ||||||
| 20 | 1.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 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 is large enough that the confidence interval for a probability is often written as
where 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 . Thus, to estimate the quantile, we find tha value such that 100p% of the data in a histogram of Y is to the left of , or, stated differently, the -npth smallest value of Extending this idea, an approximate confidence interval for can be obtained by finding two values: that cuts off % of the histogram and that cuts off of the
histogram, where
(Recall that we know In terms of sorted values, is the smallest value (rounded down) and is the smallest value (rounded up), of
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 replications. The data may be found in the spreadsheet Quantile.xls at www.bcnn.net. The point estimator is minutes, because that is the -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
The lower bound ofthe confidence interval is minutes (the 10th smallest value, -rounding down); the upper bound of the confidence interval is .98 minutes (the -240th smallest value, rounding up). Thus, with 95% confidence, the point estimate of 3.39 minutes is no more than max 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
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
and
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:
Then, we use the normal approximations and Table A.3 to get
and
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 , which, generally, are samples of an autocorrelated time series. The steady-state (or long-run) measure o performance, θ, is defined by
with probability 1, where the value of θ is independent of the initial conditions. (The phrase “with probability means that essentially all simulations of the model, using different random numbers, will produce a series . whose sample average converges to θ.) For example, if 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 , such as the number of customers in the call center’s hold queue, is defined as
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 that determines n (although n may vary from run to run). The sample size n (or 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 with several considerations in mind:
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.)
The desired precision of the point estimator, as measured by the standard error or confidence interval half-width.
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
will be used; if several replications have been made, the output data for replication r will be denoted by
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
setting the inventory levels, number of backorders, and number of items on order and their arrival dates in an inventory simulation;
placing customers in queue and in service in a queueing simulation;
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 followed by a data-collection phase from time to the stopping time that is, the simulation begins at time 0 under specified initial conditions and runs for a specified period of time . Data collection on the response variables of interest does not begin until time and continues until time . The choice of is quite important, because the system state at time denoted by should be more nearly representative of steady-state behavior than are the origina initial conditions at time 0. In addition, the length 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 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 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 , 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 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
(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 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 , and data only retained beyond that point.
To specify 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 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,, or the cumulative average from a replication 1
for . 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:
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.
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
for some , rather than the original ensemble average . 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 3. 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 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.
- 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 are not statistically independent, then , given by Equation , is a biased estimator of the true variance . This is almost always the case when is a sequence of output observations from within a single replication. In this situation,. is an autocorrelated sequence, sometimes called a time series.
Suppose that our point estimator for θ is the sample mean general result^2 from mathematical statistics is that the variance of is
where cov . To construct a confidence interval for θ, an estimate of is required. But obtaining an estimate of Equation (22) is futile, because each term cov 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 depends on in the same manner as depends on . In particular, the covariance between two random variables in the time series depends only on the number o observations between them, called the For a covariance-stationary time series,, define the lag-k autocovariance by
which, by definition of covariance stationarity, is not a function of i. For , γ becomes the population variance that is,
The lag-k autocorrelation is the correlation between any two observations k apart. It is defined by
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
where is the lag-k autocorrelation given by Equation (25).
When 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 exhibiting positive autocorrelation; (b) stationary time series exhibiting negative autocorrelation; (c) nonstationary time series with an upward trend.
On the other hand, if some of the the series . 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 is changing with the index i.
Why does autocorrelation make it difficult to estimate Recall that the standard estimator for the variance of a sample mean is . By using Equation (26), it can be shown [Law, 1977] that the expected value of the variance estimator is
where
and c is the quantity in brackets in Equation (26). The effect of the autocorrelation on the estimator is derived by an examination of Equations (26) and (28). There are essentially three possibilities:
Case 1
If the are independent, then for . Therefore, and Equation (26) reduces to the familiar . Notice also that , so is an unbiased estimator of V(Y¯ ). The 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 are primarily positive, then , so that , and hence . Therefore, is biased low as an estimator of . If this correlation were ignored, the nominal confidence interval given by Expression (10) would be too short, and its true confidence coefficient would be less than . 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 are large, B could be quite small, implying a significant underestimation.
Case 3
If the autocorrelations are substantially negative, then , and it follows that and is biased high for . In other words, the true precision of the point estimator would be greater than what is indicated by its variance estimator , because
As a result, the nominal confidence interval of Expression (10) would have true confidence coefficient greater than . 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 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 as an estimator of ), the variance of the sample mean, in all situations. If used uncritically in a simulation with positively autocorrelated output data, the downward bias in 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 can be many times greater than is indicated by
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 or extending the length of each run (i.e., increasing 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
That is, the point estimator is the average of the remaining data. The basic raw output data are exhibited in Table 4. For instance, 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 and n by . For simplicity, assume that d and n are constant over replications.
Table 4 Raw Output Data from a Steady-State Simulation
| Replication | Observations | Replication Averages | |||||
|---|---|---|---|---|---|---|---|
| 1 | d | n | |||||
| 1 | |||||||
| 2 | |||||||
| . | . | . | . | . | . | ||
| . | . | . | . | . | . | ||
| . | . | . | . | . | . | ||
| R | |||||||
When using the replication method, each replication is regarded as a single sample for the purpose of estimating θ. For replication define
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 , the replication averages
are independent and identically distributed random variables; that is, they constitute a random sample from some underlying population having unknown mean
The overall point estimator, given in Equation (29), is also given by
as can be seen from Table 4 or from using Equation (21). Thus, it follows that
also. If d and n are chosen sufficiently large, then , and is an approximately unbiased estimator of θ. The bias in is For convenience, when the value of n and d are understood, abbreviate (the mean of the undeleted observations from the rth replication) and [the mean of by and , respectively. To estimate the standard error of , first compute the sample variance,
The standard error of is given by
A confidence interval for , based on the t distribution, is given by
where is the percentage point of a t distribution with degrees of freedom. This confidence interval is valid only if the bias of 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, should at least 10d (or more generally, should be at least . 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 , then make 25 replications of longer than , 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 time units and delete the first time units. In this case becomes the number of observations obtained up to time and is the number of observations recorded between times and , both random variables that typically differ from replication to replication. In the following example we will use instead of 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 replications, each of length hours, deleting the first 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 hours and hours (approximately cycle times per replication). The purpose of the simulation is to estimate the long-run average cycle time, denoted , and to measure the error of the estimate by a 95% confidence interval.
Table 5 Data Summary for FastChip Simulation by Replication
| Replication r | Sample Mean for Replication r |
|---|---|
| 1 | 46.86 |
| 2 | 46.09 |
| 3 | 47.64 |
| 4 | 47.43 |
| 5 | 46.94 |
| 6 | 46.43 |
| 7 | 47.11 |
| 8 | 46.56 |
| 9 | 46.73 |
| 10 | 46.80 |
| 46.86 | |
| S | 0.46 |
The replication averages , are shown in Table 5. The poin estimator is computed by Equation (32) as
Its standard error is given by Equation (34) as
and using and , the 95% confidence interval for long-run mean queue length is given by Inequality (35) a
or
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 and are sufficiently large so that the bias is negligible.
5.4 Sample Size in Steady-State Simulations
Suppose it is desired to estimate a long-run performance measure θ within , with confidence . 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 . 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 The initial estimate of standard deviation is hours. Suppose that it is desired to estimate long-run mean cycle time of Chip-C, w, to within 1 hours (6 minutes) with 95% confidence. Using in Inequality (16) yields an initial estimate of
Thus, at least 82 replications will be needed.
An alternative to increasing R is to increase total run length within each replication. If the calculations in Section 4.2, as illustrated in Example 16, indicate tha additional replications are needed beyond the initial number , then an alternative is to increase run length in the same proportion to a new run length . Thus, additional data will be deleted, from time 0 to time , 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 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 to time ], it is
Figure 9 Increasing run length to achieve specified accuracy.
necessary to have saved the state of the model at time 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 onward, rather than having to start over from time 0.
Example 17
In Example suppose that run length was to be increased to achieve the desired error 0.1 hours. Since , the run length should be hours. The data collected from time 0 to time 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 , such as the length of a queue or the level of inventory, then we form k batches of size and compute the batch means as
. In other words, thejth batch mean isjust the time-weighted average of the process over the time interval .
When the raw output data after deletion form a discrete-time process such as the customer delays in a queue or the cost per period of an inventory system, then we form k batches of size and compute the batch means as
for (assuming k divides evenly, otherwise round down to the nearest integer). That is the batch means are formed as shown here
Starting with either continuous-time or discrete-time data, the variance of the sample mean is estimated by
where is the overall sample mean of the data after deletion. The batch means 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 . 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 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 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 . 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:
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.
Form up to 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
- Check the correlation to see whether it is sufficiently small.
(a) If , then rebatch the data into batches, and form a confidence -interval using degrees of freedom for the t distribution and Equation (36) to estimate the variance of .
(b) If , 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 batches, and form the confidence interval, using degrees of freedom for the t distribution and Equation (36) to estimate the variance of 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
If then accept the independence of the batch means, where 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 batches, and form the confidence interval, using 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 at -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 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 batches of size and estimate the lag-1 autocorrelation to be . 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 batches of size , is Having passed the correlation check, we rebatch the data into batches of size The point estimate is the overall mean
The variance of computed from the 40 batch means, is
Thus, a 95% confidence interval is given by
or
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 batches of size used to form the confidence interval. This gives
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 ), 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 . To be concrete, 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 replications and let be the quantile estimate from the rth. Then the R quantile estimates,-, are independent and identically distributed. Their average is
It can be used as the point estimator of and an approximate confidence interval is
where is the usual sample variance of - -What if only a single replication is obtained? Then the same reasoning applies if we let 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 is not the same as the p quantile of 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
- 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.
- Suppose that the output process from a queueing simulation is , the total number in queue at time t. A continuous-time output process can be converted into the sort of discretetime process . described in this chapter by first forming batch means of size m time units:
for . 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 queue with and for a run length of 4000 time units, computing batch means of the total number in queue with batch size 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.
Using the results of Exercise 2 above, design and execute an experiment to estimate the steadystate expected number in this queue, L, to within customers with 95% confidence. Check your estimate against the true value of ).
In Example 7, suppose that management desired a 95% confidence interval on the estimate of mean cycle time and that the error allowed was 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?
Again, simulate an queue with and , 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?
Consider an (M, L) inventory system, in which the procurement quantity Q is defined by
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 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:
| Demand | Probability |
|---|---|
| 1 | 1/2 |
| 2 | 1/4 |
| 3 | 1/8 |
| 4 | 1/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.
- Reconsider Exercise 6, except that, if the inventory level at a monthly review is zero or negative, a rush order for units is placed. The cost for a rush order is , 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.
- 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-2 | 5 |
| >2 | 0 |
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.
- 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 Day | Probability |
|---|---|
| 1 | 0.23 |
| 2 | 0.41 |
| 3 | 0.22 |
| 4 | 0.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.
- 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.]
- 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.
- 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 , and the capacity of each waiting line is assumed to be unlimited. Assume that λ 8 customers per hour and 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 , 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 for , 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.
- 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.
| Type | Flow through Stations | Proportion |
|---|---|---|
| 1 | 1, 2, 3, 4 | 0.4 |
| 2 | 1, 3, 4 | 0.3 |
| 3 | 2, 4, 3 | 0.2 |
| 4 | 1, 4 | 0.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:
| Type | Station | |||
|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |
| 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 workers,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 Based on 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.
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 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.
Consider a single-server queue with Poisson arrivals at rate 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
where W is a typical system time and N is the number of customers found by an arrival. For example, is the mean system time for those customers who find the system empty, is the mean system time for those customers who find one other customer present upon arrival, and so on. The estimate of will be a sample mean of system times taken over all arrivals who -find i in the system. Plot vs i. Hypothesize and attempt to verify a relation between 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 (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, with a standard error for each of at most 3 seconds. Repeat parts (a)–(d), but using this number of replications.
- 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 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 replications, and compute a 95% confidence interval for Next, work out the number of replications needed to estimate within .02, and make this number of replications. Recompute the 95% confidence interval for 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 be the long-run utilization of worker i, and let be the average utilization of all workers. Thus,. According to queueing theory, ρ can be estimated by , where arrivals per minute, servers, and minutes is the mean service time. Thus, 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 and . Draw conclusions concerning workload balance.
(b) Based on the same 10 replications, test the hypothesis at a level of significance . 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 (d) From the results of (a)–(c), draw conclusions for management about the balancing of workloads.
- 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.
- 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.
- Develop a simulation model of the total time in the system for an M/M/1 queue with service rate therefore, the traffic intensity is , 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 changes for 21. 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 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 . The goal of the simulation experiments is to obtain point and interval estimates of the difference in mean performance, namely . Two methods of computing a confidence interval for 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
| System | Replication | SampleMean | SampleVariance | |||
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 1 | ||||||
| 2 |
When comparing two systems, such as those in Example 1, the simulation analyst must decide on a run length for each model , a number of replications to be made of each model, or both. From replication r of system i, the simulation analyst obtains an estimate of the mean performance measure . In Example 1, would be the average call response time observed during replication r for system i, where and . The data, together with the two summary measures, the sample means , and the sample variances , are exhibited in Table 1. Assuming that the estimators are, at least approximately, unbiased, it follows that
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 , the difference between the two mean performance measures. This will lead to one of three possible conclusions:
If the confidence interval (c.i.) for is totally to the left of zero, as shown in Figure 2(a), then there is strong evidence for the hypothesis that , or equivalently In Example 1 implies that the mean response time for system 1, the original system, is smaller than for system 2, the alternative system.
If the c.i. for is totally to the right of zero, as shown in Figure 2(b), then there is strong evidence that , or equivalently, In Example 1, can be interpreted as system 2 being better than system 1, in the sense tha system 2 has a smaller mean response time.
If the c.i. for 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 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 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 , 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 will always be of the form
where is the sample mean performance measure for system i over all replications
ν is the degrees offreedom associated with the variance estimator, is the percentage point of a t distribution with ν degrees of freedom, and 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, of Table 1, are approximately normally distributed. This assumption is reasonable provided that each is itself a sample mean of observations from replication which is indeed the situation in Example 1.
By design of the simulation experiment, are independently and identically distributed (i.i.d.) with mean and variance , say. Similarly, are i.i.d. with mean and variance , 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 larger than the variability in 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 large enough to matter for the decision we need to make? In Example 1, we may reach the conclusion that and decide that system 2 is better (smaller expected response time). However, if the actual difference 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 , the true difference within the range
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 , are statistically independent of all the observations of simulated system 2, namely . By Equation (2) and the independence of the replications, the variance of the sample mean is given by
For independent sampling, and are statistically independent; hence,
There are confidence-interval procedures that are appropriate when the two variances are equa but unknown in value; that is,. 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 c.i. for can be computed as follows. The point estimate is computed by
with given by Equation (2), while the sample variance for system i is
Thus, the standard error of the point estimate is given by
with degrees of freedom ν approximated by the expression
rounded to an integer. The confidence interval is then given by Expression , using the standard error of Equation (6). A minimum number of replications and 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, and must be equal, say,. Thus, for each replication the two estimates and are no longer independent, but rather are correlated. However, independent random numbers are used on different replications, so the pairs are mutually independent when . For example, in Table 1, the observation is correlated with , but is independent of all other observations. The purpose of using CRN is to induce a positive correlation between and for each r and thus to achieve a variance reduction in the point estimator of mean difference,. In general, this variance is given by
where is the correlation between and . [By definition,, which does not depend on r.]
Now, compare the variance of arising from the use of CRN [Equation , call it to the variance arising from the use of independent sampling with equal sample sizes [Equation (3) with , call it . Notice that
If CRN works as intended, the correlation will be positive; hence, the second term on the righ side of Equation (9) will be positive, and, therefore,
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 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 c.i. with correlated data, first compute the differences
which, by the definition of CRN, are i.i.d.; then compute the sample mean difference as
Thus,. The sample variance of the differences is computed as
which has degrees of freedom . The . for is given by Expression (1), with the standard error of , estimated by
Because of Equation (13) is an estimate of and Expression (6) is an estimate of , CRN typically will produce a c.i. that is shorter for a given sample size than the c.i. produced by independent sampling if . In fact, the expected length of the c.i. will be shorter with the use of CRN if , provided . The larger R is, the smaller 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:
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.
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.
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.)
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 and are increasing functions of the random variate X (or both are decreasing functions o X), then will be positive. The intuitive idea is that both models, that is, both and 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 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):
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 Time | Differences | ||||
|---|---|---|---|---|---|
| Replication | Current | Proposed 7 | Proposed 6 | C - P7 | P7 - P6 |
| 1 | 6.24 | 6.19 | 8.35 | 0.05 | -2.16 |
| 2 | 9.06 | 10.64 | 18.03 | -1.59 | -7.39 |
| 3 | 8.02 | 9.53 | 16.17 | -1.51 | -6.64 |
| 4 | 5.93 | 6.15 | 7.40 | -0.22 | -1.25 |
| 5 | 8.31 | 7.83 | 12.70 | 0.48 | -4.87 |
| 6 | 5.91 | 6.09 | 8.26 | -0.17 | -2.17 |
| 7 | 8.74 | 7.62 | 12.32 | 1.12 | -4.70 |
| 8 | 7.78 | 7.03 | 11.40 | 0.75 | -4.37 |
| 9 | 7.15 | 12.79 | 23.04 | -5.64 | -10.24 |
| 10 | 5.72 | 7.57 | 14.30 | -1.85 | -6.73 |
| Sample mean | 7.29 | 8.14 | 13.20 | -0.86 | -5.05 |
| Sample variance | 1.60 | 4.86 | 23.99 | 3.87 | 7.72 |
| Standard error | 0.62 | 0.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 is
$$
- 86 \pm 2. 26 (0. 62) $$
or
$$
- 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
$$
- 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 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
We begin by making replications ofeach system, to obtain an initial estimate ofs.e. We then approximate the total number of replications needed to achieve the half-length criterion in Equation (15). Finally, we make an additional 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 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 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 The confidence interval used in Example 1 was of the form , with the specific values , and . To obtain the desired precision, we need to find R such that
We can approximate this by finding the smallest integer R satisfying and
Substituting and , we obtain
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 of system i, for Many different statistical procedures have been developed that can be used to analyze simulation data and draw statistically sound inferences concerning the parameters . 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:
estimation of each parameter,2. comparison of each performance measure to a control (where could represent the mean performance of an existing system);
all pairwise comparisons,, for 4. selection of the best (largest or smallest).
The first three goals will be achieved by the construction of confidence intervals The number of such confidence intervals is , and , 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 . Let 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 will be true with probability . 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
where is called the overall error probability. Expression (16) can be restated as
or equivalently,
Thus, 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, The individual α may be chosen to be equal , or unequal, as desired. The smaller the value of , the wider the jth confidence interval will be. For example, if two 95% c.i.s 0.05) are constructed, the overall confidence level will be 90% or greater . If ten 95% c.i.s are constructed , the resulting overall confidence level could be as low as 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 times longer than a 95% c.i. For smal sample sizes, say, for a sample of size a 99.5% c.i. will be 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:
Individual Construct a c.i. for parameter by using the expression in which case the number of intervals is . If independent sampling were used, the K c.i.s would be mutually independent, and thus the overall confidence level would be , 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.
Comparison to an existing system: Compare all designs to one specific design, usually to an existing system. That is, construct a . for , using Expression (1). (System 1 with performance measure is assumed to be the existing system.) In this case, the number of intervals is . This type of procedure is most often used to compare several competitors to the present system in order to learn which are better.
All pairwise comparisons: Compare all designs to each other. That is, for any two system designs construct a c.i. for . With K designs, the number of confidence intervals computed is . The overall confidence coefficient would be bounded below by [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 , and 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 and confidence intervals are to be constructed, let . Then use Expression (1), with proper modifications, to construct confidence intervals with and degrees of freedom The value of 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
or
The simulation analyst has high confidence (at least 95%) that all three confidence statements are correct. Notice that the c.i. for 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 designs for the semiconductor fabrication facility described in the Estimation of Absolute Performance chapter, in which is the steady-state mean cycle time of one product family for the ith design, and smaller 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 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 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, 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 . 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 . Then, using reasoning related to the Bonferroni inequality, the selected system is the best or a near-best system with confidence at least 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
- Specify the desired probability ofcorrect selection , the practically significan difference , an initial number of replications , and the number of competing systems K. Set
and obtain Rinott’s constant . [Hint: Both critical values are calculated automatically by SimulationTools.xls; small tables of t and h are given in the Appendix.]
- Make replications of each system. Calculate the first-stage sample means and sample variances
for 3. Calculate the screening thresholds
for all (a) If bigger is better, then form the survivor subset containing every system design i such that
That is, retain every system i whose sample mean is no more than max 0, 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
That is, retain every system i whose sample mean is no more than max 0, larger than any other system’s sample mean.
- 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
where means to round up.
Take additional replications from all systems i in , or, if it is more convenient, obtain a total of replications from system i by starting over.
Compute the overall sample means
for all i in . If bigger is better, then select the system with the largest as best. Otherwise select the system with the smallest 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 system designs, and the performance measures 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 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 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
Table 3 First-Stage Data from FastChip Simulation
| Scenario | Base 1 | Clean 2 | Load 3 | Oxidize 4 | Unload 5 | Coat 6 | Step 7 | Develop 8 |
|---|---|---|---|---|---|---|---|---|
| 46.86 | 45.70 | 47.23 | 45.13 | 46.80 | 47.81 | 47.41 | 46.94 | |
| 0.21 | 0.37 | 0.29 | 0.09 | 0.28 | 0.98 | 0.12 | 0.28 |
Table 4 Screening Threshold from FastChip Simulation
| Scenarioi | Base1 | Clean2 | Load3 | Oxidize4 | Unload5 | Coat6 | Step7 | Develop8 |
|---|---|---|---|---|---|---|---|---|
| 46.86 | 45.70 | 47.23 | 45.13 | 46.80 | 47.81 | 47.41 | 46.94 | |
| 0.60 | 0.74 | 0.68 | 0.67 | 1.13 | 0.50 | 0.67 | ||
| 45.58 | 45.72 | 45.66 | 45.65 | 46.11 | 45.48 | 45.65 |
The subset will always contain the sample best system, which is system (Oxidize) here. To avoid being screened out, the other systems’ sample means must be small enough to satisfy for all , and in particular . Table 4 contains the thresholds max ; only alternative 2 with sample mean 45.70 hours is smal enough to survive, so To determine the second-stage sample sizes for alternatives 2 and 4, we need , which could be obtained from SimulationTools.xls. Then and . Thus, alternative 2 requires additional replications, while alternative 4 requires 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, and ; therefore, alternative 4, Oxidize, is selected. The procedure guarantees, with 95% confidence, that is the smallest steadystate mean cycle time of the 8 alternatives, if it is not, then it is within 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
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 .
3 Metamodeling
Suppose that there is a simulation output response variable Y that is related to k independent variables, say,. The dependent variable Y is a random variable, while the independent variables 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 . 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
where is the intercept on the Y axis, an unknown constant, and 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
where ε is a random error with mean zero and constant variance . 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 . These observations can be used to estimate and in Equation (18). The method of least squares is commonly used to form the estimates. In the method of least squares, and 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
where are assumed to be uncorrelated random variables.
Each in Equation (19) is given by
and represents the difference between the observed response and the expected response predicted by the model in Equation (17). Figure 6 shows how is related to , and $ E ( Y_{i} | x_{i} ) $ The sum of squares of the deviations given in Equation (20) is given by
and is called the least-squaresfunction. It is convenient to rewrite as follows:
where and . Equation (22) is often called the transformed linear regression model. Using Equation (22), Equation (21) becomes
Figure 6 Relationship of to and $ E ( Y_{i} | x_{i} ) $ To minimize find and , set each to zero, and solve for and . Taking the partial derivatives and setting each to zero yields
Equations (23) are often called the normal equations, which have the solutions
and
The numerator in Equation (25) is rewritten for computational purposes as
where denotes the corrected sum of cross products of x and Y. The denominator of Equation (25) is rewritten for computational purposes as
where denotes the corrected sum of squares of x. The value of can be retrieved easily as
The simulation model of the claims-processing system in Example 4 was executed with initia conditions , 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 x | Hours of Processing Time Y |
|---|---|
| 100 | 8.1 |
| 100 | 7.8 |
| 100 | 7.0 |
| 150 | 9.6 |
| 150 | 8.5 |
| 150 | 9.0 |
| 200 | 10.9 |
| 200 | 13.3 |
| 200 | 11.6 |
| 250 | 12.7 |
| 250 | 14.5 |
| 250 | 14.7 |
| 300 | 16.5 |
| 300 | 17.5 |
| 300 | 16.3 |
Figure 7 Relationship between number of claims and hours of processing time.
With the processing times as the values (the dependent variables) and the number of claims as the values (the independent variables), and can be found by the following computations:
and From Equation (26) is calculated as
From Equation (27), is calculated as
Then, is calculated from Equation (25) as
As shown in Equation (24), is just or
To express the model in the original terms, compute from Equation (28) as
Then an estimate of the mean of Y given x,$ E ( Y | x ) $, is given by
For a given number of claims x this model can be used to predict the number of hours required to process them. The coefficient 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 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 and . However, the adequacy of the simple linear relationship should be tested prior to using the model for predicting the response given an independent variable,. 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 and 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
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
Equation (31) is also a linear model which may be transformed to the form of Equation (30) by letting and Yet another possibility is a model of the form such as
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 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 and obtain least squares estimates and Then an estimator of the expected difference in performance between design points i and j is
when and are fixed design points, determines the estimated difference between design points i and or for that matter between any other two values of x. Therefore, common random numbers can be expected to reduce the variance of 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 The least-squares estimators and 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 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 customers/time. Let , which is called the utilization . Then, the steady-state expected number of customers in the queue for is
Now, suppose that we did not know the relationship (32) and were trying to build a metamodel for L as a function of by running simulations of an queue. Clearly the usual low-order polynomial models, including only the terms x and 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 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
with , 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,, and 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 , and 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
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, time units may yield a pretty good estimate of L at but a very poor estimate at 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 or different numbers of replications, depending on x.
We suggest using the 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 and at two design points and should satisfy
For instance, if we were to simulate time unit at utilization , then we would need about time units at , or time units at , or time units at , or , 944 time units at 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 be the m controllable design variables and let be the observed simulation output performance on one run. To be concrete, might denote
the number of AGVs, the load per AGV, and the routing algorithm used to dispatch the AGVs, respectively, in Example 6, while could be total MHS acquisition and operation cost.
What does it mean to “optimiz with respect to Since Y is a random variable we cannot optimize the actual value of Y. The most common definition of optimization is
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, is the expected, or long-run average cost of operating the MHS with load per 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
We can fit this objective into formulation (35) by defining a new performance measure
and maximizing 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 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:
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.
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.
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 . 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:
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].
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.
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.
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 —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 possible solutions to the optimization via simulation problem. Let denote the solutions, where the ith solution provides specific settings for the m decision variables. The simulation output at solution is denoted this could be the output of a single replication, or the average of several replications. Our goal is to find the solution that minimizes ).
On each iteration, known as a generation, a GA operates on a “population” of solutions. Denote the population of solutions on thejth iteration as . There may be multiple copies of the same solution in , and 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 , and select, perhaps randomly, an initial population of solutions .
Step 2. Run simulation experiments to obtain performance estimates for all p solutions in .
Step 3. Select a population of p solutions from those in in such a way that those with smaller values are more likely, but not certain, to be selected. Denote this population of solutions as ).
Step 4. Recombine the solutions in via crossover (which joins parts of two solutions and to form a new solution) and mutation (which randomly changes a part of a solution ).
Step 5. Set 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 that has the smallest value in the last population is chosen as best, or alternatively, the solution with the smallest 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, 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 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 ) could be changed to the solution by the move of adding 1 to the first decision variable (perhaps represents the number of AGVs in Example 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 and the list of tabu moves to empty. Select an initial solution in X, perhaps randomly.
Step 2. Find the solution that minimizes over all of the neighbors of that are not reached by tabu moves, running whatever simulations are needed to do the optimization
Step 3. I , then ; move the current best solution to 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 , or when there are no more feasible moves. At termination, the solution 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].
4.4 An Illustration: Random Search
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 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 , where the ith solution provides specific settings for the m decision variables. The simulation output at solution is denoted ; this could be the output of a single replication or the average of several replications. Our goal is to find the solution that minimizes ).
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 . Select an initial solution , and set counts the number of times we visit solution i.]
Step 2. Choose another solution i from the set of all solutions except in such a way that each solution has an equal chance of being selected.
Step 3. Run simulation experiments at the two solutions and to obtain outputs and If , then set . (See note following Step 4.)
Step 4. Set . If not done, then go to Step 2. If done, then select as the estimated optimal solution such that 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 and to obtain outputs and If , then set 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.
Example 11: Implementing Random Search
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 be the number of buffer spaces in front of station i. Then the decision variables are with the constraint that (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 be denoted as
Random-Search Algorithm
Step 1. Initialize 1326 counter variables , one for each of the possible solutions . Select an initial solution, say, 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 . Then (20, 15, 15) remains as the current good solution.
Step 4. Set
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 . Then (28, 12, 10) becomes the current good solution.
Step 4. Set 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 that gives the largest 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 means that 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 as a discrete uniform on , and finally set . But this method does not make all solutions equally likely, as the following illustration shows: Suppose that is randomly sampled to be 50. Then the trial solution must be ; there is only one choice. But if , then both (49, 1, 0) and are possible. Thus, should be more likely than if all solutions with 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
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.
In Exercise 6 from the Estimation of Absolute Performance chapter, consider the following alternative (M, L) policies:
| L | ||||
|---|---|---|---|---|
| Low30 | High40 | |||
| M | Low | 50 | (50,30) | (50, 40) |
| High | 100 | (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.
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.
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.
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.
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 cards, decide on a range of Q worth considering further: 200 Q 250, or , etc. Then investigate this restricted range for two additional policies: Q 200 and , or Q 265 and Q 285, etc.
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?
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.
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 , to suggest the minimum number of workers needed at station 1. Recall that λ is the arrival rate, is the overall mean service time for one job with one worker, and is the number of workers at station i. Attempt to use the same basic condition,, to suggest an initial number of servers at station i for 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.
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.
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 , and At the very least, compute confidence intervals for ^1 and , where is utilization for worker i when the buffer has capacity s.
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 , 60. Notice that, in this case, we know that the correct model is
(Why?) Begin with replications at each design point and estimate and . Gradually increase the number of replications and observe how many are required for the estimates to be close to the true values.
Repeat the previous exercise using CRN. How do the results change?
Consider the simple linear regression model . Find a statistics textbook that covers regression modeling. There you will find a test for the hypothesis (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?
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.
- 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 where ε is a random variable with a distribution, and for which the optimal solution is known for minimization, in this case). See how quickly, or whether, the software can
find the true optimal solution as increases. Next, try more complex models with more than one design variable.
For Example 11, show why there are 1326 solutions. Then derive a way to sample x_1, x_2, and x_3 such that and all outcomes are equally likely.
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.]
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 .
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 , 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.]
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.
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:
Physical layout 2. Labor a. Shift schedules b. Job duties and certification
Equipment a. Rates and capacities b. Breakdowns i.Time to failure ii. Time to repair iii. Resources needed for repair
Maintenance a. Preventative maintenance (PM) schedule b. Time and resources required c. Tooling and fixtures
Workcenters a. Processing b. Assembly c. Disassembly
Product a. Product flow, routing, and resources needed b. Bill of materials
Production schedules a. Made-to-stock b. Made-to-order i. Customer orders ii. Line items and quantities
Production control a. Assignment of jobs to work areas b. Task selection at workcenters c. Routing decisions
Supplies a. Ordering b. Receipt and storage c. Delivery to workcenters
Storage a. Supplies b. Spare parts c. Work-in-process (WIP) d. Finished goods
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:
Conveyors a. Accumulating b. Nonaccumulating c. Indexing and other special purpose d. Fixed window or random spacing e. Power and free
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
- 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:
Ignore it.
Do not model it explicitly, but increase processing times in appropriate proportion.
Use constant values for time to failure and time to repair.
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:
by wall-clock time;
by machine or equipment busy time;
by number of cycle times;
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:
as a pure time delay (no resources required);
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
| Case | 1st Rep | 2nd Rep | 3rd Rep | 4th Rep | 5th Rep | Avg Rep |
|---|---|---|---|---|---|---|
| A. Ignore the breakdowns | 2.36 | 2.05 | 2.38 | 2.05 | 2.70 | 2.31 |
| B. Increase service time to 8.0 | 3.32 | 2.82 | 3.32 | 2.81 | 4.03 | 3.26 |
| C. All random | 4.05 | 3.77 | 4.36 | 3.95 | 4.43 | 4.11 |
| D. Random processing, deterministic breakdowns | 3.24 | 2.85 | 3.28 | 3.05 | 3.79 | 3.24 |
| E. All deterministic | 0.52 | |||||
| F. Deterministic processing,random breakdowns | 1.06 | 1.04 | 1.10 | 1.32 | 1.16 | 1.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:
avoidance of oversimplified and inappropriate assumptions;
careful collection of downtime data;
accurate representation of time to failure and time to repair by statistical distributions;
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:
the number of line items;
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 Station | 1 | 2 | 3 | 4 | 5 | 6 |
|---|---|---|---|---|---|---|
| Buffer Capacity | 4 | 2 | 2 | 2 | 1 | 2 |
Table 3 Assembly and Parts Resupply Times
| Station | Assembly per Gizmo (seconds) | Part Number | Parts Resupply Time (seconds per batch) | No. of Parts per batch |
|---|---|---|---|---|
| 1 | 40 | A | 10 | 15 |
| B | 15 | 10 | ||
| 2 | 38 | C | 20 | 8 |
| D | 15 | 14 | ||
| 3 | 38 | E | 30 | 25 |
| 4 | 35 | |||
| 5 | 35 | |||
| 6 | 40 | 30 | 32 |
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
| Station | TTF | MTTF(Minutes) | TTR | MTTR(Minutes) | +/- | ExpectedAvailability |
|---|---|---|---|---|---|---|
| 1 | Exponential | 36.0 | Uniform | 4.0 | 1.0 | 90% |
| 2 | Exponential | 4.5 | Uniform | 0.5 | 0.1 | 90% |
| 3 | Exponential | 27.0 | Uniform | 3.0 | 1.0 | 90% |
| 4 | Exponential | 9.0 | Uniform | 1.0 | 0.5 | 90% |
| 5 | Exponential | 18.0 | Uniform | 2.0 | 1.0 | 90% |
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 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 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
| Station | Formula to Estimate Cycle Time (seconds) | Estimate (seconds) |
|---|---|---|
| 1 | 57.2 | |
| 2 | 56.6 | |
| 3 | 54.2 | |
| 4 | 50.0 | |
| 5 | 50.0 | |
| 6 | 55.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:
having two operators to service Stations 4 and 5 (instead of the currently proposed one operator);
increasing the capacity of some of the WIP buffers;
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 & 5 | Buffer Capacities | Increase in Mean Throughput per Shift (compared to baseline) Ave. | |||||||
|---|---|---|---|---|---|---|---|---|---|
| Buffer 2 | Buffer 3 | Buffer 4 | Buffer 5 | Buffer 6 | Total | Diff. | CI Low | CI High | |
| 2 | 3 | 3 | 3 | 2 | 2 | 13 | 31.7 | 30.3 | 33.1 |
| 2 | 3 | 3 | 3 | 2 | 3 | 14 | 31.7 | 30.4 | 33.0 |
| 2 | 3 | 3 | 2 | 2 | 3 | 13 | 30.0 | 28.6 | 31.3 |
| 2 | 3 | 3 | 3 | 1 | 3 | 13 | 29.8 | 28.6 | 31.0 |
| 2 | 3 | 3 | 2 | 2 | 2 | 12 | 29.7 | 28.1 | 31.3 |
| 2 | 3 | 3 | 3 | 1 | 2 | 12 | 29.5 | 28.1 | 31.0 |
| 2 | 3 | 3 | 2 | 1 | 3 | 12 | 26.6 | 25.4 | 27.9 |
| 2 | 2 | 3 | 3 | 2 | 2 | 12 | 26.6 | 25.1 | 28.1 |
| 2 | 2 | 3 | 3 | 2 | 3 | 13 | 26.6 | 25.0 | 28.1 |
| 2 | 3 | 2 | 3 | 2 | 3 | 13 | 26.5 | 25.0 | 28.0 |
| 2 | 3 | 2 | 3 | 2 | 2 | 12 | 26.4 | 25.3 | 27.5 |
| 2 | 3 | 3 | 2 | 1 | 2 | 11 | 26.3 | 25.1 | 27.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.
- 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:
| 1 | 6% | 7 | 11% |
|---|---|---|---|
| 2 | 6% | 8 | 6% |
| 3 | 5% | 9 | 5% |
| 4 | 24% | 10 | 5% |
| 5 | 15% | 11 | 3% |
| 6 | 14% | 12 | 0% |
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.
- 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.
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.
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:
| 1 | 6% | 7 | 10% |
|---|---|---|---|
| 2 | 6% | 8 | 6% |
| 3 | 5% | 9 | 4% |
| 4 | 24% | 10 | 4% |
| 5 | 15% | 11 | 3% |
| 6 | 14% | 12 | 3% |
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.
- 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:
| Workstation | Processing Time (sec.) | MTTF (min.) | MTTR (min.) |
|---|---|---|---|
| A | 120 | 90 | 3.1 |
| B | 100 | 82 | 4.0 |
| C | 140 | 110 | 4.5 |
| D | 45 | 20 | 5.0 |
| E | 100 | 240 | 9.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.
- 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:
| Workstation | MTTF (parts) | MTTR (min.) |
|---|---|---|
| A | 45 | 3.1 |
| B | 49 | 4.0 |
| C | 47 | 4.5 |
| D | 27 | 5.0 |
| E | 144 | 9.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?
- 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:
| Workstation | Repair Time (Triangular Distribution) | |||
|---|---|---|---|---|
| Minimum(min.) | Most Likely(min.) | Maximum(min.) | Average(min.) | |
| A | 1.0 | 2.3 | 6.0 | 3.1 |
| B | 2.0 | 3.0 | 7.0 | 4.0 |
| C | 2.5 | 3.5 | 7.5 | 4.5 |
| D | 2.0 | 4.0 | 9.0 | 5.0 |
| E | 4.0 | 7.0 | 16.0 | 9.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.
- 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?
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?
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?
- 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:
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.
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?
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?
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:
| Press | Process 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.) |
|---|---|---|---|---|---|
| Shear | 4.5 | 100 | 8 | 500 | 25 |
| Punch | 5.5 | 90 | 10 | 400 | 25 |
| Form | 3.8 | 180 | 9 | 750 | 25 |
| Bend | 3.2 | 240 | 20 | 600 | 25 |
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.