swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] How to remove agents in run-time?


From: Paul Johnson
Subject: Re: [Swarm-Support] How to remove agents in run-time?
Date: Mon, 06 Apr 2009 16:46:42 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090318)

Emerson Aguiar Noronha wrote:
> Hello all,
> 
> In my simulation I need to remove agents in run-time, accordling to
> agent's local rules. I've tried to do this using a method implemented in
> the simulation's model. This method is called in ActionForEach, this code
> remove an agent from the simulation's data structures, and I've tried to
> remove it from the actionGroup in many ways.
> 
> What happens is that the agent is removed from the grid and from my
> simulation's data structure. However, the swarm action still calls the
> removed agent's step method. I've looked-up for this instance but I can't
> found it.
> 
> Anyone has already done something like that?
> 
Look in the sugar scape example. Nelson Minar showed how to do it.
Basic idea is this. You can't have an agent say "I need to die, kill me
right now." That can cause segmentation faults because things might be
scheduled concerning that agent.

In sugar scape, Nelson shows a way to create a "reaper queue" where
agents go waiting to die, and then when it is "safe" in the model's
logic to remove agents, the agents in the reaper queue get removed.


pj

> Thanks a lot,
> 


-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://pj.freefaculty.org
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700


reply via email to

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