Nevermind, I found it.

I had a rule using a multifield and had ordered my patterns such that I
was incurring some strange cartesian product or something.  I discovered
this after letting it run long enough to see a debug message proving
that the loop wasn't actually infinite, just really long.

-Mitch

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Mitch Christensen
Sent: Sunday, February 13, 2005 2:26 PM
To: Jess Mailing List
Subject: JESS: (retract) spawns an infinite loop


Hey,

I've gotten myself bogged down in an infinite loop, and can't seem to
coax any more information out of Jess to help me find it.

Using the Jess debugger (in a5) I've proven that that last call is to
(retract).  This call never returns, and my CPU show 100% consumption.
There doesn't seem to be any memory consumption as I let this run for an
hour and never got an OutOfMemory exception.

The last rule to fire is my 'remove-word-facts' rule (see below).  If I
set a breakpoint there, then single-step past it, I hit the second
pattern in my 'determine-adjacency' rule, and single stepping from then
on just stays at that location with no helpful information available in
the variables view, etc.

Here are the involved code snippets:

(defrule remove-word-facts
    ?fact <- (word)
=>
    (retract ?fact))   <=== BREAKPOINT HERE...

(defrule determine-adjacency
    "Determine 'word' adjacency"
    ?lw <- (word (x ?xl)(y ?yl))
    ?rw <- (word (x ?xr&:(> ?xr ?xl))(y ?yr&:(same-row ?yl ?yr)))   <===
LOOPS HERE!!!!!
    (not (word (x ?xm&:(and (> ?xm ?xl)(< ?xm ?xr)))(y ?ym&:(same-row
?ym ?yl)))) =>
    (assert (adjacent (left ?lw)(right ?rw))))

(deffunction same-row (?p0 ?p1)(and (< ?p1 (+ ?p0 10) )(> ?p1 (- ?p0
10))))

Is there something I can do at this point that will help me determine
why it is looping?

Thanks.
-Mitch

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