Debian Codegraph @

tests/spec/unit/regression/bug82.mzn

raw
1 /***
2 !Test
3 solvers: [gecode, chuffed]
4 expected:
5 - !Result
6 solution: !Solution
7 pos:
8 - [1, 1, 1]
9 - [1, 1, 1]
10 - [1, 1, 1]
11 - [1, 1, 1]
12 - [1, 1, 1]
13 - [1, 1, 1]
14 - [1, 1, 1]
15 - [1, 1, 1]
16 - [1, 1, 1]
17 - [1, 1, 1]
18 - [1, 1, 1]
19 - [1, 1, 1]
20 - [1, 1, 1]
21 - !Result
22 solution: !Solution
23 pos:
24 - [1, 1, 1]
25 - [1, 1, 1]
26 - [1, 1, 1]
27 - [1, 1, 1]
28 - [1, 1, 1]
29 - [2, 1, 1]
30 - [3, 1, 1]
31 - [4, 1, 1]
32 - [5, 1, 1]
33 - [4, 1, 1]
34 - [3, 1, 1]
35 - [2, 1, 1]
36 - [1, 1, 1]
37 - !Result
38 solution: !Solution
39 pos:
40 - [6, 6, 6]
41 - [6, 6, 6]
42 - [6, 6, 6]
43 - [6, 6, 6]
44 - [6, 6, 6]
45 - [6, 6, 6]
46 - [6, 6, 6]
47 - [6, 6, 6]
48 - [6, 6, 6]
49 - [6, 6, 6]
50 - [6, 6, 6]
51 - [6, 6, 6]
52 - [6, 6, 6]
53 ***/
54
55 % This caused mzn2fzn (r9627 and before) to abort.
56
57
58 % NOTE: we cannot run this on LazyFD because it the redefinition of
59 % array_var_bool_element below will conflict with the LazyFD backend's
60 % redefinitions file. We run this only with the std fd variant since
61 % we know that does not use any redefinitions.
62
63 array[1..6,1..6] of bool: linked;
64 array[1..13,1..3] of var 1..6: pos;
65
66 constraint
67 forall(t in 1..3, x in 2..13)(linked[pos[x,t],pos[x-1,t]]);
68
69 solve satisfy;
70
71 linked = [| true, true, false, false, false, false
72 | true, true, true, false, false, false
73 | false, true, true, true, false, true
74 | false, false, true, true, true, false
75 | false, false, false, true, true, false
76 | false, false, true, false, false, true |];
77
78 % From g12/zinc/lib/minizinc/g12_lazyfd/redefinitions.mzn:
79 %
80 predicate array_var_bool_element(var int : idx, array[int] of var bool : arr,
81 var bool : v) =
82 let { int : N = length(arr),
83 array[1..N] of var bool : tmp = [idx = I | I in 1..N]
84 }
85 in
86 exists(I in 1..N)(tmp[I])
87 /\ forall(I in 1..N) (tmp[I] -> v = arr[I]);
88
89 output ["pos = ", show(pos), ";\n"];