Capacitated plant location - case study P3

Supply Chain Analytics in Python

Aaren Stubberfield

Supply Chain Analytics Mgr.

Capacitated plant location model

Modeling

  • Production at regional facilities
    • Two plant sizes (low / high)
  • Exporting production to other regions
  • Production facilities open / close

image of globe with regional production

Supply Chain Analytics in Python

Expected ranges

What should we expected for values of our decision variables?

Production Quantities:

  • High production in regions with low variable production and shipping costs
  • Maxed production in regions that also have relatively low fixed production costs

Production Plant Open Or Closed:

  • High capacity production plant in regions with high demand
  • High capacity production plant in regions with relatively low fixed costs
Supply Chain Analytics in Python

Sensitivity analysis of constraints

Total Production = Total Demand:

  • shadow prices = Represent changes in total cost per increase in demand for a region
  • slack = Should be zero

Total Production ≤ Total Production Capacity:

  • shadow prices = Represent changes in total costs per increase in production capacity
  • slack = Regions which have excess production capacity
Supply Chain Analytics in Python
from pulp import *
import pandas as pd

# Initialize Class
model = 
    LpProblem("Capacitated Plant Location Model",
               LpMinimize)

# Define Decision Variables
loc = ['A', 'B', 'C', 'D', 'E']
size = ['Low_Cap','High_Cap']
x = LpVariable.dicts(
                "production_", 
                [(i,j) for i in loc for j in loc],
                 lowBound=0, upBound=None, 
                 cat='Continuous')

y = LpVariable.dicts(
               "plant_", 
               [(i,s) for s in size for i in loc], 
                cat='Binary')
# Define Objective Function
model += 
  (lpSum([fix_cost.loc[i,s]*y[(i,s)] 
          for s in size for i in loc])
 + lpSum([var_cost.loc[i,j]*x[(i,j)] 
          for i in loc for j in loc]))

# Define the Constraints
for j in loc: model += 
  lpSum([x[(i, j)] 
        for i in loc]) == demand.loc[j,'Dmd']
for i in loc: model += 
  lpSum([x[(i, j)] for j in loc]) <= lpSum(
             [cap.loc[i,s]*y[(i,s)]for s in size])
Supply Chain Analytics in Python
# Solve
model.solve()

# Print Decision Variables and Objective Value print(LpStatus[model.status]) o = [{'prod':"{} to {}".format(i,j), 'quant':x[(i,j)].varValue} for i in loc for j in loc] print(pd.DataFrame(o)) o = [{'loc':i, 'lc':y[(i,size[0])].varValue, 'hc':y[(i,size[1])].varValue} for i in loc] print(pd.DataFrame(o)) print("Objective = ", value(model.objective))
# Print Shadow Price and Slack o = [{'name':name, 'shadow price':c.pi, 'slack': c.slack} for name, c in model.constraints.items()] print(pd.DataFrame(o))
Supply Chain Analytics in Python

Business questions

Likely Questions:

  • What is the expected cost of this supply chain network model?

  • If demand increases in a region how much profit is needed to cover the costs of production and shipping to that region?

  • Which regions still have production capacity for future demand increase?

Supply Chain Analytics in Python

Summary

Reviewed:

  • Expected ranges for decision variables
  • Interpreted the output of sensitivity analysis (shadow prices and slack)
  • Code to solve and output results
  • Likely business related question
Supply Chain Analytics in Python

Great work! Your turn

Supply Chain Analytics in Python

Preparing Video For Download...