I am new to constraint programming and to Minizinc. I have look for a solution to this not relly hard task but I found nothing.
I want to count the number of different elements that appear in an array: This is the declaration of my array:
array[1..n,1..n] of var 1..n: countLeft;
I have try to do like this:
constraint
forall(j in 1..n) (
length(array2set([countLeft[i,j]|i in 1..stopCountLeft[j]]) )==left_vision[j]
);
But apparently my array is of type: array[int]of var opt int and is not accept by the function array2set.
Any ideas?
In MiniZinc 2.5.0, you can do something like this: