lisa bug: matching on retracted facts

momerath <[email protected]> Thu, 7 Jul 2005 00:42:17 -0500
Newsgroups gmane.lisp.lisa.general
Message-ID <[email protected]>
Greetings,

The following is a heavily pared-down snippet to illustrate a bug we
encountered in our attempt to incorporate LISA into our MMOG.
You'll see that, though maintain-bot-count shouldn't fire (territory
has been retracted), activations after the first that were added to
the agenda before the territory-retraction do fire when
sector-initialized is retracted.


(in-package :lisa-user)

(deftemplate territory ())

(deftemplate territory-type-num-bots-intended ()
 (slot bot-class))

(deftemplate sector-initialized ())


(defrule retreat ()
 (?territory (territory))
 (?initfact (sector-initialized))
 =3D>
 (format t "Retracting territory in this RHS should prevent
maintain-bot-count from firing~%")
 (retract ?initfact)
 (retract ?territory)) ;these retractions can be in either order- the
problem still exists

(defrule maintain-bot-count ()
 (territory)
 (territory-type-num-bots-intended (bot-class ?bot-class))
 (not (sector-initialized))
 =3D>
 (format t "This rule shouldnt fire~%"))

(defrule startup ()
 =3D>
 (assert (territory))
 (assert (sector-initialized))
 (assert (territory-type-num-bots-intended  (bot-class assault)))
 (assert (territory-type-num-bots-intended  (bot-class collector)))
 (assert (territory-type-num-bots-intended  (bot-class guardian))))


Here is the complete output of the snippet, annotated to indicate the
activations:

FIRE 1: STARTUP (F-0)
=3D=3D> F-1 (TERRITORY)
=3D=3D> F-2 (SECTOR-INITIALIZED)
=3D=3D> Activation: RETREAT : (F-1 F-2)
=3D=3D> F-3 (TERRITORY-TYPE-NUM-BOTS-INTENDED (BOT-CLASS ASSAULT))
=3D=3D> F-4 (TERRITORY-TYPE-NUM-BOTS-INTENDED (BOT-CLASS COLLECTOR))
=3D=3D> F-5 (TERRITORY-TYPE-NUM-BOTS-INTENDED (BOT-CLASS GUARDIAN))
FIRE 2: RETREAT (F-1 F-2)
Retracting territory in this RHS should prevent maintain-bot-count from fir=
ing
<=3D=3D F-2 (SECTOR-INITIALIZED)
;The following 3 activations are added to the agenda, but only the
first is removed, whereas all three should be.
=3D=3D> Activation: MAINTAIN-BOT-COUNT : (F-1 F-3)
=3D=3D> Activation: MAINTAIN-BOT-COUNT : (F-1 F-4)
=3D=3D> Activation: MAINTAIN-BOT-COUNT : (F-1 F-5)
<=3D=3D F-1 (TERRITORY)
<=3D=3D Activation: MAINTAIN-BOT-COUNT : (F-1 F-3)
FIRE 3: MAINTAIN-BOT-COUNT (F-1 F-4)
This rule shouldnt fire
FIRE 4: MAINTAIN-BOT-COUNT (F-1 F-5)
This rule shouldnt fire


Michael Warnock
Guild Software

PS I joined the mailing list with my reply-to address and my first
message was  queued for moderation since it didn't come from my
reply-to.  I rejoined with my actual address.  If both are posted, I
apologize.


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click