MASON-INTEREST-L Archives

October 2015

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:
Sun, 25 Oct 2015 13:40:09 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (19 lines)
On Oct 25, 2015, at 3:39 AM, Ernesto Carrella <[log in to unmask]> wrote:

> It seems like using elements() to bag agents and then step them in a for loop is a recipe for artifacts: agents in the top left corner always act before agents in the bottom right.

Bag vals = grid.elements();
vals.shuffle(state.random);

And you're ready to go.

> I usually do what Russell does, keeping a reference to agents in a separate collection and stepping that, but I prefer an ArrayList to aBag; partially because of generics but mostly because I can call Collections.shuffle(agentList,random) and randomize their order before stepping them.

I would recommend strongly against using java.util.Random, and hence Collections.shuffle(...)

> The only caveat is that MersenneTwisterFast is not a kosher Random object so you can’t pass it directly, but you can just pass a seed from the MASON randomizer to a standard Java one (or extend the MASON one so that it fulfills Randominterface).

Again: it is unwise to use java.util.Random in a simulation.

Sean

ATOM RSS1 RSS2