Temporary constraint #236
Replies: 1 comment 2 replies
-
How do you see someone accidentally doing either of those things? I would argue that if the programmer starts adding things to constraints or trying to make new constraints out of existing constraints then they've well and truly lost track of what they're doing and there's really no helping them. The current implementation has traded simplicity of implementation for a slight onus on the programmer to keep track of their constraint objects, and I think that's probably a good balance. Another option might be to make a "temporary constraint" class which is a subclass of LinExpr with no modifications. That way, type checking might catch some of these issues. Although that probably wouldn't be enough. |
Beta Was this translation helpful? Give feedback.
-
I would suggest introducing a temporary constraint object when setting the "equality/inequality sense" to a linear expression.
tc should be now a temporary constraint instead of a linear expression. What someone might do now:
A)
or even
B)
would - in my eyes lead - be undefined/unclear (A) or infeasible (B) operations. At the moment both operations are feasible. I would introduce separate functions to add "something" to the linear expression part (LHS) of the temporary constraint or to update the constant.
Beta Was this translation helpful? Give feedback.
All reactions