Hello,

It is unclear what your intentions are, but it may be that you are simply
using the wrong tool for the task.  Another possibility is that you have
inverted the use of facts and rules with respect to your problem.  (I.e.,
usually facts are used to represent data, rather than rules.)

To understand why you're seeing such poor performance, you should study
how the Rete algorithm works.  It is the basis for efficient pattern
matching in JESS.

Loosely speaking, a large ruleset will perform better if the patterns can
grow the Rete network into a heavily branching tree.  In your case, the
automated ruleset generation appears to be tending a plush lawn of grass.
The result is that every fact asserted is being compared to each and every
blade!  You'll need to partition your ruleset by adding additional
patterns so that facts are quickly matched against entire branches at
once.  Look on the web site for tips on writing and ordering rule
patterns.

Hope this helps,

Dave Barnett

On Fri, 16 Jun 2006, Adair, John wrote:

> I have a ruleset that looks like this:
> (deftemplate MAIN::R
>    (slot _r (type OBJECT))
>    (slot a (type STRING)))
> (defrule rule-0 (R (a "a0") (_r ?o)) => (?o a 0))
> ..
> (defrule rule-499999 (R (a "a499999") (_r ?o)) => (?o a 499999))
>
> The fact that the numeric part of the rule name and the int argument
> in the method call are the same is not a coincidence, but the particular
> value of the "a" slot that I'm matching on is because of the data I
> generated the ruleset from, not because the rules will always look like
> this.
>
> I seem to be spending a lot of time asserting facts, the main time cost
> of which I assume to be in pattern matching. When I have 5,000 rules,
> it takes about 32 seconds to assert 100,000 facts. When I have 20,000
> rules, it takes about 160 seconds. This worse-than-linear degradation
> continues as I add rules approaching my target of 500,000 rules (which
> I haven't been able to run successfully yet).
>
> Is there anything I can do to my ruleset to improve performance?
> ------------------------------------------------------------------------
> <John S. Adair><[EMAIL PROTECTED]><It's turtles all the way down.>
> ------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
>

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to