Created
April 30, 2022 14:26
-
-
Save mlabonne/4795ec782681dbe98bb85b4778fac4f9 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
# Find the variable that satisfies these constraints | |
status = solver.Solve(model) | |
# If a solution has been found, print results | |
if status == cp_model.OPTIMAL or status == cp_model.FEASIBLE: | |
print('================= Solution =================') | |
print(f'Solved in {solver.WallTime():.2f} milliseconds') | |
print() | |
print(f'🪖 Army = {solver.Value(army)}') | |
print() | |
print('Check solution:') | |
print(f' - Constraint 1: {solver.Value(army)} % 13 = {solver.Value(army) % 13}') | |
print(f' - Constraint 2: {solver.Value(army)} % 19 = {solver.Value(army) % 19}') | |
print(f' - Constraint 3: {solver.Value(army)} % 37 = {solver.Value(army) % 37}') | |
else: | |
print('The solver could not find a solution.') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment