我在 Intellij 中使用 Optaplanner 7.0.0 Beta 7。
我对 optaplanner 库的示例 pas 中的 drools 规则有问题。
Intellij 说它在 scoreHolder.addHardConstraintMatch 中找不到 kcontext 对象作为参数。 Intellij 需要对象 org.kie.api.runtime.rule.RuleContext 但关于 beta 版本我只能使用 org.kie.api.runtime.rule.KieContext。
我如何在流口水规则中解决这个问题?我是流口水的新手
// Department's maximumAge constraint
rule "departmentMaximumAge"
when
$department : Department(maximumAge != null, $maximumAge : maximumAge)
$bedDesignation : BedDesignation(department == $department, patientAge > $maximumAge)
then
// Note: the original spec classified this as a soft constraint
scoreHolder.addHardConstraintMatch(kcontext, -100 * $bedDesignation.getAdmissionPartNightCount());
end
沃尔克
最佳答案
这是 a well known bug in IntelliJ . 我曾尝试与 JetBrains (Sergey) 联系以提供修复程序,但没有任何回应。
关于intellij-idea - IntelliJ 中的 OptaPlanner 代码 : drools rule, PAS 中的第一个参数错误:kcontext,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43065540/