June 15, 2020

Employee scheduling & staggered time

Employee scheduling & staggered time

The pandemic has forced companies to make frequent adjustments in assigning people and resources to tasks at specific times.  In this article we will look at a typical use case in the healthcare sector and proposes a solution to assigning the right amount of human resource using an open source tool.

Nurse scheduling problem is a special use case of optimization, where operations have to meet certain constraints in manpower rules and hospital standards.  Here is the problem statement:

A hospital supervisor needs to create a schedule for four nurses over a three-day period, subject to the following conditions:

  • Each day is divided into three 8-hour shifts.
  • Every day, each shift is assigned to a single nurse, and no nurse works more than one shift.
  • Each nurse is assigned to at least two shifts during the three-day period.
Some scheduling software provide visual tools to guide work planning


Traditionally problem like this require the use of expensive proprietary software and have to be handled by professionals trained in the software.  However, some open source tools have been developed for Python, such as Google’s OR (Operations Research?)  tools which allow anyone interested in solving the problem to work on the problem right away, using downloadable tools.

With some general knowledge in Python and the ability to translate the constraints into something the OR tools can understand (in Python syntax), the problem can be solved quite easily.

Here is the output of the first 3 of many possible arrangements:

Solution 0

Day 0
Nurse 0 does not work
Nurse 1 works shift 0
Nurse 2 works shift 1
Nurse 3 works shift 2

Day 1
Nurse 0 works shift 2
Nurse 1 does not work
Nurse 2 works shift 1
Nurse 3 works shift 0

Day 2
Nurse 0 works shift 2
Nurse 1 works shift 1
Nurse 2 works shift 0
Nurse 3 does not work

Solution 1

Solution 2


  • conflicts : 215
  • branches : 46931
  • wall time : 0.320325 s
  • solutions found : 5184

Open source optimization tools such as Google's OR tools have enabled companies to operate under the various constraints imposed by the availability of manpower, health concern for employees and the economics of business.  

Should you feel that you’d need to approach a specialist who could offer a solution to a problem specific to your environment, please give us a buzz and we’d be happy to assist you.