Minizinc lazyfd解决方案忽略约束

Minizinc lazyfd solution ignores constraint

问题是为一些人找到一个时间表,让他们以固定规模的团体打高尔夫球(或其他)。 我们必须保证每个玩家一次只能在一组中。

这是我的代码:

int: gr;             % number of groups
int: sz;             % size of groups
int: we;             % number of weeks

int: n=gr*sz;        % number of players

set of int: G=1..gr; % set of group indices
set of int: P=1..n;  % set of players
set of int: W=1..we; % set of weeks

% test instance
gr = 2;
sz = 2;
we = 2;

array[G,W] of var set of P: X;
   %X[g,w] is the set of people that form group with index g in week w


% forall group x, |x| = sz
constraint forall (g in G, w in W) 
  (card (X[g,w]) = sz);

% one person cannot play in two groups simultaneously
constraint forall (g in G, w in W, p in X[g,w], g2 in (g+1..gr))
  (not(p in X[g2,w]));

solve satisfy;

我现在的问题是,如果我使用 G12 lazyfd 求解器,即

$ minizinc -b lazy this.mzn

我明白了

X = array2d(1..2 ,1..2 ,[1..2, 1..2, 1..2, 1..2]);
----------

这似乎忽略了我的第二个约束。 另一方面,使用没有惰性选项的 G12,即

$ minizinc this.mzn

产量

X = array2d(1..2 ,1..2 ,[1..2, 1..2, 3..4, 3..4]);
----------

这是正确的。 G12 MIP 和 Gecode 也给出了正确的结果。

这怎么可能?我如何使用惰性求解器才能依赖它?还是只是我的安装出了问题?

G12/lazyFD 已知在很多地方都被破坏了。问题是 G12 求解器不再开发,很可能很快就会从发行版中删除。

我会提供 Chuffed 作为替代方案。 Chuffed 是用 C++ 编写的具有惰性子句生成的 FD 求解器。它应该是正确的,并且会比 G12 解算器表现得更好(至少当解决方案正确时)。

可以在 software page of the MiniZinc website.

上找到 Chuffed 和其他 MiniZinc 求解器