Skip to content

Commit

Permalink
Change table and regular predicates to take 1d arrays as arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
guidotack committed Feb 13, 2019
1 parent 0f3b118 commit 7749cde
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
8 changes: 8 additions & 0 deletions changelog.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ Date: 2019-02-14
This release fixes a number of minor issues and adds post events
to general tracers.

[ENTRY]
Module: flatzinc
What: bug
Rank: minor
[DESCRIPTION]
Change table and regular predicates to take 1d arrays as arguments.
Otherwise the generated FlatZinc does not typecheck.

[ENTRY]
Module: flatzinc
What: bug
Expand Down
4 changes: 2 additions & 2 deletions gecode/flatzinc/mznlib/regular.mzn
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
%

predicate gecode_regular(array[int] of var int: x, int: Q, int: S,
array[int,int] of int: d, int: q0, set of int: F);
array[int] of int: d, int: q0, set of int: F);

predicate regular(array[int] of var int: x, int: Q, int: S,
array[int,int] of int: d, int: q0, set of int: F) =
Expand All @@ -55,5 +55,5 @@ predicate regular(array[int] of var int: x, int: Q, int: S,
assert(F subset 1..Q,
"regular: final states in 'F' contain states outside 1..Q",

gecode_regular(x,Q,S,d,q0,F)
gecode_regular(x,Q,S,array1d(d),q0,F)
))))));
12 changes: 6 additions & 6 deletions gecode/flatzinc/mznlib/table_bool.mzn
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@
%

predicate gecode_table_bool(array[int] of var bool: x,
array[int, int] of int: t);
array[int] of int: t);

predicate gecode_table_bool_reif(array[int] of var bool: x,
array[int, int] of int: t, var bool: b);
array[int] of int: t, var bool: b);

predicate gecode_table_bool_imp(array[int] of var bool: x,
array[int, int] of int: t, var bool: b);
array[int] of int: t, var bool: b);

predicate table_bool(array[int] of var bool: x, array[int, int] of int: t) =
assert (index_set_2of2(t) == index_set(x),
"The second dimension of the table must equal the number of variables "
++ "in the first argument",
gecode_table_bool(x,t));
gecode_table_bool(x,array1d(t)));

predicate table_bool_reif(array[int] of var bool: x, array[int, int] of int: t,
var bool: b) =
assert (index_set_2of2(t) == index_set(x),
"The second dimension of the table must equal the number of variables "
++ "in the first argument",
gecode_table_bool_reif(x,t,b));
gecode_table_bool_reif(x,array1d(t),b));

predicate table_bool_imp(array[int] of var bool: x, array[int, int] of int: t,
var bool: b) =
assert (index_set_2of2(t) == index_set(x),
"The second dimension of the table must equal the number of variables "
++ "in the first argument",
gecode_table_bool_imp(x,t,b));
gecode_table_bool_imp(x,array1d(t),b));
12 changes: 6 additions & 6 deletions gecode/flatzinc/mznlib/table_int.mzn
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,31 @@
%

predicate gecode_table_int(array[int] of var int: x,
array[int, int] of int: t);
array[int] of int: t);

predicate gecode_table_int_reif(array[int] of var int: x,
array[int, int] of int: t, var bool: b);
array[int] of int: t, var bool: b);

predicate gecode_table_int_imp(array[int] of var int: x,
array[int, int] of int: t, var bool: b);
array[int] of int: t, var bool: b);

predicate table_int(array[int] of var int: x, array[int, int] of int: t) =
assert (index_set_2of2(t) == index_set(x),
"The second dimension of the table must equal the number of variables "
++ "in the first argument",
gecode_table_int(x,t));
gecode_table_int(x,array1d(t)));

predicate table_int_reif(array[int] of var int: x, array[int, int] of int: t,
var bool: b) =
assert (index_set_2of2(t) == index_set(x),
"The second dimension of the table must equal the number of variables "
++ "in the first argument",
gecode_table_int_reif(x,t,b));
gecode_table_int_reif(x,array1d(t),b));

predicate table_int_imp(array[int] of var int: x, array[int, int] of int: t,
var bool: b) =
assert (index_set_2of2(t) == index_set(x),
"The second dimension of the table must equal the number of variables "
++ "in the first argument",
gecode_table_int_imp(x,t,b));
gecode_table_int_imp(x,array1d(t),b));

0 comments on commit 7749cde

Please sign in to comment.