Again: Local Search phase (1) needs to start from an initialized solution

137 views
Skip to first unread message

Adalbert Schwafel

unread,
Jul 21, 2021, 12:21:49 PM7/21/21
to OptaPlanner development
Hi, using 8.8.0.Final, I get again the below error after completion of the construction heuristics phase. 

18:13:10 INFO  Solving started: time spent (1133), best score (-400init/0hard/0soft), environment mode (REPRODUCIBLE), move thread count (1), random (JDK with seed 0).
18:16:10 INFO  Construction Heuristic phase (0) ended: time spent (181140), best score (-246init/0hard/0soft), score calculation speed (3126/sec), step total (154).
Exception in thread "main" java.lang.IllegalStateException: Local Search phase (1) needs to start from an initialized solution, but the planning variable (OB.start) is uninitialized for the entity

My solver config contains

<constructionHeuristic>
    <constructionHeuristicType>FIRST_FIT</constructionHeuristicType>
</constructionHeuristic>
<localSearch>
    <localSearchType>TABU_SEARCH</localSearchType>
</localSearch>


What am I doing wrong?

Kent Zhang

unread,
Jul 22, 2021, 12:19:58 AM7/22/21
to optapla...@googlegroups.com
In default, a solver includes 2 phases - Construction Heuristic, and Local Search. When the Construction Heuristic terminated without completion and Local Search started, this exception appeared.
Try to increase the unimprovedXXXXSpentLimit in the termination setting, to ensure the CH phase is complete before timeout.

--
You received this message because you are subscribed to the Google Groups "OptaPlanner development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to optaplanner-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/optaplanner-dev/eb2a28c3-0d43-44d0-b1bf-9ce940839745n%40googlegroups.com.


--
With kind regards,
Kent Zhang

Adalbert Schwafel

unread,
Jul 22, 2021, 4:06:48 AM7/22/21
to OptaPlanner development
Thanks a lot Kent, this solves the issue. However, I don't understand how the termination criterion applies to the two phases (CH and Local Search). Do they apply separately to both? Why does Optaplanner proceed to Local Search if CH didn't terminate?

Kent Zhang

unread,
Jul 22, 2021, 8:59:25 PM7/22/21
to optapla...@googlegroups.com
Because in the CH phase, the score will not be improved. If the CH phase reaches the stop condition (such as unimprovedXXXXSpentLimit  ), it will be regarded as the end of this phase and start the next phase.

You can set the stop condition for each phase:

        SolverConfig solverConfig = SolverConfig.createFromXmlFile(configFile);

        TerminationConfig ch_terminationConfig = new TerminationConfig();
        ch_terminationConfig.setUnimprovedSecondsSpentLimit(60L);
        ch_terminationConfig.setSecondsSpentLimit(300L);
        solverConfig.getPhaseConfigList().get(0).setTerminationConfig(ch_terminationConfig);

        TerminationConfig ls_terminationConfig = new TerminationConfig();
        ls_terminationConfig.setUnimprovedSecondsSpentLimit(30L);
        ls_terminationConfig.setSecondsSpentLimit(300L);
        solverConfig.getPhaseConfigList().get(1).setTerminationConfig(ls_terminationConfig);

Reply all
Reply to author
Forward
0 new messages