Closed cprudhom closed 2 years ago
Unless I misunderstood something, I disagree, atMostNValue and atLeastNValues are not supposed to be sharp, so those solutions are consistent : 6 = atMostNValues([0,0,0,0,0]) if the requirement is to have at most 6 values then 0,0,0,0 (only one value) is perfecty fine. And the filtering is not supposed to reduce the ub from 6 to 1. It is the same for the atLeastNValues.
If one wants to compute sharp bounds, then the "nvalues" constraint should be used instead.
Hmmm. I think I understand what I did wrong.
I was referring to the global constraint catalog to check the right definition.
However the name used in choco is not consistent with the one in the catalog.
In choco, we use atMostNValue
which refers to atmost_nvalue
in the catalog but I was looking for atmost
in the catalog.
So you are right.
The only confusing thing is that N
might not be fixe by propagation.
The two constraints
model.atMostNValues()
andmodel.atLeastNValues()
do not filter correctly then
variable. Actually,atMostNValues
only sharps the lower bound andatLeastNValues
the upper bound. So they can produce inconsistent solutions like:This PR fixes this issue.