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

Scheduling nurses’ shifts at PGI Cikini Hospital


(1) The number of nurses is constant throughout the scheduling period;
(2) There are three shifts in a day, morning shift (07.00-14.00), evening shift (14.00-21.00), and night shift (21.00-07.00);
(3) The number of minimum nurses in each shift is constant, namely 4 nurses in morning shift, 5 nurses in evening shift, and 3 nurses in night shift;
(4) The number of shifts on weekdays (Monday-Saturday) is similar to weekend (Sunday);
(5) The planning period is for 28 days (4weeks), and the first day is Monday;
(6) There is no public holiday in the planning period;
(7) The schedule does not take into account nurses’ skill level or experience.

Hard constraints

(1) The number of nurses in each shift satisfies the minimum requirement;
(2) A nurse can only work in one shift in a day;
(3) If a nurse work two night-shifts in two consecutive days, he/she will get two days-off afterwards;
(4) A nurse works 5 to 6 days in a week.

Soft constraints

(1) All nurses have similar workdays in the scheduling period;
(2) Each nurse at least gets one day-off on weekend in the scheduling period;
(3) The total number of morning and evening shits is more than the number of night shifts;
(4) There is no working day in between days-off.


You can implement the spec above within 15 minutes.

National Holiday

Shift Definitions

We have four shifts, including a day off.

We define the shift set as night or day off. We reference it in a row constraint.

Staff Definitions

We define 16 nurses.

Row Constraints

If a nurse works two night shifts on two consecutive days, they will get two days off afterward.

Each nurse gets at least one day off on a weekend during the scheduled period.

There is no working day between days off.

We added a constraint for consecutive maximum works of six.

The pattern below is for circadian rhythm.

The constraints below are for balanced shifts. The macros calculate the values.

The 22 working days mean six days off taken.

Column Constraints

Refer to the daily requirements for the maximum and minimum values.
Macro defines these values.


Macro automatically calculates each number of shifts per staff by daily requirements and number of staff.

Solving Parameters and Solving Time

It shows we get the solution within 1 sec.

The solver reported no soft errors occurred.



Circadian rhythm

The spec. doesn’t consider circadian rhythm. We added a constraint for circadian rhythm.

Consecutive working

The spec. doesn’t mention anything about consecutive workings. We added a constraint for the consecutive workings.

Shift Blances among staff

Since the production and consumption relations automatically determine balanced shift numbers.
See macro calculations for the relation.
Here, we get the following ideal results regarding shift balances.

Continuity from the previous week

We should consider continuity from the previous month.

Load the Example Project File

File → Open Project File from GitHub