rodrigo-arenas / pyworkforce

Standard tools for workforce management, queuing, scheduling, rostering and optimization problems.
https://pyworkforce.readthedocs.io
MIT License
75 stars 19 forks source link

Shift feature should allow to define opening and closing periods #29

Closed Robin-C closed 2 years ago

Robin-C commented 2 years ago

Right now, when trying to go from erlangc to shifts, the engine will sometimes "shift" a ressource even tho required_ressource was set to 0 at this period.

Practically, what it does is it will shift someone to work at 3am even tho there is no required_ressource needed before 6am.

It happens because:

1) There is a valid shift defined to cover this period 2) The engine is trying to optimize for shift coverage and will shift someone earlier than needed because it prefers a larger coverage rather than useless overlap with additional ressources later.

Describe the solution you'd like I'd like to be able to pass an optional dictionary with the day and its opening and closing periods where no shift can take place outside.

Alternatively, today I'm dynamically providing the acceptable shifts to the optimizer and run it as many times as I have days.

rodrigo-arenas commented 2 years ago

Hi, in this case, as you mention, as long as there is a valid shift that covers 3 a.m, it might end up shifting someone at that time, so it will also cover the demand of the beginning of the morning shift

There are several ways you can try to improve this:

I hope it helps

Robin-C commented 2 years ago

1 is not really feasable because some days, we might need someone at 6am and the next day at 7am.

I like solution 2 the most. I couldn't see mention of the cost parameter here. I'll try and report back :)

3 seems like as much work as adding a constraint in the source code

Thanks Rodrigo!