ABM with Mason
Spring 2017
Agent-Based Modeling with Mason
To build an agent-based model in Java requires a LOT of programming and verification that the code written works as intended. A basic principle that we will be following is to use already developed and tested tools for modeling wherever possible. This is why we will be using a programming environment that already provides us with many of the tools we need to build ABMs. There are many simulation environment available and the list is growing. We will be using MASON. There are several reasons for this choice:
(1) The environment is Open Source.
(2) Because MASON is open source, we have access to the source code and the full power of Java, which allows us maximum flexibility to create ABMs that fit our specifications.
(3) MASON is extremely fast and has been optimized to run very fast, which is important for computationally intensive simulations.
There are drawbacks as well. To use MASON efficiently, one has to learn how to program in Java, which does take time and practice.
Inheritance
Perhaps the main virtue of object-oriented programming is the reuse of code. Reusing code is good for at least two reasons. First, we don’t have to solve the problem again and write the code. Second, and perhaps most importantly, we can reuse code that has been tested and verified, so that we know that it works as intended.
We do this by the mechanism of inheritance. This amounts to defining a subclass based on an already defined class. In Java, every class we define is actually a subclass of the class Object, The class structure of Java is illustrated in the figure below.
In MASON, there are many classes that are already developed for creating agent-based models. We will use these classes to create our models, if we only use what MASON has to offer, there is still a lot of coding required to produce interesting models. What se can do to gradually overcome this problem break down our modeling problems into functional units that we can reuse in model after model. Thus, the more we do and share, the easier it gets.
MASONex is a project I have started to do just that: make programming really fast ABMs easier by reusing functionality as illustrated in the diagram below:

