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
Model choco = new Model();
IntVar a = choco.intVar(1,2);
Constraint expr = choco.arithm(a, "<", 2);
BoolVar f = choco.boolVar(false);
expr.reifyWith(f);
choco.getSolver().solve();
I diged a bit, it seems to be the constraint.reifyWith(bv) call that generates this warning.
Model choco = new Model();
Constraint expr = choco.arithm(choco.intVar(1, 2), "<", 2);
expr.getOpposite().post();
choco.getSolver().solve();
IMO that can be fixed in Constraint#getStatus(), l313 :
- return mStatus;
+ return (mStatus==FREE && opposite!=null)?opposite.mStatus:mStatus;
unit/noregression test :
Model choco = new Model();
Constraint expr = choco.arithm(choco.intVar(1, 2), "<", 2);
expr.getOpposite().post();
assert expr.getStatus() == Status.POSTED;
The text was updated successfully, but these errors were encountered:
glelouet
changed the title
[4.10.2] [minor] "At least one constraint is free, i.e., neither posted or reified. )." when constrained.opposed() is posted.
[4.10.2] [minor] "At least one constraint is free, i.e., neither posted or reified. )." while constrained.getOpposite() is posted.
Aug 17, 2020
glelouet
changed the title
[4.10.2] [minor] "At least one constraint is free, i.e., neither posted or reified. )." while constrained.getOpposite() is posted.
[4.10.2] [minor] "At least one constraint is free, i.e., neither posted or reified. )." while constraint.getOpposite() is posted.
Aug 17, 2020
That fix is bad. c.getOpposite() will always enforce the opposite is not null.
I checked if there was a test possible for c.hasOpposite() and there was none, that's why I propose to modify the getStatus() instead, which incidentally reduces the possibility of a bug for the same reasons.
The code that generates this is :
I diged a bit, it seems to be the constraint.reifyWith(bv) call that generates this warning.
IMO that can be fixed in Constraint#getStatus(), l313 :
- return mStatus;
+ return (mStatus==FREE && opposite!=null)?opposite.mStatus:mStatus;
unit/noregression test :
The text was updated successfully, but these errors were encountered: