This is precisely the idea behind the Rete algorithm: by using up lots
of memory, things can be made to run fast. 

I'm sure that each user won't have a different set of distinct rules (that
certainly wouldn't be the best way to design the system). Better,
there would be a wide range of standard rules to choose from, and
users and their choices would be represented as data. You could still
allow custom rules, but most of the rules will probably look like

(defrule forward-mail-1
        ?m <- (message (recipient ?name1) (content ?c))
        (day ?day)
        (forwarding-order (name ?name1) (day-away ?day)
                          (forward-to ?name2) (priority ?p))
        =>
        (forward-message ?content ?name2 ?p)
        (retract ?m))

This version is optimized for space: the facts that change most
frequently are at the top of the rule, so a minimum number of partial
matches are in memory at any one time.        
        
(defrule forward-mail-2
        (forwarding-order (name ?name1) (day-away ?day)
                          (forward-to ?name2) (priority ?p))
        (day ?day)
        ?m <- (message (recipient ?name1) (content ?c))
        =>
        (forward-message ?content ?name2 ?p)
        (retract ?m))

This version is optimized for speed, but takes more memory - all valid
pairs of rules and days are remembered on the relevant day, all day,
so when a message comes it, it is matched and forwarded immediately.

I think Venkat wrote:
> 
> Hi,
>  
> I am using Jess for writing filtering rules for an
> email software. 
>  
> Assume there are 10,000 users and
> each user has his own rule set for message forwarding
> and priority setting. 
>  
> For eg: 
> If email is recvd on Monday and the user
> is Mark then forward it to Marks's work email address and set the subject
> as high priority.
> In Jess parlance, each user has more than one rule defined.
>  
> I would like to know - to make "best use" of Rete efficiency
> do we need to assert every rule for each user
> in the fact list, so that when a new message comes in
> the fact is already asserted and it will go through right away -
> this will mean a huge working memory. Or do we strike a balance ?
>  
> Well, I am trying to make use of Jess (Rete)  in the best possible way
> for the above application primarily in terms of "speed" - any suggestions ?
>  
> Thanks,
> Venkat
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (510) 294-2154
Sandia National Labs                FAX:   (510) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to