If you have N people and M of them need to be on duty at a time, what is an algorithm for generating a fair duty rotation?
"Fair" is subjective, so here is the definition I'm using:
- Every M-subset should be represented exactly once in the schedule
- The variance of time off-duty should be minimized
I'm interested in M=2 specifically, but I'm curious if there is a general approach as well.
For example, for N=4, M=2, I think this is an optimal schedule
1 2 3 4 5 6
A A B A B C
B C D D C D
because everyone has the same spans of time on- and off-duty except for B who gets the more consistent schedule of 1-on, 1-off. That's more fair than this schedule
1 2 3 4 5 6
A A A B B C
B C D C D D
where A is 3-on, 3-off while C is 1-on, 1-off. I'm using variance for fairness because even if (somehow) everyone had a 3-on, 3-off schedule, that would be "less fair" than everyone having a 1-on, 1-off schedule. Variance across all off-duty periods should be considered.