28 Apr 2017
Optaplanner for Nurse Rostering
Devashish Sharma
#Technology | 4 min read
Optaplanner for Nurse Rostering
Devashish Sharma

We built a rostering solution using optaplanner for healthcare organizations providing home-care. The problem at hand was to roster the nurses (or, caregivers) to at-home appointments in an optimized manner so as to maximize benefits, i.e. a system that could automatically plan and decide:


Who should go to which appointment, when and where so as to maximise benefits and patient satisfaction

What had to be done?

The major challenge was to optimize the critical resources (caregivers) to the appointments considering various factors.


For example, a patient might be in a more critical stage and needs care immediately or, there can be some loyal customers that are to be given preference or, to distribute the workload among the employees so that maximum number of patients can be served etc.



Also, the system needed to be location aware. For example, if an employee is in a particular region, then he should be allocated all the nearby appointments so as to save on transportation time and cost.



All these calculations can be done manually (of course, less efficiently and less precisely) up to a maximum of 10-20 employees.


But as the organization grows it is impossible to do such complex calculations manually. This is where our planner would secure great benefits for the patients as well as the health-care firm.



The planner can connect to the existing employee database of the organization to get the availability of the staff. The appointments (including customer preferences) are fed to the system and the system decides the roster.


Our Solution – OptaPlanner

We used OptaPlanner to design this solution. OptaPlanner is a Java-based library to solve constraint satisfaction problems.


Especially, it can be used to solve NP-complete and NP-Hard problems in an optimized manner so that we can get the practically best possible solution in a feasible time.



We used Drools for constraint definition and built an API-server that takes JSON input and returns the solution in JSON format. Hence, it is easily pluggable into any kind of application architecture.



The planner creates the optimized solution and returns the following output for each appointment:

  • Allocated employee. (Who)
  • Allocated time slot. (When)


And also, the planner takes into consideration the location of the appointment and the travel time between each appointment. (Where)

Main features of the planning API

Intelligent preference consideration: The planner takes care if the customer prefers some caregiver. But, the planner would allocate the preferred caregiver only if the allotment does not have any negative impact on the overall roster for the day.


Therefore, the planner is intelligent enough to know that if allotting the preferred caregiver to someone results in some other customer not getting any caregiver allocated, then such allocation would not be done.**



Intelligent appointment time allocation: The planner automatically calculates a time-slot for every appointment (within the customer-specific preferred time range) so that maximum number of appointments can be handled.



Location awareness: If a caregiver is allocated two appointments, then the time difference between those appointments should be sufficient enough considering the travel duration between those locations.


We are using Google Maps Distance Matrix API to make the planner aware of the travel duration between any two appointments.



Incremental Planning: Let’s face it, in the real world, any type of intelligent planning system should also be considerate enough for manual tweaks.


Not everything can be planned for just maximizing profits. So, our planning system also accepts some appointments to be planned manually in the input JSON itself and all other appointments are planned accordingly not changing the fixed appointments.



Weightage consideration: The planner also takes into consideration the weight of the customer. Every organization has some method for prioritization of customers.


Some customers need to be given priority over others so that the organization can develop a good customer relationship. Therefore, the planner considers the weight of each appointment and meets their preferences accordingly.



This is a great solution for any service-delivery based organization looking for an automated solution to manage their rostering needs in the best possible way. And it can be adapted for a wide range of smart scheduling and route optimization problems.

Read similar blogs

Need Tech Advice?
Contact our cloud experts

Need Tech Advice?
Contact our cloud experts

Contact Us

PHP Code Snippets Powered By :