This commit is contained in:
Laurent Perron
2025-05-07 13:28:48 +02:00
parent 777738f60d
commit 99f94edb47
2 changed files with 3 additions and 2 deletions

View File

@@ -3869,6 +3869,7 @@ cc_library(
":drat_writer",
":sat_base",
"//ortools/base",
"//ortools/base:file",
"//ortools/base:strong_vector",
"//ortools/util:strong_integers",
"@abseil-cpp//absl/log:check",

View File

@@ -2156,9 +2156,9 @@ class CpModel:
self.assert_is_boolean_variable(arg.negated())
return arg.index
if isinstance(arg, IntegralTypes):
if arg == ~False: # -1
if arg == ~int(False):
return self.get_or_make_index_from_constant(1)
if arg == ~True: # -2
if arg == ~int(True):
return self.get_or_make_index_from_constant(0)
arg = cmn.assert_is_zero_or_one(arg)
return self.get_or_make_index_from_constant(arg)