Problems with sim_agent toolkit 
Author Message
 Problems with sim_agent toolkit

Hi
        This is quite embassing really.
        My old code for sim_agent (when i was working with aaron)
        now longer runs with the newkit version for Unix platforms.
        I am making use of the teach/ref material to update this code.
        and my rule sets/systems/.families are fixable but what has
                really thrown me is this:

/* File:    simtest.p
   Author:  D.N.Davis
   Date:    04/11/99
   Purpose: Test agent defintion and method sim_run_agent for
                that definition

-----------------------------------------------------------------------*/
;;; Support for object oriented programming
uses objectclass;
;;; Rule-based mechanisms in Poprulebase
uses prblib;
uses poprulebase;
;;; The scheduler and other mechanisms in SIM_AGENT
uses simlib;
uses sim_agent;
uses sim_harness

/* Define my own class of sim_object */
define :class sim_test;is sim_object;
enddefine;

define :method sim_run_agent(agent:sim_test, objects);
    pr('Hi - sim_run_agent for sim_test class used\n');
    true->prb_chatty;
    call_next_method(agent, objects);
    false->prb_chatty;
enddefine;

/* Esc d on
    go(1);
        and the pr line in
                sim_run_agent
        for sim_test is NOT output!
*/
define go( ntimes );
lvars objs;

    [% newsim_test()%] ->objs;
    sim_scheduler( objs, ntimes );
enddefine;
/*---------------------------------------------------------------------*/



Mon, 22 Apr 2002 03:00:00 GMT  
 Problems with sim_agent toolkit
[Responding via comp.lang.pop
To reply replace "Aaron.Sloman.XX" with "A.Sloman"]

Quote:

>    My old code for sim_agent (when i was working with aaron)
>    now longer runs with the newkit version for Unix platforms.

The problem is that if an agent or object has an empty list in its
sim_rulesystem slot, then sim_run_agent is not applied to it.

So try giving your agent class a dummy rulesystem, e.g. as follows:

 define :ruleset dummy;
    ;;; empty ruleset

 enddefine;

 define :rulesystem dummyrules;

     include: dummy

 enddefine;

 define :class sim_test;is sim_object;
    slot sim_rulesystem = dummyrules;
 enddefine;

After that your go(1) will behave as expected.

I had assumed that if there's no rulesystem there's nothing for
sim_run_agent to do, and the object is there only to be sensed or
acted on by other agents. I assumed nobody would notice the change!

It looks as if I was wrong to assume this, and I should change the
definition of sim_scheduler in LIB SIM_AGENT so that instead of

                for object in sim_objects do

            unless sim_rulesystem(object) == [] then
                ....
            endunless;

It should not have the unless and endunless lines.

You can change that in your copy of the code, or else give your test
example a dummy rulesystem as above.

Sorry about that.

Aaron
===
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (NB: Anti Spam address)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/



Tue, 23 Apr 2002 03:00:00 GMT  
 Problems with sim_agent toolkit
[Posting via comp.lang.pop
To reply replace "Aaron.Sloman.XX" with "A.Sloman"]

Darryl davis wrote a few days ago:

Quote:
> >       My old code for sim_agent (when i was working with aaron)
> >       now longer runs with the newkit version for Unix platforms.

I wrote, in respose to Darryl

Quote:
> Date: 5 Nov 1999 00:08:34 GMT

> The problem is that if an agent or object has an empty list in its
> sim_rulesystem slot, then sim_run_agent is not applied to it.
> ....
> I had assumed that if there's no rulesystem there's nothing for
> sim_run_agent to do, and the object is there only to be sensed or
> acted on by other agents. I assumed nobody would notice the change!

> It looks as if I was wrong to assume this, and I should change the
> definition of sim_scheduler in LIB SIM_AGENT

I have now made the changes required in this file

    http://www.cs.bham.ac.uk/research/poplog/newkit/sim/lib/sim_agent.p

also described in HELP sim_agent_news.

The changes are now in the relevant tar files

    newkit.tar.gz
    sim.tar.gz

in this directory
    ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/
    http://www.cs.bham.ac.uk/research/poplog/

Apologies for trouble and confusion caused by the change.

So now even if an agent or object has an empty sim_rulesystem slot,
sim_scheduler will apply sim_run_agent to it in every timeslice.
Users can then redefine the method sim_run_agent to do whatever is
required for that type of agent.

Aaron
--
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman AT cs.bham.ac.uk   (NB: Anti Spam address)
PAPERS: http://www.cs.bham.ac.uk/research/cogaff/



Thu, 25 Apr 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. The sim_agent toolkit - demonstration movies on web page

2. The sim_agent toolkit - demonstration movies on web page

3. Output with sim_agent

4. Toronto Toolkit problem

5. Free API Toolkit Problem

6. Nanforum Toolkit -- FT_WRITELN() problems

7. Programmers Toolkit calendar problems

8. Programmers Toolkit calendar problems

9. TCP/IP Toolkit Problems

10. Programmers Toolkit: DateRanger() Problems

11. ABCFree toolkit problems (C55ee gold ABC)

12. SQL Toolkit -- problem searching Date/Time field in Access

 

 
Powered by phpBB® Forum Software