this repo has no description
1%-----------------------------------------------------------------------------%
2% A table constraint: table(x, t) represents the constraint x in t where we
3% consider each row in t to be a tuple and t as a set of tuples.
4%-----------------------------------------------------------------------------%
5
6predicate fzn_table_bool(array[int] of var bool: x, array[int, int] of bool: t) =
7 let { int: l = min(index_set(x)),
8 int: u = max(index_set(x)),
9 int: lt = min(index_set_1of2(t)),
10 int: ut = max(index_set_1of2(t)),
11 var lt..ut: i,
12 array[l..u, lt..ut] of bool: t_transposed =
13 array2d(l..u, lt..ut, [ t[i,j] | j in l..u, i in lt..ut ]) }
14 in
15 forall(j in l..u) (
16 % Having the variable index component at the left position
17 % means that the nD-to-1D array translation during Mzn-to-Fzn
18 % will generate at most an offset constraint, instead of a
19 % scaling + offset constraint.
20 %
21 t_transposed[j,i] = x[j]
22 %
23 % t[i,j] = x[j]
24 );