Download presentation
Presentation is loading. Please wait.
Published byRolf Cunningham Modified over 9 years ago
1
Decision Technology Modeling, Software and Applications Matthew J. Liberatore Robert L. Nydick John Wiley & Sons, Inc.
2
Chapter 12 Introduction to Computer Simulation
3
SIMULATION There are many decision making situations that cannot be accurately modeled using other decision technology applications. Simulation provides the modeler with flexibility to evaluate the performance of many systems. Specifically, simulation allows the modeling and analysis of complex, real-world systems, when one or more variables or relationships are probabilistic.
4
SIMULATION A simulation model evaluates a course of action by simulating the operation of the system for an extended period of time. For example, waiting line or queueing statistics at a bank could be estimated by simulating 1000 days of operation.
5
SIMULATION Some approaches to modeling produce prescriptive models, simulation produces descriptive models. This means that simulation describes a system rather than optimizing it. However, it can test a series of complex policies for cost/benefit analysis. Comparing simulation to other modeling techniques is like comparing a moving picture to a snapshot.
6
ADDING A NEW SERVICE BAY Consider a decision faced by an automotive repair shop (Quik Lube): should an extra service bay be added? There are a variety of uncertain events, including the customer arrival rate, the service rate, the amount of time a customer will wait for service before leaving, the profit generated by different categories of service, etc.
7
ADDING A NEW SERVICE BAY A simulation model can enable you to analyze this problem and select the best alternative. Also, one can determine a range of conditions under which adding the service bay would be preferred - a form of sensitivity analysis.
8
ADVANTAGES OF SIMULATION Simulation is a flexible modeling tool that can handle complex relationships with relative ease. Some examples of complex relationships: -limited number of spaces for cars to wait for service; -customers are only willing to wait 10 minutes for service before they leave.
9
ADVANTAGES OF SIMULATION Simulation models are easy to explain and understand. Diagrams can be drawn to illustrate the various process flow steps and simplify the explanation of the modeling relationships. Computer simulation can be accomplished in a variety of environments. These include Excel, Visual BASIC, C++, and special purpose languages such as Extend, GPSS, Automod, ProModel, Flexsim ED, Witness, Arena, Simul8, and SLX.
10
CLASSES OF SIMULATION MODELS There are two types of simulation modeling: discrete event and continuous. Discrete event: The system changes only when an event occurs. Time advances based on the occurrence of the next event. For our car repair center, the system changes when a car arrives or when service begins or ends.
11
CLASSES OF SIMULATION MODELS Continuous: The system changes continuously over time. Time advances in a fixed increment and the behavior of the system is updated during each increment.
12
CLASSES OF SIMULATION MODELS For example, simulating the flight of an airplane on autopilot is continuous since changes, such as the aircraft's position or velocity, can change continuously over time. If the time fixed increment is 0.05 seconds, changes in flight information during this interval are used to automatically adjust the flight plan. We will use discrete event simulation for process analysis and continuous for financial analysis.
13
TIME MECHANISMS e1e1 e2e2 e3e3 e4e4 e5e5 T1T1 T2T2 T3T3 T4T4 T5T5 Time Next Event Fixed Increment e1e1 e2e2 e3e3 e4e4 e5e5 I4I4 Time I3I3 I2I2 I1I1
14
MONTE CARLO SIMULATION Suppose that we want to simulate the performance of Quik Lube. We need to define probability distributions that describe the time between customer arrivals and how long service takes. Assume that we are interested in generating the amount of time between customer arrivals.
15
MONTE CARLO SIMULATION After gathering data, we found that the possible interarrival times and their relative frequency of occurrence (or probability) are as follows: ProbabilityInterarrival Time 0.15 5 0.15 5 0.3510 0.3510 0.5015 0.5015
16
MONTE CARLO SIMULATION Using this information, how can we generate a sequence of interarrival times for Quik Lube? Clearly these times must be random but the chance that a given interarrival time will occur must correspond to its probability. The process of generating a sequence of random values from a probability distribution is called Monte Carlo simulation.
17
MONTE CARLO SIMULATION To understand how this can be accomplished envision a roulette wheel with 100 identical slots. Since each slot has the same chance of occurrence on the spin of the wheel, we can partition the slots according to the probabilities given and link the results of a spin with the interarrival time.
18
Interarrival TimeProbability Random Interval 5 0.1500-14 10 0.3515-49 15 0.5050-99 25 26 75 74 51504948 98 990001 12 13 14 15
19
If the ball lands on slot 74, what interarrival time is generated? Interarrival TimeProbability Random Interval 5 0.1500-14 10 0.3515-49 15 0.5050-99 25 26 75 74 51504948 98 990001 12 13 14 15
20
Interarrival TimeProbability Random Interval 5 0.1500-14 10 0.3515-49 15 0.5050-99 If the ball lands on slot 74, what interarrival time is generated? 15 minutes 25 26 75 74 51504948 98 990001 12 13 14 15
21
MONTE CARLO SIMULATION Unless you happen to have a roulette wheel in your back pocket, a simpler procedure is needed. A table of random digits prepared by, whom else, the Rand Corporation in 1955, can be used. This table appears on the next page.
23
MONTE CARLO SIMULATION What does it mean for these digits to be random? Every digit in the table is equally likely to be 0 through 9. The patterns of random digits do not repeat. The table can be used at any starting point, and in blocks of 1, 2, 3, etc. digits. For simplicity, we will start in the upper left hand corner.
24
QUIK LUBE EXAMPLE Suppose we want to generate a sequence of 20 interarrival times. We use blocks of two random digits starting in the upper left corner and moving across the table. Each value randomly generated from a probability distribution is called a trial.
25
QUIK LUBE EXAMPLE Random digitsInterarrival Time 63 Inter. TimeProbInterval 50.1500-14 50.1500-14 100.3515-49 100.3515-49 150.5050-99 150.5050-99
26
QUIK LUBE EXAMPLE Random digitsInterarrival Time 6315 Inter. TimeProbInterval 50.1500-14 50.1500-14 100.3515-49 100.3515-49 150.5050-99 150.5050-99
27
QUIK LUBE EXAMPLE Random digitsInterarrival Time 6315 27 Inter. TimeProbInterval 50.1500-14 50.1500-14 100.3515-49 100.3515-49 150.5050-99 150.5050-99
28
QUIK LUBE EXAMPLE Random digitsInterarrival Time 6315 2710 Inter. TimeProbInterval 50.1500-14 50.1500-14 100.3515-49 100.3515-49 150.5050-99 150.5050-99
29
QUIK LUBE EXAMPLE Random digitsInterarrival Time 6315 2710 1510 9915 8615 7115 7415 4510 115 025 1510 145 1810 075 145 5815 6815 3910 3110 085 Inter. TimeProbInterval 50.1500-14 50.1500-14 100.3515-49 100.3515-49 150.5050-99 150.5050-99
30
QUIK LUBE EXAMPLE Random digitsInterarrival Time 6315 2710 1510 9915What is the simulated 8615average interarrival time? 7115 7415 4510 115 025 1510 145 1810 075 145 5815 6815 3910 3110 085 Inter. TimeProbInterval 50.1500-14 50.1500-14 100.3515-49 100.3515-49 150.5050-99 150.5050-99
31
QUIK LUBE EXAMPLE Random digitsInterarrival Time 6315 2710 1510 9915What is the simulated 8615average interarrival time? 7115 7415 Avg = [6(5) + 7(10) + 7(15)] / 20 = 10.25 4510 115 025 1510 145 1810 075 145 5815 6815 3910 3110 085 Inter. TimeProbInterval 50.1500-14 50.1500-14 100.3515-49 100.3515-49 150.5050-99 150.5050-99
32
QUIK LUBE EXAMPLE Random digitsInterarrival Time 6315 2710 1510 9915What is the simulated 8615average interarrival time? 7115 7415 Avg = [6(5) + 7(10) + 7(15)] / 20 = 10.25 4510 115 025 1510 145 1810 075 145 5815 6815 3910 3110 085 OriginalSimulated Inter. TimeProbProb 50.156/20=.30 50.156/20=.30 100.357/20=.35 100.357/20=.35 150.507/20=.35 150.507/20=.35 Notice that the simulated distribution does not match the original probability distribution.
33
QUIK LUBE EXAMPLE The expected interarrival time is: EV = (.15) (5) + (.35)(10) + (.50)(15) = 11.75 Why is there a difference between the simulated average and the expected value? The simulation average will approach the expected value as we increase the number of trials. In validating simulation models, one should check that the random values generated closely fit the original probability distribution.
34
PSEUDO RANDOM NUMBERS To simplify computer generation of random numbers, pseudo-random number generators are used. Formulas are used which will generate a long series of integers before the sequence repeats itself. Programming languages have built in pseudo- random number generators, for example, RAND( ) in Visual Basic.
35
PSEUDO RANDOM NUMBERS IN EXCEL A spreadsheet, such as Excel, can generate a pseudo-random number between 0 and 1. The =RAND() function in Excel returns a random number between 0 and 1 -- try it! To generate a new random number press F9.
36
PSEUDO RANDOM NUMBERS IN EXCEL We recommend that you set the spreadsheet to manual calculation mode so that new random values will be generated only when F9 is pressed. This is accomplished by using the Tools, Options, Calculations, and Manual commands. The Quik Lube simulation that we did with random digits can be done in Excel using the =VLOOKUP command and the =RAND() function.
37
SIMULATION IN EXCEL We first set up the following random interval table (assuming 2 significant digits): Interarrival TimeRandom number interval 50.00 - 0.14 100.15 - 0.50 150.51 - 1.00
38
USING THE =VLOOKUP COMMAND The =VLOOKUP command uses the format: =VLOOKUP(X,BLOCK,COLUMN) Starting in the last row of the “block,” =VLOOKUP searches for the first value that is less than or equal to "X" and returns the value located in the "column" column in the "block." This allows you to access information in data tables. Doesn’t this sound like a definition from a software manual?
39
HOW TO USE =VLOOKUP For Quik Lube, first determine the cumulative probabilities. Cumulative Interarrival TimeProbabilityProbability 5 0.15 0.15 100.35 0.50 150.50 1.00 ------ 1.00
40
HOW TO USE =VLOOKUP The lookup table would be: Cumulative ProbabilityInterarrival Time 0.00 5 0.00 5 0.15 10 0.15 10 0.50 15 0.50 15 1.00 0 1.00 0
41
HOW TO USE =VLOOKUP The lookup table would be: Cumulative ProbabilityInterarrival Time 0.00 5 0.00 5 0.15 10 0.15 10 0.50 15 0.50 15 1.00 0 1.00 0 The lookup command would be: =VLOOKUP(+B14,$A$8:$B$11,2)
42
HOW TO USE =VLOOKUP The 0.00 in the cumulative probability column is in A8 and the 0 in the interarrival time column is in B11. A random number is generated in cell B14. If the random number is less than 0.15, then the interarrival time is 5. If the random number is less than 0.50 but greater than or equal to 0.15, then the time is 10. If the random number is less than 1.00 but greater than or equal to 0.50, then the time is 15.
43
HOW TO USE =VLOOKUP The 0 in the interarrival time column can be any number since this cell will never be used because a random number exactly equal to 1.00 is never generated. The 2 in the =VLOOKUP command indicates that the interarrival times are located in the second column of the “block,” that is, in the B-column. We now demonstrate how to apply the =VLOOKUP in Excel. The Quik Lube example is in a file called QUIK.XLS.
44
BUILDING LARGER MODELS IN EXCEL Using several probability distributions we can build more complex models in Excel. Often, we need additional Excel commands, such as, =IF, =MAX, and =MIN. Consider the following example.
45
REFRIGERATOR SERVICE A service technician for a major refrigerator appliance manufacturer is trained to service two refrigerators, the Alpha and the Beta. Approximately 60% of the technician's service calls are for the Alpha and 40% are for the Beta. The service time distributions for the two models are as follows:
46
AlphaBeta TimeRelativeTimeRelative TimeRelativeTimeRelative (Minutes)Frequency(Minutes)Frequency 250.50200.40 300.25250.40 350.15300.10 400.10350.10 REFRIGERATOR SERVICE
47
Show the random number intervals that can be used to simulate the type of refrigerator to be serviced and the length of the service time for each model. Simulate 20 service calls. What is the total service time spent on the 20 calls? This simulation is in a file called FRIDGE.XLS. REFRIGERATOR SERVICE
48
The three =VLOOKUP tables are: ProbsCall typeProbsAlphaProbsBeta 01025020 0.620.5300.425 100.75350.830 0.9400.935 1010 REFRIGERATOR SERVICE
49
The =IF and =VLOOKUP commands are: =VLOOKUP(RAND(),$A$4:$B$6,2) =IF(A23=1,(VLOOKUP(RAND(),$A$9:$B$13,2)), (VLOOKUP(RAND(),$A$16:$B$20,2))) REFRIGERATOR SERVICE
50
In the next section, we will build simulation models of queuing or waiting line processes. These models can be built in Excel but require considerable skill. An example of a basic waiting line model is shown in QSINGLE.XLS. FROM EXCEL TO EXTEND
51
Because of the complexity in building more advanced simulation models, spreadsheet add-ins are available. As discussed in Chapter 1, these add-ins cannot always address situations that occur in practice. Our goal is to empower students to model problems that interest them. We use a visual simulation software package called Extend to provide the flexibility and power needed for process simulation. FROM EXCEL TO EXTEND
52
CARS, GOATS, AND MONTE HALL On September 9th, 1990 Craig F. Whitaker addressed a seemingly innocent question to the “Ask Marilyn” column in Parade Magazine. “Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others goats. You pick a door, say No. 1, and the host, who knows what’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, “Do you want to pick door number 2?” Is it to your advantage to switch your choice?”
53
CARS, GOATS, AND MONTE HALL Monte Hall wants to know: Do you want to switch? What do you think Ms. Marilyn Vos Savant’s answer was? “Yes, you should switch. The first door has a one- third chance of winning but the second door has a two-thirds chance.” This implies that the probability of switching and winning is 2/3, while the probability of not switching and winning is 1/3.
54
CARS, GOATS, AND MONTE HALL Is anyone convinced that Marilyn’s answer is correct? For many people, Marilyn’s answer is counterintuitive since two doors remain unopened, implying that the probability that the car is behind each is 0.5. How would your thoughts change if we started with 1,000,000, doors? One of the key issues we stressed is the importance of clearly stating your assumptions before attempting problem solution.
55
CARS, GOATS, AND MONTE HALL Some key assumptions: We assume that the car has an equally likely chance of being behind each door. The car is more valuable than the goat! The position of the car will not change once the game begins.
56
CARS, GOATS, AND MONTE HALL Your decision to switch may change if a different set of assumptions hold. For example, if the car can move once a door has been opened, then it makes no difference if you switch or not.
57
CARS, GOATS, AND MONTE HALL Simulation can be used to help us better understand this problem and its solution. To keep things interesting we will simulate this problem using a web site located at: http://www.stat.sc.edu/~west/javahtml/LetsMakeaDeal.html. http://www.stat.sc.edu/~west/javahtml/LetsMakeaDeal.html This address is case sensitive. The results of the simulation should convince even the most skeptical individual that this counter-intuitive solution is correct!
58
SUMMARY In this chapter, we: Provided an introduction to simulation Provided a brief history of Monte Carlo simulation Presented simulation in Excel Discussed the understanding of a simulation solution through a game show example
59
COPYRIGHT Copyright 2003 Matthew J. Liberatore and Robert L. Nydick. All rights reserved. Reproduction or translation of this work beyond that named in Section 117 of the United States Copyright Act without the express written consent of the copyright owners is unlawful. Requests for further information should be addressed to Matthew J. Liberatore and Robert L. Nydick. Adopters of the textbook are granted permission to make back-up copies for their own use only, to make copies for distribution to students of the course the textbook is used in, and to modify this material to best suit their instructional needs. Under no circumstances can copies be made for resale. Matthew J. Liberatore and Robert L. Nydick assume no responsibility for errors, omissions, or damages, caused by the use of these programs or from the use of the information contained herein.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.