MASON-INTEREST-L Archives

August 2011

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 19 Aug 2011 17:12:09 -0400
MIME-version:
1.0 (Apple Message framework v936)
Reply-To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Content-type:
text/plain; charset=US-ASCII; format=flowed; delsp=yes
Subject:
From:
Sean Luke <[log in to unmask]>
In-Reply-To:
Content-transfer-encoding:
7bit
Parts/Attachments:
text/plain (39 lines)
On Aug 19, 2011, at 10:33 AM, Chris Wright wrote:

> When running the example "Flockers" program without a GUI, the results
> compared to a non-GUI version with the same seed seem to differ
> significantly. More specifically, the positioning of the "dead"  
> flockers
> appears to be the same but those of the live flockers are vastly  
> different
> at the same number of iterations. Both give consistent, but different,
> results each run.



Took me a while to realize what was happening, but it's simple:  the  
GUI version of Flockers uses the random number generator to produce  
the random colors of each flocker! If you change these lines in  
FlockersWithUI.


                     new Color( 128 + state.random.nextInt(128),
                         128 + state.random.nextInt(128),
                         128 + state.random.nextInt(128)),

to...

		   Color.red,

Then the problem goes away.  But of course the flockers are no longer  
pretty.  So that brings up an interesting question: do we want to  
guarantee the same exact result on the GUI versus the command line  
even if the GUI version uses the random number generator?  If this  
isn't a big deal (and it probably isn't) then no.  But if it matters,  
then we'd probably need a separate RNG just for the GUI, which is  
entirely doable  -- we could just build a MersenneTwister and use it,  
for example.  Not a hard thing to add.  But would an additional RNG be  
confusing?

Sean

ATOM RSS1 RSS2