Created
May 13, 2021 14:24
Revisions
-
samirsaci created this gist
May 13, 2021 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ # 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)