-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Labels
Description
Dear SCIPers,
Following this #212 (comment) I am here to ask for a clarification.
Consider:
from pyscipopt import Model
model = Model()
x = model.addVar(vtype="c")
print((2*x).__class__.__name__)
# Expr
print((x/2.).__class__.__name__)
# ProdExpr
print((2.*x).__class__.__name__)
# Expr
print((x/2).__class__.__name__)
# ProdExprIt seems like ProdExpr is not casted as Expr in any case the division is defined. This provokes:
model.setObjective(.5*x) # accepted
model.setObjective(x/2.) # not accepted
# AssertionError: given coefficient is neither Expr or number but ProdExprIs this a design choice? Is SCIP behaviour?
As a Python user, I would expected a full support of the division of a continuous variable with a float number.
In other cases like integer variable divided by float or continuous variable divided by integer, I would expect a division btw. floats since integers are casted to floats in these cases.
In case of division between an integer variable and an integer number I would keep the ProdExpr until there is no support for division with remainders (that is why I wrote this).
cmjdxy