| 1 |
/*** |
| 2 |
!Test |
| 3 |
expected: !Result |
| 4 |
solution: !Solution |
| 5 |
evedays: |
| 6 |
- [1, 1, 1, 1, 1] |
| 7 |
- [1, 1, 1, 1, 1] |
| 8 |
- [1, 1, 1, 1, 1] |
| 9 |
- [1, 1, 1, 1, 1] |
| 10 |
- [1, 1, 1, 1, 1] |
| 11 |
- [1, 1, 1, 1, 1] |
| 12 |
- [1, 1, 1, 1, 1] |
| 13 |
flatroster: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] |
| 14 |
morndays: |
| 15 |
- [1, 1, 1, 1, 1] |
| 16 |
- [1, 1, 1, 1, 1] |
| 17 |
- [1, 1, 1, 1, 1] |
| 18 |
- [1, 1, 1, 1, 1] |
| 19 |
- [1, 1, 1, 1, 1] |
| 20 |
- [1, 1, 1, 1, 1] |
| 21 |
- [1, 1, 1, 1, 1] |
| 22 |
restdays: |
| 23 |
- [1, 1, 1, 1, 1] |
| 24 |
- [1, 1, 1, 1, 1] |
| 25 |
- [1, 1, 1, 1, 1] |
| 26 |
- [1, 1, 1, 1, 1] |
| 27 |
- [1, 1, 1, 1, 1] |
| 28 |
- [1, 1, 1, 1, 1] |
| 29 |
- [1, 1, 1, 1, 1] |
| 30 |
roster: |
| 31 |
- [1, 1, 1, 1, 1, 1, 1] |
| 32 |
- [1, 1, 1, 1, 1, 1, 1] |
| 33 |
- [1, 1, 1, 1, 1, 1, 1] |
| 34 |
- [1, 1, 1, 1, 1, 1, 1] |
| 35 |
- [1, 1, 1, 1, 1, 1, 1] |
| 36 |
***/ |
| 37 |
|
| 38 |
% Prior to r8850 mzn2fzn would abort when attempting to flatten the |
| 39 |
% seq_search annotation here. |
| 40 |
|
| 41 |
include "globals.mzn" ; |
| 42 |
|
| 43 |
int: weeks = 5; |
| 44 |
int: flatsize = 7 * weeks ; |
| 45 |
|
| 46 |
array [1..weeks,1..7] of var 1..5: roster; |
| 47 |
array [1..flatsize] of var 1..5: flatroster ; |
| 48 |
|
| 49 |
array [1..7,1..weeks] of var 1..weeks: restdays ; |
| 50 |
array [1..7,1..weeks] of var 1..flatsize: morndays ; |
| 51 |
array [1..7,1..weeks] of var 1..flatsize: evedays ; |
| 52 |
|
| 53 |
solve |
| 54 |
:: seq_search([ |
| 55 |
int_search([restdays[d,w]|d in 1..7,w in 1..weeks], input_order, indomain_min, complete), |
| 56 |
int_search([morndays[d,w]|d in 1..7,w in 1..weeks], input_order, indomain_min, complete), |
| 57 |
int_search([evedays[d,w]|d in 1..7,w in 1..weeks], input_order, indomain_min, complete), |
| 58 |
int_search(flatroster, first_fail, indomain_min, complete)]) |
| 59 |
satisfy; |
| 60 |
|
| 61 |
output ["roster = ", show(roster), ";\n"]; |