Olivier,
here's one way to do it. In the BatchSwarm and/or the ObserverSwarm, you
insert code like this:
// a. In method buildActions() insert a stop schedule like this (where
'experimentDuration'
// is the step at which you want the simulation to stop):
stopSchedule = new ScheduleImpl(this.getZone(), true); // autodrop
stopSchedule.at$createActionTo$message
(experimentDuration, this, new Selector
(this.getClass(), "stopRunning", false) );
// b. Then you need a method like this that executes when the above action
is triggered:
public void stopRunning () {
System.out.println
("BatchSwarm: Quitting at " + Globals.env.getCurrentTime() );
// (Do other desired housekeeping chores here)
Globals.env.getCurrentSwarmActivity().terminate();
}
That should take care of it. (Translate as needed if you are running
objective-C.)
Cheers,
Sven Thommesen