Open hakank opened 3 years ago
Thanks for opening the issue. It seems like you forgot a bracket in the sum
constraint but I'm quite surprised that this doesn't throw an error for me. Will open an issue at JuMP about this.
The user would need to write something like:
@constraint(
model,
BooleanConstraint(sum(x == i && x == i for i = 1:2) <= 1),
)
which isn't implemented yet though but the suggested syntax here doesn't work due to how JuMP works internally.
In certain models, e.g. Steiner problem ( http://hakank.org/julia/constraints/steiner.jl ) there would be a great modelling benefit if one can sum over a list of constraints/conditions.
Example (from the Steiner model). Instead of the following, using booleans to first count the number of common elements and then constrain the sum to be atmost 1 (using the upcoming feature of
&&
in reification which is a great feature in itself)the following formulation would be much simpler to state: