Amen. On that thought, if any of you recall the little "cheating" line for the Miss Manners problem, it turns out that exactly WHERE you put that little cheating line also makes a significant difference; as determined by experimentation. Seems that I can get a 10x better response by putting it in the 3rd line rather than putting in in the 4th line. Weird, but true. Actually, there is also a rather involved explanation for it if you are interested.

[EMAIL PROTECTED] wrote:

I think Rowan Constable wrote:



which batches the rules located in rules.clp everytime the method is
called. This approach works fine but it is REALLY slow.



Jess's rule compiler is actually really quick; hundreds of rules can be compiled in a fraction of a second. What takes time is pattern matching. If working memory is full of facts, then reloading the rules can take a long time because all the pattern matching has to be redone.



Is there anyway of speeding this up? I tried batching the rules in
the constructor of the class and it is dramatically faster but
store-fetch doesn't work properly then. This results in every
material given the same suitability (20%). I tried to remedy this by
clearing the storage of rule engine using clearStorage but this
throws up a null-pointer exception.



Whether or what rules are defined will have no effect at all on how store and fetch work; they're just thin wrappers over calls to HashMap.set() and get().

What you need to get a handle on what is happening during your
program. First of all, given that reloading rules is slow, it sounds
like pattern-matching takes a while. You can often speed this up
dramatically by writing your rules properly. The FAQ has a little info
about this, as does the "Rete Algorithm" chapter of the manual. Use
the tools that Jess gives you (the view, watch, and matches commands)
to monitor what Jess is doing and look for large numbers of partial
matches.

Second, the reason that you get the wrong answer depending on where
you load your rules is not that Jess cares, but that changing when
things are called changes the sequence of operations that you're
asking Jess to do. Loading the rules just once is absolutely fine --
but you may need to fully or partially reset working memory for each
run, depending on how your rules are written. But unless you're
writing rules that themselves add or remove other rules, there's no
reason to ever reload the rules.

My main advice is to use "watch" to make sure you understand when your
facts are coming in, what rules are activated, what rules fire, and
when. Understand the prerequisites for your rules, and then make sure
that when you call "run", things are in the proper state.

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




--
------------
SDG jco


"Do No Evil. Do Only Good Things.
See the good in every one.
Always keep learning.
Teach those who want to be taught.
Avoid fools at all costs.
Harm No One,
Except to Defend Yourself,
Or to Defend Another.
Kill No One,
Except to Keep From Being Killed,
Or to Keep Another From Being Killed."


CafeBabe
1210151411101114

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