[net.lang.lisp] OPS-5 sa question ???

chandra@uiucuxc.CSO.UIUC.EDU (10/17/85)

	Running ops-5 in stages


hi,

I just managed to get my hands on OPS-5. I was trying to
figure how to load and unload rules from ops-5. 

	Here is what I am trying to do: I have several
files which contain rules. I plan to use these sets of rules
seprately. I intend to load the first file of rules followed by
data, followed by the (run) command. After ops has stopped I
want to load the second file of rules but keep the Working
Memory in place. In so doing I will be able to pass the reults of
on set of rules onto the next set. I would be then able to solve
the problem in stages.

	Is there any way this can be done in ops?

Navin Chandra

(kindly post a reply on net.lang.lisp itself. I never seem to
get mail on my machine (it is too remote))

Thank you!!

benson@dcdwest.UUCP (Peter Benson) (10/28/85)

Your question, as I understand it, is how can one load a set of ops5
rules, run the rules on some data, and then load some new rules and
operate on that data.  A principal problem is that the new rules will
not know anything about the old wme's.  There are several solutions:

	1.  use (rehearse) to refresh the time tags on working memory.

	2. load all the rules at the same time and use a wme that
phases the firing of the first set of rules and then changes state and
phases the firing of the next set.

I like the second solution because it seems to me more flexible.
-- 
                                _
Peter Benson                    | ITT Defense Communications Division
(619)578-3080                   | 10060 Carroll Canyon Road
decvax!ittvax!dcdwest!benson    | San Diego, CA 92131
ucbvax!sdcsvax!dcdwest!benson   | 

ken@uwai.UUCP (10/29/85)

> . . .
> I just managed to get my hands on OPS-5. I was trying to
> figure how to load and unload rules from ops-5. 
> 
I have also just begun using OPS-5 so this is as much
question as it is answer.

> 	Here is what I am trying to do: I have several
> files which contain rules. I plan to use these sets of rules
> seprately. I intend to load the first file of rules followed by
> data, followed by the (run) command. After ops has stopped I
> want to load the second file of rules but keep the Working
> Memory in place. In so doing I will be able to pass the reults of
> on set of rules onto the next set. I would be then able to solve
> the problem in stages.
> . . . 

It seems that the loading more rules after you've started
OPS5 is no problem -- just load them using: (load 'rules.file).
However, you may not load any *declarations* once some rules
have been loaded.

'Unloading' rules is a more serious problem.  I have a question
related to this: What is an efficient debugging cycle for OPS5?
When I find a bug in a rule, I ^z out of lisp, restart vi with my
rule file in it, and make the needed changes to the rule.  However,
when I go back to lisp, I can't simply reload this file -- I get
lots of errors when I try.  It seems the errors are caused by the 
attempt to, in effect, add a rule with the same name as one that
is already in the rule net.  Of course, what I want to happen is
to have the new version of the rule overwrite the old one.
OPS5 doesn't seem to work this way.  So my current alternative is
to exit lisp, then restart it, then reload OPS5 and then finally
load my modified rule file.  Clearly, there has got to be a better
way.

I've just started using OPS5 so please excuse my ignorance.  The manual 
I have doesn't seem to address this problem.  If anyone can enlighten
me or point me to a reference that will, it would be greatly appreciated.

Thanks in advance for any info,
-Ken Koedinger    
(ken@ai.wisc.edu)
 University of Wisconsin

gxm@raybed2.UUCP (GERARD MAYER) (10/31/85)

When you load a file containing OPS5 rules into OPS5 they are compiled into
OPS5. There is no incremental compiler that I know of for OPS5. You can do
the edit, load, run cycle as you are doing or you can use the OPS5 top level
commands: make, remove, ppwm, wm, pm, & back (lisp version only) to debug
while in OPS5. Also if you are doing: %lisp, =>(load 'vps2.l), =>(i-g-v)
each time you can do (dumplisp filename) to save the core image of OPS5,
and then do %filename to return to the initial OPS5 environment, then load
your rule file.
					Gerard Mayer
					Raytheon Research Division

					uucp  ..linus!raybed2!gxm

peter@graffiti.UUCP (Peter da Silva) (11/04/85)

One thing I did when working on a forth project under UNIX was to define
a word "new_forth":

: new_forth
  fork if
    wait drop ." Parent" CR
  else
    ." Child" CR
  then ;

Where fork and wait have their usual meanings (people with my UNIX variant of
John James' FIG-forth might want to try this... it's useful). What I'd do would
be to load a bunch of stuff, new_forth, then load a bunch more. This also
protected me from crashes (much more common in FORTH). Wouldn't it be possible
to do much the same thing in OPS-5?
-- 
Name: Peter da Silva
Graphic: `-_-'
UUCP: ...!shell!{graffiti,baylor}!peter
IAEF: ...!kitty!baylor!peter

liz@tove.UUCP (Liz Allen) (11/04/85)

In article <16700005@uiucuxc> chandra@uiucuxc.CSO.UIUC.EDU writes:
>
>	Here is what I am trying to do: I have several
>files which contain rules. I plan to use these sets of rules
>seprately. I intend to load the first file of rules followed by
>data, followed by the (run) command. After ops has stopped I
>want to load the second file of rules but keep the Working
>Memory in place. In so doing I will be able to pass the reults of
>on set of rules onto the next set. I would be then able to solve
>the problem in stages.

If you're willing to switch to YAPS, you can use multiple databases
and load each set of rules into different databases.  You would
have to copy the facts in working memory from one database to the
next, but it could be a useful approach.  Other than that, as
someone else suggested, using special facts in working memory which
indicate which phase you're in is probably the best approach.  Each
set of rules matches the fact for the phase they're in.

For information on getting YAPS, send mail to me.
-- 
Liz Allen   U of Maryland   ...!seismo!umcp-cs!liz   liz@tove.umd.edu

"This is the message we have heard from him and declare to you:  God
 is light; in him there is no darkness at all" -- 1 John 1:5