[rules-users] How to aggregate decisions of multiple rules?? (In Guvnor)

Wolfgang Laun wolfgang.laun at gmail.com
Thu Aug 5 04:54:26 EDT 2010


Assuming that the engine is handling one set of facts at a time, I would
use a single additional fact to collect all decisions. The details of this
object
may vary (depending on whether you have a constant number of rules or
not).

enum Decision { UNDEF, GRANTED, DEFERRED,... }
class Collector {
    Decision decision = Decision.UNDEF;
    Set<String> rules;
   //...
}

Here is a sample rule:

rule "rule1"
when
    $d : Decision( rules not contains "rule1" )
     ....
then
   modify( $d ){
      addRule( "rule1" ),
      setDecision( maximumOf( $d.getDecision(), Decision.XYZ ) )
   }
end

At the end, the decision object contains the final decision.

-W

On 5 August 2010 07:34, bbarani <bbarani at gmail.com> wrote:

>
> Hi,
>
> We have multiple rules defined in Guvnor and we fire all the rules at a
> time. There is a decision object set for each rule and I am trying to
> figure
> out a way to aggregate the result using the prirority of the decision
> object
> (kind of logical AND / OR)
>
> For Ex: The priority of the decision would be set as below
>
> Priority:
>
> Priority3              Priority2                    Priority1     Exception
> on any rule
> Granted   Action not Supported  Denied          Deferred
>
> After the rules are fired (I am considering 4 rules here) the final
> decision
> should be as follows
>
> Sample Rule result:
>
> Rule    Rule1   Rule2   Rule3                                Rule4
> FinalDecison
> Decisions       Granted Granted Granted                            Deferred
> Deferred
>        Granted Granted Action Not Supported      Granted
>     Action Not
> Supported
>        Granted Granted Denied                             Granted
> Denied
>        Granted Granted Granted                             Granted
> Granted
>
>
> Is there a way to acheive this using rule flow group / any other simple
> way?
>
> Thanks,
> Barani
>
>
>
>
>
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/How-to-aggregate-decisions-of-multiple-rules-In-Guvnor-tp1025115p1025115.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100805/ffe37a23/attachment.html 


More information about the rules-users mailing list