swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamically-created swarms


From: Michael Krumpus
Subject: Re: dynamically-created swarms
Date: Sat, 20 Nov 1999 22:33:44 -0600 (CST)

> 
> Should work fine...  Here's a Java example that exactly duplicates your 
> architecture:
> 
>    http://www.santafe.edu/~mgd/hierarchy-0.0.tar.gz
> 
> Perhaps you are missing an activateIn entry or a call to buildActions
> somewhere?

Thanks, Marcus, for providing a code example that shows this multi-layer
architecture.  I have had no problems getting this to work except for
when I am creating new agents "on the fly".  For example, imagine if
the population also maintains a schedule which calls a "step" method
in the population.  Such a method could, for example, clean up dead
agents on a reaper queue.  Additionally, my population step method
creates new agents and adds them to the population:

newAgent = [Agent create: self];
[newAgent buildObjects];
[newAgent buildActions]; // builds a schedule that calls agent's step method
[newAgent activateIn: self]; // self is the population


The Agent activateIn method is as you would expect:

- activateIn: swarmContext
{
    [super activateIn: swarmContext];
    [agentSchedule activateIn: self];
    printf("activity status = %s\n", [[[self getActivity] getStatus] getName]);
    return [self getActivity];
}


Even though the same code is used to create the initial populations of
Agents and to create Agents later in the simulation, the ones created
later do not run.  Their agent schedules are never executed.  I think a
key to solving this is that the status of the activity returned by
activateIn is "Initialized" for the agents in the initial population,
but the status is "Completed" for agents created dynamically during the
simulation.  I've spent a lot of time wading through the activity
library source in gdb, but still can't quite figure out why this
doesn't work...

-mk

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]