swarm-support
[Top][All Lists]
Advanced

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

Agent Death in Java


From: Jason York
Subject: Agent Death in Java
Date: Wed, 19 Jul 2000 11:01:00 -0400

Hello, I am relatively new swarm user who has thus far been working only
in Java.  I am working on a program involving swarm death and birth, but
I am having trouble killing off my agents.  I'm using a simple schedule
taken from the Java Tutorial:

  schedule = new ScheduleImpl (thZone, 1);
  try {
   schedule.at$createActionTo$message (0, this,
      new Selector (getClass (), "takeStep", false));
  }
  catch (Exception e) {
   e.printStackTrace (System.err);
   System.exit (1);
  }

If I try to kill the agent during takeStep () with (getActivity
()).terminate (), the program crashes during the next timestep, giving
me the error AlreadyAtEnd.  If I try to drop () the agent, either before
or after the terminate (), I get the error SourceMessage and am told
"can only drop a top-level activity or terminated activity that is not
currently running."  I guess I don't know how to get the activity into a
state in which it is "not currently running."  I've tried creating a
function in modelswarm to drop all dead agents each timestep, but I get
the same error message.  By the way, the only List in which these guys
are found is a LinkedList in the modelswarm, and I've found that
removing a dead agent from this list doesn't help with any of the error
messages.
I'm sorry, but I haven't yet subscribed to swarm-support (I should do
that next), so please email me at address@hidden with any help you
can provide.

Thanks,
Andrew Lovett
address@hidden


                  ==================================
   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]