balancing shifts, ensuring max working time taken into consideration - shift_scheduling_sat.py #2485
Unanswered
braindeaf
asked this question in
CP-SAT questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I wanted to see if there were any opinions on my strategy to balance out shifts in my solver. Forgive me if I paste my Ruby code as an example.
I'm gradually building out my solver into a real world example with real objects user_ids, shifts with hours and various configuration options, real dates, etc At which point it's hard for me to work backwards into Python.
I want to evenly distribute shifts across the period. So that ideally every person gets near enough the same number of shifts. Obviously this won't always be equal, so if num is not an integer we round up.
Ideally I'd like to minimize this and say ideally they get num.ceil or num.floor but with a penalty num.ceil + 1, num.floor - 1 etc.
Then we have shifts with their own hours. So here in a given 7 day period we limit the hours for a single staff member to say 48 hours for EU Working Time Directive, and this can be configurable for up to 56 hours if they opt out. But also over the entire period this balances out to more than 40 hours per week (otherwise we may end up with the solver just filling up with too many days off.
Ideally I'd like to minimize this too, less hours is better and balanced hours as much as possible.
Does this all seem reasonable? Any advice?
Many thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions