Tuesday, February 9, 2010

Repast Simphony: A Feast for the Mind

Mike recently posted a one-off model of urban evacuation, written in the NetLogo modeling language. NetLogo is a wonderful toy, and the environment as a whole is a great way to introduce agent-based modeling (ABM) to university students who have little programming experience; perhaps its best feature is the ability to get "down and dirty" with coding your own models from the start.

Ultimately, however, the utility of NetLogo for "serious research" is questionable, and it is arguably better suited for illustration (as Mike has used it here), rather than serious mathematical analysis. Often, the simple syntax of the NetLogo environment constrains its applicability to real-world problems, since models must conform to the "turtles and patches" spatial structure upon which NetLogo is founded.

The alternative is to learn OOP (C/C++, Java). This would, of course, allow you to construct models "from scratch", but learning a new programming language is demands a serious investment of time and/or money. Not to mention that much of the syntax you memorize at the outset will ultimately prove useless in finding the ABM perfection that you seek.

Enter Repast Simphony. Repast - aka the REcursive Porous Agent Simulation Toolkit - is the greatest open source software that you never knew existed. Like NetLogo, Repast is based upon Java. Like NetLogo, Repast is free. Unlike NetLogo, Repast complexifies, rather than simplifies, the process of modeling.

The list of features alone mark Repast out as a "serious" ABM tool, intended for conceptually and computationally heavy research. First, models can be developed using Java, Groovy (a Java language), or flowcharts, or any combination thereof. Repast also features automated connections to the R statistics environment, *ORA, SQL databases, VisAD (Visualization), Weka (datamining), and MATLAB, allowing for the easy mathematical analysis of the complex and emergent behavior generated by ABMs. Importantly, Repast has a very flexible definition of space, allowing you to chose between 2D space, 3D space, network space (using JUNG). Most importantly, Repast allows you to use "geographic" spaces derived from 2D and 3D GIS data. Finally, for those computationally heavy models that require a neutronium-supercolliding-computer to complete (ahem, Mike), Repast supports distributed computation with Terracotta, letting you tie up your department's computer lab for days on end.

So what's the catch? The learning curve is much, much steeper than Netlogo. Ideally, you should already be familiar with OOP and the basic syntax of Java or C/C++ before you attempt the tutorials. Even the flowchart interface requires you to know how to call Java functions - think "int myX = grid.getLocation(this).getX()" - in order to build your model. In fact, having worked through several of the Repast tutorials myself, I can say that attempting to learn Repast in the flowchart interface alone can be even more confusing than learning to code alone, in part because syntax errors are much easier to make, but mostly because it is difficult to see how the different parts of you model interact

The ultimate results of modeling in Repast are, however, indisputably impressive. Given enough time, willpower, and a willingness to repeatedly pound your head against the keyboard, Repast has the potential to generate the most complete - and completely analyzed - ABMs in use today.

Surface Model 2D/3D


Autocatalysis Model 2D/3D




Flocking Bird (with network connections on the right)

3 comments:

  1. In fairness to netlogo there is a GIS extension: http://ccl.northwestern.edu/netlogo/docs/gis.html

    Also I use AnyLogic - which is a very good proprietary Agent-based Modeling software package with GIS capabilities (based in eclipse, like repast, but in my opinion 100x easier). It is pretty cheap for academic use, but very expensive for a private license. It also has system dynamics modeling functionality.

    -Michael

    ReplyDelete
  2. link to anylogic: http://www.xjtek.com/

    ReplyDelete
  3. Are you shure Repast allows 3D spaces ?

    ReplyDelete