I would like to implement the following paper in Hong Kong with Schedule Nurse

Artificial intelligence and end user tools to develop a nurse duty roster scheduling system


Hard constraints

■ There were nine nurses working for day shift and two nurses working for night shift.
■ As the ward was divided into areas for male and female patients, at least three nurses should work in each area.
■ A nurse of higher seniority or of higher rank must be present in the morning and afternoon shift.
■ Each nurse member should have at least one day off each week; each nurse can only work for one shift (either morning, afternoon or night) each day; nurses were on approved annual leave.
■ A nurse member cannot work on a morning shift after a night shift.

Soft constraints

Shift sequence pattern

There are patterns generally not in preference to nurses but it is allowed to have such patterns as schedule sequence. For example, the following patterns are not preferred: ON, AAA, PPP, POP, POA, POOP (A: morning duty, P: afternoon duty, N: night duty, O: day off).

Personal request shift

These are shift requests made by nurses, in which nurses may request for day off or for some preferred schedule. It is desirable that these soft constraints are fulfilled.


You can implement the spec. above within 15 minutes.

National Holidays

Shift Definitions

Staff Definitions

Group Definitions

Group Aggregate Definitions

Row Constraints

Column Constraints

Staff Schedules

Staff Schedules are all soft-constrained at the level of 2.

Solving Parameters and Solving Time

It shows we get the solution within 1 sec.

The solver reported that two errors occurred.


Two staff schedules are forced to be changed due to the error above.


Original Solution

We read the original solution as scheduled as follows.

There was no solution due to conflicting constraints between the row constraint of no consecutive seven days working and the schedules.

Schedules as a hard constraint

If we make all the staff schedules hard constraints, we ensured that the conflict analysis correctly pointed the error constraint out as follows.

Load the Example Project File

File → Open Project File from GitHub