Search code examples
javadroolsdrools-planner

Drools Planner rule only fired once


I have a rule of the form

rule "notBar"
    when
        $foo : Foo(bar == false)
    then
        insertLogical(new IntConstraintOccurrence("notBar", ConstraintType.NEGATIVE_SOFT,
                $foo));
end

I expect to see this fired once for every Foo with bar being false however the rule is only fired once. Confusingly if I change the $foo : Foo(bar == false) to $foo : Foo() then it is correctly fired for all Foo's. What am I missing?


Solution

  • Bah. I'm an idiot. My cloneSolution method was calling a copy constructor which didn't correctly copy bar.