Simulation:Purpose ,Strengths, weaknesses, and limitations

Simulation

19.1 Purpose

Simulation is the use of a mathematical model that behaves in the same manner as the system under study. The purpose of a simulation model is to give management an insight into the behavior of the system and to give information about possible alternative actions. By changing parameter values and testing different proposed solutions to a problem, simulation can provide an insight on how the system behaves under various conditions and help management evaluate the available options.

19.2 Strengths, weaknesses, and limitations

The information obtained from the simulation model can be used to study the behavior of the system without disturbing the system, or to compare various proposed solutions and actions without actually implementing those actions. It is generally easier to understand a simulation model than an analytical model (although an analytic model, if one exists, is preferable to a simulation model). Furthermore, with the recent technological advances, computer animation can give a visual representation of a model and enable managers to better understand the model. Finally, simulation is very flexible and can be used to represent very complex systems that cannot be otherwise studied.

The quality of results depends on the quality of inputs. Gathering data to generate input values can be time consuming and expensive. Building a model requires time, effort and expertise, and the output can be hard to interpret. Simulation cannot prescribe a solution; it merely describes the behavior of a system under various inputs. Thus, the analysis will not detect the existence of a better action that was not tested.

Note that several simulation trials are necessary before inferences about an output variable can be made. In discrete simulations, multiple runs are necessary, and the mean of the average values obtained from each run serves as the point estimate for the measure of interest.

19.3 Inputs and related ideas

Before building a simulation model, you must:

1.  Formulate the problem and identify a clear objective for the model. Identify output variables and specific issues to be addressed. Decide on budget and time restrictions.
2.  Define the probability distributions of all stochastic inputs. These input distributions are obtained or estimated from empirical data or through heuristic procedures if no data are available.
3.  Obtain a good understanding of the system and determine a level of detail for the model.

Once the model is developed, verify that it is free of any programming mistakes. Throughout the entire simulation process, validate the model to ensure it represents the system under study. Use pilot runs to test the model’s behavior to small changes. Use real output data, if available, to evaluate simulated output. After verifying and validating the model, make multiple simulation runs to gather output data. Use statistical techniques to analyze the output and make inferences about the performance of particular designs.

Simulation and queuing theory (Chapter 79) are mathematically-based techniques that can be applied to similar problems. Simulation is often used to support network analysis (Chapter 53) and network routing (Chapter 54).

19.4 Concepts

Simulation models imitate real life systems. The models frequently deal with stochastic rather than deterministic inputs. These inputs have probabilistic components that can be modeled through the use of random numbers. Simulation languages and spreadsheets have built-in probability functions that allow the user to generate values from certain probability distributions.

Simulation models can be categorized into three groups: Monte-Carlo simulations, discrete simulations, and continuous simulations. Discrete and continuous simulations are often called systems simulations. The main difference between Monte-Carlo and systems simulations is the effect of time. In Monte-Carlo simulations time plays no substantive role, while in systems simulations time is an important part of the model. In discrete simulations variables change instantaneously at particular points in time, while in continuous simulations, variables change continuously. Continuous models typically use differential equations and have applications in the engineering field. Thus, they are not discussed in this chapter.

19.4.1 Monte-Carlo simulation

Monte-Carlo simulations have one or more random inputs and the passage of time plays no substantive role. Random numbers are used to generate values from the input distributions. Typically, the output depends on these probabilistic inputs and takes on different values with repeated simulation trials. The outcomes of consecutive simulation trials are independent of each other, and standard statistical methods can be used to analyze the results. Moreover, risk analysis can be performed to evaluate the potential loss resulting from a decision. Most popular spreadsheets have build-in probability functions and allow repeated sampling. Furthermore, spreadsheet add-ins make it much easier to perform simulations and generate important statistical information that facilitates the analysis of the output.

The following example is used to demonstrate the application of Monte-Carlo simulation. Albert’s Bakery Store specializes in fruitcakes. Daily demand for cakes is normally distributed with a mean of 12 and a standard deviation of 2. Production cost is $3.10 per cake and the unit selling price is $5. Any cakes not sold at the end of the day are given to the free store. Albert would like to know how many cakes to make at the beginning of the day in order to maximize his profit. Furthermore, he believes that it is important to have a profit of at least $5, and would like to minimize the probability of not meeting this minimum profit.

The unit production cost and the unit selling price are found in cells B3 and B4 of the Excel spreadsheet in Figure 19.1. The decision on daily production is shown in cell B6. Cell B7 generates demand using the normal distribution and rounds the value to the nearest integer. Production cost is in cell B8, revenue is in cell B9, and profit is the difference between revenue and cost as shown in cell B11. It is good practice to have the input values at a designated place in the spreadsheet and refer to them for the calculation of the various costs. That way, sensitivity analysis can be performed by simply changing the values of the input cells (and not the cell formulas).

19.4.1.1 Output analysis

The output variable in this example is profit. Whenever demand changes in cell B7, profit also changes. Furthermore, the daily production value in cell B6 affects profit.

