Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I solved a shift assignment problem for a large manufacturing plant recently. First we tried generating purely random schedules and returning any one which passed the <code>is_schedule_valid</code> test - the fallback algorithm. This was, of course, slow and indeterminate.</p> <p>Next we tried genetic algorithms (as you suggested), but couldn't find a good fitness function that closed on any viable solution (because the smallest change can make the entire schedule RIGHT or WRONG - no points for almost).</p> <p>Finally we chose the following method (which worked great!):</p> <ol> <li>Randomize the input set (i.e. jobs, shift, staff, etc.).</li> <li>Create a valid tuple and add it to your tentative schedule.</li> <li>If not valid tuple can be created, rollback (and increment) the last tuple added.</li> <li>Pass the partial schedule to a function that tests <code>could_schedule_be_valid</code>, that is, could this schedule be valid if the remaining tuples were filled in a possible way</li> <li>If <code>!could_schedule_be_valid</code>, simply rollback (and increment) the tuple added in (2).</li> <li>If <code>schedule_is_complete</code>, <code>return schedule</code></li> <li>Goto (2)</li> </ol> <p>You incrementally build a partial shift this way. The benefit is that some tests for valid schedule can easily be done in Step 2 (pre-tests), and others must remain in Step 5 (post-tests).</p> <p>Good luck. We wasted days trying the first two algorithms, but got the recommended algorithm generating valid schedules instantly in under 5 hours of development.</p> <p>Also, we supported pre-fixing and post-fixing of assignments that the algorithm would respect. You simply don't randomize those slots in Step 1. You'll find that the solutions doesn't have to be anywhere near optimal. Our solution is O(N*M) at a minimum but executes in PHP(!) in less than half a second for an entire manufacturing plant. The beauty is in ruling out bad schedules quickly using a good <code>could_schedule_be_valid</code> test.</p> <p>The people that are used to doing it manually don't care if it takes an hour - they just know they don't have to do it manually any more.</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. 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.
 

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