I am trying to come up with a Dynamic employee scheduling python code for a small ice cream chain based on the customer traffic everyday.
Some of the complex Constraints are:

  1. there are no fixed shifts per day
  2. min hours one can work is 4 and max hours is 9.
  3. one shall only work 5 days in a week.
  4. only a person in manager role should open and close the store.
  5. if someone is working more than 4 hrs they shall have a 30min break break and another employee must join before the break.
  6. I can hire as many people to serve customer traffic i.e., no fixed employees per day or per week.

Although I tried playing with PySchedule and Google OR Tools, but i was not able to code the above constraints. Also, I am not sure if there is another open source library available for these type of dynamic constraints.

I expect the end result something like this in the link below:

image

I would appreciate if someone can throw light and point me in right direction.

1 Answers

0
Laurent Perron On

You should create all possible shifts for one day, marking the one that must be assigned to a manager.

  • 8AM - 11AM
  • 9AM - 1PM (break) 2M -> 4PM
  • ...

Then you have two options

1) optimally select the best combination per day. Then reconstruct full shifts from that 2) in the above selection, introduce the notion of weekly schedule for 1 employee and build.

The first part version is a simple enumeration. The second part is a set covering/partitioning using a MIP solver or CP-SAT.