我是对约束编程和Minizinc不熟悉的新手。 我试图解决这个不算太难的问题,但却一无所获。
我想要计算在一个数组中出现过的不同元素的数量: 这是我的数组声明:
array[1..n,1..n] of var 1..n: countLeft;
我已经尝试做了这样的事情:
constraint
forall(j in 1..n) (
length(array2set([countLeft[i,j]|i in 1..stopCountLeft[j]]) )==left_vision[j]
);
但显然我的数组是这种类型:array[int]of var opt int,而该函数array2set无法接受此类型。
有什么想法吗?