Presentation is loading. Please wait.

Presentation is loading. Please wait.

Table of Contents Chapter 12 (Computer Simulation: Basic Concepts)

Similar presentations


Presentation on theme: "Table of Contents Chapter 12 (Computer Simulation: Basic Concepts)"— Presentation transcript:

1 Table of Contents Chapter 12 (Computer Simulation: Basic Concepts)
The Essence of Computer Simulation (Section 12.1) 12.2 Example 1: A Coin-Flipping Game (Section 12.1) 12.3–12.7 Example 2: Heavy Duty Company (Section 12.1) 12.8–12.14 A Case Study: Herr Cutter’s Barber Shop (Section 12.2) 12.15–12.23 Analysis of the Case Study (Section 12.3) 12.24–12.31 Outline of a Major Computer Simulation Study (Section 12.4) 12.32–12.34 © The McGraw-Hill Companies, Inc., 2008

2 The Essence of Computer Simulation
A stochastic system is a system that evolves over time according to one or more probability distributions. Computer simulation imitates the operation of such a system by using the corresponding probability distributions to randomly generate the various events that occur in the system. Rather than literally operating a physical system, the computer just records the occurrences of the simulated events and the resulting performance of the system. Computer simulation is typically used when the stochastic system ivolved is too complex to be analyzed satisfactorily by analytical models. © The McGraw-Hill Companies, Inc., 2008

3 Example 1: A Coin-Flipping Game
Rules of the game: Each play of the game involves repeatedly flipping an unbiased coin until the difference between the number of heads and tails tossed is three. To play the game, you are required to pay $1 for each flip of the coin. You are not allowed to quit during the play of a game. You receive $8 at the end of each play of the game. Examples: HHH 3 flips You win $5 THTTT 5 flips You win $3 THHTHTHTTTT 11 flips You lose $3 © The McGraw-Hill Companies, Inc., 2008

4 Computer Simulation of Coin-Flipping Game
A computer cannot flip coins. Instead it generates a sequence of random numbers. A number is a random number between 0 and 1 if it has been generated in such a way that every possible number within the interval has an equal chance of occurring. An easy way to generate random numbers is to use the RAND() function in Excel. To simulate the flip of a coin, let half the possible random numbers correspond to heads and the other half to tails. to correspond to heads. to correspond to tails. © The McGraw-Hill Companies, Inc., 2008

5 Computer Simulation of Coin-Flipping Game
Figure A spreadsheet model for a computer simulation of the coin-flipping game (Example 1). © The McGraw-Hill Companies, Inc., 2008

6 Data Table for 14 Replications of Coin-Flipping Game
Figure A data table that records the results of performing 14 replications of a computer simulation with the spreadsheet in Figure 12.1. © The McGraw-Hill Companies, Inc., 2008

7 Data Table for 1000 Replications of Coin-Flipping Game
Figure This data table improves the reliability of the computer simulation recorded in Figure 12.2 by performing 1,000 replications instead of 14. © The McGraw-Hill Companies, Inc., 2008

8 Corrective Maintenance versus Preventive Maintenance
The Heavy Duty Company has just purchased a large machine for a new production process. The machine is powered by a motor that occasionally breaks down and requires a major overhaul. Therefore, a second standby motor is kept, and the two motors are rotated in use. The breakdowns always occur on the fourth, fifth, or sixth day that the motor is in use. Fortunately, it takes fewer than three days to overhaul a motor, so a replacement is always ready. Cost of a Replacement Cycle that Begins with a Breakdown Replace a Motor $2,000 Lost production during replacement 5,000 Overhaul a motor   4,000   Total $11,000 © The McGraw-Hill Companies, Inc., 2008

9 Probability Distribution of Breakdowns
Day Probability of a Breakdown Corresponding Random Numbers 1, 2, 3 4 0.25 to 5 0.5 to 6 to 7 or more © The McGraw-Hill Companies, Inc., 2008

10 Computer Simulation of Corrective Maintenance
Figure A spreadsheet model for a computer simulation of performing corrective maintenance on the Heavy Duty Co. motors. © The McGraw-Hill Companies, Inc., 2008

11 Preventive Maintenance Options
Preventive maintenance would involve scheduling the motor to be removed (and replaced) for an overhaul at a certain time, even if a breakdown has not occurred. The goal is to provide maintenance early enough to prevent a breakdown. Scheduling the overhaul enables removing and replacing the motor at a convenient time when the machine is not in use, so no production is lost. Cost of a Replacement Cycle that Begins without a Breakdown Replace a motor on overtime $3,000 Lost production during replacement Overhaul a motor before a breakdown   3,000   Total $6,000 © The McGraw-Hill Companies, Inc., 2008

12 Replace Motor After 3 Days
Cost of a replacement cycle is $6,000. (Replacement always occurs without a breakdown). Replacement cycle occurs every three days. E(Cost per day) = ($6,000) / (3 days) = $2,000 per day. © The McGraw-Hill Companies, Inc., 2008

13 Replace Motor After 4 Days
Figure A spreadsheet model for a computer simulation of performing preventitive maintenance (replace after four days) on the Heavy Duty Co. motors. © The McGraw-Hill Companies, Inc., 2008

