The BOF was a success and as promised, I ‘ve posted the slides online:
People asked a bunch of interesting questions afterwards.
One question I felt I left a bit unanswered: how do you weigh your constraints in DRL? So, here’s a code example that should answer that question too:
rule "twoExamsInARow"
when
// ...
then
insertLogical(new IntConstraintOccurrence(
"twoExamsInARow",
10, // weight
$leftExam, $rightExam));
end
rule "twoExamsInADay"
when
// ...
then
insertLogical(new IntConstraintOccurrence(
"twoExamsInADay",
1, // weight
$leftExam, $rightExam));
end
rule "softConstraintsBroken"
when
$total : Double() from accumulate(
IntConstraintOccurrence($weight : weight),
sum($weight)
);
then
scoreCalculator.setSoftConstraintsBroken($total.intValue());
end
So the 2 in a row constraint is 10 times heavier than the 2 in a day constraint.