WCSS 2006 Introduction to MASON
MASON is a discrete-event simulator designed for very large "swarm-" style simulations. It is written inJava and is free open source, available at theMASON home page. MASON has grids, continuous regions,networks, hexagonal spaces, etc., all in 2D or 3D, plus the flexibility to create your own "space" datastructures. Any object can be inspected ("probed") in 2D or in 3D, and tracked with histograms, time seriescharts, etc. Among the simulators you may be familiar with, MASON is most similar to RePast.MASON was designed from first principles for large numbers of simulations on back-end clusters. To thisend it has a number of architecture features which make it somewhat different from other simulationpackages:
MASON's models are separated from its visualizers.
You can dynamically attach visualizers,detach them and run on the command line, or attach different ones. This allows us to
(serialize, or "freeze-dry") a running MASON simulation to a file, move it to a
,and continue to run it. For example, we can run a MASON simulation with no visualization tools atall on a back-end Linux machine, checkpoint it, and examine/tweak the simulation mid-run on afront-end Mac under visualization. We can then put it back and continue to run from there. Amongcompiled-code multiagent simulators, MASON is unique in this respect.You'll see this architecture in the tutorial's separate
MASON is written in highly portable Java,
backward-compatible with Java 1.3.1, so as to run onas many legacy cluster systems as possible.
MASON pays very careful attention to speed.
It has special data structures which are designed tobe hacked at a very low (and potentially unsafe) level if speed is called for. In this tutorial, suchstructures include Bag, IntBag, DoubleBag, and ObjectGrid2D. MASON also uses a highly efficientimplementation of the Mersenne Twister random number generator, and has both "fast" and "slowbut flexible" versions of much of its visualization toolkit.In the tutorial,
we will be using these data structures and visualizers but will not be takingadvantage of their faster procedures; rather we'll stick with slow-but-safe approaches.
As aresult, our simulation model will run at about 1/3 (or less) the speed it
run, and our visualizerwill likewise run at about 1/5 the speed. But it will make the tutorial easier to understand.
MASON is compatible with ECJ
, our open-source evolutionary computation and stochastic searchlibrary, and presently among the very best available.
MASON is highly modular
. MASON was designed to be easily modified, extended, and otherwisebent any which way. We have tried hard to make the simulator core cleanly structured. A great manyelements of MASON can be separated and used by themselves independent of the reset of thesimulation package.
About the Tutorial
We will develop a simple version of the Schelling Segregation model. In this version of Schelling, Red andBlue agents live in a non-toroidal grid world. Each agent computes its happiness as a function of the sum of like-colored agents around it, weighted by distance from those agents. If an agent is not happy enough, itpicks a random empty location to move to. All agents have an opportunity to move once per time tick.As mentioned above, our example tutorial has emphasized tutorial brevity and simplicity over speed; thuswe use slow-but-safe mechanisms whenever. At the very end of the simulation, we do show how to use a"faster" drawing procedure, which you may be interested in.Here's the tutorial:1. Get MASON Running (not in the tutorial -- we'll do this by hand)2. A Minimum Simulation