On Apr 15, 2007, at 5:21 AM, Rick wrote:
> What I want to do is run a simulation until a flag = true store
> that result and then run the same simulation again (x number of
> times). Preferably with the results at the end of each simulation
> being displayed in a chart. (simulations could run one after
> another or all together should not matter that much, would maybe
> like to have an option for either though if one is not a lot more
> complex than the other.
> The problem I am getting at the moment is stopping the
> schedule.scheduleRepeating() I just cant do it! think i have tried
> everything but it does not seem to stop.
There are various issues here:
- Handling the chart redisplaying itself
[for later discussion]
- Restarting an entire simulation
[if you're running from the command line, the easiest way to do
this to run N simulation runs via your outer simulation stepper --
for example, you could just say sim.app.blah.Blah -repeat R ]
- killing a repeat
Killing a repeat is easy. When you call scheduleRepeating, you get
back an object called a Stoppable.
Stoppable stopThis = schedule.scheduleRepeating(agent1);
All you have to do is squirrel away this Stoppable until the time
comes when you'd like the repeat to stop, at which time you call
You might schedule a "stopper" in the future which does this at a
final Stoppable stopThis = schedule.scheduleRepeating(agent1);
schedule.scheduleOnce(theTimeInTheFuture, new Steppable()
public void step(SimState state)
Mark is correct about killing a whole simulation, but you should only
do that if you can't find all the repeated scheduled items you set up.