Debian Codegraph @

tests/spec/unit/globals/table/globals_table.mzn

raw
1 /***
2 !Test
3 expected:
4 - !Result
5 solution: !Solution
6 x: 1
7 y: 2
8 z: 1
9 - !Result
10 solution: !Solution
11 x: 2
12 y: 5
13 z: 2
14 - !Result
15 solution: !Solution
16 x: 6
17 y: 5
18 z: 1
19 ***/
20
21 include "table.mzn";
22
23 array[1..10,1..3] of int: t;
24
25 t = [| 1,1,1
26 | 1,2,3
27 | 2,1,3
28 | 4,1,3
29 | 2,3,4
30 | 6,5,1
31 | 1,3,3
32 | 2,5,2
33 | 1,2,1
34 | 3,4,4 |];
35
36 var 1..10: x ::add_to_output;
37 var 1..10: y ::add_to_output;
38 var 1..10: z ::add_to_output;
39
40 constraint table([x,y,z], t);
41
42 constraint x != y /\ z < 3;
43
44 solve satisfy;
45
46 output [
47 "x = ", show(x), ";\n",
48 "y = ", show(y), ";\n",
49 "z = ", show(z), ";\n"
50 ];