I am trying to run my rule set but it shows :
ERROR[102]
I added ")" where it is missing and after that The error said that it was in ")" [the added ")" in $transfer1 block]
rule "balanceTransfers"
when
$bus1 : CloudBus();
$bus2 : CloudBus(id > $bus1.id);
$transfers1: Number() from accumulate(
CloudRoute(bus == $bus1, count(1))
$transfers2: Number() from accumulate( //<-line 51
CloudRoute(bus == $bus2, count(1)
then
scoreHolder.addSoftConstraintMatch(kcontext, -Math.abs($transfers1 -
$transfers2));
end
Exception in thread "Thread-114" java.lang.IllegalStateException: There are errors in a score DRL: Error Messages: Message [id=1, kieBase=defaultKieBase, level=ERROR, path=..., line=51, column=0
text=[ERR 102] Line 51:1 mismatched input '$transfers2' in rule "balanceTransfers"] Message [id=2, kieBase=defaultKieBase, level=ERROR, path=..., line=0, column=0 text=Parser returned a null Package]
The accumulate
syntax is wrong. It should be accumulate ( Pattern(), fc())
. You are not closing the parenthesis of the pattern:
rule "balanceTransfers"
when
$bus1 : CloudBus();
$bus2 : CloudBus(id > $bus1.id);
$transfers1: Number() from accumulate(
CloudRoute(bus == $bus1),
count(1)
)
$transfers2: Number() from accumulate(
CloudRoute(bus == $bus2),
count(1)
)
then
scoreHolder.addSoftConstraintMatch(kcontext, -Math.abs($transfers1 -
$transfers2));
end
Hope it helps,