14 Replace Motor After 5 Days
Figure A spreadsheet model for a computer simulation of performing preventitive maintenance (replace after four days) on the Heavy Duty Co. motors. © The McGraw-Hill Companies, Inc., 2008

15 Herr Cutter’s Barber Shop
Herr Cutter is a German barber who runs a one-man barber shop. He opens his shop at 8:00 AM each weekday morning. His customers arrive randomly at an average rate of two customers per hour. He requires an average of 20 minutes for each haircut. As his business has increased, his customers now often wait awhile (sometimes over half-an-hour). His loyal customers are willing to wait, but new customers are much less likely to return if they have to wait. An article in The Barber’s Journal states In a well-run barber shop, loyal customers will tolerate an average wait of 20 minutes, while new customers will tolerate only a 10 minute average wait. (With longer waits, they typically take their business elsewhere in the future.) Question: Should Herr Cutter hire a new associate to share the workload? © The McGraw-Hill Companies, Inc., 2008

16 Probability Distributions
The time required to give a haircut varies between 15 and 25 minutes. His best estimate is that the times between 15 and 25 minutes are equally likely. Estimated distribution of service times: The Uniform distribution over the interval from 15 to 25 minutes. To generate a random observation from the uniform distribution, with values between a and b equally likely, =a + (b–a)*RAND() For a uniform distribution between 15 and 25 minutes, = *RAND() © The McGraw-Hill Companies, Inc., 2008

17 Probability Distributions
The barber shop has random arrivals of customers, averaging two per hour. Estimated distribution of interarrival times: An exponential distribution with a mean of 30 minutes. To generate a random observation from the exponential distribution, = –(mean) * LN(RAND()) For a mean of 30 minutes, = –30*LN(RAND()) © The McGraw-Hill Companies, Inc., 2008

18 Building Blocks of a Simulation Model
A description of the components of the system, including how they are assumed to operate and interrelate. A simulation clock. A definition of the state of the system. A method for randomly generating the (simulated) events that occur over time. A method for changing the state of the system when an event occurs. A procedure for advancing the time on the simulation clock. © The McGraw-Hill Companies, Inc., 2008

19 Building Blocks for Herr Cutter’s Simulation Model
A description of the components of the system, including how they are assumed to operate and interrelate. The components are the customers, the queue, and Herr Cutter as the server. A simulation clock. t = Amount of simulated time that has elapsed so far A definition of the state of the system. N(t) = Number of customers in the barber shop at time t. A method for randomly generating the (simulated) events that occur over time. The interarrival and service times are generated using the inverse transformation method. © The McGraw-Hill Companies, Inc., 2008

20 Building Blocks for Herr Cutter’s Simulation Model
A method for changing the state of the system when an event occurs. Reset N(t) = N(t) + 1 if an arrival occurs at time t Reset N(t) = N(t) – 1 if a service completion occurs at time t A procedure for advancing the time on the simulation clock. The Next-Event Time-Advance Procedure Observe the current time t and randomly generated times of the next occurrence of each event type that can occur (service or arrival in Herr Cutter’s problem). Determine which event will occur next. Advance the time on the simulation clock to the time of this next event. Updated the system by determining its new state as a result of this event and by randomly generating the time until the next occurrence of any event type that can occur from this new state (if not previously generated). Also record desired information about the performance of the system. Then return to the first step. © The McGraw-Hill Companies, Inc., 2008

21 A Computer Simulation of Herr Cutter’s Barber Shop
Figure A computer simulation of Herr Cutter’s barber shop (as currently operated) over a period of 100 customer arrivals. © The McGraw-Hill Companies, Inc., 2008

22 Evolution of Number of Customers Over First 100 Minutes
Figure This graph shows the evolution of the number of customers in Herr Cutter’s barber shop over the first 100 minutes of the computer simulation in Figure (Note: This graph matches the data from Figure in the text, but NOT in the previous slide. Every simulation gives different results.) © The McGraw-Hill Companies, Inc., 2008

23 Simulating the Barber Shop with an Associate
The only difference occurs when the next-event time-advance procedure is determining which event occurs next. Instead of just two possibilities, there are now three: A departure because Herr Cutter completes a haircut. A departure because the associate completes a haircut. An arrival. © The McGraw-Hill Companies, Inc., 2008

24 Analysis of the Case Study: Financial Factors
Revenue = $15 per haircut Average tip = $2 per haircut Cost of maintaining the shop = $50 per working day Salary of an associate = $120 per working day Commission for an associate = $5 per haircut given by the associate. In addition to his salary and commission, the associate would keep his own tips. Otherwise, the revenue would go to Herr Cutter. The shop is open from 8:00 AM to 5:00 PM, so it admits customers for nine hours. © The McGraw-Hill Companies, Inc., 2008

25 Analysis of Continuing without an Associate
The current distribution of interarrival times has a mean of 30 minutes. Therefore, he averages 18 customers per working day. After subtracting the cost of maintaining the shop, his average net income per working day is Net daily income = ($15 + $2) (18 customers) – $50 = $306 – $50 = $256 © The McGraw-Hill Companies, Inc., 2008

