I've taken the rule on nabble (for strange reasons, it does not display 
correctly on mails ...).
Wolfgang was right :

rule "C020 - Gate charge (Out M)-B"
salience 45
no-loop true
when
ChargeDetailEntity( opsDate_currentLeg >= "20110101 000000" ) and
$charge : ChargeDetailEntity ( $tariffType : tariffType, $tariffCode : 
tariffCode, $chargeEtd : etd, billToCompany == "C020", chargeType == "YH", 
cntrStatus1 == "XM" ) and
not(
exists(
$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))))))))) ) ) )
then
insert(createChargeDetailRefSeqEntity("C020 - Gate charge (Out M)", $charge, 
newSeqList));
retract($charge);
end


the first ChargeDetailEntity( opsDate_currentLeg >= "20110101 000000" ) is the 
problem.
Don't know why there is 2 ChargeDetailEntity patterns, but I would put the 
contraint in the other ChargeDetailEntity pattern.
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 ...

PS : using a exists inside a not is redundant. not means "not exists" by 
itself. not( exists (X) ) is the same as not( X ) .

----- Mail original -----

De: "Wolfgang Laun" <wolfgang.l...@gmail.com>
À: "Rules Users List" <rules-users@lists.jboss.org>
Envoyé: Vendredi 18 Mai 2012 13:02:09
Objet: Re: [rules-users] Object activiates same rule many times

Please show the rule.

Exponentially growing activations can be caused by rules where the
same fact type is used more than once. You'll have to use constraints
inhibiting useless duplications, e.g.,

when
$a1: A()
$a2: A(this != $a1 )
then

-W



On 18/05/2012, Christina Lau <lau.christ...@hit.com.hk> wrote:


Hi all,

I find an odd pattern in the audit log. When an Object is inserted to the
working memory, activation is created many times on same rule. The more
objects are inserted, the duplicated activations are growing exponentially 
which degrade the performance a lot.

Here attached part of the audit log:

http://drools.46999.n3.nabble.com/file/n4000630/rule-DOCSEP-1337325521971.log
rule-DOCSEP-1337325521971.log

In the log,
- when object (130) is inserted, rule "C020 - Gate charge (Out M)-B" is
activiated 129 times.
- when object (131) is inserted, rule "C020 - Gate charge (Out M)-B" is
activiated 130 times.

Here is the rule of "C020 - Gate charge (Out M)-B",



The "insert" in RHS only add ChargeDetailRefSeqEntity to working memory
that
I don't think it causes the recursive activation.

And I'd already set no-loop to true. Does anyone offer some help here?


Thank you very much,
Christina


--
View this message in context:
http://drools.46999.n3.nabble.com/Object-activiates-same-rule-many-times-tp4000630.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

_______________________________________________


rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to