Presentation is loading. Please wait.

Presentation is loading. Please wait.

McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 12.1 Table of Contents Chapter 12 (Computer Simulation: Basic Concepts) The Essence of Computer.

Similar presentations


Presentation on theme: "McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 12.1 Table of Contents Chapter 12 (Computer Simulation: Basic Concepts) The Essence of Computer."— Presentation transcript:

1 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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

2 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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.

3 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Example 1: A Coin-Flipping Game Rules of the game: 1.Each play of the game involves repeatedly flipping an unbiased coin until the difference between the number of heads and tails tossed is three. 2.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. 3.You receive $8 at the end of each play of the game. Examples: HHH3 flipsYou win $5 THTTT5 flipsYou win $3 THHTHTHTTTT11 flipsYou lose $3

4 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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.

5 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Computer Simulation of Coin-Flipping Game

6 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Data Table for 14 Replications of Coin-Flipping Game

7 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Data Table for 1000 Replications of Coin-Flipping Game

8 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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 replacement5,000 Overhaul a motor 4,000 Total$11,000

9 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Probability Distribution of Breakdowns Day Probability of a Breakdown Corresponding Random Numbers 1, 2, to to to or more

10 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Computer Simulation of Corrective Maintenance

11 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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 replacement0 Overhaul a motor before a breakdown 3,000 Total$6,000

12 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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.

13 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Replace Motor After 4 Days

14 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Replace Motor After 5 Days

15 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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?

16 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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()

17 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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())

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

19 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Building Blocks for Herr Cutter’s Simulation Model 1.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. 2.A simulation clock. t = Amount of simulated time that has elapsed so far 3.A definition of the state of the system. N(t) = Number of customers in the barber shop at time t. 4.A method for randomly generating the (simulated) events that occur over time. The interarrival and service times are generated using the inverse transformation method.

20 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Building Blocks for Herr Cutter’s Simulation Model 5.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 6.A procedure for advancing the time on the simulation clock. The Next-Event Time-Advance Procedure a)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. b)Advance the time on the simulation clock to the time of this next event. c)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.

21 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., A Computer Simulation of Herr Cutter’s Barber Shop

22 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Evolution of Number of Customers Over First 100 Minutes

23 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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: 1.A departure because Herr Cutter completes a haircut. 2.A departure because the associate completes a haircut. 3.An arrival.

24 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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.

25 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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

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

27 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Queueing Simulator for Herr Cutter (Without Associate)

28 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Testing the Validity of the Simulation Model

29 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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 W q 95 Percent Confidence Interval for W q 20 minutes3.33 minutes3.05 to 3.61 minutes 15 minutes8.10 minutes6.98 to 9.22 minutes 14 minutes10.80 minutes9.51 to minutes 14.2 minutes9.83 minutes8.83 to minutes 14.3 minutes9.91 minutes8.76 to minutes

30 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., Queueing Simulator for Herr Cutter (With an Associate)

31 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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$ This compares to Herr Cutter’s current net daily income of $256.

32 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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.

33 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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.

34 McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 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


Download ppt "McGraw-Hill/Irwin © The McGraw-Hill Companies, Inc., 2008 12.1 Table of Contents Chapter 12 (Computer Simulation: Basic Concepts) The Essence of Computer."

Similar presentations


Ads by Google