A RePast Tutorial by John T. Murphy, University of Arizona & Arizona State University (contact)

Note: This tutorial only applies to RepastJ and earlier versions of Repast. Repast's new tool, called 'Simphony', is a very different kind of tool from the original Repast, and this tutorial does not apply to it. You should instead use the tutorials provided by the Repast team on the repast.sourceforge.net web site.

How to create a RePast model

The RePast simulation tool kit is a set of pre-made programming elements that allows you to build Agent-Based simulation models relatively easily. However, there are a number of steps that are neither intuitive (at least, not to me!) nor thoroughly explicated in any document I've yet found; this brief guide allows you to work through these.

IMPORTANT! The tutorial shows how to build a RePast model 'step by step.' The first steps that it does, though, are NOT enough to actually run the model. The first steps allow you to run RePast, so that you can see the RePast toolbar and other graphics on your screen. However, pressing the buttons on that toolbar will not work immediately; not until around Step 21 of the tutorial can you begin to press the RePast buttons with success. Until then, pressing the buttons will cause errors.


Setting up RePast is not difficult, but the details will depend on the development environment you are using. For good overviews of how to set up the RePast model, see:

Many thanks to the authors for contributing these; I would be happy to post links to any similar resources dealing with other development environments- if you have one, please send it to me.


To use RePast, you must make the current distribution of the RePast jar file available on the Build Path of your compiler; see Build Path for a discussion of how to do this.

NOTE: One user of this tutorial reported that the newer versions of RePast also require the 'colt.jar' library to be put on the build path even for the earliest steps of the tutorial; in my own work with the tutorial, generally using earlier versions of RePast, I did not need the colt library until step 21, but you may avoid problems if you add the colt.jar library to the build path from the outset. See Build Path and Step 21 for clarification.

A basic RePast model includes the following elements:

  1. A Model Object that acts as the model itself
  2. A Space Object that controls the environment in which the action takes place
  3. An Agent Object

It is theoretically possible to omit the explicit ‘Space’ object, but this is rarely done. If it were omitted, then the agents would either live in a spaceless ‘soup’ or would have only the barest space in which to interact.

Of these the most complicated to set up is the Model object, which is the first to execute and is in control of the simulation, and hence is a reasonable place to start.

Previous: Tutorial Main Page

Next: The SimModel object

Go to Table of Contents

A RePast Tutorial by John T. Murphy, University of Arizona & Arizona State University (contact)