Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created May 13, 2021 14:24
Supply Chain Optimization
# Solve Model
model.solve()
print("Total Costs = {:,} ($/Month)".format(int(value(model.objective))))
print('\n' + "Status: {}".format(LpStatus[model.status]))
# Dictionnary
dict_plant = {}
dict_prod = {}
for v in model.variables():
if 'plant' in v.name:
name = v.name.replace('plant__', '').replace('_', '')
dict_plant[name] = int(v.varValue)
p_name = name
else:
name = v.name.replace('production__', '').replace('_', '')
dict_prod[name] = v.varValue
print(name, "=", v.varValue)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment