-
Notifications
You must be signed in to change notification settings - Fork 271
Open
Description
Describe the bug
It can't call getVal
from a matrix expression. If the expression has a division operation.
To Reproduce
from pyscipopt import Model
model = Model()
model.hideOutput()
x = model.addMatrixVar(3, lb=1, ub=3)
model.setObjective(x.sum(), "maximize")
model.optimize()
print(model.getVal(x))
# [3. 3. 3.]
print(model.getVal(x / x))
# Traceback (most recent call last):
# line 12, in <module>
# print(model.getVal(x / x))
# ^^^^^^^^^^^^^^^^^^^
# File "src/pyscipopt/scip.pxi", line 10399, in pyscipopt.scip.Model.getVal
# TypeError: Argument 'expr' has incorrect type (expected pyscipopt.scip.Expr, got pyscipopt.scip.ProdExpr)
print(model.getVal((x / x).sum()))
# Traceback (most recent call last):
# line 20, in <module>
# print(model.getVal((x / x).sum()))
# ^^^^^^^^^^^^^^^^^^^^^^^^^^
# File "src/pyscipopt/scip.pxi", line 10401, in pyscipopt.scip.Model.getVal
# TypeError: Argument 'expr' has incorrect type (expected pyscipopt.scip.Expr, got pyscipopt.scip.SumExpr)
Expected behavior
Get the value without any error.
Screenshots

System
- OS: Windows 11
- Version: 24H2 (26100.4061)
- SCIP version: 9.2.3
- How did you install pyscipopt?: build from c681f94, base on 5.5.0
Metadata
Metadata
Assignees
Labels
No labels