ItHadToComeToThis Posted January 8, 2021 Share Posted January 8, 2021 (edited) Okay so, the math on this has thrown me a little and I am not sure where to start if I am honest. Lets say we have a total of 64 hours each week that needs working Then we have 6 employees split into three teams of two Each employee needs to work 40 hours per week or say 120 hours per month There are two 8 hour shifts each week day and four 12 hour shifts at the weekend Each employee needs on average two days off per week....give or take.... I am trying to code a scheduler that generates the optimal shift pattern for this data. Not for anything in particular per say but just....because I wanted to figure out how it would work but I have lost myself already xD. Now, a rolling shift pattern over a number of weeks is acceptable so each employee works 4 days on 2 days off for example. But how do I go about starting to scripting this, maybe im over thinking it but at the minute my brain is upside down. I want it to generate the optimal shift pattern for all employees so that in theory you wouldn't need to enter anymore data ever. Any ideas, tips, pointers? Edited January 8, 2021 by ItHadToComeToThis Link to comment Share on other sites More sharing options...

Mollymews Posted January 8, 2021 Share Posted January 8, 2021 what is the number of people required to be at work on any given shift ? Link to comment Share on other sites More sharing options...

Mollymews Posted January 8, 2021 Share Posted January 8, 2021 (edited) if 4 employees are at work on every shift then a 4 and 2 roster beginning on Monday, a 4 and 2 roster runs for 6 calendar weeks (42 days) before it repeats there are 3 blocks with 2 employees on each block. The blocks are staggered 4 days on, 2 days off Block 1. Emp1 and Emp2. These two people come to work on Monday. Work Monday, Tuesday, Wednesday, Thursday. Have Friday and Saturday off. Start again on Sunday for 4 days. Block 2. Emp3 and Emp4. These two start work on Wednesday. Monday Tuesday off. Work Wednesday .. Saturday. Sunday Monday off. Start again Tuesday Block 3. Emp5 and Emp6. These work Monday and Tuesday. Off on Wednesday and Thursday. Start again Friday when the employees work 8 hours when their shifts fall on Monday-Friday and work 12 hours on Saturday and Sunday then over the 6 weeks it results in: 8 * 12 hour shifts. 20 * 8 hour shifts and 14 days off 256 hours work per employee over the 42 days. Which is 42.66 hours average per calendar week for 4 employees at work every day edit add. Just add that employees will never work more than 40 hours in any 4 day period. 12 + 12 + 8 + 8. The least no. of hours worked in a 4 day period is 8+8+8+8 = 32 hours Edited January 8, 2021 by Mollymews Link to comment Share on other sites More sharing options...

ItHadToComeToThis Posted January 8, 2021 Author Share Posted January 8, 2021 (edited) 2 hours ago, Mollymews said: what is the number of people required to be at work on any given shift ? 2 on shift at at any one time. Two shifts per day Edited January 8, 2021 by ItHadToComeToThis Link to comment Share on other sites More sharing options...

Mollymews Posted January 8, 2021 Share Posted January 8, 2021 (edited) 37 minutes ago, ItHadToComeToThis said: 2 on shift at at any one time. Two shifts per day in this case then you only need 3 employees working a 4 and 2 roster M T W T F S S M T W T F etc for 6 weeks til it comes back around to M 1 - 3 1 1 1 1 - - 1 1 1 1 - - - - 2 2 2 2 - - 2 2 2 2 3 3 - - 3 3 3 3 - - 3 3 while this averages out to 42.66 hours per calendar week per employee (and 14 days off each over the 6 weeks rota rather than 12 days off per normal), is lots cheaper than hiring 6 people, 3 of whom would get paid for doing nothing edit: if you mean 2 people on each of the 2 shifts per day then is 6 employees yes M T W T F S S M T W T F etc for 6 weeks til it comes back around to M 1 - 3 1 1 1 1 - - 1 1 1 1 - - - - 2 2 2 2 - - 2 2 2 2 3 3 - - 3 3 3 3 - - 3 3 4 4 4 4 - - 4 4 4 4 - - - - 5 5 5 5 - - 5 5 5 5 6 6 - - 6 6 6 6 - - 6 6 team A is employee 1 and 4 team B is employee 2 and 5 team C is employee 3 and 6 Edited January 8, 2021 by Mollymews Link to comment Share on other sites More sharing options...

Mollymews Posted January 8, 2021 Share Posted January 8, 2021 (edited) the question: Is there a program that can work out these kind of scheduling problems? falls into the field of computational complexity theory: https://en.wikipedia.org/wiki/Computational_complexity_theory more precisely this question is a NP-hard problem, more here: https://en.wikipedia.org/wiki/NP-hardness if we could write such a program for the general case then we have a conclusive proof that either P = NP or P != NP. And when so we would collect $US1 million from the Clay Institute for solving the P vs NP Millenium Prize question, we would also get the Fields Medal for Math if under the age of 35, and we would also be awarded a Nobel Prize. And we would also break every known computational encryption system ever invented Millenium Prize here: https://www.claymath.org/millennium-problems/p-vs-np-problem a interesting thing is that we can give these kinds of problems to a human being who can work out what the probable solution is in relatively short time. Give it to a computer and it can take forever, or never, when the program doesn't employ fuzzy logic, aped intelligence, probabilistic determinism, etc in the same way that the human brain does once we know what the answer to a problem in this class is, then we can computationally proof it easily enough, virtually instantaneously. The hard part is working out what the answer is in the first instance, and the human brain is enabled to be able to do this. A computer not so much, so the huge effort and expense that has gone into developing machine intelligence Edited January 8, 2021 by Mollymews link fix 1 Link to comment Share on other sites More sharing options...

## Recommended Posts

Please take a moment to consider if this thread is worth bumping.

## Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now