OptaPlanner :我试图打印出 ConstraintMatch 的 justificationList,但得到了不是我的域的 SubnetworkTuple 对象 类

OptaPlanner : I tried to print out the justificationList of ConstraintMatch, but got objects of SubnetworkTuple which are not my domain classes

我正在使用 OptaPlanner 来解决规划问题。我使用 drools 来计算分数。当我试图打印出每个 constraintMatch 的 justificationList 时,除了我的域 class 对象之外,我得到的对象是 SubnetworkTuple 的实例。这些似乎是用于 它的内部实现。

我之前没有用过drools规则引擎:)。这是我第一次使用 OptaPlanner。据我所知,justificationList 应该包含该规则中涉及的所有对象。

口水规则:

rule "roomPriority"
    when
        EduClassRoomPriority($left : leftEduClass, $right : rightEduClass, $priority : priority)
        exists(LectureOfEduClass(eduClass == $left,$room1 : room ) and LectureOfEduClass(eduClass == $right, $room1 != room))
    then
        scoreHolder.addSoftConstraintMatch(kcontext,-$priority);
end

java:

for (ConstraintMatchTotal constraintMatchTotal : constraintMatchTotals) {
                String constraintName = constraintMatchTotal.getConstraintName();
                Score totalScore = constraintMatchTotal.getScore();
                Set<ConstraintMatch> constraintMatchSet = constraintMatchTotal.getConstraintMatchSet();
                logger.info(totalScore.toShortString() + " constraint(" + constraintName + ") has " + constraintMatchSet.size() + " matches");
                for (ConstraintMatch constraintMatch : constraintMatchSet) {
                    List<Object> justificationList = constraintMatch.getJustificationList();
                    Score score = constraintMatch.getScore();
                    logger.info(score.toShortString() + justificationList.toString());
                }
            }

我想知道我能做些什么来解决这个问题,因为这些额外的对象会使用户感到困惑。我可以做检查实例。但这不应该是解决它的正确方法。

先谢谢大家了。

https://issues.jboss.org/browse/DROOLS-4423 为 7.26 引起并修复。