Search code examples
optaplanner

Getting the optimal number of employees for a month (rostering)


Is it possible to get the optimal number of employees in a month for a given number of shifts?

I'll explain myself a little further taking the nurse rostering as an example.

Imagine that we don't know the number of nurses to plan in a given month with a fixed number of shifts. Also, imagine that each time you insert a new nurse in the planification it decreases your score and each nurse has a limited number of normal hours and a limited number of extra hours. Extra hours decrease more the score than normal ones.

So, the problem consists on getting the optimal number of nurses needed and their planification. I've come up with two possible solutions:

  1. Fix the number of nurses clearly above of the ones needed and treat the problem as an overconstrained one, so there will be some nurses not assigned to any shifts.

  2. Launching multiple instances of the same problem in parallel with an incremental number of nurses for each instance. This solution has the problem that you have to estimate more or less an approximate range of nurses under and above the nurses needed beforehand.

Both solutions are a little bit inefficient, is there a better approach to tackle with this problem?


Solution

  • I call option 2 doing simulations. Typically in simulations, they don't just play with the number of employees, but also the @ConstraintWeights etc. It's useful for strategic "what if" decisions (What if we ... hire more people? ... focus more on service quality? ... focus more on financial gain? ...)

    If you really just need to minimize the number of employees, and you can clearly weight that versus all the other hard and soft constraint (probably as a weight in between both, similar to overconstrained planning), then option 1 is good enough - and less cpu costly.