为什么这个 MiniZinc 声明是 "unexpected"?

Why is this MiniZinc declaration "unexpected"?

我是 MiniZinc 新手,我试图通过使用数组概括 MiniZinc 教程中的玩具程序,为澳大利亚地图着色。

这是包含我的 2 个数组声明的程序:

% Colouring Australia using nc colours

int: nc = 3;   /* number of colours */
int: ns = 7;  % number of states

  % I added these 2 lines, and changed nothing else so far
array[1..ns] of string: names = ["wa","nt","sa","q","nsw","v","t"]; 
var array[1..ns] of 1..nc: colours;

var 1..nc: wa;  % the color assigned to each state, to be calculated
var 1..nc: nt;
var 1..nc: sa;
var 1..nc: q;
var 1..nc: nsw;
var 1..nc: v;
var 1..nc: t;

constraint wa != nt;  % adjacent states
constraint wa != sa;
constraint nt != sa;
constraint nt != q;
constraint sa != q;
constraint sa != nsw;
constraint sa != v;
constraint q != nsw;
constraint nsw != v;

solve satisfy;

编译器毫无怨言地接受了第一个数组语句。 第二个数组语句给出语法错误消息:"unexpected array",但没有抱怨语法本身。

陈述的顺序应该是无关紧要的,所以不可能那样。 用 int 替换 1..nc 仍然会报错。

是什么造就了它 "unexpected"?为什么第一个数组没有意外?

我应该如何定义决策变量数组?

声明决策变量数组的语法是

 array[1..ns] of var 1..nc: colours;

即"var" 放在域之前(而不是 "array" 之前)。