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|
Using command line.
Compiling and running.
|Starting our model||
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.
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.
|Structuring our model I||
Tying two object classes together.
Accessors and mutators.
|We shift the agent behaviour into the agents.||
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.
java.awt.Polygon for area searches.
|We reduce model artifacts and add neighbourhood-based behaviour.||
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.|
Building a GUI.
Frames and Menus.
|We build a user interface.||Comparing Strings.|
|We get our data and agents to display.||
Floating point number issues.
|Modelling for real||
Using other's code.
We run our model in a batch.
We calibrate our model using a genetic algorithm.
We run in parallel.
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: