0

I need to create something very similar to the Nursing Roster example in optaplanner.

The planning requirements are:

  • Nurses have special skills.
  • There are shifts throughout the day, and week, and weekend.
  • New feature: Different tasks require different sets of skills.
  • New feature: Staff are often scheduled to spend 2 hours in the morning on a special task, then the rest of their day on their main task.

I thought the best way of modeling this is that a shift has a List, and each task requires a set of skills, and each shift takes a list of tasks.

And then Optaplanner would not only allocate nurses to shifts, but also combine tasks and allocate them to shifts.

My questions then are: Would a Task be a planning entity, planning variable, planning value?
Do I need to modify the solver factory? If yes, any tips on how best to do this?

Alex
  • 1,986
  • 22
  • 23

1 Answers1

2

Sounds like instead of having a Shift granularity, you have smaller granularity, namely a Task granularity.

In that case, I 'd consider making Task the planning entity (with a planning variable of Employee). The trouble is then to add a constraint to make sure that the several tasks on 1 day add up nicely to 1 shift... That's a bit of a pain, not just to write the constraint, but also because the metaheuristics will benefit greatly from a custom move to swaps always moves all tasks of the same shift in a move (which is a bit like pillar swap moves (see docs), but then filtered on tasks of the same shift).

Are you sure you can't just keep it simple and predefine the tasks in a shift, before assigning the shifts?

As for a shift having multiple skill requirements: that's easy and already part of the example in OptaPlanner: ShiftTypeSkillRequirement is a many2many relationship between ShiftType and Skill (you might want to change it to be between Shift and Skill).

Geoffrey De Smet
  • 26,223
  • 11
  • 73
  • 120