Issues with sums
joegaudet opened this issue · comments
Joe Gaudet commented
Not sure this is something that can be fixed just because of the way ruby works. But I've noticed in situations where you might collect a set of vars and sum them to be part of an inequality, if the set is empty the lib fails to create the constraint.
vars = [] # this might not be empty some of the time
model.add(vars.sum <= 2)
This fails because the sum contains no variables which means that the sum totals to zero, and you end up with a model.add(true).
It does how ever work in the python lib.
Andrew Kane commented
Hey @joegaudet, thanks for another report. It now follows the same behavior as Python.