Construction Heuristic in KIE Project

125 views Asked by At

I used the KIE Workbench 6.5.0.Final created a Solver Configuration as below:

<solver xStreamId="1">
  <scanAnnotatedClasses xStreamId="2"/>
  <scoreDirectorFactory xStreamId="3">
    <scoreDefinitionType>HARD_SOFT</scoreDefinitionType>
    <ksessionName>apsSession</ksessionName>
  </scoreDirectorFactory>
  <termination xStreamId="4">
    <unimprovedSecondsSpentLimit>0</unimprovedSecondsSpentLimit>
    <unimprovedMinutesSpentLimit>1</unimprovedMinutesSpentLimit>
    <unimprovedHoursSpentLimit>0</unimprovedHoursSpentLimit>
    <unimprovedDaysSpentLimit>0</unimprovedDaysSpentLimit>
  </termination>
</solver>

When I execute the project in Eclipse for deluging, I got the following error saying that I need to initialize the solution by Construction Heuristic before Local search.

[main] INFO org.optaplanner.core.impl.constructionheuristic.DefaultConstructionHeuristicPhase - Construction Heuristic phase (0) ended: step total (273), time spent (5903), best score (-429hard/-5400soft).
    Exception in thread "main" java.lang.IllegalStateException: Local Search phase (1) needs to start from an initialized solution, but the planning variable (Task.previousTaskOrMachinePlan) is uninitialized for the entity (com.esquel.fas.aps.Task@ac91282).
      Initialize the solution by configuring a Construction Heuristic phase before this phase.
        at org.optaplanner.core.impl.phase.AbstractPhase.assertWorkingSolutionInitialized(AbstractPhase.java:141)
        at org.optaplanner.core.impl.localsearch.DefaultLocalSearchPhase.phaseStarted(DefaultLocalSearchPhase.java:124)
        at org.optaplanner.core.impl.localsearch.DefaultLocalSearchPhase.solve(DefaultLocalSearchPhase.java:66)
        at org.optaplanner.core.impl.solver.DefaultSolver.runPhases(DefaultSolver.java:215)
        at org.optaplanner.core.impl.solver.DefaultSolver.solve(DefaultSolver.java:176)
        at com.esquel.fas.aps.App.main(App.java:127)

After adding the following in the Solver Configuration, everything ruining perfect.

 <constructionHeuristic>
    <constructionHeuristicType>FIRST_FIT</constructionHeuristicType>
  </constructionHeuristic>

However, the Solver Configuration in KIE Workbench is not editable in source level and there is no option in User Interface, wondering how can we include this inside the KIE project? Thanks.

1

There are 1 answers

1
Geoffrey De Smet On BEST ANSWER

Check your setters and getters in your domain model, especially on Task. Check the DEBUG log.