The performance of a Rete-based system depends not so much on the
number of rules and facts but on the number of partial matches
generated by the rules. Section 4.2 of the Jess manual mentions this
briefly, but there is a much better treatment in the Giarrantano and
Riley book (also mentioned in the Jess Manual.) The classic example of
writing efficient rules looks like this: this rule

(defrule match-1
  (item ?x)
  (item ?y)
  (item ?z)
  (item ?w)
  (find-match ?x ?y ?z ?w)
  => )

is HORRIBLE, because it must form all possible permutations of 'item'
facts before finding the one permutation that matches the 'find-match'
fact. If there are 10 'item' facts, this is 10x9x8...x2x1 = 3,628,800
partial matches are sent to the last join node - a lot of
bookkeeping! If you rewrite the rule like this:

(defrule match-1
  (find-match ?x ?y ?z ?w)
  (item ?x)
  (item ?y)
  (item ?z)
  (item ?w)
  => )

Then there is precisely one partial match sent to the last join
node - actually only one is sent to each join node. Whereas the first
rule might take a half-hour to reset on a fast machine, the second
rule resets instantaneously. 

The jess (view) command can be used to explore the efficiency of your
rules. 



I think Jacek S. Gwizdka wrote:
> 
> We are planning to use JESS for real-time processing with given upper limit
> for allowed processing time. 
> I expect the system to have 20-30 rules for start, which will increase as
> the system learns to 100, perhaps more. The number of facts will be
> probably in the order of 10 (these are structures (JavaBeans) with a bunch
> of member slots each). At least half of the facts will change each time. 
> What kind of performance could we expect from the system? 
> 
> Thanks,
> -- Jacek
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 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