accumulate (irrespective of its form and particular coding) is
absolutely fickle and finicky in a changing fact data base. The basic
caveat is that each change to the domain of the accumulat CE starts a
new game.
Forget accumulate, roll your own!
Set up a fact type Avg that's capable of holding the running average
for an account (and other data that may be useful). One rule inserts
an Avg if it isn't there for a new Transactions and initializes the
average. Another rule should just extend the average while the count
is below 100. And for the 101st Transaction to arrive, the third rule
checks the amount and modifies the average, too. Obviously, you'll
have to keep 100 amounts in Avg as well in order to remove the
contribution of the 1st Transaction, or you just continue to extend
the average.
Note that this permits you to drop Transactions from the system
earlier than with accumulate, which should more than compensate for
the additional memory requirements due to Avg for each observed
account.
Average may be a poor threshold for raising an alarm, but I suspect
you haven't been showing all of your cards ;-)
-W
On 09/12/2013, sumantp <sumantp(a)yahoo.com> wrote:
I forgot to include some output from my test. It shows that the two
$600
transactions do not initially trigger alerts (as expected), the $800 one
triggers an alert (as expected), but the $100 one results in alerts for the
first 3 transaction (not expected).
Inserting Account = 1, Amount = 600.0, current average = 600.0
Inserting Account = 1, Amount = 600.0, current average = 600.0
Inserting Account = 1, Amount = 800.0, current average = 666.6666666666666
***ALERT***: Higher than average transaction amount (Average =
666.6666666666666): Account = 1, Amount = 800.0
Inserting Account = 1, Amount = 100.0, current average = 525.0
***ALERT***: Higher than average transaction amount (Average = 525.0):
Account = 1, Amount = 800.0
***ALERT***: Higher than average transaction amount (Average = 525.0):
Account = 1, Amount = 600.0
***ALERT***: Higher than average transaction amount (Average = 525.0):
Account = 1, Amount = 600.0
--
View this message in context:
http://drools.46999.n3.nabble.com/Prevent-re-evaluation-of-events-in-stre...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users