August 2011


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
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Tue, 2 Aug 2011 14:04:29 -0400
text/plain (48 lines)
On Aug 2, 2011, at 12:42 PM, Sam Brett wrote:

> I've noticed that in the scheduling methods of the Schedule class that
> intervals and times can be doubles. Is this still integral time with  
> some
> divisor? Is there some fixed timestep or can one schedule at any  
> time? Is
> there a performance hit if some intervals are not repeatable (i.e.
> irrational)? So I guess what I'm really asking is if time is still  
> discrete
> and steppables are lumped into bins or if the schedule is truly  
> asynchronous
> now. I know for a long time MASON had only discrete timesteps.

You can schedule events for any double-valued timestamp >= 0 other  
than +Infinity.  There's no discretization or binning, and no  
performance hit for unusual values.  [Note however that it's  
*impossible* to represent a truly irrational number in a computer  
numerical value]  MASON does have a specific mechanism for specifying  
the relative ordering among elements scheduled for exactly the same  

However, "asynchronous" is a loaded word.  If by asynchronous you mean  
that agents are fired off in separate threads, the answer is no (*far*  
too inefficient).  If you mean that the agents can be scheduled for  
any real-valued timestep, the answer is yes.

Here's how it works.  When you schedule an agent on the schedule, you  
provide two numbers: a double-valued TIME and an integer-valued  
ORDERING.  The time must be >= 0 and also must be >= the current  
scheduled time.  If the time is = the current scheduled time, it'll  
get bumped to the very next possible timestep representable by a  
double (basically the current time + epsilon).  The ordering can be  
any number, including negative.

Each tick of the schedule, when the schedule wishes to step (fire,  
pulse) one or more agents, it first looks up which scheduled agent has  
the lowest TIME.  It then advances the clock to that time, then  
removes all the agents which are scheduled for exactly that time.   
Then it sorts those removed agents by their ORDERING, lower-ordered  
agents sorted first.  If any agents have exactly the same ordering,  
they're shuffled: their sorted position is random with respect to one  
another.  Finally, the schedule goes through each of the agents in  
this sorted order, one by one, and calls step() on them.  Then it  
discards the agents.