Debian Codegraph @

tests/spec/unit/regression/bug110.mzn

raw
1 /***
2 !Test
3 solvers: [gecode, chuffed]
4 expected:
5 - !Result
6 solution: !Solution
7 board:
8 - [0, 0, 0, 0, 0]
9 - [0, 0, 0, 0, 0]
10 - [0, 0, 0, 0, 0]
11 - [0, 0, 0, 0, 0]
12 - [0, 0, 0, 0, 0]
13 - !Result
14 solution: !Solution
15 board:
16 - [2, 2, 2, 2, 2]
17 - [2, 2, 2, 2, 2]
18 - [2, 2, 2, 2, 2]
19 - [2, 2, 2, 2, 2]
20 - [2, 2, 2, 2, 2]
21 ***/
22 % vim: et ts=4
23 % Cut down version of MiniZinc bug 110.
24 % When flattened with mzn2fzn 1.1 this model results in negative
25 % (and more generally out-of-bounds) array accesses.
26
27 array[1..5,1..5] of var 0..2: board;
28
29 constraint
30 forall(row,col in 1..5) (
31 ( board[row, col] = 1 ->
32 forall(i in 1..5) (
33 (((row-i > 0) /\ (col-i > 0)) -> (board[row-i,col-i] < 2))
34 )
35 )
36 );
37
38 solve satisfy;
39
40 output ["board = ", show(board), ";\n"];