[rules-users] Limiting rule evaluation--not firing

Edson Tirelli ed.tirelli at gmail.com
Mon Mar 21 09:20:19 EDT 2011


   The algorithm as is does eager evaluation, as for the general case that
is still better than doing selective evaluation.

   If, in your case, the decision of which rules to fire is an arbitrary
application decision, and not based on the actual constraints of the rules
themselves, then the only way would be by creating a control fact:

rule 1
when
   ControlFact( phase == Phase.ONE )
...

rule 2
when
   ControlFact( phase == Phase.TWO )
...

   This way, if the control fact is the first pattern in each rule it
effectively disables all the beta evaluations for rules of phases other than
the current one. Just be aware that by blocking the eager evaluation this
way, phase switches are heavier than without the control fact, where most
constraints were already previously evaluated. Obvious, but worth saying out
loud... :)

   There is also a feature that Leonardo is working on that makes the engine
automatically unlink and relink parts of the network, based on the existence
and possibility of matching the other required facts in a rule LHS. It might
achieve similar results to what you are looking for in some cases, but that
is totally based on the constraints in there and not on any arbitrary
application decision.

   Edson


2011/3/21 FrankVhh <frank.vanhoenshoven at agserv.eu>

> Hi,
>
> Having the same questions you had, I played a bit with agenda-groups to see
> if there was any notable performance effect.
>
> I added 200 extra rules which did not fire at all and did two "series" of
> rule executions. Once with all rules within the same agenda-group and once
> with the 200 extra rules in a different agenda-group, while setting focus
> to
> the firing rules. Allthough I cannot claim statistical significance, I
> didn't notice big effects.
>
> As I consider it, the reason for still evaluating all rules is because you
> would need an Update() statement everytime focus is switched to an other
> agenda-group to make sure Objects are matched to those rules.
>
> Maybe ruleflow-groups work a bit different - allthough I doubt it - but I
> haven't played with them yet.
>
> Regards,
> Frank
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Limiting-rule-evaluation-not-firing-tp2695533p2709697.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110321/54777245/attachment.html 


More information about the rules-users mailing list