Print

Print


Ah no, definitely not a bug.  But certainly a misfeature for you.

If you enter the seed into the GUI's seed text field, you'll get the  
same behavior as running non-gui.  But of course you want to specify  
the seed programmatically.  It's not a bug because in a GUI the user  
expects to be able to set that text field, not have it overridden.

For the moment, you can just comment out that line, and the GUI will  
never change the seed.  But I have to mull over a better approach for  
you which doesn't get weird for GUI users.  There's gotta be a way....

Sean

On Jul 21, 2010, at 1:56 AM, Joerg Hoehne wrote:

> 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