Minzinc:在2D阵列的每一行上施加约束

时间:2019-02-28 13:36:48

标签: arrays minizinc

我正在尝试将regular约束应用于int var的2D数组的每一行:

enum ROW;
enum COL;
enum VAR_ENUM;
array[ROW, COL] of var VAR_ENUM: sequence;
include "regular.mzn"
constraint forall(r in ROW)(regular(sequence[r], ... other regular parameters))

我最终遇到错误MiniZinc: type error: 2-dimensional array accessed with 1 expression

是否可以切片2D数组?如果没有,我该如何对大量数组变量应用常规约束?

1 个答案:

答案 0 :(得分:2)

r可以访问2D数组sequence的行row(sequence, r)