To analyze this problem, multiple simulation trials are necessary for each production value. Using a two-way table in Excel, the profit was generated for 1000 simulation trials and 6 different production values. For each production value, the average, standard deviation, minimum, and maximum profit values were calculated using the =AVERAGE, =STDEV, =MIN, and =MAX functions.

19-01
Figure 19.1  Spreadsheet setup for Albert’s Bakery Store.

19-02
Figure 19.2  Simulation results for Albert’s Bakery Store.

The summary statistics of the simulation trials are shown in Figure 19.2. A daily production value of 12 maximizes average profit at 19.335 with a standard deviation of 5.652. A daily production value of 11 gives an average profit at 19.245 and a standard deviation of 3.95. This option gives a lower profit but has less variability.

The formula for computing a 95 percent confidence interval of the average profit given a specific production value is shown in Table 19.1 (Formula 19.1).  is the average profit, s is the standard deviation, nis the number of simulation trials, and Z0.25 is 1.96, and is obtained from the standardized normal tables. The 95 percent confidence interval for a daily production value of 11, is 19.245 ± 1.96(3.95/10001/2), or from 19.000 to 19.490. For a daily production value of 12, the 95 percent confidence interval is 18.985 to 19.685. Again, the intervals indicate that a production of 12 has a higher average value but also a higher variability.

Table 19.1 Confidence Intervals

19-01d

Since simulation trials are independent of each other, other statistical methods (for example, hypothesis testing) can be used to analyze and compare the various decisions.

19.4.1.2 Risk analysis

Risk is the potential occurrence of an undesirable outcome when a decision must be taken in the presence of uncertainty. In the Albert’s Bakery Store example, the undesirable outcome is a profit less than $5.

For each production value, the number of simulation trials having a profit less than $5 can be obtained using Excel’s =COUNTIF(range,”<5”) function. This number is divided by the total number of simulation trials (1000) to give the risk or probability of profit being less than $5 (Figure 19.2).

Risk is minimized when daily production is 9, but profit is low at this level. Compare the two production values with the highest average profit. A production quantity of 12 has the highest average profit with a risk of 3.4 percent. A production quantity of 11 has a slightly lower profit with a lower risk at 0.8 percent.

19.4.2 Discrete simulation

Discrete simulations represent systems in which changes occur instantaneously at particular points in time. They model a sequence of events that occur over time and are typically used for inventory, queuing, and manufacturing analyses. Lately, their applications have been extended to the service and public policy sectors among others.

Even though the analysis of such models can be done manually or in spreadsheets, the amount of information that must be kept can be overwhelming and the use of computer simulation languages is recommended.

Queuing applications of discrete simulations abound. In these studies, the characteristics of the system change with the occurrence of two events: arrival of entities and departure (or end of service) of entities. The simulation clock is advanced to the time when the next event takes place, and the changes in the system are recorded. Thus, the models are frequently called next-event simulations.

Consider the example of Harry, the barber (Chapter 79). Customers arrive at Harry’s shop at the average rate of 4 per hour, according to a Poisson distribution. Harry’s average service rate is 3.2 customers per hour, exponentially distributed. Chapter 79 shows the calculation of performance measures (length of queue, waiting time in queue, etc.) using an analytical approach. In this chapter, the same analysis is performed with the help of a simulation language.

Using SLAM II,1 the graphical network of the problem is shown in Figure 19.3. The first node in the network creates arrivals at an average rate of one every 0.25 h. The customers are routed to a queue (HARRY) where they wait for service. Average service time is 0.2 h, and after service they leave the system.

19-03
Figure 19.3  SLAM II network for Harry’s barbershop.

The simulation was run for 4000 h and statistics were cleared after 1000 h in order to eliminate any effects of transient state. The output statistics in Figure 19.4 represent steady state statistics for one run. Average length of the queue is 3.189 and average waiting time is 0.795 h or 47.7 min. These values can be found under “FILE STATISTICS” and are in agreement with the analytical values (Chapter 79) of 3.2 and 48 min.

Consider the same example with the following extension: There is a 50 percent chance that an arriving customer will balk if there are more than 4 customers waiting. The new network in Figure 19.5 shows conditional as well as probabilistic branching. Variable NNQ(1) refers to the number of customers waiting for service. The condition and probabilities on the branches indicate that 50 percent of the arriving customers leave if the line is greater than 4. As expected, the average length of the queue decreased to 1.692, and average waiting time is 0.444 h or 26.64 min (Figure 19.6). Furthermore, the output indicates that during the 3000 simulated hours, 722 customers left the system without receiving service (regular activity statistics) while 11,443 customers received service (service activity statistics).

19-04
Figure 19.4  SLAM II output for Harry’s barbershop.

19-05
Figure 19.5  SLAM II network for Harry’s barbershop with probabilistic balking.

19-06
Figure 19.6  SLAM II output for Harry’s barbershop with probabilistic balking.

19.4.2.1 Stopping rules

In the preceding example, the model was run for a fixed amount of time. The simulation lasted 4000 h and the statistics were cleared after 1000 h in order to eliminate transient state effects. If the transient state is of interest, then statistics are collected over the initial stages of the simulation.

