Skip to content

Commit 7749cde

Browse files
committed
Change table and regular predicates to take 1d arrays as arguments
1 parent 0f3b118 commit 7749cde

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

changelog.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ Date: 2019-02-14
6969
This release fixes a number of minor issues and adds post events
7070
to general tracers.
7171

72+
[ENTRY]
73+
Module: flatzinc
74+
What: bug
75+
Rank: minor
76+
[DESCRIPTION]
77+
Change table and regular predicates to take 1d arrays as arguments.
78+
Otherwise the generated FlatZinc does not typecheck.
79+
7280
[ENTRY]
7381
Module: flatzinc
7482
What: bug

gecode/flatzinc/mznlib/regular.mzn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
%
3232

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

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

58-
gecode_regular(x,Q,S,d,q0,F)
58+
gecode_regular(x,Q,S,array1d(d),q0,F)
5959
))))));

gecode/flatzinc/mznlib/table_bool.mzn

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,30 @@
3333
%
3434

3535
predicate gecode_table_bool(array[int] of var bool: x,
36-
array[int, int] of int: t);
36+
array[int] of int: t);
3737

3838
predicate gecode_table_bool_reif(array[int] of var bool: x,
39-
array[int, int] of int: t, var bool: b);
39+
array[int] of int: t, var bool: b);
4040

4141
predicate gecode_table_bool_imp(array[int] of var bool: x,
42-
array[int, int] of int: t, var bool: b);
42+
array[int] of int: t, var bool: b);
4343

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

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

5757
predicate table_bool_imp(array[int] of var bool: x, array[int, int] of int: t,
5858
var bool: b) =
5959
assert (index_set_2of2(t) == index_set(x),
6060
"The second dimension of the table must equal the number of variables "
6161
++ "in the first argument",
62-
gecode_table_bool_imp(x,t,b));
62+
gecode_table_bool_imp(x,array1d(t),b));

gecode/flatzinc/mznlib/table_int.mzn

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,31 @@
3333
%
3434

3535
predicate gecode_table_int(array[int] of var int: x,
36-
array[int, int] of int: t);
36+
array[int] of int: t);
3737

3838
predicate gecode_table_int_reif(array[int] of var int: x,
39-
array[int, int] of int: t, var bool: b);
39+
array[int] of int: t, var bool: b);
4040

4141
predicate gecode_table_int_imp(array[int] of var int: x,
42-
array[int, int] of int: t, var bool: b);
42+
array[int] of int: t, var bool: b);
4343

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

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

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

0 commit comments

Comments
 (0)