Skip to content

Commit c681760

Browse files
committed
let _evaluate as the base method
1 parent 94131e9 commit c681760

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/pyscipopt/expr.pxi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ cdef class ExprLike:
304304
def cos(self, /) -> CosExpr:
305305
return CosExpr(Operator.cos, buildGenExprObj(self))
306306

307+
cpdef double _evaluate(self, Solution sol) except *:
308+
raise NotImplementedError(
309+
f"{self.__class__.__name__!s} need to implement _evaluate() method"
310+
)
311+
307312
cdef ExprLike copy(self, bint copy=True):
308313
raise NotImplementedError(
309314
f"{self.__class__.__name__!s} need to implement copy() method"

src/pyscipopt/scip.pxd

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,13 +2152,12 @@ cdef extern from "tpi/tpi.h":
21522152

21532153
cdef class ExprLike:
21542154

2155+
cpdef double _evaluate(self, Solution sol)
21552156
cdef ExprLike copy(self, bint copy=*)
21562157

21572158
cdef class Expr(ExprLike):
21582159
cdef public terms
21592160

2160-
cpdef double _evaluate(self, Solution sol)
2161-
21622161
cdef class Event:
21632162
cdef SCIP_EVENT* event
21642163
# can be used to store problem data

src/pyscipopt/scip.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ class MatrixConstraint(np.ndarray):
526526
def isStickingAtNode(self) -> Incomplete: ...
527527

528528
class MatrixExpr(np.ndarray):
529-
def _evaluate(self, sol: Incomplete) -> Incomplete: ...
529+
def _evaluate(self, sol: Solution) -> Incomplete: ...
530530
def __array_ufunc__(
531531
self,
532532
ufunc: np.ufunc,

0 commit comments

Comments
 (0)