Skip to content

Instantly share code, notes, and snippets.

@samirsaci
Created April 5, 2021 21:18
Show Gist options
  • Select an option

  • Save samirsaci/7d2021e849bff6fdea0f68897b2c1ad3 to your computer and use it in GitHub Desktop.

Select an option

Save samirsaci/7d2021e849bff6fdea0f68897b2c1ad3 to your computer and use it in GitHub Desktop.
Pulp Analysis
# Solve Model
model.solve()
# The status of the solution is printed to the screen
print("Status:", LpStatus[model.status])
# How many workers per day ?
dct_work = {}
for v in model.variables():
dct_work[int(v.name[-1])] = int(v.varValue)
# Show Detailed Sizing per Day
dict_sch = {}
for day in dct_work.keys():
dict_sch[day] = [dct_work[day] if i in list_in[day] else 0 for i in n_days]
df_sch = pd.DataFrame(dict_sch).T
df_sch.columns = jours
df_sch.index = start_jours
# The optimized objective function value is printed to the screen
print("Total number of Staff = ", pulp.value(model.objective))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment