Showing posts with label Repast. Show all posts
Showing posts with label Repast. Show all posts

Thursday, January 26, 2023

Repast4Py

In the past we have blogged about how we are using the Python agent-based modeling framework Mesa. But we would be remiss if we did not also mention other Python toolkits. One of which is Repast4Py from the people we created Repast suite. To quote from their user guide website:

To find out more about Repast4Py I highly recommend readers to look at the following publications or their webpage: https://repast.github.io/repast4py.site/.

References:

 

Wednesday, November 07, 2018

ABM platform developers from CoMSES 2018

There are many reviews of agent-based modeling platforms (e.g. Abar et al., 2017; Kravari and Bassiliades, 2015; Castle and Crooks, 2006) but rarely do you see movies  describing how such platforms have developed or where they are heading. Recently CoMSES Net (home of many great resources for agent-based modeling) held their second virtual conference: CoMSES 2018. During this virtual conference, the were presentations from Repast, Cormas and MESA to name but a few and I thought theese were worth sharing. If you click on the links below your can go directly to their threads (discussion) on from the conference.

Repast:
 

Cormas:


Mesa:


On a slightly different note, I just came across a series of podcasts by Jacob Ingalls and Benjamin Schumann (http://brokenjars.xyz/simtalk/) who have interviewed a number of practitioners carrying out simulation modeling including the CEO of AnyLogic. Similar to the movies above, these podcasts provide a different way of learning more about simulations.

Thursday, January 25, 2018

Place-Based Simulation Modelling

Nick Malleson, Alison Heppenstall and myself recently had a chapter published in the Oxford Research Encyclopedia of Criminology and Criminal Justice, entitled "Place-Based Simulation Modelling:  Agent-Based Modelling and Virtual Environments". In the chapter, we discuss how agent-based modeling (ABM) can be used for modeling spatial patterns of crime.

Specifically we discuss the motivation for ABM in criminology. We then introduce the core components of ABM and how one can structure such models and represent human behavior in them (e.g. using Beliefs-Desires-Intentions (BDI) or Physical conditions, Emotional states, Cognitive capabilities and Social status" (PECS) frameworks). Next, we discuss space can be represented in agent-based models, both from an abstract sense but also accurate spatial environments (i.e. by using GIS data). The chapter then moves onto briefly discussing tools for the implementation of agent-based models (e.g. MASON, NetLogo, Repast) before we provide a critique of ABM for modeling spatial crime, including its appeal (e.g. the emergence of crime from the bottom up), the difficulties of using ABM (e.g adequately defining behavior, access to data etc.) and finally the ethical implications of using agent-based models for studying crime. Below you can read the official summary of the chapter along with its full citation.

Chapter Summary: 
Since the earliest geographical explorations of criminal phenomena, scientists have come to the realization that crime occurrences can often be best explained by analysis at local scales. For example, the works of Guerry and Quetelet—which are often credited as being the first spatial studies of crime—analyzed data that had been aggregated to regions approximately similar to US states. The next major seminal work on spatial crime patterns was from the Chicago School in the 20th century and increased the spatial resolution of analysis to the census tract (an American administrative area that is designed to contain approximately 4,000 individual inhabitants). With the availability of higher-quality spatial data, as well as improvements in the computing infrastructure (particularly with respect to spatial analysis and mapping), more recent empirical spatial criminology work can operate at even higher resolutions; the “crime at places” literature regularly highlights the importance of analyzing crime at the street segment or at even finer scales. These empirical realizations—that crime patterns vary substantially at micro places—are well grounded in the core environmental criminology theories of routine activity theory, the geometric theory of crime, and the rational choice perspective. Each theory focuses on the individual-level nature of crime, the behavior and motivations of individual people, and the importance of the immediate surroundings. For example, routine activities theory stipulates that a crime is possible when an offender and a potential victim meet at the same time and place in the absence of a capable guardian. The geometric theory of crime suggests that individuals build up an awareness of their surroundings as they undertake their routine activities, and it is where these areas overlap with crime opportunities that crimes are most likely to occur. Finally, the rational choice perspective suggests that the decision to commit a crime is partially a cost-benefit analysis of the risks and rewards. To properly understand or model these three decisions it is important to capture the motivations, awareness, rationality, immediate surroundings, etc., of the individual and include a highly disaggregate representation of space (i.e. “micro-places”). Unfortunately one of the most common methods for modeling crime, regression, is somewhat poorly suited capturing these dynamics. As with most traditional modeling approaches, regression models represent the underlying system through mathematical aggregations. The resulting models are therefore well suited to systems that behave in a linear fashion (e.g., where a change in model input leads to a predictable change in the model output) and where low-level heterogeneity is not important (i.e., we can assume that everyone in a particular group of people will behave in the same way). However, as alluded to earlier, the crime system does not necessarily meet these assumptions. To really understand the dynamics of crime patterns, and to be able to properly represent the underlying theories, it is necessary to represent the behavior of the individual system components (i.e. people) directly. For this reason, many scientists from a variety of different disciplines are turning to individual-level modeling techniques such as agent-based modeling.

Keywords: agent-based modelling, crime simulation, travel to crime, virtual environment, NetLogo, virtual laboratory.

Figure 1: The process of initializing, running, and analyzing an agent-based model.

Full Reference:
Malleson, N., Heppenstall, A. and Crooks, A.T. (2018). Place-Based Simulation Modelling: Agent-Based Modelling and Virtual Environments, Oxford Research Encyclopedia of Criminology and Criminal Justice, Oxford University Press. DOI: 10.1093/acrefore/9780190264079.013.319 (pdf)

Thursday, February 12, 2015

Village Model

http://village.anth.wsu.edu/node/67
What now seems like a very long long time ago, when I was getting up to speed with Agent-based modeling and GIS, I came across a great edited book entitled "Dynamics in Human and Primate Societies: Agent-Based Modeling of Social and Spatial Processes". 

One chapter in particular that I really enjoyed because of its clarity and use of data was by Kohler et al. (2000) entitled "Be There Then: A Modeling Approach to Settlement Determinants and Spatial Efficiency Among Late Ancestral Pueblo Populations of the Mesa Verde Region, U.S. Southwest". 

The chapter explored the question of why did Pueblo people vary their living arrangements between  compact villages and dispersed hamlets between 901-1287AD? To this day, I use this chapter when I am teaching about early agent-based models. While the initial model was implemented in Swarm, it has now been ported to Repast and developed further by an NSF supported program called Village Ecodynamics Project.




Full Reference:
Kohler, T.A., Kresl, J., Van Wes, Q., Carr, E. and Wilshusen, R.H. (2000), 'Be There Then: A Modeling Approach to Settlement Determinants and Spatial Efficiency Among Late Ancestral Pueblo Populations of the Mesa Verde Region, U.S. Southwest', in Kohler, T.A. and Gumerman, G.J. (eds.), Dynamics in Human and Primate Societies: Agent-Based Modeling of Social and Spatial Processes, Oxford University Press, Oxford, UK, pp. 145-178.

Friday, May 21, 2010

Agent Analyst Bird Migration Model

While I have blogged about Agent Analyst before (see here), the Redlands Institute have created some movies showing a simulation of bird migration patterns. While the exact details are not abundant, it appears they where developed to learn and demonstrate concepts relating to linking agent-based models with a GIS. Specifically using the Agent Analyst toolkit with Tracking Analyst in ArcMap (as shown in the movie below):


While this movie shows a live model run:


Finally the movie below shows how one can visualize the results in ESRI's ArcGlobe.



More movies from the Redlands Institute on YouTube can be found here.

Friday, November 13, 2009

Agents on campus

I thought it was time I started exploring Repast Simphony and GIS data for US. So following the excellent tutorial by Nick Malleson entitled "RepastCity - A demo virtual city" which demonstrates how to load up several shapefiles and move agents around a road network (the code is also very well documented).

The movie below shows the George Mason campus (2005). The GIS data comes from the GMU Library in the form of shapefiles. Within the model we have agents (red stars), one for each building (black polygons). These agents choose a building at random and use the footpaths (thin grey/blue lines) to navigate to the chosen building. Additional layers are also represented including: car parks and roads (grey/blue areas); and streams grey blue) and a pond (green)1.




Another interesting tutorial is by Karl Liebert which discusses how create a basic GIS model in Repast Simphony.

1 For some reason the colors have been messed up in the conversion from computer to Vimeo.

Friday, May 22, 2009

Agent Analyst movies

Agent Analyst is an Agent-based modelling extension that allows users to create, edit, and run RepastJ and RepastPy models from within ArcGIS. The Agent Analyst toolkit was developed by Argonne National Laboratory’s Center for Complex Adaptive Agent Systems Simulation in collaboration with ESRI and to promote cooperation and collaboration between GIS professionals and agent-based modellers

While its been around for some time, I have recently just come across two videos from the Redlands Institute, however the actual models and further details is limited, they show the potential of the extension for agent-based modelling. The first demonstrates the integration of Agent Analyst and Tracking Analyst within ArcGIS Desktop. Specifically the model shows a simulation of bird migration patterns of 2 species. The second model uses Agent Analyst to compare two urban growth scenarios.




Bird migration patterns



Comparing two urban growth scenarios

For more information including tutorials on how to use Agent-Analyst see the Agent Analyst website.


Monday, February 09, 2009

N-Person Prisoner's Dilemma: A Spatial Application

In the current issue of JASSS there is an article by Conrad Power entitled "A Spatial Agent-Based Model of N-Person Prisoner's Dilemma Cooperation in a Socio-Geographic Community" where he presents a spatial agent-based model on the N-person prisoner's dilemma (NPPD). The NPPD is a social dilemma game which is focused on the simulation of the collective actions and behaviours within social groups.

The purpose of the model is to present a spatial agent-based approach for modelling the processes of communication and cooperation within a socio-geographic community. The model itself is written in Java and utilizes RepastJ, OpenMap and JTS to simulate agent interactions, movements, and the NPPD game play to the town of Catalina, Newfoundland and Labrador, Canada.

The full article can be found on the JASSS site.

Monday, January 19, 2009

Generations Model

The Schelling (1971, 1978) model of segregation is probably one of the best known agent-based models and unknowingly, one of the pioneers in the field of Aagent-based modelling (Schelling, 2006). He emphasised the value of starting with rules of behaviour for individuals and using simulation to discover the implications for large scale aggregate outcomes through the interactions of these individuals. This key feature of the model arises because the decisions of any one individual can impact in unexpected and unanticipated ways upon the decisions of others.

While the model is excellent in the sense that it uses of simple logic to illustrate how segregation could emerge, through the mild tastes and preferences to locate amongst like social or economic groups. The model has no population turnover (Fossett and Waren, 2005), households are ‘immortal’ and thus a satisfied household can reside in the same location for ever.

While I been exploring Schellings model (see Crooks, 2008), recently I cam across the "Generations Model" by Hugh Stimson which extends Schellings model so that agents have a chance of of dying and giving birth. But what is interesting about the model is that depending on how many agents of opposite type live nearby, agents may give birth to a new 'mixed' type of agent, who do not share their parent’s biases.

The model is programmed in RepastJ and can be downloaded from here (30kb). More information about the model can be found on Hugh Stimson's blog.


References:


Crooks, A. T. (2008), Constructing and Implementing an Agent-Based Model of Residential Segregation through Vector GIS, Centre for Advanced Spatial Analysis (University College London): Working Paper 133, London, England. (pdf)

Fossett, M. and Waren, W. (2005), Overlooked Implications of Ethnic Preferences for Residential Segregation in Agent-Based Models, Urban Studies, 42(11): 1893-1917.

Schelling, T.C. (1971), Dynamic Models of Segregation, Journal of Mathematical Sociology 1: 143-186.

Schelling, T.C. (1978), Micromotives and Macrobehavior, WW Norton and Company, New York, NY.

Schelling, T.C. (2006), Some Fun, Thirty-Five Years Ago, in Tesfatsion, L. and Judd, K.L. (eds.), Handbook of Computational Economics: Agent-Based Computational Economics, North-Holland Publishing, Amsterdam, Netherlands, pp. 1639-1644.

Wednesday, January 14, 2009

Kvintus Model

Hans Skov-Petersen and his team from the Forest and Landscape Centre at the University of Copenhagen has created the Kvintus model. An agent-based model implemented in Repast and visualised on Google Maps at runtime. Within the model recreationalists (walkers, runners, mountain bikers etc.) can be simulated along with animals (e.g. roe deer). Such a style of model has similarities with the RBSim model (click here to see a previous blog post).

In the YouTube movie below; the yellow squares are joggers (which run at 10 km/h, and prefers marked trails), the circles are Roe deer (the green and blue are deer at various stages in eating and searching for food, red is when they are scared by a jogger, white is when they are searching for a hiding place and black when the deer is hiding.





For more information about the model, readers may be interested in a presentation entitled “Kvintus - an agent-based model of recreational behaviour” on slideshare.

If you like these sorts of models it may be worth reading “Monitoring, simulation and management of visitor landscapes” by Randy Gimblett and Hans Skov-Petersen (eds.). University of Arizona Press. 2008.


Tuesday, August 12, 2008

Toolkits update

The pace of development of agent-based toolkits sometimes amazes me. No sooner have I written something and it’s out of date (so ignore some of my earlier posts or at least check the ABM sites).

Just a quick note that Repast Simphony 1.1 was released recently and one of its many updates is its option to link with NASA World Wind. So not only can one have a 3D display but can visualize agents with satellite imagery, elevated terrain, and scientific data sets (as shown in the image below). This is quite important for geo-spatial agent-based models in the form of testing its validity, as Mandelbrot (1983) argues that good models which generate spatial or physical predictions that can be mapped or visualised must ‘look right’. Such visualisation of agent-based models also helps us share (disseminate), communicate and potentially influence people about the model as the model’s spatial outcomes can be mapped to real world places which people can potentially relate to.


For a brief tutorial on using RepastS GIS functionally, Nick Malleson from the Agent-Based Crime Simulation blog has recently written an excellent tutorial (and code) showing a small town with a few agents, some houses and some roads. In the model agents choose a random house and then travel there (Click here for a link to his post).

In other news, NetLogo (4.0.3) has also been released and has the GIS extension for handling geographic data is now included (formerly it was separate download).

Monday, April 28, 2008

Agent-Based Crime Simulation

I just come across a blog called “Agent-Based Crime Simulation” by Nick Malleson who is building an agent-based model to predict rates of residential burglary. Within the model potential burglars are represented as agents, drawing from studies in criminology and artificial intelligence. The virtual environment is made as realistic as possible by incorporating GIS data (in the form of OS Mastermap) for the area of study.

While the model is still only a prototype, it is one of the first examples I seen using GIS in Repast Simphony, he has also posted a short video showing simple burglar agents moving around their environment.

For more information about the model and Nick's blog see “http://crimesim.blogspot.com/”.



Wednesday, April 16, 2008

New Working Paper: ABM of Residential Segregation

We just finished a new working paper entitled “Constructing and Implementing an Agent-Based Model of Residential Segregation through Vector GIS

The abstract is as follows:
In this paper, we present a geographically explicit agent-based model, loosely coupled with vector GIS, which explicitly captures and uses geometrical data and socio economic attributes in the simulation process. The ability to represent the urban environment as a series of points, line and polygons not only allows one to represent a range of different sized features such as houses or larger areas portrayed as the urban environment but is a move away from many agent-based models utilising GIS which are rooted in grid-based structures. We apply this model to the study of residential segregation, specifically creating a Schelling (1971, 1978) type of model within a hypothetical cityscape, thus demonstrating how this approach can be used for linking vector-based GIS and agent-based modelling. A selection of simulation experiments are presented, highlighting the inner workings of the model and how aggregate patterns of segregation can emerge from the mild tastes and preferences of individual agents interacting locally over time. Furthermore, the paper suggests how this model could be extended and demonstrates the importance of explicit geographical space in the modelling process.

Keywords: Agent-Based Modelling, GIS, Residential Segregation, Repast

The full reference is:
Crooks, A. T. (2008), Constructing and Implementing an Agent-Based Model of Residential Segregation through Vector GIS, Centre for Advanced Spatial Analysis (University College London): Working Paper 133, London, England. (pdf)

The paper can be downloaded from here. As always, any thoughts or comments about the paper are more than welcome.

Friday, December 07, 2007

Recent Developments in Toolkits

Many Agent-based modelling toolkits are continuously being developed and reviews quickly go out of date (see Nikolai and Madey for a recent review). Some recent developments can be seen in Repast, StarLogo and NetLogo toolkits, including the support of 3D environments. Repast Simphony 1.0 has recently been released which includes a point and click interface for model development and full GIS support. Additionally StarLogo has created an open source version of StarLogo called OpenStarLogo. Furthermore it has released StarLogo TNG (see image below) which has a simple user interface which allows users with little or no programming experience to create models. NetLogo also supports 3D models (see below).


Repast Simphony 1.0 - Runtime displays showing 2D and 3D visualization of networks.


StarLogo TNG Hill-Climbers example. Highlighting the user interface to create models (E.g. Block Factory and Block Canvas) and the 3D viewer.

Netlogo Traffic Grid 3D Viewer

Allows one to “control traffic lights and overall variables, such as the speed limit and the number of cars, in a real-time traffic simulation (NetLogo)." Thus allowing one to explore traffic dynamics.


Tuesday, November 06, 2007

The Basic Immune Simulator

Just a quick note on a Repast model we recently found called the Basic Immune Simulator developed by Charles Orosz, Virginia Folcik and Christina Sasswas utilizing RepastJ. The model was developed to explore the behaviour of the immune system as a complex system.

The site provide the source code of the model and instructions to run the model. Which addresses some of the key issues with regard to sharing information with the social sciences which Axelrod (2007) recommends.


Further information and model code can be seen at the Basic Immune Simulator website and an article

Folcik, V.A., An, G.C. and Orosz, C.G.(2007) The Basic Immune Simulator: An agent-based model to study the interactions between innate and adaptive immunity. Theoretical Biology and Medical Modelling, 4:39.

Axelrod (2007) ‘Simulation in the social sciences’ inRennard, J.-P. (ed), Handbook of Research on Nature-Inspired Computing for Economics and Management, Idea Group Reference, Hershey, PA.


Thursday, September 27, 2007

Geospatial Simulation with Repast

After the previous post "ABM–S4–ESHIA Summer School" I thought it would be useful to draw peoples attention to a new CASA working paper entitled "The Repast Simulation / Modelling System for Geospatial Simulation." Which was the basis of talk two from the workshop Mike and I gave.

The abstract to the paper is: 'The use of simulation/modelling systems can simplify the implementation of agent-based models. Repast is one of the few simulation/modelling software systems that supports the integration of geospatial data especially that of vector-based geometries. This paper provides details about Repast specifically an overview, including its different development languages available to develop agent-based models. Before describing Repast’s core functionality and how models can be developed within it, specific emphasis will be placed on its ability to represent dynamics and incorporate geographical information. Once these elements of the system have been covered, a diverse list of Agent-Based Modelling (ABM) applications using Repast will be presented with particular emphasis on spatial applications utilizing Repast, in particular, those that utilize geospatial data.'

If you feel like you might be interested in this paper. It can be downloaded from here. As always any thoughts and comments are most welcome.

Full Reference:
Crooks, A. T. (2007), The Repast Simulation/Modelling System for Geospatial Simulation, Centre for Advanced Spatial Analysis (University College London): Working Paper 123, London, England. (pdf)



Tuesday, September 25, 2007

ABM–S4–ESHIA Summer School

Mike Batty and myself have recently attended a summer school entitled 'Agent Based Models for Spatial Systems in Social Sciences Economic Science with Heterogeneous Interacting' or ABM–S4–ESHIA for short. This summer school was organized by both by the European GDR S4 (Spatial Simulation for the Social Sciences), and the ESHIA (Society for Economic Science with Heterogeneous Interacting Agents ). Full details about the talks including .pdfs can be found here.

While at the summer school Mike and myself gave a workshop entitled 'How to Build an Agent-Based Model'. I thought it would be useful to share this workshop/.pdfs to a wider audience. The workshop was organised into three parts/talks.

The first talk was given by Mike focusing on "Models and Theories: Science, Validation,
Verification and Calibration." Within this talk Mike discussed what should be considered when building an agent-based model. Specifically outlining what are models, types of models and how models can be based on 'Stylized Facts'. Before focusing on how to develop models using a software environment.

This lead to second talk presented by myself on how a geospatial agent-based model can be developed using such a software environment. In this case using Repast. Within this talk, there was a discussion of what Repast is, examples of models created in Repast specifically those utilising Raster and Vector data sets and what the difference between the two are.


The third talk was given by Mike which focused on Cellular Automata (CA). Within this talk there was a discussion on CA applications, specifically focusing on urban growth and land cover (LUCC) etc. This was followed by how one represents space and dynamics within models, the key elements of CA models and a list of groups actively researching urban phenomena utilizing CA models. To give an example of a CA model the DUEM model (Dynamic Urban Evolutionary Model) was given.

Hopefully in the future we will have time to develop this material in the future but for now you can download any of the talks as .pdf by clicking on the number one, two and three.


Wednesday, April 18, 2007

Creating Slider bars in Repast

Slider bars (as in the image above) are a easy way to change model parameters of a simulation. Someone asked how to create a Slider Bar within a Repast model, so I thought I would share it. To create one is relatively straight forward. All you need to do is place this piece of code in the setup method:

//creates a slider which has to be an int.
RangePropertyDescriptor pdMovement = new RangePropertyDescriptor("Movement", 0, 1000, 200);

descriptors.put("Movement", pdMovement);

Where “Movement” relates to the “Movement” parameter in the getInitParam method. For example:

String [] initparams = {"PerAgents", "Movement",
};
return initparams;
}

Further information on PropertyDescriptors can be found on the Repast Website under "How to Create PropertyDescriptors"


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).

Monday, January 08, 2007

Agent-Based Modelling and Simulation using Repast: A Gallery of GIS Applications

Below is a paper that Christian and I gave at GISRUK 2006. We would like to thank all those at CASA that helped us with by providing information. The full reference is:
Castle, C.J.E., Crooks, A.T., Longley, P.A. Batty, M. (2006), 'Agent-Based Modelling and Simulation using Repast: A Gallery of GIS Applications from CASA', in Priestnall, G. and Aplin, P. (eds.), Proceedings of the 14th Geographical Information Systems Research UK Conference, The University of Nottingham, England, pp. 237-239.  (pdf)

1. Introduction

Agent-based modelling and simulation (ABMS) is a relatively new approach to modelling systems comprising of autonomous, interacting actors (i.e. agents) by computer representation. For example, in a pedestrian evacuation context, agents can include different evacuees with different physical and behavioural characteristics (e.g. adult, child, mobility impaired person, knowledge of building layout, member of staff, visitor or tourist, etc), all of whom are required to make decisions or take actions that might affect the evacuation process. By simulating individual actions of diverse agents, and measuring the resulting system behaviour and outcomes over time, ABMS can be a useful tool for studying the effects on processes that operate at multiple scales and organisational levels, and their effects (Brown, in press).

2. Agent-Based Modelling and Simulation

The development of models can be greatly facilitated by the utilisation of libraries of reusable model components. The use of pre-defined ABMS toolkits can reduce the burden modellers face, programming parts of a simulation that are not content-specific e.g. simulation control or input-output procedures (Tobias and Hofmann, 2004). It also increases the reliability and efficiency of the programs, as most of the complex parts of the program have been created and optimised by professional developers, as standardised simulation tools. Finally, modellers profit from their ease of use, most are ready made, widely distributed, provide detailed documentation and a user interface that simplifies the user’s task of creating a model. Unsurprisingly, there are limitations. For example, a substantial amount of effort is required to understand another programmer’s code, a toolkit may be written in its ‘own’ programming language (e.g. NetLogo), and the desired/required modelling functionality may not all be present (yet!). However, these can be offset against additional tools offered by the user community.

Object-Orientated Programming (OOP) is central to ABMS. However, it is not the intention of this paper to outline its concepts here. The subsequent section of this paper evaluates some of the ABMS toolkits currently available, highlighting some of the key questions that should be considered whilst determining an appropriate toolkit for a users needs.


2.1 Toolkits

Numerous ABMS toolkits have emerged, although their level of development varies considerably. Some of the more established toolkits, and therefore mainstream include: AgentSheets; AnyLogic; Ascape; Breve; Cormas; deX; ECHO; JADE; Madkit; MAGSY; MASON; MIMOSE; NetLogo; Ps-I; Quicksilver (renamed Omonia); Repast; SimAgent; SimPAck; StarLogo; Sugarscape; Swarm; TeamBots; and VSEit. Of course, comprehensive practical experience must be gained to obtain a full understanding of a modelling or simulation toolkit’s functionality in relation to a users needs. Unfortunately, this is not usually a feasible objective. For this reason several authors (Najlis et al., 2001; Tobias and Hofmann, 2004; and Roberson, 2005) discuss criteria that can, or should be considered before selecting a toolkit. These include, but are not limited to: ease of programming and/or using the package; size of the community using the platform; size of the programming community familiar with the language in which the package is implemented; the ability to represent space (object vs. field view) and topological relationships; mechanism for scheduling and sequencing events; and the ability to represent multiple organisational / hierarchical levels, or scales.

Depending on the model specification and the users programming expertise, these criteria will be weighted differently. For example, the ease of programming the model, which is affected by the programming language used by the platform, can have a considerable bearing on the platform used. According to Wood (2002) in comparison to C++, for example, Java is considerably easier to use, especially for a beginner. Although Java also incorporates some of the more modern and useful developments in OOP languages (e.g. applets, which allow models to be shared over the internet), the most compelling argument for using Java is its platform independence.

The remainder of this paper is dedicated to Repast models that have, or are being developed at the Centre for Advanced Spatial Analysis, University College London. Repast has/is been used by a number of researchers for several reasons, which are a balance of the criteria listed above. Repast provides the option of programming a model in Java, which is advantageous for the reasons outlined above. Currently there is a large and very active community using Repast, which has generated an invaluable library of example models and source code. Help is also available via the community mailing list, where responses are usually prompt (allowing for the time lag in to America) and helpful. Additionally, the list of toolkits listed above can be split into proprietary, freeware, and open source. The distinction being, unlike freeware, proprietary toolkits require a licence, but both are essentially black box. This limits the possibility to extend the toolkit when required functionality is unavailable, and the user is not entirely sure about the inner workings of their model. Conversely, open source toolkits (which includes Repast) are not only free, but they provide a modeller with the flexibility to alter or extend core functions if they do not exist, and understand how core functions are programmed and work. This provides the user with a more extensible and robust toolkit. A more detailed overview of Repast, including an outline of Repast’s functionality is provided in the subsequent section.

3. Repast

Repast provides a set of core classes for creating, running, displaying and collecting data from agent based simulations (Figure 1), that allow for complex models to be developed in a relatively short period of time (Macal and North, 2005). It seeks to support the development of extremely flexible models of agents with an emphasis of social interactions. Users can build simulations by incorporating Repast library components into their own programs depending on what functions are required. The use of these core features means that less time is given to GUI development and more time for model development.

At present Repast 3.1 offers three different programming languages in which to implement and develop Repast models: RepastPy (based on Python scripting language), RepastJ (Java based), Repast.Net (implemented in C# but can use any .Net language). All have the same core services, which allow ABMs to be developed.

One of Repast’s attractive features is its ability to integrate GIS data (either raster or vector) directly into the simulation with relative ease. GIS have been available for quite a while, but until recently has not been easily incorporated into programmes of social systems. Repast allows a user to build a ‘world’ populated by mobile entities (agents) that have their own rule sets for establishing their behaviour. Agents live in ‘spaces’ within these worlds, which are the environments they move around and interact within. Typically, the space agents occupy are simple grids (i.e. cellular or raster), or graphs with edges and nodes. However, with the integration of GIS, agents can move around ‘real space’. For example, the use of RepastJ or RepastPy provides a set of classes that allow Shapefiles to be displayed either through OpenMap or ArcGIS (via Agent Analysis).





Figure 1: Typical Repast features.


4. Applications

Repast is currently being used in a wide variety of applications from the study of land use change (Deadman, et al., 2004; Brown et al., 2005; and Xi et al., 2005), watershed modelling (Reitsma and Albrecht 2005), infectious disease modelling (Yang and Atkinson 2005), regime change (Cederman 2003), economics and business studies (North et al., 2002; Robertson 2003; and Padgett et al., 2003), to name but a few. CASA researchers have used or are using Repast (specifically RepastJ) to study a range of applications: pedestrian modelling, urban dynamics, segregation, residential and business location and evacuation modelling (Figure 2). The models use the core Repast functionality, extending it further to meet their own specific needs.

For example the CAPABLE project (Children’s Activities, Perceptions and Behaviour in the Local Environment) is based on the increasing concern about allowing children out unaccompanied by adults and at the same time increasing recognition of children's rights and autonomy. The purpose of this research is to explore how children use the local environment and what kind of environmental factors affect children’s spatial behaviour. Part of the project objective is to develop a multi-agent-based model of children’s spatial movement, as well using animation software for visualizing GPS traces. This software is written in Java using Repast and OpenMap libraries. The Ordnance Survey (OS) MasterMap™ is used as the base map, upon which GPS points are overlaid, thus allowing the creation of a time-series animation.

Barros (in press) has used Repast to study urban dynamics in Latin American cities. This research produced a series of exploratory agent-based simulation models exploring urban growth in relation to poverty and spontaneous settlements in Latin American cities where there is poor control of policies upon the development process. The models explore how these processes occur in both space and time, and how this is shaped by individual decisions.


Figure 2: Screen shots of some applications that are being developed at CASA.

Another research project at CASA involves an agent-based approach to simulating pedestrian movement and the factors that control it. Part of the model simulates rent rate, land value and land use changes in informal shopping centres. Another part of model looks at the affect of pedestrians on micro-scale land use change due to decisions that are likely to have an impact on trips’ demand and/or offer. Issues being explored include how pedestrians affect rent rates, pedestrian flows and then rent rates based on retailing theory (Zachariadis, 2005).


5. Conclusion

ABMS is a relatively new and growing approach to modelling systems comprising of autonomous, interacting agents by computer representation. Modelling can be facilitated by the use of model components that are predefined within an ABMS toolkit. This reduces the burden of programming non content-specific parts of a simulation, and increases the reliability and efficiency of the program by allowing complex parts to be created and optimised by professional developers. A non-exhaustive list of mainstream toolkits was identified, providing the reader with criteria they should consider before choosing a toolkit for their modelling requirements. Specific details of the Repast toolkit were discussed, outlining benefits in relation other toolkits. In particular, Repast is a robust and extensible toolkit that allows user to develop models tailored to their specific needs. It also has the added advantage of being open source and having a healthy support and user community. Finally, an overview of models developed at CASA using Repast was provided focusing on GIS applications.

References:
  • Barros J. (in press), Urban Dynamics in Latin American cities: An Agent Based Simulation Approach. Environment and Planning B: Planning and Design.
  • Brown, D.G. (in press), Agent Based Models. In The Earth’s Changing Land: An Encyclopaedia of Land-Use and Land-Cover Change (Westport CT: Greenwood Publishing Group).
  • Brown, D.G., Riolo R., Robinson D.T., North, M., and Rand W. (2005), Spatial Process and Data Models: Toward Integration of Agent-Based Models and GIS. Journal of Geographical Systems, Special Issue on Space-Time Information Systems 7(1), pp. 25-47.
  • Cederman, L-E. (2003), Modelling the Size of Wars: from Billiard Balls to Sand Piles, American Political Science Review, 97(1), pp. 135-150.
  • Deadman, P.J., Robinson, D.T., Moran E., Brondizio E. (2004), Effects of Colonist Household Structure on Land Use Change in the Amazon Rainforest: An Agent Based Simulation Approach. Environment and Planning B: Planning and Design 31(5), pp. 693-709.
  • Macal, C.M., and North, M. (2005), Tutorial on Agent-Based Modelling and Simulation. Proceedings of the 2005 Winter Simulation Conference. M. E. Kuhl, N. M. Steiger, F. B. Armstrong, and J. A. Joines, eds.
  • Najlis, R., Janssen M.A., and Parker D.C. (2001), Software Tools and Communication Issues. In Parker, D.C., Berger, T., and Manson, S.M., Meeting the Challenge of Complexity: Proceedings of a Special Workshop on Land-Use/Land-Cover Change (California).
  • North, M., Macal, C., Cirillo, R., Conzelmann, G., Koritarov, V., Thimmapuram, P., Veselka, T. (2002), Multi-Agent Modelling of Electricity Markets. In Proceedings of the Agent 2002 Conference on Social Agents: Ecology Exchange and Evolution pp. 215-226.
  • North, N., Collier, N., Vos, R., Najlis, R., and Maciorowski, W., (2005), Agent-Based Modeling with Agent Analyst, GeoComputation 2005.
  • Reitsma, F.E., and Albrecht, J. (2005), A New Process Data Model and its Application. Proceedings of GISUK’05 (Glasgow).
  • Robertson, D.A. (2003). Agent-Based Models of a Banking Network as an Example of a Turbulent Environment: The Deliberate vs. Emergent Strategy Debate Revisited. Emergence, 5(2), pp. 56-71.
  • Robertson, D.A. (2005). Agent-Based Modelling Toolkits: Netlogo, Repast, and Swarm, Academy of Management Learning and Education, 4(4), 525-527.
  • Padgett, J.F., Lee, D., and Collier, N. (2003), Economic production as Chemistry Industrial and Corporate Change, 12(4), pp. 843-877.
  • Tesfatsion, L., (2005), General Software and Toolkits: Agent-Based Computational Economics (ACE) and Complex Adaptive Systems (CAS), http://www.econ.iastate.edu/tesfatsi /acecode.htm.
  • 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).
  • Wood, J., (2002), Java Programming for Spatial Sciences (London; Taylor and Francis).
  • Xie, Y., Batty, M., and Zhao, K. (2005), Simulating Emergent Urban Form: Desakota in China. CASA Working Paper 95.
  • Yang, Y., and Atkinson, P.M., (2005), An Integrated ABM and GIS Model of Infectious Disease Transmission. Paper 143 Computers in Urban Planning and Urban Management (CUPUM).
  • Zachariadis, V., (2005). An Agent-Based Approach to the Simulation of Pedestrian Movement and Factors that Control it. Paper 372 Computers in Urban Planning and Urban Management (CUPUM).