26 Features of the Queueing Simulator
Can run computer simulations of various kinds of basic queueing systems. Can have any number of servers up to a maximum of 25. Can use any of the following probability distributions for either interarrival times or service times: Constant time (also called the degenerate distribution). Exponential distribution. Translated exponential distribution (the sum of a constant time and a time from an exponential distribution). Uniform distribution. Erlang distribution. Provides estimates of various key measures of performance: L = Expected number of customers in the system, including those being served. Lq = Expected number of customers in the queue. W = Expected waiting time in the system (includes service time) for a customer. Wq = Expected waiting time in the queue (excluding service time) for a customer. Pn = Probability of exactly n customers in the system (for n = 1, 2, … , 10). © The McGraw-Hill Companies, Inc., 2008

27 Queueing Simulator for Herr Cutter (Without Associate)
Figure The output obtained by using the Queueing Simulator in one of this chapter’s Excel files to perform a computer simulation of Herr Cutter’s barber shop (without an associate) over a period of 100,000 customer arrivals. © The McGraw-Hill Companies, Inc., 2008

28 Testing the Validity of the Simulation Model
Figure This Excel template for the M/G/1 model shows the basic measures of performance for Herr Cutter’s barber shop without an associate. © The McGraw-Hill Companies, Inc., 2008

29 Analysis of the Option of Adding an Associate
Adding an associate would reduce the average waiting time before a haircut begins to less than 10 minutes. gradually attract new business until this average waiting time reaches 10 minutes. Queueing Simulator Results: Mean of Interarrival Times Point Estimate of Wq 95 Percent Confidence Interval for Wq 20 minutes 3.33 minutes 3.05 to 3.61 minutes 15 minutes 8.10 minutes 6.98 to 9.22 minutes 14 minutes 10.80 minutes 9.51 to minutes 14.2 minutes 9.83 minutes 8.83 to minutes 14.3 minutes 9.91 minutes 8.76 to minutes Table The estimates of Wq obtained by using the queueing simulator to simulate Herr Cutter’s barber shop with an associate for 10,000 arrivals for different means of the distribution of interarrival times. © The McGraw-Hill Companies, Inc., 2008

30 Queueing Simulator for Herr Cutter (With an Associate)
Figure The results obtained by using the Queueing Simulator to perform a computer simulation of Herr Cutter’s barber shop with an associate over a period of 100,000 customer arrivals. © The McGraw-Hill Companies, Inc., 2008

31 Analysis of the Option of Adding an Associate
Herr Cutter believes 14.3 minutes provides an adequate and conservative estimate of the mean interarrival rate with an associate. This corresponds to a mean arrival rate of 37.8 customers per day. Net daily income = 37.8 ($15) (shop revenue) ($2) (his tips) – $50 (shop maintenance) – $120 (associate’s salary) – $18.9 ($5) (associate’s commission) Total $340.30 This compares to Herr Cutter’s current net daily income of $256. © The McGraw-Hill Companies, Inc., 2008

32 Outline of a Major Computer Simulation Study
Step 1: Formulate the Problem and Plan the Study What is the problem that management wants studied? What are the overall objectives for the study? What specific issues should be addressed? What kinds of alternative system configurations should be considered? What measures of performance of the system are of interest to management? What are the time constraints for performing the study? Step 2: Collect the Data and Formulate the Simulation Model The probability distributions of the relevant quantities are needed. Generally it will only be possible to estimate these distributions. A simulation model often is formulated in terms of a flow diagram. Step 3: Check the Accuracy of the Simulation Model Walk through the conceptual model before an audience of all the key people. © The McGraw-Hill Companies, Inc., 2008

33 Outline of a Major Computer Simulation Study
Step 4: Select the Software and Construct a Computer Program Classes of software Spreadsheet software (e.g., Excel, Crystal Ball) A general purpose programming language (e.g., C, FORTRAN, Pascal, etc.) A general purpose simulation language (e.g., GPSS, SIMSCRIPT, SLAM, SIMAN) Applications-oriented simulators Step 5: Test the Validity of the Simulation Model If the real system is currently in operation, performance data should be compared with the corresponding output generated by the simulation model. Conduct a field test to collect data to compare to the simulation model. Have knowledgeable personnel check how the simulation results change as the configuration of the simulated system is changed. Watch animations of simulation runs. © The McGraw-Hill Companies, Inc., 2008

34 Outline of a Major Computer Simulation Study
Step 6: Plan the Simulations to Be Performed Determine length of simulation runs. Keep in mind that the simulation runs do no produce exact values. Each simulation run can be viewed as a statistical experiment that is generating statistical observations of the performance of the system. Step 7: Conduct the Simulation Runs and Analyze the Results Obtain point estimates and confidence intervals to indicate the range of likely values for the measures. Step 8: Present Recommendations to Management © The McGraw-Hill Companies, Inc., 2008


Download ppt "Table of Contents Chapter 12 (Computer Simulation: Basic Concepts)"

Similar presentations


Ads by Google