<br> Eymeric,<br><br> This is a fairly common case of finding the "best" 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> 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> 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> Thanks,
<br> Edson<br><br><br><br><div><span class="gmail_quote">2007/9/12, Eymeric VIEUILLE <<a href="mailto:evieuille@gfi.fr">evieuille@gfi.fr</a>>:</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'1(date = "09/25/2006") M'1(date = "09/25/2006")<br>M'2(date = "09/26/2006") M'2(date = "09/26/2006")<br>M'3(date = "09/29/2006") M"3(date = "09/27/2006")
<br>M'4(date = "09/31/2006") M"4(date = "09/30/2006")<br><br>I would like the second tuples to be selected for executing the right<br>hand of the rule because dates of M'2, M"3, M"4 are the closest dates
<br>compared to M'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 "accumate" CE, but I am affraid to have
<br>unreadle rules (impossible to maintain). And I don't see quite well how<br>to implement this with "accumulate" 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> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646
<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a>