[rules-users] Drools Accumulate function

Wolfgang Laun wolfgang.laun at gmail.com
Wed May 8 05:17:57 EDT 2013


Insert 100s static facts containing the location id. Then, start your rule

when
    Location( $id: id )
    accumulate( TrafficData( id == $id,...

continue as before, except you won't need the entry point.

Cheers
-W



On 08/05/2013, lyally <stephen.lyall at serco.com> wrote:
> Hi,
>
> I am new to Drools so please excuse me if this is a simple question.
>
> I currently have several rules that look as follows  (one for each entry
> point):
>
>
>
> The intention of these rules is to average the speed, occupancy and flow of
> traffic at a particular road location over a 30 second sliding window. The
> rule works fine as it is, however it is not very scalable since I currently
> need a similiar rule and associated input stream for each road location
> that
> I am monitoring. There may be 100s of these.
>
> What I was really after was one rule that would perform the same averaging
> calculations over the 30 second window. My first thoughts were that I would
> need to lose the individuall input streams per location and thereby place
> all of the TrafficData facts from all locations into working memory. But
> then I was unsure how I would change the rule to group relevant TrafficData
> instances by their location (Note that the TrafficData instance has a
> location identifier within it) together before doing the averaging.
>
> Any assistance would be much appreciated.
>
> Regards,
>
> Steve
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Drools-Accumulate-function-tp4023718.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