Created
April 30, 2022 14:37
-
-
Save mlabonne/253fd724f1c8f30fe5cddbee5ad56cb9 to your computer and use it in GitHub Desktop.
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 characters
# Solve problem | |
status = solver.Solve(model) | |
# If an optimal solution has been found, print results | |
if status == cp_model.OPTIMAL: | |
print('================= Solution =================') | |
print(f'Solved in {solver.WallTime():.2f} milliseconds') | |
print() | |
print(f'Optimal value = {3*solver.Value(bread)+10*solver.Value(meat)+26*solver.Value(beer)} popularity') | |
print('Food:') | |
print(f' - 🥖Bread = {solver.Value(bread)}') | |
print(f' - 🥩Meat = {solver.Value(meat)}') | |
print(f' - 🍺Beer = {solver.Value(beer)}') | |
else: | |
print('The solver could not find an optimal solution.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment