On May 18, 2010, at 3:41 PM, Steven Saul wrote:

> thanks for the reply once again.  It sounds like my agents don't have
> quite as much info as those you referred to which each had a map in  
> their
> brains, I just need to make a lot of them because i'm modeling 5  
> species
> of fish off of Florida, where each species abundance is about 5  
> million
> fish (i.e. about 25 million fish agents).

Good grief!

> Each fish has about 16 int parameters, 33 doubles, and a few booleans.
> The fish species don't
> interact with one another, but instead are fished by a fishing fleet  
> (~600
> agents so no big deal).

Each fish is about 4*(1 + 16 + 33*2 + 1) = 336 bytes.  That comes to  
40 gigabytes of fish.  That surely cannot be right.

The biggest MASON model I am aware of was done in-house here at GMU,  
involving about 80 million agents doing moderately sophisticated  
things.  Even with a 16-processor box, loaded with memory, we still  
didn't have enough power and had to go to a more compact  
representation in C.  The basic issue was memory: Java's too costly  

With 40 gigs of fish I think you're out of MASON's range.  First, I'd  
cut the ints and doubles down to shorts/bytes and floats if possible.   
But even then you're trading speed in one fashion (Java works faster  
when it has a smaller footprint and so has more space to GC) for speed  
in another fashion (converting floats to doubles on-the-fly to do math).

> Any thoughts on the best way to set up each species of fish
> (type of agent) on its own thread?

I would have each species of fish in its own grid totally separate  
from the other species if possible.  For speed I'd try to go with  
ObjectGrid2D instead of SparseGrid2D if you can (or we have in-house a  
new Grid2D called DenseGrid2D which might give you some of the  
SparseGrid2D features but be a bit faster).

You want to avoid putting agents on the Schedule, which is O(n lg n).   
I'd put all the agents in one Sequence.  Ideally you'd not need  
RandomSequence, which is a bit slower.

Then I'd put all five Sequences in a five-way threaded  
ParallelSequence.  Finally, I'd stick that ParallelSequence on the  

> Also, I have studied the 16 StupidModel tutorials that were  
> implemented in
> MASON and noticed that they are setup kind of differently, where  
> instead
> of placing the methods of each agent (i.e. StupidBug) in the step  
> method
> call of that object, each method from the agent (StupidBug) was  
> instead
> called in its own steppable.  Is there any advantage for setting up  
> the
> model this way verses the way you have set up the MASON tutorials and
> examples?

Ugh, the StupidModel tutorials.  When the guys who built those models  
contacted me, I looked at their examples and told them that there were  
tons of really dumb things they were doing.  They were bad examples  
and it was clear they (or more correctly, the student they had  
contracted with) didn't really understand how to code these things  
properly.  :-(  Unfortunately they never fixed things, and a lot of  
their conclusions are also plain wrong (such as MASON not having  
histograms, etc.  Geez.)  I guess we should take out some time to fix  
their nonsense.  It causes a fair bit of braindamage.