我正在使用带有optaplanner的drools,但是当我启动项目时,它有时会返回此异常,有时并没有使用相同的代码返回任何异常。
规则:
rule "groupedSteps"
when
$Act : Action(this !=null,Step != null,$step : getStepType().getId(),isCanItBeGrouped(),period !=null)
accumulate(
Action(this != null,Step != null,period != null,isCanItBeGrouped(),getStepType().getId() == $step,$startTime : getStartTime(),getStartTime() >= 0);
$firstStart : min(checkStartTimeIsBigOrEqualToZero($startTime))
)
Action($firstStart == getStartTime(),$step == getStepType().getId(),isCanItBeGrouped() == true,$xMachine : Machine, $employee : Employee,period != null)
Action(this != null,isCanItBeGrouped() == true,getStepType().getId() == $step,$xStartTime : getStartTime(),$xMach : Machine,$xEmployee : Employee,period != null,Employee !=null)
eval($xStartTime < (int)$firstStart || $xEmployee != $employee || $xMachine != $xMach)
then
scoreHolder.addHardConstraintMatch(kcontext, -5);
end
checkStartTimeIsBigOrEqualToZero方法:
function int checkStartTimeIsBigOrEqualToZero(int startTime)
{
try{
if (startTime >= 0)
return startTime;
else
return 99999;
}
catch (Exception ex)
{
return 99999;
}
}
完全错误:
线程中的异常&#34; AWT-EventQueue-0&#34;执行后果异常 for rule&#34; groupedSteps&#34;在org.optaplanner.examples.opnext.solver中: java.lang.UnsupportedOperationException:累积函数(min) 在规则中使用[groupedSteps]没有reverseSupport org.drools.core.runtime.rule.impl.DefaultConsequenceExceptionHandler.handleException(DefaultConsequenceExceptionHandler.java:39) 在 org.drools.core.common.DefaultAgenda.handleException(DefaultAgenda.java:1247) 在 org.drools.core.phreak.RuleExecutor.innerFireActivation(RuleExecutor.java:438) 在 org.drools.core.phreak.RuleExecutor.fireActivation(RuleExecutor.java:379) 在org.drools.core.phreak.RuleExecutor.fire(RuleExecutor.java:135) 在 org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:88) 在 org.drools.core.concurrent.AbstractRuleEvaluator.internalEvaluateAndFire(AbstractRuleEvaluator.java:34) 在 org.drools.core.concurrent.SequentialRuleEvaluator.evaluateAndFire(SequentialRuleEvaluator.java:43) 在 org.drools.core.common.DefaultAgenda.fireLoop(DefaultAgenda.java:1067) 在 org.drools.core.common.DefaultAgenda.internalFireAllRules(DefaultAgenda.java:1014) 在 org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1006) 在 org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1318) 在 org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1309) 在 org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1293) 在 org.optaplanner.core.impl.score.director.drools.DroolsScoreDirector.calculateScore(DroolsScoreDirector.java:117) 在 org.optaplanner.examples.common.business.SolutionBusiness.getScore(SolutionBusiness.java:218) 在 org.optaplanner.examples.opnext.business.CalculatorClass.bestSolutionChanged(CalculatorClass.java:149) 在 org.optaplanner.examples.common.business.SolutionBusiness.lambda为$ null $ 0(SolutionBusiness.java:247) 在 java.awt.event.InvocationEvent.dispatch $$$捕获(InvocationEvent.java:311) 在java.awt.event.InvocationEvent.dispatch(InvocationEvent.java)at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)at at java.awt.EventQueue.access $ 500(EventQueue.java:97)at java.awt.EventQueue $ 3.run(EventQueue.java:709)at java.awt.EventQueue $ 3.run(EventQueue.java:703)at java.security.AccessController.doPrivileged(Native Method)at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) 在java.awt.EventQueue.dispatchEvent(EventQueue.java:726)at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) 在 java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) 在 java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) 在 java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 引起:java.lang.UnsupportedOperationException:累积 规则[groupsSteps]中使用的函数(min)没有 reverseSupport at org.drools.core.reteoo.FromNodeLeftTuple.getAccumulatedObjects(FromNodeLeftTuple.java:105) 在 org.drools.core.common.AgendaItem.getObjectsDeep(AgendaItem.java:79) 在 org.drools.core.reteoo.RuleTerminalNodeLeftTuple.getObjectsDeep(RuleTerminalNodeLeftTuple.java:359) 在 org.optaplanner.core.api.score.holder.AbstractScoreHolder.extractJustificationList(AbstractScoreHolder.java:118) 在 org.optaplanner.core.api.score.holder.AbstractScoreHolder.registerConstraintMatch(AbstractScoreHolder.java:88) 在 org.optaplanner.core.api.score.buildin.hardmediumsoft.HardMediumSoftScoreHolder.addHardConstraintMatch(HardMediumSoftScoreHolder.java:58) 在 org.optaplanner.examples.opnext.solver.Rule_groupedSteps547703499.defaultConsequence(Rule_groupedSteps547703499.java:21) 在 org.optaplanner.examples.opnext.solver.Rule_groupedSteps547703499DefaultConsequenceInvokerGenerated.evaluate(未知 来源)at org.optaplanner.examples.opnext.solver.Rule_groupedSteps547703499DefaultConsequenceInvoker.evaluate(未知 来源)at org.drools.core.phreak.RuleExecutor.innerFireActivation(RuleExecutor.java:431) ......还有30多个