From: Paolo Amoroso
Subject: What's the purpose of CLEANUP rule in Lisa mab-clos.lisp example?
Date: 
Message-ID: <87ekcdehfw.fsf@plato.moon.paoloamoroso.it>
What is the purpose of the CLEANUP rule:

  ;;; Retract every object whose ancestor is an instance of MAB-FUNDAMENTAL...

  (defrule cleanup (:salience -100)
    (?fact (mab-fundamental))
    =>
    (retract ?fact))

in the mab-clos.lisp example of Lisa?  The file is here::

  http://cvs.sourceforge.net/viewcvs.py/*checkout*/lisa/lisa/misc/mab-clos.lisp

and this is the Lisa site:

  http://lisa.sourceforge.net

Why is it necessary or desirable to retract objects whose ancestors
are instances of MAB-FUNDAMENTAL?


Paolo
-- 
Lisp Propulsion Laboratory log - http://www.paoloamoroso.it/log

From: Sashank Varma
Subject: Re: What's the purpose of CLEANUP rule in Lisa mab-clos.lisp example?
Date: 
Message-ID: <1116036941.705302.153490@f14g2000cwb.googlegroups.com>
Paolo Amoroso wrote:

> What is the purpose of the CLEANUP rule:
>
>   ;;; Retract every object whose ancestor is an instance of
MAB-FUNDAMENTAL...
>
>   (defrule cleanup (:salience -100)
>     (?fact (mab-fundamental))
>     =>
>     (retract ?fact))
>
> in the mab-clos.lisp example of Lisa?  The file is here::
[...]
> Why is it necessary or desirable to retract objects whose ancestors
> are instances of MAB-FUNDAMENTAL?

Paolo,

I just perused the MAB code. It looks to me like the :SALIENCY keyword
is the key.

This rule will match every declarative element since every declarative
element ultimately inherits from the MAB-FUNDAMENTAL class. The
:SALIENCY keyword indicates that this rule is of low importance. in
other words, it will lose out to any other matching rules during
conflict resolution -- the process of selecting which matching rule to
fire next. So this rule will only fire at the end of a run, after the
problem has been solved. Its purpose is to purge declarative memory of
all elements, leaving the system in a tidy state. Hence the name
CLEANUP.

This is a common idiom when writing rule sets. Try commenting out and
running the model. My guess is that it will solve the problem
correctly, but leave behind a mess.

Sashank

PS: This explanation is based on how other rule interpreters work. I
assume LISA works similarly.
From: Paolo Amoroso
Subject: Re: What's the purpose of CLEANUP rule in Lisa mab-clos.lisp example?
Date: 
Message-ID: <87hdh6tboo.fsf@plato.moon.paoloamoroso.it>
"Sashank Varma" <············@yahoo.com> writes:

> fire next. So this rule will only fire at the end of a run, after the
> problem has been solved. Its purpose is to purge declarative memory of
> all elements, leaving the system in a tidy state. Hence the name
> CLEANUP.

Doesn't RESET do something similar?


Paolo
-- 
Why Lisp? http://lisp.tech.coop/RtL%20Highlight%20Film
Recommended Common Lisp libraries/tools (see also http://clrfi.alu.org):
- ASDF/ASDF-INSTALL: system building/installation
- CL-PPCRE: regular expressions
- UFFI: Foreign Function Interface
From: Sashank Varma
Subject: Re: What's the purpose of CLEANUP rule in Lisa mab-clos.lisp example?
Date: 
Message-ID: <1116111585.156987.176210@g47g2000cwa.googlegroups.com>
Paolo Amoroso wrote:

> "Sashank Varma" <············@yahoo.com> writes:
>
> > fire next. So this rule will only fire at the end of a run, after
the
> > problem has been solved. Its purpose is to purge declarative memory
of
> > all elements, leaving the system in a tidy state. Hence the name
> > CLEANUP.
>
> Doesn't RESET do something similar?

Well there's resetting, Resetting, and RESETTING ;-)

Sometimes you want to totally clear the system of all rules, facts,
parameter settings, etc., as when you're switching from one model
(e.g., monkeys and bananas) to another model (e.g., tower of hanoi).

Sometimes you want to keep the rules and parameter settings, but clear
all facts, as when you're getting to run the current model on a new
problem. It looks like this is what RESET does. It appears to also
establish "the initial fact" and all facts specified by the DEFFACTS
command to get the model rolling.

Sometimes you want to clean up some, but not all, facts, as when
solving the current problems has impassed in some way. This calls for
ad hoc solutions like the CLEANUP production of the MAB model.

Sashank