this repo has no description
1% Simple nurse rostering 2include "regular.mzn"; 3enum NURSE; 4enum DAY; 5int: req_day; 6int: req_night; 7int: min_night; 8 9enum SHIFT = { d, n, o }; 10int: S = card(SHIFT); 11 12int: Q = 6; int: q0 = 1; set of int: STATE = 1..Q; 13array[STATE,SHIFT] of int: t = 14 [| 2, 3, 1 % state 1 15 | 4, 4, 1 % state 2 16 | 4, 5, 1 % state 3 17 | 6, 6, 1 % state 4 18 | 6, 0, 1 % state 5 19 | 0, 0, 1|]; % state 6 20 21array[NURSE,DAY] of var SHIFT: roster; 22 23constraint forall(j in DAY)( 24 sum(i in NURSE)(roster[i,j] == d) == req_day /\ 25 sum(i in NURSE)(roster[i,j] == n) == req_night 26 ); 27constraint forall(i in NURSE)( 28 regular([roster[i,j] | j in DAY], Q, S, t, q0, STATE) /\ 29 sum(j in DAY)(roster[i,j] == n) >= min_night 30 ); 31 32solve satisfy; 33 34output [ show(roster[i,j]) ++ if j==card(DAY) then "\n" else " " endif 35 | i in NURSE, j in DAY ];