Folks -
David Parker points out the error in my writing here - he was even
polite enough to reply off the list which was very considerate. My
only defense is that I wrote this first thing in the morning and, like
many things I do before the coffee has taken effect, I was just
completely, utterly wrong. 10,000 it is, and we're talking minutes,
not tens of minutes.
I think Parker, David wrote:
> From [EMAIL PROTECTED] Tue Mar 2 16:49:54 1999
>
> Hi Ernest
>
> Is it really as bad as that. I thought that there would -only- be 10**4 ie
> 10,000 partial matches not 3,628,800.
>
> David
>
> > -----Original Message-----
> > From: Ernest Friedman-Hill [SMTP:[EMAIL PROTECTED]]
> >
> > 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.
> >
> >
---------------------------------------------------------
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]
---------------------------------------------------------------------