Tuesday, May 11, 2010

Automated nurse rostering based on hard and soft constraints with Drools Planner

The optimal solution for a planning problem is the solution with the highest score. But how do we calculate and compare scores?

In a previous blog, I have shown that there's no easy way to find the optimal solution in for example the bin packaging use case. Today I 'll use the nurse rostering use case to explain scoring based on hard and soft constraints.

The use case

In the nurse rostering rostering use case, we assign nurses to work shifts in a hospital. We want to increase quality of service, minimize staff size and maximize staff contentment.

In the example above, on the Monday morning we need 1 maternity nurse. Both solutions assign nurse C to that shift. As you can see, the solution on the right is better, because it breaks less constraints.

Each solution has a score and Drools Planner will look for the solution with the highest score. In some use cases the score is a single integer (SimpleScore), but in other use cases, such as this one, there are both hard and soft constraints (HardAndSoftScore).

Hard constraints

Hard constraints need to be fulfilled. We always look for the solution with the least hard constraints broken.

The example above shows 2 hard constraints. The solution is feasible when none of the hard constraints are broken. The hospital can work with any feasible solution, but still they prefer some feasible solutions over others...

Soft constraints

Soft constraints should be fulfilled as much as possible. Of all the feasible solutions, we look for the solution with the least soft constraints broken.

The example above shows some of the soft constraints of the nurse rostering use case. But if you talk to a business analyst, you 'll discover that there are many more and you need something which makes adding extra constraints easy. Something like Drools Planner.



  1. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. armerie a san marino

  2. I would like to say that this blog really convinced me to do it! Thanks, very good post. สล็อตออนไลน์

  3. I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post. armerie a san marino

  4. Like different controls development, nursing has created different speculations that fit the distinctions and philosophical convictions or ideal models of the world.local doctors

  5. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks automated access

  6. Yes, I am entirely agreed with this article, and I just want say that this article is very helpful and enlightening. I also have some precious piece of concerned info !!!!!!Thanks. Travel Nursing

  7. Huge numbers of these microorganisms can be profoundly irresistible just as medication safe making them unmistakably more hazardous to the numerous immunocompromised patients housed in a medical services office. cna classes online in california

  8. Interestingly you write, I will address you'll find exciting and interesting things on similar topics. 2 week cna classes online

  9. Thanks for every other informative site. The place else may just I get that kind of information written in such an ideal means? I have a venture that I’m just now operating on, and I have been on the look out for such information. testbank