Chapter 14 Simulation Modeling What Is Simulation? • Simulation is to mimic a process by using computers. Simulation and Decision Making • Simulation helps pre-view a complicated business process to identify possible problems; • It allows to try different decision alternatives, and select the best alternative as the decision. Simulation and Uncertainty • Simulation is particularly useful when there exist uncertainties (demand, processing time, for example) in a process with many correlated factors. Probable Events and Random Numbers • Probable events: – Tossing a coin, it may land on Head (0.5) or Tail (0.5). – Daily demand of an item can be 4 units (0.3), 5 units (0.45), or 6 units (0.25). • Computers can randomly generate a number between 0 and 1. Simulate Tossing Coins • A randomly generated number has 50% chance between 0 and 0.5, 50% chance between 0.5 and 1. • So, we can simulate the result of tossing a coin by generating a random number T so that if T is between 0 and 0.5, then the result is “Head”; if T is between 0.5 and 1, then the result is “Tail”. Simulate Probable Outcomes with Random Numbers • The key idea of simulating probable outcomes with randomly generated number in computer: Probability of a possible actual outcome = Probability of the corresponding possible outcome in computer simulation Simulate Tossing a Dice • Probability of landing on a number is 1/6. • Computer randomly generated numbers are uniformly spread over the range 0~1. • Divide range 0~1 evenly into six parts, so that: – (0 to 0.1667) for “landing with 1”; – (0.1667 to 0.333) for “landing with 2”; –… – (0.8333 to 1) for “landing with 6). Simulate Daily Demands • Possible demands 40, 50, 60 units with probabilities 0.2, 0.5, 0.3 respectively. • Divide range 0~1 into three parts with lengths 0.2, 0.5, and 0.3 respectively. • If a random number is between 0 and 0.2, then demand is 40 units; between 0.2 and 0.7 then 50 units; between 0.7 and 1 then 60 units. Simulate a Probable Event • In general, to simulate probable outcomes with randomly generated numbers: Step 1. Put all possible outcomes and their probabilities in a table; Step 2. Calculate cumulative probabilities; Step 3. Use the cumulative probabilities as the cutting points of random number ranges. =RAND() • =RAND() is an Excel function generating a random number between 0 and 1. =IF() • Syntax of =IF() function in Excel: =IF(C,a,b) It means: If condition C is true then the function value is a, otherwise the value is b. • e.g. For tossing coins: =IF(C4>0.5, ”Head”, ”Tail”) • =IF() function can be nested, e.g. =IF(B5<0.2, 40, IF(B5<0.7,50, 60)) =VLOOkUP() • If we use =IF() function to represent six possible outcomes in tossing a dice case, then we have to have get =IF() function nested for five times, which is too awkward. • =VLOOKUP() facilitates our work in that case. • Syntax of =VLOOKUP(): =VLOOKUP(value to lookup, range table,2) Range Table for =VLOOKUP() • 1st column contains separating points of ranges – Start from the smallest allowable number of the ranges – In ascending order • 2nd column lists values of =VLOOKUP corresponding to the ranges. =VLOOKUP() for Tossing Dices (1) • Set up the table of ranges. – Cumulative probabilities are in the 1st column, starting from 0 – Possible outcomes are in the 2nd column. B 5 6 7 8 9 10 11 12 C Cumu. Prob Values 0 1 0.1667 2 0.3333 3 0.5 4 0.6667 5 0.8333 6 1 =VLOOKUP() for Tossing Dices (2) • Generate the simulation table: – In F5: =RAND() – In G5: =VLOOKUP(F5, $B$6:$C$12, 2) – Copy E5, F5, and G5 down to other rows. 2 3 4 5 6 7 E F G Simulation of tossing dices Tossing # 1 2 Random Outcome number of tossing 0.618707 4 Simulate Demands (1) • Possible daily demands (from past data): Demand 8 Probability 0.01 9 0.06 10 11 12 13 0.11 0.34 0.31 0.10 14 0.05 15 0.02 Simulate Demands (2) • Calculate Cumulative Probabilities: Demand 8 Probability 0.01 Cumulative Probability 0.01 9 0.06 0.07 10 11 12 13 0.11 0.34 0.31 0.10 0.18 0.52 0.83 0.93 14 0.05 0.98 15 0.02 1.00 Simulate Demands (3) • Generate Vlookup range table in Excel E F Cumulative Probability Demand 4 5 6 7 8 9 10 11 12 0 0.02 0.07 0.18 0.52 0.83 0.93 0.98 1 8 9 10 11 12 13 14 15 Simulate Demands (4) • Generate Simulations in Excel – In B4: =RAND() – In C4: =VLOOKUP(B4,$E$4:$F$12,2) – Copy A4, B4, C4 down to other rows A 3 4 5 6 B C Random Day # Demand number 1 0.575409 12 2 3 Tips of using Excel • Use cell addresses, relative or absolute, rather than the values in the cells; • Use Copy / Paste functions as far as possible; • Use multiple columns to decompose complicated formulas; • Put the parameters to be changed on the top of the spreadsheet; • Put the summary results on top. Simulation for Decision Making • A simulation is actually a description of day-by-day or week-by-week business operations. • For a decision alternative, the simulation shows its effects on business quality or/and profit. • After trying alternatives, the manager can pick one that would be best for business. How Many Cases to Stock? (1) • Product BC-6 costs $56.95/case from the supplier, and is sold at the price of $91.80/case. For the cases unsold at the end of a week, the store will sell them to a convenient store at price of $12.50/case. Shortage penalty cost is about $4 per case short. Possible demands of a week and their probabilities are as follows from the past records: Weekly demand of BC-6 Probability 11 cases 0.45 12 cases 0.35 13 cases 0.2 • Manager Wendy is considering how many cases of product BC-6 to stock at beginning of each week. Simulations of Weekly Business Operations on BC-6 Selling price ($): Salvage value ($): Order cost ($): Goodwill penalty ($): 91.80 per case 12.50 per case unsolde at the end of a week 56.95 per case 4.00 per case short Number of cases of BC-6 to stock every week: Total number of cases shortage in 52 weeks: Total number of cases surplus in 52 weeks: Total profit in 52 weeks: Average weekly profit of 52 weeks: 12 <- enter your trial order quantity in cases 14 18 20,263.00 389.67 Goodwill Revenue Revenue of penalty Number Numbr of the Number of Number the week Total Total Total Weekly in the Week of cases Random of cases week cases of cases from selling revenue cost of profit of Demand week due # ordered # sold in from short in surplus in surplus at of the the week the week (case) to per week the week regular the week the week salvage week ($) ($) ($) shortage sales ($) price ($) ($) 1 12 0.527107 12 12 1101.6 0 0 0 0 1101.6 683.4 418.2 2 12 0.951569 13 12 1101.6 1 4 0 0 1101.6 687.4 414.2 3 12 0.059013 11 11 1009.8 0 0 1 12.5 1022.3 683.4 338.9 4 12 0.967144 13 12 1101.6 1 4 0 0 1101.6 687.4 414.2 5 12 0.466342 12 12 1101.6 0 0 0 0 1101.6 683.4 418.2 6 12 0.070006 11 11 1009.8 0 0 1 12.5 1022.3 683.4 338.9 How Simulation Helps Decide How Many Cases to Stock (3) • The worksheet each time simulates 52 weeks of business operations. • Given the number of cases to order (green cell), Excel gives the operation results of 52 weeks (yellow cells). • Decision maker may change the green cell, observe the outcome of 52 weeks in yellow cells, and choose the best order quantity. Inventory Simulation (1) • An inventory simulation simulates day-by-day transactions occurred on inventory, such as daily demand of inventoried item, number of units in stock, placing an order, length of lead time, and costs involved. • An inventory simulation helps determine when to place an order to the supplier and how many units in an order. Inventory Simulation of 365 days Ordre Quantity: Reorder Point: Total Day 0 1 2 3 4 5 6 7 8 750 15099 Units Begin on received hand 0 25 0 25 0 21 0 16 0 12 0 8 0 3 0 0 150 150 150 10 97.195 Cost H per day: 0.05 Cost S per order: 25 Cost L.S. / unit: 20 758 25 14366 Total holding: Total setup: Total L.S. cost: Overall total: 750 718.3 125 500 1343.3 3.0048 Lost Ending Order Rand # Demand sales on hand Order? Quantity Rand # 0 0 25 0 0.6682 4 0 21 N 0 0.9004 5 0 16 N 0 0.5151 4 0 12 N 0 0.3733 4 0 8 Y 150 0.5057 0.8038 5 0 3 N 0 0.9435 6 3 0 N 0 0.7776 5 5 0 N 0 0.5561 4 0 146 N 0 16 34 Lead Time Lead time Remaining 0 0 0 0 3 2 1 0 0 0 0 0 3 0 0 0 0 How Simulation Helps Make Inventory Decision (3) • For each “re-order point” and “order quantity” tried, the simulation shows the total inventory cost (including holding cost, ordering cost, and lost sales cost) of a year. • A good re-order point (showing when to place an order) and a good order quantity (showing many units in an order) can thus be selected from many alternatives. Other Examples of Business Simulations with Excel • • • • • • Minutes-by-minutes waiting lines; Gambling game; Production in a workshop; Transactions in a bank; Truck transportation; Department store operations to see the requirements of resources.