On 19/07/2012, Ladd <l...@codemettle.com> wrote:
>
> That's a good question.  Smaller memory footprint by retracting.  But we
> lose the immediate activation of future rules.  Maybe I'll make it an
> option
> and let somebody else decide.  ;)
>

Here's a plausible idea, which might be useful - I still don't
understand the scenario well enough to be confident ;-)

You can retract rules and still keep them in the game. Let's say X()
is the type for the ones you'd consider to retract, and Y() are the
ones that would expect to match with X(), no matter how old.

rule "make X dormant
when
    $b: Bed()
    $x: X( ... decisions ... )  // or simply not Y() // or both combined
then
   retract( $x );
   $server.putToBed( $x );
   $b.modify{ incCount() }
end

rule "awaken all X"
when
    $b: Bed( count > 0 )
    exists Y()
then
    $server.getFromBed( $b );
end

If you have many classes like X() or Y(), simply add a marker
interface to these classes.

There's an infinite number of strategies for "putting to bed". LFU
comes to my mind, in addition to age.

Of course, eventually the Bed will fill up; this just postpones the
issue to decide when really to dispatch them to the bit bucket.

-W
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to