Skip to content

Instantly share code, notes, and snippets.

@imohitmayank
Created September 13, 2018 15:06
Show Gist options
  • Save imohitmayank/404c2e218bb826d7d08694723900b057 to your computer and use it in GitHub Desktop.
Save imohitmayank/404c2e218bb826d7d08694723900b057 to your computer and use it in GitHub Desktop.
# The status of the solution is printed to the screen
print("Status:", LpStatus[prob.status])
# Output=
# Status: Optimal
# Each of the variables is printed with it's resolved optimum value
for v in prob.variables():
print(v.name, "=", v.varValue)
# Output=
# Medicine_1_units = 3.0
# Medicine_2_units = 4.0
# The optimised objective function value is printed to the screen
print("Total Health that can be restored = ", value(prob.objective))
# Output=
# Total Health that can be restored = 155.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment