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