Solution to Preventive Maintenance1 We start with a spreadsheet layout, as shown here: A B C D 1 Simulation of policy 1 (never replace) 2 Week Beginning state Revenue Replace? 3 1 1 100 0 4 2 1 100 0 5 3 2 80 0 6 4 2 80 0 7 5 2 80 0 8 6 3 50 0 9 7 4 10 0 10 8 4 10 0 11 9 4 10 0 12 10 4 10 0 13 11 4 10 0 14 12 4 10 0 15 13 4 10 0 16 14 4 10 0 17 15 4 10 0 18 16 4 10 0 19 17 4 10 0 20 18 4 10 0 21 19 4 10 0 22 20 4 10 0 E F Cost 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Profit 100 100 80 80 80 50 10 10 10 10 10 10 10 10 10 10 10 10 10 10 G H I Random # Ending State 0.678 1 0.852 2 0.469 2 0.156 2 0.936 3 0.689 4 0.989 4 0.549 4 0.867 4 0.403 4 0.648 4 0.449 4 0.699 4 0.163 4 0.469 4 0.982 4 0.928 4 0.095 4 0.926 4 0.425 4 J K Average weekly profit L M Inputs Cost of replacing $200 Weekly revenue as a function of the state of the machine State Revenue 1 $100 2 $80 3 $50 4 $10 Initial state 1 Description of machine deterioriation from one week to the next State at beginning State at beginning of next week of this week 1 2 3 4 1 0.7 0.3 0 0 2 0 0.7 0.3 0 3 0 0 0.6 0.4 4 0 0 0 1 The right side of the spreadsheet contains basic input information: the average profit earned by the machine over 50 weeks (K2), the cost of replacing the machine (K5), the various revenue values associated with different machine states (J9:K12), the initial state of the machine (K14), and the probabilities associated with the changes in the state of the machine from week to week. (K19:N22). J 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Average weekly profit Inputs Cost of replacing K $18.60 L M N =AVERAGE(F3:F52) $200 Weekly revenue as a function of the state of the machine State Revenue 1 $100 2 $80 3 $50 4 $10 Initial state 1 Description of machine deterioriation from one week to the next State at beginning State at beginning of next week of this week 1 2 3 4 1 0.7 0.3 0 0 2 0 0.7 0.3 0 3 0 0 0.6 0.4 4 0 0 0 1 Based on 11-25 (p. 612) in Practical Management Science (2 nd ed., Winston and Albright, 2001 Duxbury Press). Solution by David Juran, 2002. 1 N $18.60 On the left side of the spreadsheet, we have a row for every simulated week. The state of the machine at the start of the first week is “1”, representing “excellent”. For all the other weeks, the beginning state is simply the ending state from the previous week. The revenue (column C) is a function of the state of the machine, as is the replacement policy. (For this particular replacement policy, we wouldn’t need such an elaborate model, but we need a way to model different policies within the same basic layout.) The numbers in column D will be binary (zeroes or ones), indicating whether we do or don’t replace the machine under specific circumstances. The cost of replacing the machine will be captured in column E, and will affect net profit in column F. A B C D E F G H 1 Simulation of policy 1 (never replace) =D4*$K$5 =C4-E4 2 Week Beginning state Revenue Replace? Cost Profit Random # Ending State =K14 3 1 1 100 0 0 100 0.678 1 4 2 1 100 0 0 100 0.852 2 5 3 2 =H3 80 0 0 80 0.469 2 6 4 2 80 0 0 80 0.156 2 7 5 =VLOOKUP(B4,$J$9:$K$12,2,0) 2 80 0 0 80 0.936 3 8 6 3 50 0 0 50 0.689 4 9 This will 7 contain a different 4 10 for each proposed 0 0 10Depending 0.989 4 decision rule replacement policy. on the previous week a one 10 state8of the machine at 4 the end of the10 0 we will have0a zero or a one, 10 where 0.549 4 the decision machine. Here, so it's10 always a zero. 11 represents 9 4 to replace the 10 0 we never replace, 0 0.867 4 12 10 4 10 0 0 10 0.403 4 13 11 4 10 0 0 10 0.648 4 =IF(B4=1,(((G4<$K$19)*(1))+((G4>$K$19)*(2))),IF((B4=2),(((G4<$L$20)*(2)) 14 12 4 +((G4>$L$20)*(3))),IF((B4=3),(((G4<$M$21)*(3))+((G4>$M$21)*(4))),4))) 10 0 0 10 0.449 4 15 13 4 10 0 0 10 0.699 4 16 14 4 10 0 0 10 0.163 4 The tricky part is to use the probabilities in K19:N22 to model random deterioration of the machine from week to week. One way to accomplish this is to generate uniform random variables (column G) and use the complicated “IF” statement in column H to make changes in the machine state. (We will eventually get Crystal Ball to generate the random numbers, but we haven’t done anything about that yet.) How does this “IF” statement work? First, it is important to understand how a uniform random number works. These uniform random numbers have a lower limit of zero and an upper limit of 1, a range in which all possible numbers are equally likely. The probability that the uniform random variable X is less than 0.5 = 0.5; the probability that X is less than 0.9 is 0.9, and so forth. Now consider this statement: =((G5<$K$19)*(1))+((G5>$K$19)*(2)) B60.2350 2 Prof. Juran In English, this translates as “1 if G5 is less than K19 and 2 if G5 is not less than K19”. We can have this cell return a 1 or a 2, based on the probability that G5 is less than K19. We use nested “IF” statements to expand this idea into four different probability distributions, each representing a different condition for the machine at the beginning of the week. Here is a probability tree for this problem, showing what the “IF” statement is doing: Excellent at End of Week 70.0% Good at End of Week 30.0% Begin in Excellent Condition Average at End of Week 0.0% Bad at End of Week 0.0% Excellent at End of Week 0.0% Preventive Maintenance Good at End of Week 70.0% Average at End of Week 30.0% Begin in Good Condition Bad at End of Week 0.0% Excellent at End of Week 0.0% Good at End of Week 0.0% Begin in Average Condition Average at End of Week 60.0% Bad at End of Week 40.0% Excellent at End of Week 0.0% Good at End of Week 0.0% Average at End of Week 0.0% Begin in Bad Condition Bad at End of Week B60.2350 3 100.0% Prof. Juran Once we have the ending state for a particular week in column H, it becomes the beginning state for the following week. Now for the Crystal Ball part. A Crystal Ball spreadsheet is like any other Excel file, except that it contains two special kinds of cells. The first is called an assumption cell (a random variable). The other is called a forecast cell (very similar to the objective function in an optimization model). The assumption cells in this model are the uniform random variables in column G. (Make sure that you have some numbers in these cells before you try to define them.) Selecting cell G3, click on the define assumption button distribution gallery. Select Uniform, and click OK. . This opens the We want a uniform distribution from 0 to 1, so type in these values for the two parameters, and then click OK. B60.2350 4 Prof. Juran The cell turns bright green: F 1 2 3 4 5 Profit 100 100 80 G H Random # Ending State 0.678 1 0.852 2 0.469 2 We could use the same procedure to define all of the other assumption cells, but that would be tedious. Luckily, Crystal Ball has copy and paste buttons, and . Select the assumption cell you want to copy (G3), and click the Crystal Ball copy button (not the regular Excel copy button). Then select the cells you want to define as assumptions (G4:G52), and click the Crystal Ball paste button. They will all turn green. A B C D 1 Simulation of policy 1 (never replace) 2 Week Beginning state Revenue Replace? 3 1 1 100 0 4 2 1 100 0 5 3 2 80 0 6 4 2 80 0 7 5 2 80 0 8 6 3 50 0 9 7 4 10 0 10 8 4 10 0 11 9 4 10 0 12 10 4 10 0 E F Cost 0 0 0 0 0 0 0 0 0 0 Profit 100 100 80 80 80 50 10 10 10 10 G H Random # Ending State 0.350 1 0.852 2 0.469 2 0.156 2 0.936 3 0.689 4 0.989 4 0.549 4 0.867 4 0.403 4 Now we need to define a forecast cell, which is a cell that Crystal Ball will track through the simulation experiment, and for which we will be able to extract summary statistics, charts, etc. In our case, we are interested in the long-run average profit of the machine over 50 weeks, which is cell K2. Select cell K2 and click on the Crystal Ball define forecast button . The only things Crystal Ball needs to define a forecast are a name and the units. In this case, call it Average Weekly Profit, and use dollars as the units. B60.2350 5 Prof. Juran Click OK, and the forecast cell will turn blue. To actually run the simulation, we need to specify run preferences by clicking on the run preferences button . There are a lot of features in the run preferences dilaog box, accessed through the selections across the right side of the box (Trials, Sampling, Speed, etc.). We will mostly be concerned with Trials and Sampling. For now, select 1000 trials and leave the other default settings. Crystal Ball has buttons for controlling the simulation run, similar to the buttons on a DVD player: Play Stop Rewind Single Step The single step button is useful for performing one iteration at a time to ensure that the simulation is behaving properly. Once we are satisfied that the calculations are working properly, we click on the play button and Crystal Ball runs all 1,000 trials. During the run, we can watch the forecast window to see what the distribution of average weekly profit looks like. After the run is over, we can look at the results in various ways; most often we will use either the frequency chart or the summary statistics. To answer this question, we need to make models of the other replacement policies. We can copy this spreadsheet using Excel’s Edit – Move Or Copy Sheet B60.2350 6 Prof. Juran function. The four models are all identical except for the functions in column D. Here are pictures of the four models, showing the function in cell D6: A B C D 1 Simulation of policy 1 (never replace) 2 Week Beginning state Revenue Replace? 3 1 1 100 0 4 2 1 100 0 5 3 1 100 0 6 4 1 100 0 7 5 1 100 0 8 6 1 100 0 A B C D 1 Simulation of policy 2 (replace bad machines) 2 Week Beginning state Revenue Replace? 3 1 1 100 0 4 2 1 100 0 5 3 2 80 0 6 4 2 80 0 7 5 2 80 0 8 6 2 80 0 E F Cost 0 0 0 0 0 0 0 E G H Profit Random # Ending State 100 0.545 1 100 0.189 1 100 0.383 1 100 0.195 1 100 0.649 1 100 0.620 1 F G H Cost Profit Random # Ending State 0 100 0.259 1 0 100 0.964 2 0 80 0.056 2 0 80 0.170 2 0 80 0.203 2 =(H5=4)*(1)+(H5<4)*(0) 0 80 0.119 2 A B C D E F G H 1 Simulation of policy 3 (replace bad and average machines) 2 Week Beginning state Revenue Replace? Cost Profit Random # Ending State 3 1 1 100 0 0 100 0.816 2 4 2 2 80 0 0 80 0.384 2 5 3 2 80 0 0 80 0.703 3 6 4 1 100 1 200 -100 0.115 1 7 5 1 100 0 0 100 0.333 1 =(H5>2)*(1)+(H5<3)*(0) 8 6 1 100 0 0 100 0.415 1 A B C D E F G H 1 Simulation of policy 4 (replace bad, average, and good machines) 2 Week Beginning state Revenue Replace? Cost Profit Random # Ending State 3 1 1 100 0 0 100 0.786 2 4 2 1 100 1 200 -100 0.880 2 5 3 1 100 1 200 -100 0.014 1 6 4 1 100 0 0 100 0.239 1 7 5 1 100 0 =(H5>1)*(1)+(H5<2)*(0) 0 100 0.080 1 8 6 1 100 0 0 100 0.709 2 Now we can run all four models simultaneously, and compare the results after the run is over. B60.2350 7 Prof. Juran B60.2350 8 Prof. Juran Preventative Maintenance $70 Policy 3 Average Weekly Profit $60 Policy 2 $50 $40 $30 Policy 4 Policy 1 $20 $10 $$- $2 $4 $6 $8 $10 $12 $14 Standard Deviation of Weekly Profit It looks like policies 2 and 3 are both reasonable, while policies 1 and 4 are clearly inferior. Some Crystal Ball notes: If you lose your forecast windows, you can get them back by clicking the forecast windows button: . Your frequency charts will look slightly different from the ones in this document. You need to learn how to use the forecast preferences menu to make the charts and statistics look the way you want. B60.2350 9 Prof. Juran