[rules-users] multiple rules modifying the same fact
FrankVhh
frank.vanhoenshoven at agserv.eu
Mon Nov 7 04:16:16 EST 2011
Hi,
Generally, there are 2 common approaches. Pick your choice depending on your
case.
1) Do not modify the working memory. Rules will not be retriggered and an
infinite loop is avoided. This is only feasible if your rules do not have to
react on changes made by other rules. I.e. the state that your objects are
in when calling the engine, can be considered final.
2) Insert (or modify) control objects to make sure that rules do not fire
over and over again. I.e. in your RHS, you "mark" that the rule has already
fired. F.e. insert(new RuleOneJustFired() ); In your LHS, you check for the
presence of these markers in your working memory.
A third option would be that you fix the sequence of your rules by using
something like ruleflow-groups.
Regards,
Frank
dwipin wrote:
>
> Hi,
> I have 4 rules modifying the same fact. Right now these rules fall
> under the same Agenda-Group; the execution order is controlled using
> Salience. How do I prevent the execution from getting into an infinite
> loop?
>
> Thanks and Regards,
> Dwipin Chandran.
>
--
View this message in context: http://drools.46999.n3.nabble.com/multiple-rules-modifying-the-same-fact-tp3484623p3486443.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
More information about the rules-users
mailing list