gecode
gecode copied to clipboard
fzn-gecode, global cardinality, missing solutions
On Ubuntu 22.04.2 LTS.
The following model has 26 solutions, but fzn-gecode
find only 22. Model:
include "globals.mzn";
var 1..1 union 3..3: A;
var 2..3: B;
var 2..3: C;
var 2..3: D;
var 2..5: E;
var 1..4: F;
var 2..3: G;
var 2..3: H;
constraint
global_cardinality([A,D,1,3,3,C,1,H,B],[1,2,3],[G,F,E]) :: domain;
solve :: int_search([A,B,C,D,E,F,G,H], anti_first_fail, indomain_min) satisfy;
output ["\([A,B,C,D,E,F,G,H])\n"];
Missing solutions:
[1, 2, 3, 3, 5, 1, 3, 3]
[1, 3, 2, 3, 5, 1, 3, 3]
[1, 3, 3, 2, 5, 1, 3, 3]
[1, 3, 3, 3, 5, 1, 3, 2]
Here is the smallest model that I was able to find for this bug.
include "globals.mzn";
var 1..3: A;
var 1..3: B;
var 1..3: C;
var 1..2: D;
var 2..3: E;
var 2..3: G;
constraint
global_cardinality([3,A,D,G,E],[1,2,3],[1,B,C]) :: domain;
solve :: int_search([D,A,E,B], input_order, indomain_random, complete) satisfy;
output ["\([A,B,C,D,E,G])\n"];
Missing solution:
[3, 1, 3, 1, 2, 3]