| 1 |
/*** |
| 2 |
!Test |
| 3 |
expected: |
| 4 |
- !Result |
| 5 |
solution: !Solution |
| 6 |
x: [6, 3, 8, 3] |
| 7 |
- !Result |
| 8 |
solution: !Solution |
| 9 |
x: [3, 6, 8, 3] |
| 10 |
- !Result |
| 11 |
solution: !Solution |
| 12 |
x: [3, 3, 8, 6] |
| 13 |
***/ |
| 14 |
|
| 15 |
include "global_cardinality.mzn"; |
| 16 |
|
| 17 |
array[1..4] of var 0..8: x; |
| 18 |
|
| 19 |
% Make one of the array elements a value that is not in the cover. |
| 20 |
% This is to check that we get the behaviour specified in the global |
| 21 |
% constraint catalogue. |
| 22 |
constraint x[3] = 8; |
| 23 |
|
| 24 |
constraint |
| 25 |
global_cardinality( |
| 26 |
%[3, 3, 8, 6], |
| 27 |
x, |
| 28 |
[3, 5, 6], |
| 29 |
[2, 0, 1], |
| 30 |
[3, 2, 1]); |
| 31 |
|
| 32 |
solve satisfy; |
| 33 |
|
| 34 |
output ["x = array1d(1..4, ", show(x), ");\n"]; |