我曾尝试在 Drools 的用户论坛上发帖,但没有得到任何回复(我相信他们只是忙),所以我希望在这里吸引更广泛的观众。
我对我得到的结果感到非常困惑,因为他们似乎没有为我提供“最好的分数”。这是一些日志输出:
[construction steps]
2013-03-13 08:00:08,305 [com....] INFO Phase constructionHeuristic ended: step total (60), time spend (2222), best score (-200hard/-2780soft).
[local search steps]
2013-03-13 08:00:21,807 [com....] INFO Phase localSearch ended: step total (42), time spend (15724), best score (0hard/-2495soft).
2013-03-13 08:00:21,807 [com....] INFO Solving ended: time spend (15724), best score (0hard/-2495soft), average calculate count per second (3748).
但是,它给我的结果包含一个损坏的硬约束(即使日志清楚地指出“解决结束:时间花费(15724),最好的分数(0hard/-2495soft)”)-它给了我一个分数的结果- 200hard/-2495soft(貌似是构建阶段的硬分和局部搜索阶段的软分)。这是应该的吗?我是否遗漏了手册中的某些内容(我已阅读,但尚未完全消化)?
这是我的大部分求解器配置(只是可能相关的部分):
<termination>
<terminationCompositionStyle>OR</terminationCompositionStyle>
<maximumSecondsSpend>60</maximumSecondsSpend>
<scoreAttained>0hard/0soft</scoreAttained>
</termination>
<constructionHeuristic>
<constructionHeuristicType>FIRST_FIT_DECREASING</constructionHeuristicType>
<constructionHeuristicPickEarlyType>FIRST_LAST_STEP_SCORE_EQUAL_OR_IMPROVING</constructionHeuristicPickEarlyType>
</constructionHeuristic>
<localSearch>
<termination>
<terminationCompositionStyle>OR</terminationCompositionStyle>
<maximumUnimprovedStepCount>20</maximumUnimprovedStepCount>
<scoreAttained>0hard/0soft</scoreAttained>
</termination>
<unionMoveSelector>
<changeMoveSelector>
<entitySelector>
<entityFilterClass>com.....RequiredTypeEntityFilter</entityFilterClass>
</entitySelector>
</changeMoveSelector>
<swapMoveSelector>
<entitySelector>
<entityFilterClass>com.....RequiredTypeEntityFilter</entityFilterClass>
</entitySelector>
</swapMoveSelector>
</unionMoveSelector>
<acceptor>
<solutionTabuSize>1000</solutionTabuSize>
<planningEntityTabuSize>7</planningEntityTabuSize>
</acceptor>
<forager>
<minimalAcceptedSelection>1000</minimalAcceptedSelection>
</forager>
</localSearch>
提前致谢!
编辑:这里有一些可能有用的信息......如上所述,它说我的最佳(硬)分数是 0,但它给我的解决方案包含硬约束违规。我添加了一些代码来打印出约束(使用 DroolsScoreDirector 到达 WorkingMemory 并最终到达 ConstraintOccurrences)......这个打印输出也显示了一个硬约束。
ConstraintType: NEGATIVE_HARD, RuleID: endLocationMustMatchStartLocation, Causes:...