fix issue 260 for the CP-SAT solver

This commit is contained in:
Laurent Perron
2018-09-01 08:48:43 +02:00
parent 265e54a9aa
commit 5824112e27
2 changed files with 14 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
#from ortools.constraint_solver import pywrapcp
from ortools.sat.python import cp_model
model = cp_model.CpModel()
y = model.NewIntVar(0, 3, 'y')
y == None
#solver = pywrapcp.Solver('my solver')
#x = solver.IntVar(0, 3, 'var_name')
#x == None

View File

@@ -218,6 +218,8 @@ class IntegerExpression(object):
return _ProductCst(self, -1)
def __eq__(self, arg):
if arg is None:
return False
if isinstance(arg, numbers.Integral):
AssertIsInt64(arg)
return BoundIntegerExpression(self, [arg, arg])
@@ -257,6 +259,8 @@ class IntegerExpression(object):
return BoundIntegerExpression(self - arg, [1, INT_MAX])
def __ne__(self, arg):
if arg is None:
return True
if isinstance(arg, numbers.Integral):
AssertIsInt64(arg)
if arg == INT_MAX: