You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
For older (still standard) versions of numpy, we fail to create the below constraints. This issue no longer exists for numpy 2.x, but I predict it will be a few years until 1.x becomes non widely used.
The general reason for the error after looking into for a few hours:
At some point when we create the ExprCons object the __nonzero__ function will be called (probably should change this to __bool__ at some point). It is called after the ExprCons object has been initialised and after the richcmp function has finished. My best guess is that it is being called because np is somehow forcing a comparison between the two objects at some point. This problem is avoided when np is on the RHS and we are then comparing our ExprCons object to the np object (therefore using our comparison function, which doesn't exist I guess?). Somehow when it is on the LHS np is returning some actual value instead of something that hides the comparison.
To Reproduce
a = np.array([1, 2, 3], dtype=np.float32)
scip.addCons(a[1] <= 2 * x + 3 * y)
Expected behavior
A constraint should be added
The text was updated successfully, but these errors were encountered:
Describe the bug
For older (still standard) versions of numpy, we fail to create the below constraints. This issue no longer exists for numpy 2.x, but I predict it will be a few years until 1.x becomes non widely used.
The general reason for the error after looking into for a few hours:
At some point when we create the
ExprCons
object the__nonzero__
function will be called (probably should change this to__bool__
at some point). It is called after theExprCons
object has been initialised and after therichcmp
function has finished. My best guess is that it is being called becausenp
is somehow forcing a comparison between the two objects at some point. This problem is avoided whennp
is on the RHS and we are then comparing ourExprCons
object to thenp
object (therefore using our comparison function, which doesn't exist I guess?). Somehow when it is on the LHSnp
is returning some actual value instead of something that hides the comparison.To Reproduce
a = np.array([1, 2, 3], dtype=np.float32)
scip.addCons(a[1] <= 2 * x + 3 * y)
Expected behavior
A constraint should be added
The text was updated successfully, but these errors were encountered: