## Sunday, August 31, 2014

### SIMULATION TECHNIQUES ARE NOT USEFUL FOR FORECAST ONLY: A MONTE CARLO APPROACH FOR IMPROVING A PROCESS

For this post I am going to show with further detail how simulation techniques used in forecasting can also be used to make predictions to understand and improve operations. In particular, I will use the ten-step sequential process example (single-piece flow) provided in the core reading “Designing, Managing and Improving Operations”  as a starting point.
As stated in this example, we can imagine a ten-step sequential process in which each task takes 3 minutes per unit to complete. Therefore, a process with single-peace flow takes 30 minutes to complete the first unit. However, this does not necessarily happen in practice because instead of having specific times for each operation we have a distribution of values. In other words, a task could take in average 3 minutes to complete but there is a probability it would take 3 minutes and 10 seconds or even less than the average. Statistics plays a vital role to understand and improve timing in operations. I will show using basic Monte Carlo simulations how this is possible.
To start with, we could restate the example shown above having instead each task associated to a probability distribution, for instance, a normal distribution with mean 3 and standard deviation 0.1 (see Figure 1). We can assume these values were obtained from timing workers to complete their tasks a statistically significant number of times. In particular, it would be useful to know the distribution for the time to make the first unit and the probability of taking less than 31 minutes to complete it -let us assume this is a critical time for the process-.

Figure 1: Ten-step sequential process using probability distributions. Adapted from 

The advantage of applying Monte Carlo in this case is that we can do repeated calculations using random values that satisfy the distributions for each task for a very large number of times (10,000 times in these simulations) to calculate the values we are interested in. I programmed this simulation using Matlab (a script with explanations is available at the end of the document, see Appendix 1) but it could also be done in Excel.
From this simulation, the estimated time to make the first unit gave a normal distribution with mean 30 (an expected result) and standard deviation ~0.3. The probability to make the first unit in less than 31 minutes was more than 0.999, i.e., the probability of ending the first unit in more than 31 minutes is less than 1 in 10,000.
Now, let us assume that worker in charge of task 5 is retiring and will be replaced for a new inexperienced worker. The time it takes to perform this task on average is only 30 more seconds than the experienced worker (3.5 minutes), but is not accustomed to work on this task so the time it takes varies more from average (0.7 minutes). In other words, the distribution for this task now will be assumed to be a normal distribution with mean 3.5 and standard deviation 0.7. Then, again, what would be the distribution for the time to make the first unit and the probability of taking less than 31 minutes to complete the first unit?
From this second simulation, the estimated time to make the first unit gave a normal distribution with mean 30.5 and standard deviation ~0.8. Although in average it takes less than 31 minutes to make the first unit, the probability to make the first unit in less than 31 minutes was ~0.75, i.e., the probability of ending the first unit in more than 31 minutes is in the order of  1 in 4. This change could have a significant impact in the overall process if this time were critical as was previously assumed.
To sum up, I tried to show in this example how a simulation technique that is used in forecast (Monte Carlo simulation) can also be used to design, manage or improve operations. This technique was used to calculate the probability distribution of the time to make a single unit in a single-piece flow process but could be further exploited to calculate the distribution time to make the batch, calculate dead times, and also be used for other flow processes. Moreover, this is not the only technique that can be used for this purpose, e.g. Markov Chains can be used to forecast demand (a practical example is provided in ) but also for inventory management .

REFERENCES

 Roy D. Shapiro (September 10th, 2013), “Core Curriculum. Operations Management Reading: Designing, Managing, and Improving Operations”, Harvard Business Publishing, US.

See for further information: http://www.vertex42.com/ExcelArticles/mc/MonteCarloSimulation.html (Accessed 8/31/2014)

 N.A. (n.d.), “Markov Chains”, Temple University, Pennsylvania, USA. Retrieved from: http://astro.temple.edu/~hweiss/emba/markov.ppt (Accessed 8/31/2014)

 Erhan Bayraktar, Michael Ludovski (n.d.) “Inventory Management with Partially Observed Nonstationary Demand”, University of California, California, US. Retrieved from: http://www.pstat.ucsb.edu/faculty/ludkovski/InvControl.pdf (Accessed 8/31/2014)

APPENDIX 1
SIMULATION SCRIPT

%SIMULATION 1

%The following line generates 10,000 examples for
%the 10 tasks of the process with a normal distr.
%with mean 3 and standard deviation 0.1

r1 = 3 + 0.1.*randn(10000,10);

%The following lines calculate the total time
%for each of the 10,000 examples, the mean
%and the standard deviation of total times

totalr1=sum(r1,2);
meanr1=mean(totalr1);
stdr1=std(totalr1);

%The following line gives a histogram using 21 bars

hist(totalr1,21);

%the following line calculates the probability
%of taking less than 31 minutes for the total time

p1=sum(totalr1<=31)/10000;

%SIMULATION 2 (see SIMULATION 1 for explanations
% of similar commands)

r2 = 3 + 0.1.*randn(10000,10);

% The following line modifies task 5 distribution
% i.e., normal distribution with mean 3.5 and std 0.7

r2(:,5) = 3.5 + 0.7.*randn(10000,1);
totalr2=sum(r2,2);
meanr2=mean(totalr2);
stdr2=std(totalr2);
hist(totalr2,21);

p2=sum(totalr2<=31)/10000;

 For a basic introduction to Monte Carlo see Reference