Hi guys,
I've run some experiments on the DRL's used in the drools solver
examination example to see how the DRL affects performance.
In one experiment, I merged 2 rules into 1 rule:
I changed this DRL part of examinationScoreRules.drl:
rule "hardConstraintsBroken"
salience -1
when
$hardTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight)
);
then
scoreCalculator.setHardConstraintsBroken($hardTotal.intValue());
end
rule "softConstraintsBroken"
salience -1
when
$softTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_SOFT, $weight : weight),
sum($weight)
);
then
scoreCalculator.setSoftConstraintsBroken($softTotal.intValue());
end
into this DRL part:
rule "constraintsBroken"
salience -1
when
$hardTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_HARD, $weight : weight),
sum($weight)
);
$softTotal : Number() from accumulate(
IntConstraintOccurrence(constraintType ==
ConstraintType.NEGATIVE_SOFT, $weight : weight),
sum($weight)
);
then
scoreCalculator.setHardConstraintsBroken($hardTotal.intValue());
scoreCalculator.setSoftConstraintsBroken($softTotal.intValue());
end
Now the performance for a 100 steps when from 71s to 172s, so it more
then doubled.
All other code stayed the same and the output (except for the times) is
exactly the same.
What can explain this loss in performance?
--
With kind regards,
Geoffrey De Smet