KIE项目的构造启发式

时间:2016-12-20 06:18:23

标签: drools optaplanner kie

我使用了KIE Workbench 6.5.0.Final创建了一个求解器配置如下:

<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>

当我在Eclipse中执行项目以进行泛洪时,我收到以下错误,说我需要在本地搜索之前通过构造启发式初始化解决方案。

[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)

在求解器配置中添加以下内容后,一切都毁了完美。

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

但是,KIE Workbench中的求解器配置在源级别是不可编辑的,用户界面中没有选项,想知道我们如何在KIE项目中包含它?谢谢。

1 个答案:

答案 0 :(得分:1)

检查域模型中的setter和getter,尤其是在Task上。检查DEBUG日志。