Hi Joerg, I've been making a lot of cleanups out on SVN as I go
through all the code as I write each chapter of the manual and
discover things in the code which are less than optimal. I then
deprecate or slightly tweak it. It's a good exercise but it'll drive
you nuts, sorry about that. :-) Wait till people complain about the
revised charting code API.
So you've got the right idea. SimState's constructor is really
*really* simple:
public SimState(long seed)
{
this.random = new MersenneTwisterFast(seed);
this.schedule = new Schedule();
this.seed = seed; // for GUIs later on if they want to
know...
}
This means that all you have to do is call super(seed), then just set
the schedule as you like, exactly like your example below. I expect
your code to be safe for the foreseeable future.
So I'm interested: what kind of code are you executing before and
after each step? Is there a reason why MASON's "ordering" facility
wouldn't be sufficient? Should we be thinking about adding a gizmo to
the existing Schedule?
Sean
On Mar 22, 2011, at 2:32 AM, Joerg Hoehne wrote:
> Hi developers,
> in the current svn repository the SimState class was modified at
> least the
> constructors. This class does now only provide one constructor
> accepting a
> long a seed value for the random number generator.
> In older releases it was allowed to specify a scheduler what I did
> in the past.
> I'm using a subclassed scheduler to execute some additional code
> before and
> after each simulation step.
> Now I set the scheduler immediately after invoking super(seed) as
> the code
> example shows below.
>
>
> private AbstractSimulation(IUserSimulation userSimulation) {
> super(1);
> this.schedule = new ScheduleExtended();
> <and some more code>
>
> My question is: Is this a safe way to set up an own Schedule object
> and will it
> be safe in the future?
>
>
> Jörg
|