[rules-users] rule algorithm

Edson Tirelli tirelli at post.com
Fri Aug 29 11:49:06 EDT 2008


   Or an accumulate function (as long as all you objects implement a commong
interface):

rule "overall certainty"
when
   $cert : Number() from accumulate(
             $f : CertaintyFacts(  ),
             overallCertainty( $f ) )
then
   // do something with $cert
end

   Implement your own formula inside overallCertainty function .

   []s
   Edson

2008/8/29 Greg Barton <greg_barton at yahoo.com>

> Looks like a job for a query.
>
> http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html/ch06s06.html
>
> Query for all matching certainties/weights in working memory.  Loop through
> them to perform calculation.
>
>
> --- On Fri, 8/29/08, thomas kukofka <thomaskukofka at web.de> wrote:
>
> > From: thomas kukofka <thomaskukofka at web.de>
> > Subject: [rules-users] rule algorithm
> > To: "Rules Users List" <rules-users at lists.jboss.org>
> > Date: Friday, August 29, 2008, 9:08 AM
> > Hello,
> >
> > I search a rule implementation for the following
> > calculation:
> > I have n Objects of differents types (A, B, C, ...) each
> > with a parameter
> > certainty.
> >
> > the overall certainty is calculated as follows:
> > certaintyOverall =
> > (certaintyA * weightA + certaintyB * weightB + ... ) /
> > (weightA  + weightB +
> > ...)
> >
> > If it can be assumed that all Objects in the formula always
> > exist it's quite
> > easy:
> > when
> >   A (certaintyA: certainty)
> >   B (certaintyB: certainty)
> >   ...
> > then
> >   certaintyOverall = (certaintyA * weightA + certaintyB *
> > weightB + ... ) /
> > (weightA  + weightB + ...)
> >
> > But if one ore more objects are missing the formula should
> > be reduced to the
> > certainty and weights of the existing objects. But there
> > are too many
> > combinations of existing/nonexisting objects. How can this
> > be implemented in
> > Drools?
> >
> > Regards
> > Thomas
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080829/f130a81c/attachment.html 


More information about the rules-users mailing list