[rules-users] Rules that cumulate on consequence

Michael Anstis michael.anstis at gmail.com
Wed Nov 23 04:56:44 EST 2011


Why not use a Fact that contains your result?

In DRL terms it'd look like this:-

rule "one"
    when
        $r : Result( $score : score )
        Applicant( numberOfLoans > 1 )
    then
        $r.setScore( $score + 5 );
        update( $r );
end

rule "two"
    when
        $r : Result( $score : score )
        Applicant( disposableIncome < 20000 )
    then
        $r.setScore( $score + 10 );
        update( $r );
end

The result could equally just contain the factors influencing the score
with a low salience rule then calculating the final score:-

rule "one"
    salience 100
    when
        $r : Result()
        Applicant( $nl : numberOfLoans )
    then
        $r.setNumberOfLoans( $nl );
        update( $r );
end

rule "two"
    salience 100
    when
        $r : Result()
        Applicant( $di : disposableIncome )
    then
        $r.setDisposableIncome( $di );
        update( $r );
end

rule "calculate score"
    salience 200
    when
        $r : Result( $nl : numberOfLoans > 1, $di : disposableIncome <
20000 )
    then
        $r.setScore( 20 );
        update( $r );
end


On 23 November 2011 09:44, lansyj <lansyjp at gmail.com> wrote:

> hi folks
>
> We are working on a requirement that requires us to have multiple rules
> that
> could fire for a given input and for all the rules that fire, we would want
> to cumulate the consequence to reach the final consequence.
>
> As an example, if we want to identify the credit score for a person, based
> on his gender you might want to assign/increment/decrement the score, then
> based on nationality, and so on.
>
> So, considering the long list of such criteria, having rules that cover all
> scenarios and are still mutually exclusive isnt a scalable solution. Could
> you please advice on how this could be achieved.
>
> We run Drools 5.1.1 and Guvnor; rules are made using the guided editor with
> DSLs.
>
> Awaiting your support,
>
> Best Regards
>
> -lj
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Rules-that-cumulate-on-consequence-tp3530214p3530214.html
> Sent from the Drools: User forum 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/20111123/8710a564/attachment.html 


More information about the rules-users mailing list