I think Andreas Andreakis wrote:

> But, when I ran it with both rules it takes more then 3 secs. I 
> understand why this happens (pattern mathing problem), but I dont 
> understand why I face the same problem while using Modules. The docs 
> say, that rules contained in a Module do not consider information in 
> other modules, unless they are referensed directly over their Modules 
> namespace. Maybe I missunderstood ?
> 

I think you've made things more complex in your head than they really
are. The template "triple" is shared by all modules. It doesn't matter
what module a fact is asserted in. All rules that match that template
see all the facts.

> I will try your suggestion. But in general I_m interessted to see 
> whether it is possible to solve the performance issue using the more 
> generic triple Fact.

Writing something like

(defrule foo
    (triple ...)
    (triple ...)
    (triple ...)
    (triple ...)

Is equivalent to something in Java like

List triples = ...

for (int i=0; i<triples.size(); ++i)
    for (int j=0; j<triples.size(); ++j)
        for (int k=0; k<triples.size(); ++k)
            for (int m=0; m<triples.size(); ++m)

Jess tries to be very clever, and definitely succeeds in making this
go faster than the worst-case O(N^4), but you have to help as much as
you can. Using separate templates is of course a great help, and
paying attention to pattern-ordering helps too. Try to put the pattern
that will match the fewest facts first, and put the pattern that
matches the facts that will change the most last.

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