swarm-support
[Top][All Lists]
Advanced

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

Re: [Swarm-Support] creating agents using a schedule


From: Paul Johnson
Subject: Re: [Swarm-Support] creating agents using a schedule
Date: Wed, 22 Sep 2004 15:39:01 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803

Yes, you can create and kill agents whenever you want. No need to limit yourself to buildObjects method. If I were you, I'd write a method

Use a list and schedule agents in there to step, and then you can add a method that puts more agents in your list, and scheule that.

- addAgents
{
    int N= 15;
    int i;
    for (i=0; i<N; i++)
      {
         Heatbug * aBug = [blah blah];
         [listOfBugs addLast: aBug];
       }
  return self;
}

Then when you want more agents, arrange to call that.


Mervin Chan wrote:
Hi all,

I am using swarm with JAVA. I have a question with regard to creating objects.

I understand that I can only create agents within buildobjects().

Like so:

Public object Buildobjects()

{

abug = new SimpleBug( …. )

}

As such, agents are created before the simulation is run. Is it possible to insert into the schedule to allow the creation of agents at pre-defined (or random) timesteps. Instead of pre-defining all my agents in buildobjects()

Ie: for every X timesteps, create Y number of agents. Do until Simulation end.

Thank you.


------------------------------------------------------------------------

_______________________________________________
Support mailing list
address@hidden
http://www.swarm.org/mailman/listinfo/support


--
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
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]