MASON-INTEREST-L Archives

August 2006

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:
Sat, 26 Aug 2006 15:45:08 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (53 lines)
On Aug 25, 2006, at 9:34 AM, Bruno Van Den Bossche wrote:

> We've been using Mason for some simulations now and discovered a
> "feature" which can be very annoying.
>
> It seems that the scheduler is using the random generator provided by
> the SimState. Which means that if you have a different amount of
> schedulable objects or schedule an object at different intervals this
> will influence the randomness of the simulation.

Bruno, it's very common, and generally accepted as proper scientific
modeling form, to use a single random number generator throughout
your simulation. Use of multiple generators can produce
irreproducible results if you aren't careful.

It sounds as if you have a randomly-generated sequence of events that
you would like to keep consistent despite changing the Schedule's
scheduling frequency. There's a way to hack this, but before I get
to it, let me state that what you are hoping for causes fairly big
warning bells to go off in my mind. Random number generators are
intended, on purpose, to provide pseudorandom number streams, and a
simulation which expects a specific sequence is just inviting big-
time statistical problems. You may want to rethink this carefully.

That being said, here's how to hack it. I believe the random number
generator is used by only two things: you and the scheduler. There
is no reason you can't make a second random number generator in your
SimState and use it instead. Alternatively you can change the
Schedule's random number generator to a different one (that's
probably easier). To do that, let's say the second generator has
been set to the variable state.random2. Then you just change the line:

if (substeps.numObjs > 1) substeps.shuffle
(state.random);
to
if (substeps.numObjs > 1) substeps.shuffle
(state.random2);

That should do the trick. Also, RandomSequence, if you use it, may
need to also be modified. You probably don't use it.

If you're doing things under visualization, note that the Console
sets the random number generator seed at start() time. So in your
GUIState.start() method, after calling super.start(), you may wish to
set the random2 seed as well to what you feel to be appropriate.

Once again, be very careful using multiple generators in the same
simulation. I have _never_ seen a simulation using multiple
generators -- other than a multithreaded one that had no option --
which wasn't doing so in error.

Sean

ATOM RSS1 RSS2