<div dir="ltr"><br> Or an accumulate function (as long as all you objects implement a commong interface):<br><br>rule "overall certainty"<br>when<br> $cert : Number() from accumulate( <br> $f : CertaintyFacts( ),<br>
overallCertainty( $f ) )<br>then<br> // do something with $cert<br>end<br><br> Implement your own formula inside overallCertainty function .<br><br> []s<br> Edson<br><br><div class="gmail_quote">2008/8/29 Greg Barton <span dir="ltr"><<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Looks like a job for a query.<br>
<br>
<a href="http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html/ch06s06.html" target="_blank">http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html/ch06s06.html</a><br>
<br>
Query for all matching certainties/weights in working memory. Loop through them to perform calculation.<br>
<br>
<br>
--- On Fri, 8/29/08, thomas kukofka <<a href="mailto:thomaskukofka@web.de">thomaskukofka@web.de</a>> wrote:<br>
<br>
> From: thomas kukofka <<a href="mailto:thomaskukofka@web.de">thomaskukofka@web.de</a>><br>
<div class="Ih2E3d">> Subject: [rules-users] rule algorithm<br>
</div>> To: "Rules Users List" <<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>><br>
> Date: Friday, August 29, 2008, 9:08 AM<br>
<div><div></div><div class="Wj3C7c">> Hello,<br>
><br>
> I search a rule implementation for the following<br>
> calculation:<br>
> I have n Objects of differents types (A, B, C, ...) each<br>
> with a parameter<br>
> certainty.<br>
><br>
> the overall certainty is calculated as follows:<br>
> certaintyOverall =<br>
> (certaintyA * weightA + certaintyB * weightB + ... ) /<br>
> (weightA + weightB +<br>
> ...)<br>
><br>
> If it can be assumed that all Objects in the formula always<br>
> exist it's quite<br>
> easy:<br>
> when<br>
> A (certaintyA: certainty)<br>
> B (certaintyB: certainty)<br>
> ...<br>
> then<br>
> certaintyOverall = (certaintyA * weightA + certaintyB *<br>
> weightB + ... ) /<br>
> (weightA + weightB + ...)<br>
><br>
> But if one ore more objects are missing the formula should<br>
> be reduced to the<br>
> certainty and weights of the existing objects. But there<br>
> are too many<br>
> combinations of existing/nonexisting objects. How can this<br>
> be implemented in<br>
> Drools?<br>
><br>
> Regards<br>
> Thomas<br>
</div></div>> _______________________________________________<br>
> rules-users mailing list<br>
> <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br>
<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>