MASON-INTEREST-L Archives

April 2007

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Sun, 15 Apr 2007 10:37:05 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (51 lines)
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

	stopThis.stop()

You might schedule a "stopper" in the future which does this at a  
preordained time:

         final Stoppable stopThis = schedule.scheduleRepeating(agent1);
	schedule.scheduleOnce(theTimeInTheFuture, new Steppable()
		{
		public void step(SimState state)
			{
			stopThis.stop();
			}
		});

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.

Sean

ATOM RSS1 RSS2