I think Tobias Hilka wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hello,

> All in all, there are about 60 to 100 facts in each rete engine. If
> I insert like 40 of these agents in my world, everything is working
> fine. But just in the beginning. If I let it run 300 and more turns,
> it gets terribly slow, sometimes even runs out of memory.

When a Jess program is using too much memory, the problem is generally
that you're forming a large number of partial matches in your rules:
see http://herzberg.ca.sandia.gov/jess/FAQ.shtml#Q12 for an
explanation. You need to look at the rules you've written and try to
eliminate any code that generates polynomial numbers of matches.

There's a newbie mistake that often causes problems like this: overuse
of the "test" conditional element. "test" is needed only in rare
circumstances. Don't write

(defrule bad-example
  (number ?n1)
  (number ?n2)
  (test (eq (+ ?n1 1) ?n2))
  ...

Instead write

(defrule good-example
  (number ?n1)
  (number ?n2&:(+ ?n1 1))
  ...

The former forms N^2 partial matches, the latter only N (where N is
the number of "number" facts).

---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
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