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

A new formulation and solution for the nurse scheduling problem: A case study in Egypt


■ The planning horizon is one week, i.e.,7days.
■ Each day has three types of shifts:morning shift(7h) from 8:00AM to 3:00PM,afternoon shift(7h) from 3:00PM to 10:00PM, and night shift (10h) from 10:00PM to 8:00 AM.
■ Saturday is the first day of each week.
■ The hospital administration is aiming to limit the nurses to work between six and eight shifts a week.
■ The head nurses work only in the morning shifts.

Hard constraints

■ Each nurse takes at least one day off.
■ Each nurse takes at least two successive shifts off working one shift.
■ If a nurse is assigned to two consecutive shifts, then he/she takes at least three consecutive shifts off.
■ Maximum of 65 hours working per week.

Soft constraints

■ The hospital administration is aiming to limit the nurses to work between six and eight shifts a week.
■ The daily sum of each shift are based on the paper.


You can implement the spec above within 15 minutes.

National Holiday

Shift Definitions

We have two shifts, working and a day off.

As for the morning, afternoon, and night shift,we define them in the phase section.

Task Definition

Task1 activates in each phase.

Staff Definitions

We define 46 nurses, including six head nurses.

Phase Definition

We have three phases: PH0 to morning, PH1 to afternoon, and PH2 to night.

Phase Vars

We define the primitive vars for the set of phase vars. Note we have the specific work hours for the phase var.

Phase Vars Set

Using a set of the vars above, we can count work hours.

Row Constraints

The regulation is 56 hours. However, we use the value of 65 since the paper describes 65 hours maximum.

We count tasks as total shifts on the planning horizon. Note we use “task count”.

Here, we describe forbidden sequences.

Daily Requirements

Refer to the paper for the specified values.

Column Constraints

Refer to the daily requirements for the maximum and minimum values.

Solving Parameters and Solving Time

It shows we get the solution within 1 sec.

The solver reported that two errors occurred.


Task View.

Hybrid View.

Shift View.



Since the regulations state 56 hours, we tested the 56-hour limit. We observed three shifts shortage as below.

Continuity from the previous week

We should consider continuity from the previous week.

Object values are compared between the original paper and the Schedule Nurse result.

The paper shows 13 nurses for six shifts,28 for seven, and five for eight.

Original object value=(6-6)*13+(7-6)*28+(8-6)*5=38 Schedule Nurse shows 38 as an object function value. So, the results are in complete accordance with this.

Load the Example Project File

File → Open Project File from GitHub