Skip to content

Maximize Wishes

We try to grant as many wishes of the employees as possible. The employee can wish for a free shift or a complete free day. In our visualization wishes are also shown:

  • colored small diamond: employee wishes to have shift corresponding to the color off
  • brown triangle: employee wished to have the whole day off
  • green background: wish for specific shift off was granted
  • yellow background: wish for complete day off was granted

Implemented using Google's OR Tools

src/cp/objectives/maximize_wishes.py
model.Add(penalty == 1).OnlyEnforceIf(var)
model.Add(penalty == 0).OnlyEnforceIf(var.Not())
penalties.append(penalty)

For each non hidden employee we penalties all wished shifts or days that are not granted. var in this case means that the employee has to work the wished day or wished shift.