fix issue 260 for the CP-SAT solver
This commit is contained in:
10
examples/tests/issue260.py
Normal file
10
examples/tests/issue260.py
Normal 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
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user