Problem with Model.intGeView()
See original GitHub issueIn our non public Choco model we have code on the form:
final IntVar[] xs = model.intVarArray(10, 0, 9);
final BoolVar[] bs = Stream.of(xs).map(x -> model.intGeView(x, 1)).toArray(BoolVar[]::new);
final IntVar count = model.intVar(0, 10);
model.sum(bs, "=", count).post();
Our model produced wrong solutions, and after debugging we found out that:
-
The domain size of all
bs
are 10, and not 2 that we had expected. It seems the domain size of the underlyingIntVar
is used. -
Replacing (only) the code
model.intGeView(x, 1)
above bymodel.arithm(x, ">", 0).reify()
makes our model produce correct solutions. In addition the domain size of allbs
are then 2, as expected. -
During debugging (and still using
intGeView()
), we replacedmodel.sum(bs, "=", count).post();
bymodel.sum(bs, "<=", count).post(); model.sum(bs, ">=", count).post();
. This made the solver (from producing a solution within seconds) not producing any solution within reasonable time.
I apologise that this report does not contain a reproducing example of the bug that produce wrong solutions, but hope that it is still useful.
Choco version: 4.10.0 Java version: 11.0.1 Operating system: Linux Kernel 5.0.2
Best regards,
Magnus
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
I fix the issue (thank you for reporting it). This was related to a missing method implementation in views.
This should work now (you can try the snapshot version, or wait for a release).
Best, CP
Only
eq
andleq
views were affected by the problem. The other ones (scale
,offset
,minus
andnot
) act in a different way.