| 1 |
/*** |
| 2 |
!Test |
| 3 |
expected: |
| 4 |
- !Result |
| 5 |
solution: !Solution |
| 6 |
mark: |
| 7 |
- 0 |
| 8 |
- 1 |
| 9 |
- 3 |
| 10 |
objective: 3 |
| 11 |
***/ |
| 12 |
|
| 13 |
% A regression test for G12 bug #85. |
| 14 |
% |
| 15 |
include "all_different.mzn"; |
| 16 |
|
| 17 |
int: m = 3; |
| 18 |
int: n = m*m; |
| 19 |
|
| 20 |
array [1..m] of var 0..n: mark :: add_to_output = [0, 1, 3]; |
| 21 |
|
| 22 |
array[1..(m*(m-1)) div 2] of var 0..n: differences = |
| 23 |
[ mark[j] - mark[i] | i in 1..m, j in i+1..m]; |
| 24 |
|
| 25 |
constraint mark[1] = 0; |
| 26 |
|
| 27 |
constraint forall ( i in 1..m-2 ) ( mark[i] < mark[i+1] ); |
| 28 |
|
| 29 |
constraint all_different(differences); |
| 30 |
|
| 31 |
constraint mark[2] - mark[1] < mark[m] - mark[m-1]; |
| 32 |
|
| 33 |
solve minimize mark[m]; |
| 34 |
|
| 35 |
output ["% golomb ", show(mark), "\n"]; |