And what if you perform the count in some java methods (a session listener on inserted
objects which updates a big map?) and then only use resulting counters in rules ?
If you have to use rules to compute the counters (for instance because it is not always as
simple, or if you want to keep the ability to add arbitrary businness logic), you nay
consider using objects for counters, and then have :
- a first set of rules updating counters (using accumulate or not). The idea there is
to share common accumulates instead of repeating them in many many rules. You can also use
queries instead of accumulates.
- a second set of rules checking counters to take a decision.
----- Mail original -----
De: "fx242" <drools(a)fx242.com>
À: rules-users(a)lists.jboss.org
Envoyé: Mercredi 14 Mars 2012 11:49:19
Objet: Re: [rules-users] drools arithmetics without eval()
Hi,
These rules are all auto-generated every day, and I don't control what is
going into them, so this kind of optimizations won't work for me. The basic
problem here, is that I have tons of rules that count facts
(PortfolioProducts) and use the result as rule conditions.
Some conditions could look like this: count(PortfolioProduct(A)) +
count(PortfolioProduct(B)) <= ( count(PortfolioProduct(C)) -
count(PortfolioProduct(D)) ) - count(PortfolioProduct(E))
and so on...
All rules look like the rule I've posted: I first calculate all relevant
fact counts to be used by the rule (accumulates), and then perform the
logic/arithmetic evaluation using evals(). Some rules end up having 15
accumulates and 2 evals as conditions...
My question is if using accumulate and eval() is the only choice I have to
write these kind of rules.
Regards,
Tiago Lopes
--
View this message in context:
http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-tp38232...
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