<div dir="ltr"><div>Thanks for you quick answer.</div><div><br></div>Not yet,<div><br></div><div>For that I will need to switch to fact insertion instead of Java Set.</div><div>Do you think to will make a difference in the way the RETE Tree will be built ?</div>
<div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-20 20:27 GMT+01:00 Mark Proctor <span dir="ltr"><<a href="mailto:mproctor@codehaus.org" target="_blank">mproctor@codehaus.org</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Did you try using the engine in equality mode? It will only ever allow one “equal” object to be inserted, others are just ignored.<br>
<span class="HOEnZb"><font color="#888888"><br>
Mark<br>
</font></span><div class="HOEnZb"><div class="h5">On 20 Mar 2014, at 18:54, Raphael <<a href="mailto:raphael.jolivet@gmail.com">raphael.jolivet@gmail.com</a>> wrote:<br>
<br>
> Hi,<br>
><br>
> In our project, we use Drools to compute forbidden allocations as input for<br>
> an allocation problem (for which we do not use Drools BTW).<br>
><br>
> The constraint of the problem (forbidden operation for given resources) are<br>
> expressed as drools rules.<br>
><br>
> We have about<br>
> -200 resources<br>
> -700 operations<br>
><br>
> Those are the Drools facts.<br>
> We have about 200 Drools rules describing the forbidden allocations<br>
><br>
> The problem here is that many rules produce duplicates forbids.<br>
> For instance :<br>
> Rule 1 may forbid Op1 on Res1 & Res3<br>
> Rule 2 may forbid Op1 on Res2 & res3<br>
><br>
> Currently the RHS of rules just insert forbids into a pure Java Set (no fact<br>
> insertion).<br>
> The Set takes care of avoiding duplicates, but still, we feel we could help<br>
> Drools by giving him a hint that<br>
> all rules are actually producing pairs of <Resource, Allocation> and that he<br>
> should not try to produce them more than once.<br>
><br>
> Currently the structure of each rule looks like that :<br>
><br>
> when<br>
> $resource : Resource(<someconditions>)<br>
> $operation : Operation(<someconditions>)<br>
> then<br>
> globalSet.add(Pair<resrouce, operation>)<br>
> end<br>
><br>
> With the size of the problem, we often end up with outOfMem/ GC limit.<br>
> When analyzing memory dump, we see about<br>
> 300.000 drools left tuple object.<br>
><br>
> I am not sure if we could help drools to reduce the Rete tree here.<br>
> I mean, the allocation matrix is already : 200*700 = 140.000 cells.<br>
> Drools only uses 2 nodes for each possible forbids, which seems already well<br>
> optimized.<br>
><br>
> We had several idea to improve that though, but we are not enough expert in<br>
> the internal of the RETE algorithm to decide if that's a good way to go :<br>
><br>
> 1) Insert forbids as facts in the RHS and check they are not already there<br>
> in the LHS :<br>
> when<br>
> $resource : Resource(<someconditions>)<br>
> $operation : Operation(<someconditions>)<br>
> not Forbid(res=$resource, op=$operation)<br>
> then<br>
> insert(Forbid($resource, $operation))<br>
> end<br>
><br>
> 2) Merge all rules in one big rule with a single RHS<br>
> Is it possible to have something like :<br>
> when<br>
> // Rule 1<br>
> ($resource : Resource(<someconditions>)<br>
> $operation : Operation(<someconditions>))<br>
> or<br>
> // Rule 2<br>
> ($resource : Resource(<someconditions>)<br>
> $operation : Operation(<someconditions>))<br>
> // Etc ...<br>
> then<br>
> globalSet.add(Pair<resrouce, operation>)<br>
> end<br>
><br>
> 3) Define a common RHS somewhere and tell Drools all rules use this one.<br>
> Is there a possibility in Drools to define reusable RHS ? Would it help ?<br>
><br>
> 4) Any other idea ?<br>
><br>
><br>
> Thanks in advance for your help.<br>
> Brgds,<br>
><br>
> Raphael Jolivet<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> --<br>
> View this message in context: <a href="http://drools.46999.n3.nabble.com/Needs-advice-to-help-Drools-on-a-big-problem-and-avoid-GC-overhead-tp4028838.html" target="_blank">http://drools.46999.n3.nabble.com/Needs-advice-to-help-Drools-on-a-big-problem-and-avoid-GC-overhead-tp4028838.html</a><br>
> Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
<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>
</div></div></blockquote></div><br></div>