Print

Print


On Tue, 20 Jul 2010 09:38:44 -0400, Sean Luke <[log in to unmask]> wrote:

>On Jul 20, 2010, at 3:33 AM, Joerg Hoehne wrote:
>
>> Is there (an intended) different behavior between gui and non gui
>> simulations?
>
>Nope.  They should be absolutely, 100% identical.  So this is
>definitely interesting.  What makes it more interesting is that I
>cannot immediately think of a single thing in MASON proper which could
>possibly cause it.  We go through a lot of hoops to make sure that the
>model code is separate from the GUI code.

I found the bug/feature (but more likely a bug) in the Console.java code:

    void startSimulation()
    {
        removeAllInspectors(true);      // clear inspectors
-->    setRandomNumberGenerator(randomSeed);
        simulation.start();
        updateTime(simulation.state.schedule.getSteps(), 
simulation.state.schedule.time(), -1.0);
        //setTime(simulation.state.schedule.time());
        //setStepsPerSecond(-1.0);  // negative value, guarantees nothing is 
shown



Invoking setRandomNumberGenerator does:

    void setRandomNumberGenerator(final int val)
    {
        doChangeCode(new Runnable()
            {
                public void run()
                {
-->                        simulation.state.setRandom(new 
MersenneTwisterFast(val));
                }
            });


I've checked the id of the MersenneTwisterFast during the simulation and the 
id (hence the object) changed in the GUI version before the first simulation 
step.

Honestly I'd like not to tamper with the code because I do not have a deep 
insight into the logical structure so I'd like to leave it up to you.


Jörg