Created
April 30, 2022 14:39
-
-
Save mlabonne/aea856c2297ee6484a2578924fc4f647 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
class CountSolutions(cp_model.CpSolverSolutionCallback): | |
"""Count the number of solutions.""" | |
def __init__(self): | |
cp_model.CpSolverSolutionCallback.__init__(self) | |
self.__solution_count = 0 | |
def on_solution_callback(self): | |
self.__solution_count += 1 | |
def solution_count(self): | |
return self.__solution_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment