&nbsp;<br>&nbsp;&nbsp; Eymeric,<br><br>&nbsp;&nbsp; This is a fairly common case of finding the &quot;best&quot; of multiple choices (usually, the max, min, etc). You can find some examples and explanation in the wiki:<br><br><a href="http://wiki.jboss.org/wiki/Wiki.jsp?page=RulesFindMax">
http://wiki.jboss.org/wiki/Wiki.jsp?page=RulesFindMax</a><br><br>&nbsp;&nbsp;&nbsp; So, the answer to your question is: it must be done in the LHS. AgendaFilters, IMO, should be used only for debug purposes, since they are beyond the control of the rule writers.
<br><br>&nbsp;&nbsp;&nbsp; BTW, the wiki was written when we had only Drools 3.0, so there is no example of 4.0 features like accumulate, DSL, etc, so, feel free to improve the docs with your findings and examples... :)<br><br>&nbsp;&nbsp;&nbsp; Thanks,
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Edson<br><br><br><br><div><span class="gmail_quote">2007/9/12, Eymeric VIEUILLE &lt;<a href="mailto:evieuille@gfi.fr">evieuille@gfi.fr</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi !<br><br>After solving the problem of Out of Memory, I come back with another<br>question :<br><br>I currently implemented rules that give me tuples like this (in the<br>agenda, before firing rules) : M1xM2xM3xM4.<br><br>
<br>But now, I want to select THE tuple that as M1xM2xM3xM4 with a property<br>p as little as possible to execute the right hand of the rule.<br><br>For sample, I have the two following tuples activated in the agenda :<br>
<br>M&#39;1(date = &quot;09/25/2006&quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;M&#39;1(date = &quot;09/25/2006&quot;)<br>M&#39;2(date = &quot;09/26/2006&quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;M&#39;2(date = &quot;09/26/2006&quot;)<br>M&#39;3(date = &quot;09/29/2006&quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;M&quot;3(date = &quot;09/27/2006&quot;)
<br>M&#39;4(date = &quot;09/31/2006&quot;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;M&quot;4(date = &quot;09/30/2006&quot;)<br><br>I would like the second tuples to be selected for executing the right<br>hand of the rule because dates of M&#39;2, M&quot;3, M&quot;4 are the closest dates
<br>compared to M&#39;1.<br><br>The problem is that I do not know on what layer this selection must be<br>made : in the Left Hand of the rule ? Or in a AgendaFilter (selecting<br>the better tuple to use) ?<br><br>For the LH, I thought to the &quot;accumate&quot; CE, but I am affraid to have
<br>unreadle rules (impossible to maintain). And I don&#39;t see quite well how<br>to implement this with &quot;accumulate&quot; CE (knowing that I use a DSL).<br><br>For the AgendaFilter, I saw that only the current activation is
<br>accessible...so impossible to compare whith other tuples<br>values....Moreover, I am affraid to make performance fall.<br><br>Is this selection possible ? And what would be the best practice to<br>implement it ?<br><br>
Regards,<br>Eymeric.<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">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>&nbsp;&nbsp;Edson Tirelli<br>&nbsp;&nbsp;Software Engineer - JBoss Rules Core Developer<br>&nbsp;&nbsp;Office: +55 11 3529-6000<br>&nbsp;&nbsp;Mobile: +55 11 9287-5646
<br>&nbsp;&nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>