[rules-users] Slow compilation (4h) for a single rule

Wolfgang Laun wolfgang.laun at gmail.com
Wed Jul 25 07:42:40 EDT 2012


A last effort from my side.

Given any number of bound variables a, b, c: to determine whether an
arbitrary boolean expression involving arithmetic and comparison
operators, a single eval() is sufficient and preferable to a CE
combination involving the CE operators "and", "or", "not" combining
many evals.

Instead of
   not( eval( a == 1 ) )
use
   eval( ! (a == 1) )  // or better
   eval( a != 0 )

Instead of
    eval( a == 1 ) or eval( b == 1 )
use
   eval( a == 1 || b == 1 )

Instead of
    eval( a == 1 ) and eval( b == 1 )
use
   eval( a == 1 && b == 1 )

-W

On 25/07/2012, fx242 <drools at fx242.com> wrote:
> Thanks for your explanation Edson, it makes sense now I think!
> Basically what you are saying is that there is a limit, beyond which is no
> longer feasible to use more ORs on a rule.
>
>
> Edson Tirelli-4 wrote
>>
>> You are trying to avoid the issue. As reported by others, your
>> conditions should be inside the patterns, not in "or'd" evals in the end,
>> and yes, it is possible to generate rules like that in an automated
>> program.
>>
>
> Sadly I don't see how, as some of my rules have arbitrary arithmetic
> involving more than one variable inside the Number(), for more context see
> the example I've put on
> http://drools.46999.n3.nabble.com/drools-arithmetics-without-eval-td3823232.html.
>
> For this case I think I will try to invert the logic and get rid of the
> ORs:
> not(A or B) => not(A) and not(B).
>
> Best regards,
> TL
>
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Slow-compilation-4h-for-a-single-rule-tp4018855p4018894.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>


More information about the rules-users mailing list