<div dir="ltr"><br>&nbsp;&nbsp; Or an accumulate function (as long as all you objects implement a commong interface):<br><br>rule &quot;overall certainty&quot;<br>when<br>&nbsp;&nbsp; $cert : Number() from accumulate( <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $f : CertaintyFacts(&nbsp; ),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; overallCertainty( $f ) )<br>then<br>&nbsp;&nbsp; // do something with $cert<br>end<br><br>&nbsp;&nbsp; Implement your own formula inside overallCertainty function .<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/8/29 Greg Barton <span dir="ltr">&lt;<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>&gt;</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. &nbsp;Loop through them to perform calculation.<br>
<br>
<br>
--- On Fri, 8/29/08, thomas kukofka &lt;<a href="mailto:thomaskukofka@web.de">thomaskukofka@web.de</a>&gt; wrote:<br>
<br>
&gt; From: thomas kukofka &lt;<a href="mailto:thomaskukofka@web.de">thomaskukofka@web.de</a>&gt;<br>
<div class="Ih2E3d">&gt; Subject: [rules-users] rule algorithm<br>
</div>&gt; To: &quot;Rules Users List&quot; &lt;<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>&gt;<br>
&gt; Date: Friday, August 29, 2008, 9:08 AM<br>
<div><div></div><div class="Wj3C7c">&gt; Hello,<br>
&gt;<br>
&gt; I search a rule implementation for the following<br>
&gt; calculation:<br>
&gt; I have n Objects of differents types (A, B, C, ...) each<br>
&gt; with a parameter<br>
&gt; certainty.<br>
&gt;<br>
&gt; the overall certainty is calculated as follows:<br>
&gt; certaintyOverall =<br>
&gt; (certaintyA * weightA + certaintyB * weightB + ... ) /<br>
&gt; (weightA &nbsp;+ weightB +<br>
&gt; ...)<br>
&gt;<br>
&gt; If it can be assumed that all Objects in the formula always<br>
&gt; exist it&#39;s quite<br>
&gt; easy:<br>
&gt; when<br>
&gt; &nbsp; A (certaintyA: certainty)<br>
&gt; &nbsp; B (certaintyB: certainty)<br>
&gt; &nbsp; ...<br>
&gt; then<br>
&gt; &nbsp; certaintyOverall = (certaintyA * weightA + certaintyB *<br>
&gt; weightB + ... ) /<br>
&gt; (weightA &nbsp;+ weightB + ...)<br>
&gt;<br>
&gt; But if one ore more objects are missing the formula should<br>
&gt; be reduced to the<br>
&gt; certainty and weights of the existing objects. But there<br>
&gt; are too many<br>
&gt; combinations of existing/nonexisting objects. How can this<br>
&gt; be implemented in<br>
&gt; Drools?<br>
&gt;<br>
&gt; Regards<br>
&gt; Thomas<br>
</div></div>&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <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>