Practical Outline

The practicals are designed to build up your basic coding skills but also to cover some aspects of modelling.

As such they cover key skills, but also build up an Agent-Based Model (ABM), introducing core ideas in the area of modelling and giving you a code base suitable for ABM and a wide range of other software.

Practical Key skills Model Code themes
Introduction Using command line.
Compiling and running.
Core class. JVM.
Starting our model Primitive variables.
Object variables.
Variables inside objects.
Objects inside arrays.
Variables inside objects inside arrays.
Variables inside arrays inside objects.
Basic model classes. Structuring object-orientated software.
Debugging classes and arrays.
Running our model. Single counting for loops.
Nested counting for loops.
For-each loops.
Do-while loops.
We add to our structure:
an environment containing data;
a set of agents that move around;
agents quering the environment;
agents interacting with the environment.
Debugging arrays.
Structuring our model I Constructors.
Tying two object classes together.
Accessors and mutators.
Protecting variables.
We shift the agent behaviour into the agents. Object labels.
Well structured and protected code.

At this stage, we've finished the basic agent model, and our code looks like this:

Structuring our model II Building an inheritance hierarchy.
Using method calls in conditions.
Calling methods within the same class.
We make the model flexible and future-proof.
We add a stopping criterion.
Using system time to time runs.
Finishing the core model Importing and using packages.
Collections framework.
java.awt.Polygon for area searches.
We reduce model artifacts and add neighbourhood-based behaviour. Model artifacts.
Open Source licenses.

At this stage, we've finished the flexible agent model, and our code looks like this:

File I/O File reading and writing. We get real data into our model. The advantages of code in methods.
GUI Building a GUI.
Event-based programming.
Frames and Menus.
We build a user interface. Comparing Strings.
Images Images.
Processing data.
We get our data and agents to display. Floating point number issues.
Using null.
Enabling menus.
Modelling for real Using other's code.
Parallel coding.
We run our model in a batch.
We calibrate our model using a genetic algorithm.
We run in parallel.
Shell scripts.

At this stage, we've finished the full model, and our code looks like this:

For those who are feeling especially keen, there is a final chapter to this practical sequence, not part of the summer school, but which might be of interest. This covers how to add user interactions to your model. It takes the example of using the keyboard to control one of the agents, but could be used, for example, to set up the model so mouse-clicks add additional agents as the model is running. More generally, it also covers using "threads", a way of separating off processing jobs from the main program.

You can find the practical here: User interactions

And it develops the following two classes:


In addition there are practicals for the hacking days that include useful generic information on:

  1. Using IDEs
  2. Using GitHub
  3. Web scraping