timefold

Timetable solver does not find solution after a pause


Run spring-boot-school-timetabling from timefold 1.13. When start solve, we obtain the optimal solution Score: 0hard/11soft.

13:02:42.523  INFO [pool-2-thread-3] Solving started: time spent (0), best score (-40init/0hard/0soft), environment mode (REPRODUCIBLE), move thread count (NONE), random (JDK with seed 0).
13:02:42.524  INFO [pool-2-thread-3] Problem scale: entity count (20), variable count (40), approximate value count (13), approximate problem scale (3,486744 × 10^29).
13:02:42.533  INFO [pool-2-thread-3] Construction Heuristic phase (0) ended: time spent (10), best score (-1hard/-15soft), score calculation speed (66666/sec), step total (20).
13:03:12.523  INFO [pool-2-thread-3] Local Search phase (1) ended: time spent (30000), best score (0hard/11soft), score calculation speed (34569/sec), step total (60994).
13:03:12.523  INFO [pool-2-thread-3] Solving ended: time spent (30000), best score (0hard/11soft), score calculation speed (34578/sec), phase total (2), environment mode (REPRODUCIBLE), move thread count (NONE).

If you stop immediately after starting and then continue, the solution does not improve.

13:03:30.203  INFO [pool-2-thread-4] Solving started: time spent (1), best score (-40init/0hard/0soft), environment mode (REPRODUCIBLE), move thread count (NONE), random (JDK with seed 0).
13:03:30.203  INFO [pool-2-thread-4] Problem scale: entity count (20), variable count (40), approximate value count (13), approximate problem scale (3,486744 × 10^29).
13:03:30.212  INFO [pool-2-thread-4] Construction Heuristic phase (0) ended: time spent (10), best score (-1hard/-15soft), score calculation speed (66666/sec), step total (20).
13:03:31.296  INFO [nio-8080-exec-3] Terminating solver early.
13:03:31.296  INFO [pool-2-thread-4] Local Search phase (1) ended: time spent (1094), best score (0hard/6soft), score calculation speed (34268/sec), step total (5846).
13:03:31.296  INFO [pool-2-thread-4] Solving ended: time spent (1094), best score (0hard/6soft), score calculation speed (34473/sec), phase total (2), environment mode (REPRODUCIBLE), move thread count (NONE).
13:03:33.442  INFO [pool-2-thread-5] Solving started: time spent (1), best score (0hard/6soft), environment mode (REPRODUCIBLE), move thread count (NONE), random (JDK with seed 0).
13:03:33.442  INFO [pool-2-thread-5] Problem scale: entity count (20), variable count (40), approximate value count (13), approximate problem scale (3,486744 × 10^29).
13:03:33.442  INFO [pool-2-thread-5] Construction Heuristic phase (0) ended: time spent (1), best score (0hard/6soft), score calculation speed (0/sec), step total (0).
13:04:03.441  INFO [pool-2-thread-5] Local Search phase (1) ended: time spent (30000), best score (0hard/6soft), score calculation speed (34240/sec), step total (54656).
13:04:03.441  INFO [pool-2-thread-5] Solving ended: time spent (30000), best score (0hard/6soft), score calculation speed (34239/sec), phase total (2), environment mode (REPRODUCIBLE), move thread count (NONE).

Why does the solution stop? What about continuous optimization?


Solution

  • It looks like it got stuck in a local optima and even the default metaheuristic implementation can't get it out.

    This sometimes happen on a small dataset. It's not pretty.

    We have a fix for this in 1.14: the ruin&recreate move. I am not sure if it will be active by default in 1.14 or if you have to explicitly enable it, but we're definitely working towards it just working well out-of-the-box.