add python ClearHints method to CpSolver

This commit is contained in:
Laurent Perron
2021-02-04 18:14:43 +01:00
parent 71c9abe73d
commit 8f458b3c38

View File

@@ -1539,9 +1539,14 @@ class CpModel(object):
' is not a boolean variable')
def AddHint(self, var, value):
"""Adds 'var == value' as a hint to the solver."""
self.__model.solution_hint.vars.append(self.GetOrMakeIndex(var))
self.__model.solution_hint.values.append(value)
def ClearHints(self):
del self.__model.solution_hint.vars[:]
del self.__model.solution_hint.values[:]
def EvaluateLinearExpr(expression, solution):
"""Evaluate a linear expression against a solution."""