<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
Good idea,<br>
<br>
but note that it will only work properly in a stateless session
(which is most likely in his case).<br>
<br>
In a stateful session, with multiple fireAllRules and when the
applicant's properties change between those fireAllRules call,<br>
the trick is to do an insertLogical of a ScoreDiff instead of
setScore()<br>
and then add 1 general rule to accumulate all those ScoreDiffs and
put the resulting score into the Result.<br>
<br>
Op 23-11-11 10:56, Michael Anstis schreef:
<blockquote
cite="mid:CAAG9P0smYEsu+wsTFtYBLmy_-1PDj2bW2QDsWntLZ53FeDb5QQ@mail.gmail.com"
type="cite">Why not use a Fact that contains your result?<br>
<br>
In DRL terms it'd look like this:-<br>
<br>
rule "one"<br>
when<br>
$r : Result( $score : score )<br>
Applicant( numberOfLoans > 1 )<br>
then<br>
$r.setScore( $score + 5 );<br>
update( $r );<br>
end<br>
<br>
rule "two"<br>
when<br>
$r : Result( $score : score )<br>
Applicant( disposableIncome < 20000 )<br>
then<br>
$r.setScore( $score + 10 );<br>
update( $r );<br>
end<br>
<br>
The result could equally just contain the factors influencing the
score with a low salience rule then calculating the final score:-<br>
<br>
rule "one"<br>
salience 100<br>
when<br>
$r : Result()<br>
Applicant( $nl : numberOfLoans )<br>
then<br>
$r.setNumberOfLoans( $nl );<br>
update( $r );<br>
end<br>
<br>
rule "two"<br>
salience 100<br>
when<br>
$r : Result()<br>
Applicant( $di : disposableIncome )<br>
then<br>
$r.setDisposableIncome( $di );<br>
update( $r );<br>
end<br>
<br>
rule "calculate score"<br>
salience 200<br>
when<br>
$r : Result( $nl : numberOfLoans > 1, $di :
disposableIncome < 20000 )<br>
then<br>
$r.setScore( 20 );<br>
update( $r );<br>
end<br>
<br>
<br>
<div class="gmail_quote">On 23 November 2011 09:44, lansyj <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:lansyjp@gmail.com">lansyjp@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
hi folks<br>
<br>
We are working on a requirement that requires us to have
multiple rules that<br>
could fire for a given input and for all the rules that fire,
we would want<br>
to cumulate the consequence to reach the final consequence.<br>
<br>
As an example, if we want to identify the credit score for a
person, based<br>
on his gender you might want to assign/increment/decrement the
score, then<br>
based on nationality, and so on.<br>
<br>
So, considering the long list of such criteria, having rules
that cover all<br>
scenarios and are still mutually exclusive isnt a scalable
solution. Could<br>
you please advice on how this could be achieved.<br>
<br>
We run Drools 5.1.1 and Guvnor; rules are made using the
guided editor with<br>
DSLs.<br>
<br>
Awaiting your support,<br>
<br>
Best Regards<br>
<br>
-lj<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
View this message in context: <a moz-do-not-send="true"
href="http://drools.46999.n3.nabble.com/Rules-that-cumulate-on-consequence-tp3530214p3530214.html"
target="_blank">http://drools.46999.n3.nabble.com/Rules-that-cumulate-on-consequence-tp3530214p3530214.html</a><br>
Sent from the Drools: User forum mailing list archive at
Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a moz-do-not-send="true"
href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a moz-do-not-send="true"
href="https://lists.jboss.org/mailman/listinfo/rules-users"
target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></span></blockquote>
</div>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
With kind regards,
Geoffrey De Smet</pre>
</body>
</html>