Thread View: comp.lang.prolog
4 messages
4 total messages
Started by popx
Tue, 25 Aug 1992 19:20
Wanted: production system/coroutiner
Author: popx
Date: Tue, 25 Aug 1992 19:20
Date: Tue, 25 Aug 1992 19:20
61 lines
2926 bytes
2926 bytes
I'm looking for two Prolog programs:
1) An efficient production system, possibly one that works by compiling
into a Rete network. I have written a slow production system that works
in the obvious fashion, to use as part of my
teaching-AI-by-controlling-simulated-animals project. (Shame English
lost the clausal adjective construction: it's handy in Dutch and
German :-). This slow PS produces a log showing each match-resolve-act
stage as it cycles. What I need now is a fast system that can be used
with big rule-bases/long-running programs, and that I can make
behaviourally identical (apart from logging) with the slow one.
2) A meta-interpreter for implementing coroutines. Example:
test :-
goal_to_coroutine( count(10), C ),
test_count( C ).
test_count( C ) :-
resume( C, Result ), % Resume or start C.
% Result will be unified with
% the argument to the next call
% C makes of 'suspend'.
write( Result ), nl,
test_count( C ).
count( N ) :-
write( 'Suspending' ), nl,
suspend( N ), % Return N as result.
write( 'Resuming' ), nl,
Next is N + 1,
count( Next ).
Again, I want this for the animal. My simulation works in a cycle:
update animal's perceptions, call animal's "brain" predicate, act on
result. Many "brains" are easiest to write if control appears to go the
other way: that is, the "brain" is in a continuous loop, and calls
suspend each time it has to return a result to the world simulator. This
saves a lot of nasty program inversion. I was able, for example, to make
the animal crawl in depth-first, breadth-first, and other search
patterns along trees, just by taking the standard code for these, doing
some simple transformations to add the between-node walks, and inserting
calls to 'suspend'.
I have implemented coroutines in Poplog: very easy to do, using Pop
processes (bet you can't do that in Quintus without operating-system
support...). However, I'll eventually be publishing this software in my
next book, and I'd like a portable version. (Failing that, does anyone
have a system for automatically inverting coroutined programs?).
Any other software for animal control, e.g. planners, would also be
welcome. This has to be public domain, since I'll be making all my code
freely available, but I'll acknowledge all donors.
Jocelyn Paine
Re: Wanted: production system/coroutiner
Author: John E. Kreznar
Date: Sun, 30 Aug 1992 05:34
Date: Sun, 30 Aug 1992 05:34
14 lines
946 bytes
946 bytes
In article <1992Aug25.202004.8511@vax.oxford.ac.uk>, popx@vax.oxford.ac.uk writes:
> I'm looking for two Prolog programs:
>
> 1) ...
>
> 2) A meta-interpreter for implementing coroutines.
Have you seen L.M. Pereira's "Logic control with logic" in _Implementations of
Prolog_, J.A. Campbell editor, Ellis Horwood Limited, 1984? Section 2.2 of the
paper is entitled "An Interpreter to Control Coroutining".
--
Relations among people to be by mutual consent, or not at all.
---John E. Kreznar, jkreznar@ininx.com, uunet!ininx!jkreznar
Re: Wanted: production system/coroutiner
Author: popx
Date: Sat, 05 Sep 1992 17:37
Date: Sat, 05 Sep 1992 17:37
31 lines
1927 bytes
1927 bytes
> In article <1992Aug25.202004.8511@vax.oxford.ac.uk>, > popx@vax.oxford.ac.uk writes: > > I'm looking for ... a meta-interpreter for implementing coroutines. > > > Have you seen L.M. Pereira's "Logic control with logic" in > _Implementations of Prolog_, J.A. Campbell editor, Ellis Horwood > Limited, 1984? Section 2.2 of the paper is entitled "An Interpreter to > Control Coroutining". > > John E. Kreznar, jkreznar@ininx.com, uunet!ininx!jkreznar > Yes I have, thanks for the reference. I was hoping to get a reply from someone who had used such a meta-interpreter seriously, and who had optimised it. The code in Pereira's article is easy to read, but (for that reason), not as efficient as it could be. Pereira gives a listing, and then says "Although this rendering of the interpreter is clearer than others, it is not very efficient as it stands. Use of the cut, more indexing, and non-normalised resolvents and clause bodies permit much more efficient versions, even surpassing in efficiency compiled Prolog in the case of programs that do benefit much from the special control. They also surpass lower-level implementations (see Filgueiras, M: "On the implementation of control in logic programming languages", Research Report, Departmento de Informa'tica, Universidade Nova de Lisboa, 1984). I want my meta-interpreter to be capable of co-routining _large_ programs (animal "brains", containing production systems, planners, etc), so time and space efficiency is important. Jocelyn Paine
Re: Wanted: production system/coroutiner
Author: Aaron Sloman
Date: Sun, 06 Sep 1992 10:58
Date: Sun, 06 Sep 1992 10:58
34 lines
1678 bytes
1678 bytes
popx@vax.oxford.ac.uk writes:
> Date: 5 Sep 92 17:37:56 GMT
> Organization: Oxford University VAX 6620
> I want my meta-interpreter to be capable of co-routining _large_
> programs (animal "brains", containing production systems, planners,
> etc), so time and space efficiency is important.
It is possible that someone has said this already, but if you don't
insist on portability you can use the "lightweight process"
mechanism in Poplog, which works with prolog, I believe. For details
see the online Poplog file
REF PROCESS
which describes consproc, runproc, suspend, resume. LIB TPARSE,
described in HELP TPARSE illustrautes the use of the mechanism in a
simple top down parser written in Pop-11 that finds all parses by
backtracking.
For information on using the mechanism with Prolog see the prolog
help file
PLOGHELP PROCESSES
You may need help from someone who has already done this, e.g. one
of the Sussex Poplog people.
Aaron
--
Aaron Sloman, School of Computer Science,
The University of Birmingham, B15 2TT, England
EMAIL A.Sloman@cs.bham.ac.uk
Phone: +44-(0)21-414-3711 Fax: +44-(0)21-414-4281
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads