Friday, February 16, 2007

Repast Implementation Languages

This is a more detailed follow up on a previous post ‘Strands of Repast’ outlining the implementation languages of Repast and a list of relevant references if you want to know more.

Repast Implementation Languages

Repast is a derivative of the Swarm simulation toolkit. Initially conceived as a library of Java classes that could interface with the Swarm simulation framework, this concept was abandoned when, amongst other reasons, a Java implementation version of Swarm was released (Collier, 2002). Consequently, the creators of Repast developed an independent framework completely written in Java, thus completely object oriented borrowing several key abstractions present within Swarm. Repast has matured considerably since its inception, with many enhancements included with every new version. However, to accommodate a growing number of researchers that were interested in developing simulations with the toolkit, Repast was developed for implementation in alternative programming languages. Currently Repast can be implemented in three different programming languages: Java (RepastJ and RepastS), Microsoft.Net (Repast.Net), and Python (RepastPy). The following four subsections will explore these further different implementations.

Python - RepastPy

RepastPy is useful for rapidly developing a basic ABM, offering the most graphical way to create a model via a point-and-click graphical user interface (GUI) (Figure 1). Thus allowing modellers with limited programming experience to create basic models. Collier and North (2004; 2005) identify three model types permissible within RepastPy: 1) a GIS-based model where agents are GIS features with topology interacting within a landscape; 2) a network based model where agents are nodes in a network that can manipulate the network topology; and, a grid based model where agents with topology reside and interact. RepastPy is also the basis of Agent Analyst, an ABM extension for ArcGIS that allows users to create, edit, and run Repast models from within the GIS (Redlands Institute, 2006), although this is not a requirement for using RepastPy.

Within RepastPy, template agents can be created to populate each model type, but a user must develop behaviours for agents using a subset of the Python programming language, referred to as not quite Python (NQPython) by the Repast developers. A subset is used because the entire Python language is not necessary to develop agent behaviours. Python is particularly useful because it integrates with Java, thus permitting access to the Repast framework, as well as other extensions and packages available in the Java programming language. Furthermore, models developed in RepastPy can be exported into Java, allowing users to subsequently work with the traditional RepastJ framework. Collier and North (2004; 2005) provide a more detailed overview of the RepastPy, and how to develop a model with this implementation of Repast. Further documentation, tutorials, and demonstration models for RepastPy and Agent Analyst are available in their retrospective installation folders. The Agent Analysts website (http://www.institute.redlands.edu/agentanalyst/) also provides some useful resources.

Figure 1: RepastPy GUI.

Java - RepastJ

Object-oriented languages, such as Java, easily lend themselves to the creation of extensible frameworks through the use of inheritance and composition. Thus, Repast benefits from the extensibility offered by Java. For instance, a large library of classes originally constructed for alternative means can be used by an agent-based modeller to extend the generic Repast’s functionality. For example, the ability to import data in different formats (e.g. .shp (ESRI Vector Shapefile format) .pgm (Portable grey map image: a raster file format) and .ascii (ESRI’s grid format.) formats). Collier (2002) and North et al. (2006) provide more details about RepastJ, and how to develop a model with this implementation. ‘How-to’ documentation and demonstration models for RepastJ are available in the installation folder. Tobias and Hofmann (2004) when reviewing several Java based simulation/modelling systems, commented that the RepastJ environment was the “clear winner” with extensive technical documentation and “How to Documents” that make it easy to become familiar with the software, along with an active mailing list.

Microsoft.Net - Repast.NET

Any programming language compatible with the Microsoft.Net framework (e.g. Visual Basic.Net, C++, J#, C#, etc) can be used to develop a model with Repast.Net. The majority of core and non-core functionality within RepastJ is available in Repast .Net. However, a notable omission is GIS functionality (e.g. ESRI’s, OpenMap, etc). Vos (2005a; 2004) explains that the GIS packages available within RepastJ were not converted into C# for inclusion within Repast.Net because of both time constraints and issues with the integration of the necessary external libraries. Nevertheless, the majority of packages included within RepastJ (both native and external), were converted into C# (e.g. Colt, JGAP and OpenForecast libraries), or similar replacement libraries have been included. This continuity in packages provides a modeller with a similar development experience in Repast.NET or RepastJ. Similarly, modellers are able to leverage any Repast related knowledge they have (in Repast.NET or RepastJ) and apply it to the alternative implementation of Repast. In the majority of cases the same package names, class names, method names in RepastJ are include in Repast.NET (Vos, 2005a). Even though Repast.Net is developed in C#, the interoperability of the .NET framework does not impose any restrictions on the compatible language a modeller can use to develop a model (Vos, 2005a). Vos and North (2004) and Vos (2005b) provide more details about Repast.Net, and how to develop a model with this implementation. How-to documentation and demonstration models for Repast.Net are available in the installation folder.

Repast Simphony

Whilst still being maintained RepastJ, Repast.Net and RepastPy have now reached maturity and are no longer being developed. They have been superseded by Repast Simphony (RepastS) which provides all the core functionality of RepastJ or Repast.Net, although limited to implementation in Java (Version 1.5). RepastS provides a more point-and-click interface for developing certain parts of the model, for example when creating graphs thus less code needs to be written. The Repast development team have provided a series of articles regarding RepastS. The architecture and core functionality are introduced by North et al. (2005a), and the development environment is discussed by Howe et al. (2006). The storage, display and behaviour / interaction of agents, as well as features for data analysis (i.e. via the integration of the R statistics package) and presentation of models within RepastS are outlined by North et al. (2005b). Tatara et al. (2006) provide a detailed discussion outlining how-to develop a “simple wolf-sheep predation” model; illustrating RepastS modelling capabilities. RepastS was only released in October 2006 and therefore there is little detail about all its core functionality at present. In relation to GIS functionality, the Repast team has moved away from Agent Analyst and OpenMap towards GeoTools for the display of GIS data.

Choosing an Implementation Language?

The developers of Repast recommend basic models are created with RepastPy, due to its visual interface, and advanced models are written with RepastJ or Repast.NET (and more recently RepastS). Since RepastPy will export into Java, it provides a logical starting point for beginners to develop basic models, or more experienced users to develop an initial model for further development in Java (RepastJ). RepastJ has several advantages over the other Repast implementations. Firstly, Java is popular programming language due to its platform independence (i.e. a simulation written in RepastJ can be run on computer using several different operating system e.g. Windows™, Unix™, Linux™, Mac™, etc), opposed to a simulation written in Repast.Net. However, Weidmann and Girardin (2005) highlight the affect of running a RepastJ model on different operating system and using different Java Development Kits (JDKs). The authors concluded that while performance (execution time of program without graphical output) is very similar when using RepastJ on different operating system (tested on MS Windows XP Professional™ and Linux Fedora Core 2), the performance varies considerably when using different JDKs (i.e. more recent JDKs are more efficient). Finally, as Java is the original implementation language of Repast there considerably more demonstration models, tutorials, and help via the user community is available. Nevertheless, Repast.NET offers a range of languages in which to develop Repast models. At the time of writing, RepastS had just been released and the Repast team see it as the end goal of Repast. However there are no examples models available apart from those in the download, there is little in the way of user documentation and transforming existing RepastJ models to RepastS in the immediate future will require a substantial effort, additionally there is no GIS support.

On the GIS side, currently only RepastJ and RepastPy have direct support for the importation of GI datasets.

Any thoughts or comments please send them


References

Collier, N. (2002), RePast: An Extensible Framework for Agent Simulation, Available at http://www.econ.iastate.edu/tesfatsi/RepastTutorial.Collier.pdf [Accessed on June 16th, 2006].

Collier, N. and North, M.J. (2004), 'Repast for Python Scripting', Proceedings of the Agent 2004 Conference on Social Dynamics: Interaction, Reflexivity and Emergence, Chicago, USA, pp. 231-237, Available at http://www.agent2005.anl.gov/Agent2004.pdf.

Collier, N. and North, M.J. (2005), 'Repast for Python Scripting', Annual Conference of the North American Association for Computational Social and Organizational Science (NAACSOS) Notre Dame, Indiana, USA, Available at http://www.casos.cs.cmu.edu/events/c

Howe, T.R., Collier, N.T., North, M.J., Parker, M.T. and Vos, J.R. (2006), 'Containing Agents: Contexts, Projections, and Agents', Proceedings of Agent 2006 Conference on Social Agents: Results and Prospects, Chicago, USA.

North, M.J., Collier, N.T. and Vos, J.R. (2006), 'Experiences Creating Three Implementations of the Repast Agent Modelling Toolkit', ACM Transactions on Modelling and Computer Simulation, 16(1): 1-25.

North, M.J., Howe, T.R., Collier, N.T. and Vos, J.R. (2005a), 'The Repast Simphony Development Environment', Proceedings of the Agent 2005 Conference on Generative Social Processes, Models, and Mechanisms, Chicago, USA, Available at http://www.agent2005.anl.gov/.

North, M.J., Howe, T.R., Collier, N.T. and Vos, J.R. (2005b), 'The Repast Simphony Runtime System', Proceedings of the Agent 2005 Conference on Generative Social Processes, Models, and Mechanisms, Chicago, USA, Available at http://www.agent2005.anl.gov/2005pdf/Mysore%20et%20al.pdf.

Redlands Institute (2006), What is Agent Analyst?, Available at http://www.institute.redlands.edu/ [Accessed on May 31st, 2006].

Tatara, E., North, M.J., Howe, T.R., Collier, N.T. and Vos, J.R. (2006), 'An Introduction to Repast Simphony Modelling using a simple Predator-Prey Example', Proceedings of the Agent 2006 Conference on Social Agents: Results and Prospects, Chicago, USA.

Tobias, R. and Hofmann, C. (2004), 'Evaluation of Free Java-libraries for Social-Scientific Agent Based Simulation', Journal of Artificial Societies and Social Simulation, 7(1).

Vos, J.R. (2005a), ' Repast .NET: The Repast Framework Implemented in the .NET', Annual Conference of the North American Association for Computational Social and Organizational Science (NAACSOS) Notre Dame, Indiana, USA, Available at http://www.casos.cs.cmu.edu/events/.

Vos, J.R. (2005b), 'Repast .NET: The Repast Framework Implemented in the .NET', Annual Conference of the North American Association for Computational Social and Organizational Science (NAACSOS) Notre Dame, Indiana, USA, Available at http://www.casos.cs.cmu.edu/events.

Vos, J.R. and North, M. (2004), 'Repast .NET', Proceedings of the Agent 2004 Conference on Social Dynamics: Interaction, Reflexivity and Emergence, Chicago, IL, USA, pp. 239-254, Available at http://www.agent2005.anl.gov/Agent2004.pdf

Weidmann, N.B. and Girardin, L. (2005), 'Technical Note: Evaluating Java Development Kits for Agent-Based Modelling', Journal of Artificial Societies and Social Simulation, 8(2).

1 comment:

Mantasha said...

Great site buddy . Really I like ur site I think u r also a Java Developer like me any ways I have some reference books of java which are readable .... Following are the books

Programmer's Guide to Java
Certification A Comp. Primer SE
By Khalid A. Mughal, Rolf W. Rasmussen Publisher : Addison Wesley
Pub Date : August 04, 2003

Java™ Development on PDAs
Building Applications PocketPC
By Daryl Wilding-McBride Publisher : Addison Wesley
Pub Date : June 05, 2003


Learning Java™, 2nd Edition
Publisher : O'Reilly Pub Date : July 2002
Pub Date : June 05, 2003

Jython for Java Programmers
By Robert W. Bill Publisher : New Riders Publishing
Pub Date : December 21, 2001

Enterprise JavaBeans, 3rd Edition
By Richard Monson-Haefel Publisher : O'Reilly
Pub Date : September 2001

Java 1.5 Tiger: A Developer's Notebook
By David Flanagan, Brett McLaughlin Publisher : O'Reilly
Pub Date : June 2004


Java Tutorials Index 1
Java Data Objects
By David Jordan, Craig Russell Publisher : O'Reilly
Pub Date : April 2003

Java™ Extreme Programming Cookbook
By Eric M. Burke, Brian M. Coyner Publisher : O'Reilly
Pub Date : March 2003


Java™ Performance Tuning, 2nd Edition
By Jack Shirazi Publisher : O'Reilly
Pub Date : January 2003

Java™ Performance Tuning, 2nd Edition
By Jack Shirazi Publisher : O'Reilly
Pub Date : January 2003

JavaScript & DHTML Cookbook
By Danny Goodman Publisher : O'Reilly
Pub Date : April 2003

Java Servlet & JSP Cookbook
By Bruce W. Perry Publisher : O'Reilly
Pub Date : January 2004
Java Tutorials Index 2