Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WeeklyRoster #39

Open
evr194 opened this issue Feb 1, 2023 · 0 comments
Open

WeeklyRoster #39

evr194 opened this issue Feb 1, 2023 · 0 comments

Comments

@evr194
Copy link

evr194 commented Feb 1, 2023

Hello Rodrigo,

I have been looking into your ‘MinHoursRoster’, which does exactly what it is supposed do to. However, realistic workforce planning is conducted most often on a weekly basis. Therefore, I would like o ask you to create a ‘WeeklyRoster’ tool that would look like the existing ‘MinHoursRoster’ but with following three major differences :
Instead of a number of days, the user should be able to create a roster based on a number of weeks (each week made up of 7 days)
When entering a number of ‘max_rest’ days (from 0 as no resting day and 7 as the maximum number of resting days per week), whenever the ‘max_rest’ days >= 2, such two resting days should be combined to simulate the weekend (or its replacing two days) according to a revolving scheme to be calculated by the logic. I think this could be done by adapting your ‘MinHoursRoster’ code as follows :

def optimize_max_resting(shifts, num_days, max_resting):
resting_days = 0
for i in range(num_days):
if shifts[i] == 0:
resting_days += 1
if resting_days >= 2:
return True
else:
resting_days = 0
if max_resting > 2:
return True
return False

Finally, the shifts should remain stable throughout the week for each individual resource (and not having such a resource switch between 2, 3 or even 4 shifts (or more) during the days he/she will be planned for each week. E.g. someone should work 5 days the same shift during the same week in which he/she has 2 resting days. Next week this could be another shift, but always the same shift within this second week, and so on. I think this could be done by adapting your ‘MinHoursRoster’ code as follows :

def optimize_shifts(shifts, max_consecutive_shifts):
consecutive_shifts = 0
for i in range(len(shifts)):
if shifts[i] == 1:
consecutive_shifts += 1
if consecutive_shifts >= max_consecutive_shifts:
if i + 1 < len(shifts) and shifts[i + 1] == 0:
consecutive_shifts = 0
else:
return False
else:
consecutive_shifts = 0
return True
I am not proficient enough to start tampering with your code, but it would be greatly appreciated if you could look into this. Creating a ‘WeeklyRoster’ tool would be a great addition to pyworkforce, I think since it would mimic more closely real life situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant