Get startedGet started for free

Capacitated plant location - case study P4

1. Capacitated plant location - case study P4

In this lesson we will get back to our case study problem.

2. Simulation vs. sensitivity analysis

Simulation testing can provide us with additional information that the sensitivity analysis we reviewed earlier does not. For example, we can observe how changes in demand and costs affect the production in the model. From sensitivity analysis, we can determine how much production capacity is still available. However, once that capacity is used, simulation testing can help us determine, where is the next optimal regional location to add capacity. Additionally, we can observe if changes in fixed or variable costs will affect where production is in the network. Additional insight can be gain by determining which regions have stable production quantities, or quantities that do not change much throughout the simulation. Sensitivity analysis does not provide this information. Finally, with simulation testing we can observe the effects of multiple changes simultaneously to the inputs. This includes how those changes might interact. Sensitivity analysis looks at changing only one input at a time and provides insight on only how that change will affect the model.

3. Simulation modeling

We can apply simulation testing to our Capacitated Plant Location model. Recall that there are several inputs to the model, all of which we could apply noise to in our simulation testing. You may have a valid reason to apply noise to all of them. However, in this lesson we will work through applying noise to the demand and variable cost inputs. We will assume that our variable cost estimates often underestimate the actual costs. Therefore, we will add noise that is biased positively to our variable costs inputs.

4. Code example - step 1

In this code example, we first start with the code of the capacitated model viewed in an earlier lesson which we will modify in the coming steps.

5. Code example - step 2

Next, we modify the objective to include noise that has a positive bias. The first input of the normalvariate() method sets the mean of the random normal value it returns. Instead of having the mean centered at 0 we show it as 0-point-5. This will ensure that our random numbers will tend to be positive. Therefore, our variable costs will tend to be larger than our original inputs. Additionally, we modify our total demand constraint to add noise that is proportional to our demand estimates. The standard deviation of the normalvariate() method is set to 5% of the demand estimate.

6. Code example - step 3

After modifying our objective and constraint we wrap our PuLP model in a function. In this case we add functional parameters which are the input estimates needed for the PuLP model.

7. Code example - step 3 continued

This is a continuation of our function shown in the last slide. However, we modified the code after the model is solved to return a dictionary with the total production of each region and the total costs of the model from the objective. Next, our code repeatedly calls our function to solve the PuLP model and save the results each time. Eventually we create a Pandas DataFrame with the results.

8. Results

It is convenient to view our simulation results as a histogram.

9. Summary

In summary we discussed how simulation testing compared to sensitivity analysis for the capacitated plant model, including what type of additional information can be gained from simulation testing. Next, we stepped through a code example of how we might convert our original code for simulation testing.

10. Try it out!

Your turn!