Supply Chain Analytics in Python
Aaren Stubberfield
Supply Chain Analytics Mgr.
Modelleerproblemen:
Schaduwprijzen:
Context - Glasbedrijf - Resourceplanning:
| Resource | Prod. A | Prod. B | Prod. C |
|---|---|---|---|
| Productie-uren | 6 | 5 | 8 |
| WH-capaciteit ft² | 10.5 | 20 | 10 |
| Winst $US | $500 | $450 | $600 |
Restricties:
# Initialize Class, Define Vars., and Objective
model = LpProblem("Max Glass Co. Profits",
LpMaximize)
A = LpVariable('A', lowBound=0)
B = LpVariable('B', lowBound=0)
C = LpVariable('C', lowBound=0)
model += 500 * A + 450 * B + 600 * C
# Constraint 1
model += 6 * A + 5 * B + 8 * C <= 60
# Constraint 2
model += 10.5 * A + 20 * B + 10 * C <= 150
# Constraint 3
model += A <= 8
# Solve Model
model.solve()
print("Model Status:
{}".format(LpStatus[model.status]))
print("Objective = ", value(model.objective))
for v in model.variables():
print(v.name, "=", v.varValue)
Oplossing:
| Producten | Prod. A | Prod. B | Prod. C |
|---|---|---|---|
| Productie-cases | 6.667 | 4 | 0 |
Doelwaarde is $5133.33
Beslissingsvariabele:
Restricties:
Python-code:
o = [{'name':name, 'shadow price':c.pi}
for name, c in model.constraints.items()]
print(pd.DataFrame(o))
Output:
name shadow price
_C1 78.148148
_C2 2.962963
_C3 -0.000000
Onthoud de restricties:
slack:
Python:
o = [{'name':name, 'shadow price':c.pi, 'slack': c.slack}
for name, c in model.constraints.items()]
print(pd.DataFrame(o))
Output:
name shadow price slack
_C1 78.148148 -0.000000
_C2 2.962963 -0.000000
_C3 -0.000000 1.333333
Meer over binding
slack = 0 → bindendOnthoud de restricties:
shadow pricesslackslack = 0 → bindendslack > 0 → niet-bindendSupply Chain Analytics in Python