Tony, it's not too tough at all. All you need is a function which
picks a random interval of time based on your probabilistic
distribution. Then in the agent's step() method, the first thing you
say something like:
double delta = random_interval_of_time();
state.schedule.scheduleOnceIn(delta, this);
And you're done! If you want a more abstract thing, we can put
together a class which does arbitrary repeats. Like Repast, you can
also replace or subclass MASON's schedule. For example, we could
modify the Repeat inner class to call a function in Schedule to get
the interval to step by rather than a fixed interval, and then you
just override that function to provide the interval you like.
Sean
On Jun 30, 2011, at 1:54 PM, Tony Bigbee wrote:
> Hi,
>
> There may only be one or two MASON core team members on this list
> who can answer this question, but:
>
> I've inherited some code in an internal project that uses a
> subclassed AbstractAction from Repast so that things are stepped
> according to a probabilistic distribution--instead of stepping at
> precise intervals, such as every 10 ticks, scheduled entities are
> stepped, on average, every 10 ticks:
>
> "GeomAction provides an IAction that repeats at intervals drawn from
> the geometric distribution. The interval parameter passed into the
> constructor is the probability that the action occurs in one
> tick.The event [AbstractAction] converts the interval to log(1-P) to
> increase efficiency in computing the interval. The interval for
> rescheduling will be ceiling(log(U)/log(1-P)) where U is a draw from
> the uniform random distribution between 0 and 1.0"
>
> Repast allows you to replace their "schedule" with a custom version,
> and ours creates GeomAction instances as described above. They use
> reflection and annotated methods rather than a step() approach like
> MASON, but that's not the important part of this.
>
> Is geometric scheduling would be something that I could implement in
> MASON and what the scope might entail? I would like to consider
> switching our project to MASON.
|