Skip to content

Commit 06f8ebc

Browse files
committed
find what type it is
1 parent a3a6239 commit 06f8ebc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/pyscipopt/expr.pxi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _expr_richcmp(self, other, op):
5454
elif isinstance(other, MatrixExpr):
5555
return _expr_richcmp(other, self, 5)
5656
else:
57-
raise NotImplementedError
57+
raise TypeError(f"Unsupported type {type(other)}")
5858
elif op == 5: # >=
5959
if isinstance(other, Expr) or isinstance(other, GenExpr):
6060
return (self - other) >= 0.0
@@ -63,7 +63,7 @@ def _expr_richcmp(self, other, op):
6363
elif isinstance(other, MatrixExpr):
6464
return _expr_richcmp(other, self, 1)
6565
else:
66-
raise NotImplementedError
66+
raise TypeError(f"Unsupported type {type(other)}")
6767
elif op == 2: # ==
6868
if isinstance(other, Expr) or isinstance(other, GenExpr):
6969
return (self - other) == 0.0
@@ -72,7 +72,7 @@ def _expr_richcmp(self, other, op):
7272
elif isinstance(other, MatrixExpr):
7373
return _expr_richcmp(other, self, 2)
7474
else:
75-
raise NotImplementedError
75+
raise TypeError(f"Unsupported type {type(other)}")
7676
else:
7777
raise NotImplementedError("Can only support constraints with '<=', '>=', or '=='.")
7878

@@ -181,7 +181,7 @@ cdef class Expr:
181181
left,right = right,left
182182
terms = left.terms.copy()
183183

184-
if isinstance(right, Expr):
184+
if isinstance(right, (Expr, ExprCons)):
185185
# merge the terms by component-wise addition
186186
for v,c in right.terms.items():
187187
terms[v] = terms.get(v, 0.0) + c

0 commit comments

Comments
 (0)