MASON-INTEREST-L Archives

October 2004

MASON-INTEREST-L@LISTSERV.GMU.EDU

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

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

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Tue, 5 Oct 2004 09:57:07 -0400
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Subject:
From:
Keith Sullivan <[log in to unmask]>
Content-Type:
TEXT/PLAIN; charset=US-ASCII
In-Reply-To:
MIME-Version:
1.0
Comments:
To: MASON Multiagent Simulation Toolkit <[log in to unmask]>
Parts/Attachments:
TEXT/PLAIN (47 lines)
Another potential solution is to use the scheduleOnce method.  In the
step() method of your agents, you could test if they are alive on the
current time step.  If so, then run
        scheduleOnce(state.schedule.time()+1.0f, this)

If they are dead, then just omit the previous line.  This will effectly
schedule the agents only when they are alive.  However, this method will
not work if you have agents that die and are later resurected.

Keith

On Tue, 5 Oct 2004, Rob Alexander wrote:

> Tony Bigbee wrote:
> > Is there a recommended way to dynamically remove specific Steppable
> > objects from the schedule?
>
> I've been doing:
>
> entity.setStoppable( schedule.scheduleRepeating(entity) );
>
> ...which then allows me to do.....
>
>         if( this.stoppable != null )
> {
>       this.stoppable.stop();
> }
>
> (you'll need to define stoppable and setStoppable() in your entity class)
>
> I had a quick look at the Mason scheduler code, but couldn't figure out
> whether this truly takes the entity off the schedule (and, hence,
> whether its any more efficient than your current approach). I'll have
> another look when I have time (if Sean doesn't provide a better answer
> in the mean time, of course).
>
>
> yours,
> rob
>
> --
> Rob Alexander                   (E-mail: [log in to unmask])
> Research Associate, Dept of Computer Science, The University of York,
> York, YO10 5DD, UK
> Tel: 01904 432792       Fax: 01904 432708
>

ATOM RSS1 RSS2