[Agent practical 9 of 9]
Having now built our ABM, let's now use it to model something. We'll run through the whole sequence, from preparing our model, through calibration, including some comparison with real data, and then making a prediction. At the same time, we'll look at using genetic algorithms in calibration, and parallel processing.
Here's our code, as it stands at the moment, with full(ish) comments etc., plus the docs:
The first thing we need to do is adjust our model so it works in both GUI mode, which is good for development, visualisation, and public displays, and command-line mode. Command-line mode is good for running large numbers of simulations as a "batch" (a large number set running in one go), but also allows us to adapt the model when we run it using command line arguments.
Command line arguments allow you to pass information into a program when it runs. We've been using them from the first practical, but you may not have noticed. The command:
runs the "java.exe" program, and passes it the command line argument "HelloWorld". This argument is then used inside the "java.exe" program, for example as the class filename to search for and read.
We need our program to do the same. It is usual, when modelling, to want to run the same model with lots of different datasets, variable values, iterations, etc. We'll look at an example when we look at calibrating our model in a bit. Being able to set these things up at the command line will help enormously; for example, we could then write another program which runs our model multiple times with different settings drawn from a population of values.
Hopefully you'll recall that the way we get command line arguments into Java programs is which the
(String args) parameter, which the operating system and JVM pass command line arguments to.
We'll look in a bit at utilising these. For the moment though, let's look at which values we want to pass in.