<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Times New Roman; font-size: 12pt; color: #000000'>I've taken the rule on nabble (for strange reasons, it does not display correctly on mails ...).<br>Wolfgang was right :<br><br>rule "C020 - Gate charge (Out M)-B"<br> salience 45<br> no-loop true<br>when<br> <span style="color: rgb(255, 0, 0); font-weight: bold;"> ChargeDetailEntity( opsDate_currentLeg >= "20110101 000000" )</span> and<br> $charge :<span style="color: rgb(255, 0, 0); font-weight: bold;"> ChargeDetailEntity</span>( $tariffType : tariffType, $tariffCode : tariffCode, $chargeEtd : etd, billToCompany == "C020", chargeType == "YH", cntrStatus1 == "XM" ) and<br> not( <br> exists( <br> $seq : ChargeDetailRefSeqEntity( $seqEtd : etd, (invSepCriteriaName == "C020 - Gate charge (Out M)") && ((adjType == $charge.adjType) && ((bargeJobId == $charge.bargeJobId) && ((billToCompany == $charge.billToCompany) && ((chargeType == $charge.chargeType) && ((consortiumCode == $charge.consortiumCode) && ((serviceCode == $charge.serviceCode) && ((vesselCode == $charge.vesselCode) && ((voyageCode == $charge.voyageCode) && (etd == $chargeEtd))))))))) ) ) ) <br>then<br> insert(createChargeDetailRefSeqEntity("C020 - Gate charge (Out M)", $charge, newSeqList));<br> retract($charge);<br>end<br><br><br>the first ChargeDetailEntity( opsDate_currentLeg >= "20110101 000000" ) is the problem.<br>Don't know why there is 2 ChargeDetailEntity patterns, but I would put the contraint in the other ChargeDetailEntity pattern.<br>This way, adding one ChargeDetailEntity object will only lead one rule activation. With the rule as this, the number of activiation you show in your log is normal ...<br><br>PS : using a exists inside a not is redundant. not means "not exists" by itself. not( exists (X) ) is the same as not( X ).<br><br><hr id="zwchr"><br>De: "Wolfgang Laun" <wolfgang.laun@gmail.com><br>À: "Rules Users List" <rules-users@lists.jboss.org><br>Envoyé: Vendredi 18 Mai 2012 13:02:09<br>Objet: Re: [rules-users] Object activiates same rule many times<br><br>Please show the rule.<br><br>Exponentially growing activations can be caused by rules where the<br>same fact type is used more than once. You'll have to use constraints<br>inhibiting useless duplications, e.g.,<br><br>when<br> $a1: A()<br> $a2: A(this != $a1 )<br>then<br><br>-W<br><br><br><br>On 18/05/2012, Christina Lau <lau.christina@hit.com.hk> wrote:<br><blockquote> Hi all,<br><br> I find an odd pattern in the audit log. When an Object is inserted to the<br> working memory, activation is created many times on same rule. The more<br> objects are inserted, the duplicated activations are growing exponentially<br> which degrade the performance a lot.<br><br> Here attached part of the audit log:<br><br> http://drools.46999.n3.nabble.com/file/n4000630/rule-DOCSEP-1337325521971.log<br> rule-DOCSEP-1337325521971.log<br><br> In the log,<br> - when object (130) is inserted, rule "C020 - Gate charge (Out M)-B" is<br> activiated 129 times.<br> - when object (131) is inserted, rule "C020 - Gate charge (Out M)-B" is<br> activiated 130 times.<br><br> Here is the rule of "C020 - Gate charge (Out M)-B",<br><br><br><br> The "insert" in RHS only add ChargeDetailRefSeqEntity to working memory<br> that<br> I don't think it causes the recursive activation.<br><br> And I'd already set no-loop to true. Does anyone offer some help here?<br><br><br> Thank you very much,<br> Christina<br><br><br> --<br> View this message in context:<br> http://drools.46999.n3.nabble.com/Object-activiates-same-rule-many-times-tp4000630.html<br> Sent from the Drools: User forum mailing list archive at Nabble.com.<br> _______________________________________________<br> rules-users mailing list<br> rules-users@lists.jboss.org<br> https://lists.jboss.org/mailman/listinfo/rules-users<br><br>_______________________________________________</blockquote><br>rules-users mailing list<br>rules-users@lists.jboss.org<br>https://lists.jboss.org/mailman/listinfo/rules-users<br></div></body></html>