Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The constraints cannot be respected <em>exactly</em> as expressed in the question.<br> That's because the numbers don't add up (or rather "divide up").<br></p> <p>Consequently, the problem should be reworded to require</p> <ul> <li>exactly 3 shifts per day</li> <li>exactly 2 workers per shift</li> <li>workers work <em>a maximum</em> of 5 consecutive days</li> <li>workers rest <em>a minimum</em> of 2 consecutive days</li> </ul> <p>With the introduction of the minimum and maximum qualifiers, <strong>the minimum number of workers required is 9</strong> (again assuming no part-time worker).<br> Note that although 9 appears to be a absolute minimum, given the need to cover 42 shifts per week (3 * 2 * 7) with workers who can cover a maximum of 5 shifts per week (5 work days 2 rest days = a week), there is no assurance that 9 would be sufficient given the consecutive work and/or rest day requirements.</p> <p>This is how I figure...<br> 8 workers isn't enough, and the following 9 workers line-up, is an example of such a schedule.<br> To make things easy, I assigned all workers except for worker #1 and #9, to an optimal schedule of exactly a 5 days-on and 2 days-off schedule; #1 and #9 work less. Of course many other arrangements would work (maybe this is what the OP sensed when he hinted at an NP-complete problem). Also, the schedule is such that each week's schedule is exactly the same for everyone, but that could also be changed (maybe introducing some fairness, by having all workers have a lighter week every once in a while, but this BTW can lead to some difficulties of respecting the requirement of 5 maximum work days).<br> The sample schedule shows two consecutive weeks to help see the consecutive work or rest days, but as said, all weeks are the same for every one.</p> <pre><code> Max Conseq Ws Min Conseq Rs Worker #1 RRWWWRW RRWWWRW 3 2 Worker #2 WWWWWRR WWWWWRR 5 2 Worker #3 WWWRRWW WWWRRWW 5 2 Worker #4 WWWRRWW WWWRRWW 5 2 Worker #5 WRRWWWW WRRWWWW 5 2 Worker #6 WRRWWWW WRRWWWW 5 2 Worker #7 RWWWWWR RWWWWWR 5 2 Worker #8 RWWWWWR RWWWWWR 5 2 Worker #9 WWRRRRW WWRRRRW 3 3 Nb of Ws 6666666 6666666 </code></pre> <p>The tally at the bottom shows exactly 6 workers per day (respecting the need to cover 3 shifts with 2 workers each), the max and min columns on the right show that the maximum consecutive work and minimum consecutive rest requirements are respected.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload