timefold

Employee Scheduling - Allow Shifts not Assigned


I'm running a proof on concept to see if Timefold can cover the scenarios we have. So, all good, but, Timefold always find an Employee to all shifts, event when the oneShiftPerDay constraint is set, it always repeats someone and assigns them to the shift. Is there a way to leave shifts unassigned?

My test case was simple:


Solution

  • It is not enough to enable the constraint. You also need to tell the solver that it is allowed to leave some entities unassigned. Based on if you're using basic variables or list variables, the documentation will tell you more:

    Also, without actually seeing your constraints, I can't really tell if the constraint perhaps doesn't do something that would make the solver prefer assigning the entities.