Basic Agent-Based Modelling and Inheritance
[Practical 6 of 11]
This practical is going to lead you through creating a basic Agent-Based Model (ABM) using the MASON ABM toolkit. The model will implement a variant on the Schelling model of segregation. Feel free to experiment with the rules as we progress.
You will first need to download the MASON toolkit. You will also find other useful information on this page such as the manual which has some helpful tutorials.
Save the compressed file on your computer and extract the contents to a known location. Browse inside the folder structure. You should see the folder docs, ec, jar, sim and start. The two that you are going to be most interested in at the moment are the jar and docs folders.
The docs folder contains information on the classes and methods that make up the toolkit. To access this information double click on the index.html.
Inside the jar folder you will find a file called mason.17.jar. Jar files are compressed file formats containing the binary code that the JVM reads. They are a neat way to bundle multiple java classes together once they have been compiled ready for deployment. The mason.17.jar contains all of the compiled code that the basic MASON toolkit requires.
When you have extracted the MASON toolkit create a new project in Netbeans called BasicAgents of type
Java Application. A package called basicagents
with a class called
BasicAgents
inside will be created automatically for you.
We are going to add a reference to the MASON toolkit to allow us to use the functionality provided. Right click on the Libraries folder and select Add JAR/Folder... as shown in Figure 1.
Browse to the location of the mason.17.jar you have just downloaded and click OK or choose as shown in Figure 2.
This action has added the MASON toolkit as a reference and we can now use the tools within it. You should be able to see the file in the Libraries folder as shown in Figure 2.
We have created a new project and added the toolkit we are going to use as a reference. We are now ready to proceed with the main model development in part 1 of the practical.