Introduction to RePast
In this practical you'll have a go at building a RePast agent-based model of the much-predicted Zombie Apocalypse.
Go to the RePast website and download the Windows version (alternatively, you can find it at N:\Earth&Environment\Geography\FileStore\PGTaught\RePast). Once RePast is installed on your M: drive (Warning: it needs 500+Mb space) work your way through the introductory model building tutorial. Read the text below first - it is full of handy hints.
The tutorial is generally well explained, but doesn't distinguish well which classes you need to import (there are several in RePast with the same name but in different packages). With that in mind, here's the import statements you'll need: imports.txt. If you want to do it yourself, the main thing is to just not except the first option Eclipse gives you - think about which package each class is likely to be in.
You'll need to know a few pieces of java syntax that weren't introduced in the Core module. We've covered these in various places, but as they weren't in the Core module I thought it might be useful to draw them together in one place for you now: Generics; Annotations; For-each Loops; instanceOf.
You can cut and paste out of the tutorial pdf, but just remember to remove the line numbers and extra spaces, especially from Strings. In particular watch out for the XML file - you don't want any spaces either side of the "=" signs or in any of the Strings. If this file is wrong, you won't see options for adding displays etc. If you do cut and paste, you can format the text in Eclipse by selecting it, right-clicking it, and selecting source -> format.
Note that when you run the model it can take a minute or so to appear and another minute or so to initialise.
To view the graph, you may have to play around with the window - it appears behind the Zombie model. Minimised windows can be found on the far right of the model application.
The Excel loader is a little fragile. It needs the full path to excel, including "excel.exe" at the end, and if there are any spaces in the path, it needs the lot putting in double-quotes.
The installer build option is under the drop-down list you use to run the model in Eclipse.
Zombie example model files, including the icons, are not in the Zombie workspace that opens, but in the RePast directory Models subdirectory under JZombie_Demo.
If you get that working, and want to see a larger scale model that uses proper Geography, with road-routing and decision-making behaviour, Nick Malleson has simplified his burglary model (see his publications page) down to a short tutorial.
In the tutorial, poverty stricken Bankers ransack houses for money. You can find the tutorial here: Bankers!, and the associated project files you'll need at N:\Earth&Environment\Geography\FileStore\PGTaught\Bankers. The repastcity_bankers directory is a Eclipse project you can import to get to the starting point of the tutorial. The repastcity_bankers_end directory is a Eclipse project containing the finished code from the tutorial. It is worth working through the tutorial: a) because it will give you some idea what a full model looks like (even though this is considerably stripped down), and b) Nick stripped his model down to the urban elements so other people could use it as a framework for other models that involve things moving around cities - it is an excellent starting point for this kind of thing. You can find the basic framework here: RepastCity.
Finally, I should note that claims that the virus was caused by rage-infected monkeys have now been dismissed as bullsh...