Chapter 6 Simulation Advantages and Disadvantages of Using Simulation Modeling Random Variables and Pseudo-Random Numbers Time Increments Simulation Languages Validation and Statistical Considerations Examples • Risk Analysis • Waiting Line Simulation Slide 1 What is Simulation? An attempt to duplicate the features, appearance, and characteristics of a real system 1. To imitate a real-world situation mathematically 2. To study its properties and operating characteristics 3. To draw conclusions and make action decisions based on the results of the simulation Slide 2 Simulation Applications Ambulance location and dispatching Assembly-line balancing Parking lot and harbor design Distribution system design Scheduling aircraft Labor-hiring decisions Personnel scheduling Traffic-light timing Voting pattern prediction Bus scheduling Design of library operations Taxi, truck, and railroad dispatching Production facility scheduling Plant layout Capital investments Production scheduling Sales forecasting Inventory planning and control Slide 3 The Process of Simulation Define problem Introduce variables Construct model Specify values of variables Conduct simulation Examine results Select best course Slide 4 Advantages of Simulation 1. Relatively straightforward and flexible 2. Can be used to analyze large and complex realworld situations that cannot be solved by conventional models 3. Real-world complications can be included that most OR models cannot permit 4. “Time compression” is possible Slide 5 Advantages of Simulation 5. Allows “what-if” types of questions 6. Does not interfere with real-world systems 7. Can study the interactive effects of individual components or variables in order to determine which ones are important Slide 6 Disadvantages of Simulation 1. Can be very expensive and may take months to develop 2. It is a trial-and-error approach that may produce different solutions in repeated runs 3. Managers must generate all of the conditions and constraints for solutions they want to examine 4. Each simulation model is unique Slide 7 Monte Carlo Simulation Select numbers randomly from a probability distribution Use these values to observe how a model performs over time Random numbers each have an equal likelihood of being selected at random Slide 8 Distribution of Demand LAPTOPS DEMANDED PER WEEK, 0 1 2 3 4 FREQUENCY OF DEMAND PROBABILITY OF DEMAND, P(x) CUMULATIVE 20 40 20 10 10 0.20 0.40 0.20 0.10 0.10 100 1.00 0 0.20 0.60 0.80 0.90 Slide 9 Roulette Wheel of Demand 0 90 x=4 80 x=0 x=3 20 x=2 x=1 60 Slide 10 Generating Demand from Random Numbers DEMAND, x RANGES OF RANDOM NUMBERS, r 0 1 2 3 4 0-19 20-59 60-79 80-89 90-99 r = 39 Slide 11 Random Number Table 39 73 72 75 37 65 71 18 12 17 76 23 47 25 79 45 70 33 69 88 45 90 84 17 74 19 65 51 17 63 90 97 67 95 52 69 60 47 21 06 64 12 97 78 34 61 11 19 58 30 Slide 12 15 Weeks of Demand WEEK 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 r 39 73 72 75 37 02 87 98 10 47 93 21 95 97 69 DEMAND (x) REVENUE (S) 1 2 2 2 1 0 3 4 0 1 4 1 4 4 2 4,300 8,600 8,600 8,600 4,300 0 12,900 17,200 0 4,300 17,200 4,300 17,200 17,200 8,600 = 31 $133,300 Average demand = 31/15 = 2.07 laptops/week Slide 13 Computing Expected Demand E(x) = (0.20)(0) + (0.40)(1) + (0.20)(2) + (0.10)(3) + (0.10)(4) = 1.5 laptops per week Not particularly close to simulated result of 2.07 laptops Difference is due to small number of periods analyzed Slide 14 Random Numbers in Excel Slide 15 Simulation in Excel Enter this formula in G6 and copy to G7:G20 Enter “=4300*G6” in H6 and copy to H7:H20 Generate random numbers for cells F6:F20 with the formula “=RAND()” in F6 and copying to F7:F20 = AVERAGE (G6:G20) Slide 16 Simulation in Excel Slide 17 Example of Risk Analysis PortaCom Project PortCom’s product design group has developed a prototype for a new high-quality portable printer. The new printer has an innovative design and the potential to capture a significant share of the portable printer market. Preliminary marketing and financial analysis have provided the following information. Selling price = $249 per unit Administrative cost = $400,000 Advertising cost = $600,000 PortaCom believes that the costs and the demand range as follows: Unit direct labor cost = $43~$47 Unit parts cost = $80~$100 First-year demand = 1500~28,500 units Slide 18 Simulation The advantage of simulation is that it allows us to assess the probability of a profit and the probability of a loss. Procedure of simulation 1. Check parameters 2. Check controllable inputs 3. Check probabilistic inputs * Generate random numbers 4. Formulate a model 5. Draw a flowchart Slide 19 Simulation 1. Check parameters Selling price = $249 per unit Administrative cost = $400,000 Advertising cost = $600,000 2. Check controllable inputs Whether or not introduce the product 3. Check probabilistic inputs Unit direct labor cost range = $43~$47 Unit parts cost range = $80~$100 First-year demand range = 1500~28,500 units Slide 20 Simulation 4. Formulate a model Profit=(249-c1-c2)X-1,000,000 5. Draw a flowchart Slide 21 Probability Distribution of the Direct Labor Cost Direct labor cost $43 $44 $45 $46 $47 Probability 0.1 0.2 0.4 0.2 0.1 Slide 22 Probability Distribution of the Parts Costs The probability distribution for the parts cost per unit is the uniform distribution as follows: Slide 23 Probability Distribution of the First-year Demand The first-year demand is described by the normal probability distribution with mean 15,000 units and the standard deviation 45000 units as follows: Slide 24 How to Generate Random Numbers Computer-generated random numbers * Assign ranges of random numbers to to corresponding values of probabilistic inputs. The prob. of any input value is identical to the prob. of its occurrence in the real system. * Placing =RAND() in a cell of an Excel worksheet will result in a random number. Slide 25 Generate Random Value for Direct Labor Cost Interval of Direct labor cost Probability random numbers $43 0.1 0.0~0.1 $44 0.2 0.1~0.3 $45 0.4 0.3~0.7 $46 0.2 0.7~0.9 $47 0.1 0.9~1.0 *Excel Statement =Vlookup(Rand(),range, Col_index) Slide 26 Generate Random Numbers for Parts Cost With a uniform probability distribution, the following relationship between the random number and the associated value of the parts cost is used. Parts cost=a+r(b-a) where r=random number a=smallest value for parts cost b=largest value for parts cost Parts cost=80+r(100-80)=80+r20 Slide 27 Generate Random Numbers for First-year Demand Because first-year demand is normally distributed, we need a procedure for generating random values from a normal distribution. We use the following formula of Excell =NORMINV(RAND(),mean,standard deviation) Slide 28 Waiting Line Simulation HKSB Savings Bank will open several new branch bank during the coming year. Each new branch is designed to have one automated teller machine (ATM). A concern is that during busy periods several customer may have to wait to use the ATM. This concern prompted the bank to undertake a study of the waiting line system. The bank’s vise president want to determine whether one ATM will be sufficient. The bank established service guidelines for its ATM system stating that the average customer waiting time for an ATM should be one minute or less Slide 29 Waiting Line Simulation Customer Arrival Times Interval Time = a + r (b-a) r = random number between o and 1 a = minimum interarrival time b = maximum interarrival time For the HKSB ATM System, the minimum interarrival time is a = 0 minutes, and the maximum interarrival time is b = 5 minutes Interval Time = 0 + r (5 - 0)= 5r Slide 30 Customer Arrival Times For the HKSB ATM System, the minimum interarrival time is a = 0 minutes, and the maximum interarrival time is b = 5 minutes Interval Time = 0 + r (5 - 0)= 5r Assume that the simulation run begins at time = 0, A random number of r= 0.2804 generates an interval time of 5(0.2804) = 1.4 minutes for customer 1. A second random number of r=0.2598 generates an interarrival time of 5(0.2598) = 1.3 minutes, indicating that customer 2 arrive 1.3 minutes after customer 1. Thus customer 2 arrives 1.4 + 1.3 = 2.7 minutes after the simulation begin. Continuing, a third random number of r = 0.9802 indicates that customer 3 arrives 4.9 minutes after customer 2, which 7,6 minutes after the simulation begin. Slide 31 Waiting Line Simulation HKSB ATM Simulation Model Interarrival Time Number of ATMs Service Time Operating Character istic Model Interarrival Times (Uniform Distribution) Smallest Value Largest Value Service Times (Normal Distribution) Mean Std Deviation 0 5 2 0.5 Slide 32 Waiting Line Simulation • Simulation results for 10 ATM Customer Customer Interarrival Time Arrival time Service Start Time Waiting Time Service Time Completion Time Time in System 1 1.4 1.4 1.4 0.0 2.3 3.7 2.3 2 1.3 2.7 3.7 1.0 1.5 5.2 2.5 3 4.9 7.6 7.6 0.0 2.2 9.8 2.2 4 3.5 11.1 11.1 0.0 2.5 13.6 2.5 5 0.7 11.8 13.6 1.8 1.8 15.4 3.6 6 2.8 14.6 15.4 0.8 2.4 17.8 3.2 7 2.1 16.7 17.8 1.1 2.1 19.9 3.2 8 0.6 17.3 19.9 2.6 1.8 21.7 4.4 9 2.5 19.8 21.7 1.9 2.0 23.7 3.9 10 1.9 21.7 23.7 2.0 2.3 26.0 4.3 Total 21.7 11.2 20.9 Averages 2.17 1.12 2.09 Slide 33