Other stopping rules for discrete simulations can depend on the number of entities that go through the system. It is possible to generate only 100 customers for Harry’s barbershop, and end the simulation when the last customer leaves the system. Alternatively, it is possible to keep generating customers, but end the simulation when the 100th customer leaves the system. In the first example, the system is empty when the simulation terminates, while in the latter example, there can be customers in the system at the end of simulation. The performance measures of the two scenarios will probably be different.

19.4.2.2 Output analysis

Statistical analysis of discrete simulations is not as straightforward as in Monte-Carlo simulations because observations are not independent. For example, the waiting time in queue for the 10th customer is correlated with the waiting time of the 9th customer. If customer 9 was in line for a long time, most probably, customer 10 will be in line for a long time. Multiple simulation runs are necessary, with each run lasting a reasonable amount of time or processing a large number of entities. If the transient state is not of interest, statistics should be collected after the steady state has been reached. A popular technique for collecting statistics is the batch means approach. One long simulation run is used instead of many shorter ones. Statistics are cleared after the warm-up period in order to eliminate the transient state. The remaining length of the simulation is divided into the desired number of batches. Statistics are collected at the end of each batch and then cleared in order to start collection for the next batch. For each batch, the average value of a performance measure is calculated. The 95 percent confidence interval for a performance measure is given by Formula 19.2 in Table 19.2.  is the mean of all batch averages, n is the number of batches (which is typically small), t0.25 has n – 1 degrees of freedom and is obtained from the t-tables, and s is the standard deviation of the average values, given by Formula 19.3, where xi is the average value of the ith batch.

Table 19.2 Discrete Simulation Output Analysis

19-02d

The simulation model for Harry’s shop with probabilistic balking (Figure 19.5) was run for 16,000 h; statistics were cleared after the first 1000 h, and then collected, and subsequently cleared at 3000 h intervals. The average queue-lengths for the five batches are: 1.692, 1.507, 1.715, 1.633, and 1.585. The mean, , is 1.6264 and the standard deviation, s, is 0.0839. The 95 percent confidence interval for the length of the queue is 1.6264± 2.776(0.0839/51/2) or 1.522 to 1.730. In other words, there is a 95 percent chance that the length of the queue is between 1.522 and 1.730.

19.5 Key terms
Analytic model —
A mathematical equation(s) that will give the value of an output when an input value is specified.
Balking —
The act of walking away from a queue; usually occurs when the queue is either too long or at maximum capacity.
Continuous simulation —
A simulation model of a system in which changes occur continuously.
Deterministic model —
A model having all inputs fixed and known (or assumed known).
Discrete simulation —
A simulation model of a system in which changes occur instantaneously at particular points in time.
Entities —
Units such as people, parts, jobs, etc., that flow through a system.
Monte-Carlo simulation —
A simulation with one or more random variables where the passage of time plays no substantive role. Random numbers are used to generate values from probability distributions.
Risk analysis —
An analysis of the potential occurrence of an undesirable outcome when a decision must be taken in the presence of uncertainty.
Simulation —
The use of a mathematical model that behaves in the same manner as the system under study.
Steady state —
The end of transient state as the system reaches normal operations.
Stochastic or probabilistic model —
A model having some data described by probability distributions.
System —
A set of components (entities, machines, etc.) that interact to perform an operation that is of interest to the modeler.
Transient state —
The beginning or warm-up period of a model as activity builds up.
19.6 Software

Most standard spreadsheet programs are sufficient for Monte-Carlo simulations. Build-in probability functions give the analyst the capability to sample from certain distributions. However, the number of available distributions is limited. Furthermore, it can become cumbersome to generate thousands of trials of a simulation model. Spreadsheet add-ins (@RISK Crystal Ball, etc.) provide a wide variety of probability distributions, and make it much easier to perform multiple trials, and generate important statistical information to facilitate the analysis of the output.

Both general-purpose languages (C, C++, Fortran, etc.) and simulation languages (SLAM II, SIMSCRIPT, GPSS, Extend, etc.) can be used for discrete simulation. Even though general-purpose languages offer greater flexibility, simulation languages can be more efficient as far as computing time and effort. Simulation languages provide most of the features required in a simulation model and are easier to change.

For a comprehensive survey of available simulation software see Swaim.2

19.7 References
19.7.1 Citations
1.  Pritsker, A. B., Introduction to Simulation and SLAM II, 3rd ed., Halsted Press (John Wiley & Sons), New York, 1986.
2.  Swaim, J. J., Simulation goes mainstream, OR/MS Today, 24(5), 35, 1997.
19.7.2 Suggestions for additional reading
1.  Law, A. M. and Kelton, W. D., Simulation Modeling & Analysis, 2nd ed., McGraw-Hill, New York, 1991.
2.  Winston, W. L., Simulation Modeling Using @RISK, Duxbury Press, Belmont, CA, 1996.

Comments

Popular posts from this blog

The Conversion Cycle:The Traditional Manufacturing Environment

The Revenue Cycle:Manual Systems

HIPO (hierarchy plus input-process-output)