Debian Codegraph @

tests/spec/unit/globals/global_cardinality/globals_global_cardinality_set.mzn

raw
1 /***
2 !Test
3 solvers: [gecode, chuffed]
4 options:
5 all_solutions: true
6 expected: !Result
7 solution: !SolutionSet
8 - !Solution
9 x: [!!set {}, !!set {}]
10 counts: [0, 0]
11 empty: []
12 zero: [0, 0, 0]
13 - !Solution
14 x: [!!set {}, !!set {1}]
15 counts: [1, 0]
16 empty: []
17 zero: [0, 0, 0]
18 - !Solution
19 x: [!!set {1}, !!set {}]
20 counts: [1, 0]
21 empty: []
22 zero: [0, 0, 0]
23 - !Solution
24 x: [!!set {1}, !!set {1}]
25 counts: [2, 0]
26 empty: []
27 zero: [0, 0, 0]
28 - !Solution
29 x: [!!set {}, !!set {2}]
30 counts: [0, 1]
31 empty: []
32 zero: [0, 0, 0]
33 - !Solution
34 x: [!!set {2}, !!set {}]
35 counts: [0, 1]
36 empty: []
37 zero: [0, 0, 0]
38 - !Solution
39 x: [!!set {}, !Range 1..2]
40 counts: [1, 1]
41 empty: []
42 zero: [0, 0, 0]
43 - !Solution
44 x: [!!set {2}, !!set {1}]
45 counts: [1, 1]
46 empty: []
47 zero: [0, 0, 0]
48 - !Solution
49 x: [!!set {1}, !!set {2}]
50 counts: [1, 1]
51 empty: []
52 zero: [0, 0, 0]
53 - !Solution
54 x: [!Range 1..2, !!set {}]
55 counts: [1, 1]
56 empty: []
57 zero: [0, 0, 0]
58 - !Solution
59 x: [!!set {1}, !Range 1..2]
60 counts: [2, 1]
61 empty: []
62 zero: [0, 0, 0]
63 - !Solution
64 x: [!Range 1..2, !!set {1}]
65 counts: [2, 1]
66 empty: []
67 zero: [0, 0, 0]
68 - !Solution
69 x: [!!set {2}, !!set {2}]
70 counts: [0, 2]
71 empty: []
72 zero: [0, 0, 0]
73 - !Solution
74 x: [!!set {2}, !Range 1..2]
75 counts: [1, 2]
76 empty: []
77 zero: [0, 0, 0]
78 - !Solution
79 x: [!Range 1..2, !!set {2}]
80 counts: [1, 2]
81 empty: []
82 zero: [0, 0, 0]
83 - !Solution
84 x: [!Range 1..2, !Range 1..2]
85 counts: [2, 2]
86 empty: []
87 zero: [0, 0, 0]
88 ***/
89
90 include "global_cardinality.mzn";
91
92 constraint global_cardinality([{1}, 0..2, 1..4], [1, 2, 3], [3, 2, 1]);
93
94 array [1..2] of var set of 1..2: x;
95 array [1..2] of var -10..10: counts;
96 constraint global_cardinality(x, [1, 2], counts);
97
98 array [1..0] of var set of 0..4: empty;
99 array [1..3] of var -10..10: zero;
100 constraint global_cardinality(empty, [1, 2, 3], zero);
101
102 solve satisfy;