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

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.

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.

Tuesday, December 02, 2008

Territorial Self-organization Model

MATer is an agent-based model that aims at reproducing the historical patterns of population settlement in a territory written using Repast. It is the result a interdisciplinary project at the University of Coimbra that combined agent-based modelling, geographic information systems and historical and archaeological evidence in order to understand how self-organizational processes shape human settlements throughout a territory.

Within the model there is simple population dynamics (birth, growing, reproducing and dying). Individuals require land to survive and seek locations to settle down (low land close to the rivers), migrating when overpopulation makes land scarce. Through these behaviours the model simulates the foundation, growth and decline of settlements, taking into account the actual geography of a territory. What I find particularly appealing is that the simulation generates roads between settlements when there is population movements and once created the roads, affect the ease with which agents move around the area.


Video Simulation of MATer




Click here to see the Project website and to find out more about the model.

Monday, October 27, 2008

New Paper: Key challenges in agent-based modelling for geo-spatial simulation

Just found out we (Christian Castle, Mike Batty and myself) have a new article inpress within Computers, Environment and Urban Systems, entitled "Key challenges in agent-based modelling for geo-spatial simulation" Below is the abstract.

Agent-based modelling (ABM) is becoming the dominant paradigm in social simulation due primarily to a worldview that suggests that complex systems emerge from the bottom-up, are highly decentralised, and are composed of a multitude of heterogeneous objects called agents. These agents act with some purpose and their interaction, usually through time and space, generates emergent order, often at higher levels than those at which such agents operate. ABM however raises as many challenges as it seeks to resolve. It is the purpose of this paper to catalogue these challenges and to illustrate them using three somewhat different agent-based models applied to city systems. The seven challenges we pose involve: the purpose for which the model is built, the extent to which the model is rooted in independent theory, the extent to which the model can be replicated, the ways the model might be verified, calibrated and validated, the way model dynamics are represented in terms of agent interactions, the extent to which the model is operational, and the way the model can be communicated and shared with others. Once catalogued, we then illustrate these challenges with a pedestrian model for emergency evacuation in central London, a hypothetical model of residential segregation model tuned to London data, and an agent-based residential location model, for Greater London. The ambiguities posed by this new style of modelling are drawn out as conclusions, and the relative arbitrariness of such modelling highlighted.

Anyone wishing to give us feedback on the article is most welcome.

Full Reference:
Crooks, A.T., Castle, C. J. E., and Batty, M. (2008), Key Challenges in Agent-Based Modelling for Geo-spatial Simulation, Computers, Environment and Urban Systems, 32(6): 417-430. (pdf)

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/”.



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.


Tuesday, February 13, 2007

Pedestrian Fire Evacuation Model

I found this model a few months ago, its quite good as it shows how pedestrians exit a building when a fire is spreading through it. The model is written in Repast and makes use of .xml and txt files. While it is extremely basic, the model highlights how ABM can be utilized to examine emergency egress from a building. On a side note, CASA has a long history of pedestrian modelling using ABM (Click here to see more along with checking out the CASA working papers)


Unfortunately I don’t remember where the original source code came from but if you wrote it please let me know so I can give you full credit.

The model can be run by clicking here (Sorry it will only work in Windows). For instructions on how to run a Repast model see the Repast website. Alternatively the original source code can be downloaded from here.

Monday, December 11, 2006

Repast Model of the Week: Fads Model

The Fads Model from Tom Carter is a well commented model utilizing some of Repasts core functions including OpenSequenceGraph, OpenHistogram (histogram), reading in a .pgm for the space, and uses Object2DTorus for the underlying agent grid. The model writes information out using the DataRecorder object

Similar to other Repast Models, the typical way to code a simulation is to divide up the creation of the simulation into three methods - buildModel(), buildDisplay(), buildSchedule(). This division is not strictly necessary, but it does make the creation conceptually clearer and this is what the Fad model does

The buildModel() method is responsible for creating those parts of the simulation that represent what is being modeled. Consequently, the agents and their environment are typically created here together with any optional data collection objects. Of course, this method may call other methods to help build the model.

There are also a few other Repast models available from Tom Carters website: NinaNet, NinaNet2, and WealthModel.

Further information

The original source code of the fads model model can be found:
http://csustan.csustan.edu/~tom/SFI-CSSS/2005/FadsModel/
The model can either be run as a .jnlp (ie using Java web start therefore works on any OS) from:

Or run as an executable by clicking here (Sorry it will only work in Windows). For instructions on how to run a Repast model see the Repast website.

Wednesday, September 27, 2006

Repasts Raster GIS and Sugar Scape models

Following on from Christians ‘How to create a .pgm file from an .ascii file’ post I thought it would be useful to provide some models that show how this type of information can be loaded into Repast. Repast provides two models that use images that to create the basis of artificial worlds: the Sugar Scape model and a GIS Model (based on Raster data).

The GIS Model (top image), uses the RasterSpace class and reads in a .txt file (e.g. an .ascii file that can be outputted from ESRI ArcGIS. While the Sugar Scape Model (bottom image) reads in a .pgm file to great a Object2Dtorus space

The original source code for both models can be accessed through the RepastJ download. Alternatively, one can run the Sugar Scape or GIS Model by clicking these links (sorry these models will only run on a windows operating system)

Tuesday, September 26, 2006

PLAN C

PLAN C: Planning with Large Agent-Networks against Catastrophes

New York University Bioinformatics group are using Repast to develop a agent based model simulation framework able to simulate the emergency responses in urban settings entitled PlanC. Catastrophic scenarios simulated include bomb explosion, the spread of small pox and food poisoning. The tool is intended to devise plans (such as time to recovery) for such scenarios based on the modelling of a large number of individual agents. The Models incorporate GIS data with agent based modelling (utilizing Repast)


Further reading/references such as the study of food poisoning in Brazil, or a hypothetical Sarin attack within Manhattan can be seen on the project website, along with a software demo. The site also claims the software will be available soon.

Thursday, August 03, 2006

Repast Models of the Week:The SLUDGE and SluGIS models

The SLUDGE model (Simulated Land Use Dependent on Edge Effect Externalities) was developed by Dawn Parker. The combines a simple cellular automaton and agent-based model which was designed to study the joint influence of distance-dependent spatial externalities and transportation costs on patterns of land use. Further information on her work can be found at discussed in the following papers:
A Repast model of SLUDGE has also been programmed by Robert Najlis. The source code for the original model can be downloaded from here. Alternatively if you viewing this post on a computer using windows, you can run the model directly by clicking here.
Robert Najlis has also developed a model called SluGIS which is a closely-related model of of SLUDGE. With the major distinction as it is a move away from the cellular space used in the previous model. SluGIS runs on a vector landscape. Robert Najlis has used Repast GIS functionally (and produced the same model both ESRIs and OpenMap interfaces of Repast).
A modified OpenMap version can be run by downloading the following and unzipping the following Shapefile package (download Shapefiles) and storing it to disk. Then by running the model by clicking here and choosing the shapefile you just saved to disk.
The original java files for the OpenMap and ESRI SluGIS models can be found here. A modified ESRI version which was created by Michael Leamy can be downloaded from here. All that needs to be done is to change the path names for the .shp file, the .gal file, and the refresh call. Look for this in SluGISEsri.java.
For more information on Repast GIS see the Repast website “How to use GIS data with Repast”.

Tuesday, June 27, 2006

Repast Model of the week: jEcho

jECHO, created by Brian McIndoe is a new version of the ECHO model of a Complex Adaptive System (CAS) described by Holland using Repast. The aim of the research was to seek insights into CAS behavior in an attempt to evaluate ECHO model mechanisms and properties.

Further information
Brian McIndoe site also contains a copy of the Masters dissertation which describes the analysis, design and implementation of jECHO plus some experimentation and references.

The original source code for the model can be found and downloaded by clicking here

Alternatively, to run a verision of the model click here (Sorry it will only work in Windows). For instructions on how to run a Repast model see the Repast website.

Tuesday, June 20, 2006

Repast Model of the week: EvoTech model

EvoTech2 is an model exploring Evolutionary Technology: A Repast-Based Causal Approach. Created by Laszlo Gulyas and George Kampis. The Projects research question is “Can you evolve an increasing number of species in a developing ecosystem so that they perform an increasing range of different tasks? The authors write, that current evolutionary simulations cannot do this.” The authors come up with an alternative suggestion. To illustrate their idea they consider evolutionary technology instead of natural evolution. The ultimate goal of the project is to develop artificial organisms that perform increasingly complicated tasks. We are currently in the process of developing a simple test-bed for the causal principles.
Figure is Part of the frameset of the simulation model. It shows population numbers, surviving phenotypes, and their distribution.


The creators developed an agent-based simulation model using the RePast package. Organisms are agents that selectively feed, reproduce and die, based on their phenotypic properties described in variable length records. As adaptation progresses, new property sets extend the records, and as a result, selection can spontaneously switch between the defining properties of an interaction. The aim is to develop functionally disjoint subpopulations specialised for the use of different property sets. The initial results show the possibility of progressive evolution productive of new selection effects, as an illustration for the causal principles of embodiment.

The model has some good features, not only does it use a whole host of repasts core functions it is also clearly commented. The models also demonstrates how to add buttons to the Controller, This is extremely useful, while one can add buttons to custom actions pain these can’t be activated till the model is running. By adding extra buttons on the control bar gets around this problem.

Further Information

Further information about the model can be found on the project website. And some articles about the work here. The original source code can be down loaded from here. Alternatively to run the model on a windows machine click here.

Friday, May 26, 2006

Repast Model of the week: GeoSim

International Conflict Research (ICR) group at the Centre for Comparative and International Studies (CIS) Zurich, has numerous Repast models which can be downloaded. Click here to see the models available and for further details. These models use a whole host of Repasts functionality and spaced (from networks to grids).

One model is GeoSim (see Cederman 2003 for more information). GeoSim represents an agent based computational model of an inter-state or world system where sovereign countries (nation-states) are composed of capitals and provinces and interactions determine the rise and fall of territorial agents. The ICR provides a simplified version of the model which can be downloaded.

Further Information

The original source code of the GeoSim model can be found by clicking here.

For further information on the context of GeoSim see: Cederman L-E 2003 "Modelling the size of wars: from billiard balls to sand piles", American Political Science Review, 97(1), 135-150. A copy of the article can be found by clicking here.

To run the model as an executable click here (Sorry it will only work in Windows). For instructions on how to run a Repast model see the Repast website.

Thursday, April 27, 2006

Repast Model of the Week: The Beer Game

I thought it would be quite useful to keep track of the Repast models I find, I have found by looking at other peoples code a good way of learning about Repast. It is also a bit of an experiment, how many models are out there.

For the models I intend to create an executable created using exe4J (a simple piece of software that converts jar files into executables, if you like the idea of this you can download a free trial version). Initially I wanted to use Java Web Start but I have been having issues creating an executable jar with only the code needed and not all the other Java classes. I have tried using Repasts’ JarBuilder but I cant seem to get it to work (if you know how to create a simple jar especially using JarBuilder please drop me a line).

For each model I also intend to supply as much information as possible, i.e. who created the model, where I downloaded it from (i.e. the source code) and related articles and links that I find along the way as I not trying to take credit of the models.


The Beer Game
The "beer game" agent-based model is a classic supply chain exercise. Created by Michael North to illustrate how the ABM approach can be used and to show how a simple model can reveal important insights. North recreates Sterman’s “Beer Game” simulation from its original Systems Dynamics implementation (Sterman 1989) to an agent-based simulation using Repast.

The supply chain consists of four stages: factories, distributors, wholesalers, and retailers who respond to customers’ demand by executing behaviors. The flows of goods and information in the form of orders between stages (agents) as well as physical shipments are included in the model, but the flows of payments and the additional complexities of pricing, negotiation, and financial accounting that this would entail are not included. However, Macal and North (2005) note that these aspects of supply chain agent behavior could easily be incorporated in the agent-based version of the supply chain model. supply chain agents only have access to local information. Within the model no agent has a global view of the supply chain or is in a position to optimize the system as a whole. Agents adopt decision rules that only this local information in making their decisions.

“The goal of the agents in the model is to manage their inventory in such a way as to minimize their costs through judicious decisions based on how much to order each period. When inventories are too low and there is a danger of running out of stock, agents order more; when inventories are too large and agents incur high inventory holding costs, agents order less. Each agent incurs a cost when holding stock in inventory, the inventory holding charge. Agents also incur a backorder charge when they receive an order and cannot immediately meet that order because they have no stock. Each agent strikes a delicate balance between having too much inventory, which runs up inventory holding costs, and too little inventory, which puts the agent at a greater risk of running out of stock and incurring excessive backorder charges (Macal and North, 2005)”.

“The results of the agent-based supply chain model exactly duplicate the results from Sterman’s original Beer Game Simulation. The “Bull-Whip” effect, observed in real supply chains, is observed even in this highly simplified supply chain model (Macal and North 2005)”. Macal and North (2005) also note this agent-based model is a very useful foundation for more realistic models of supply chains, such as models based on supply network topologies and alternative agent decision rules.


Further information

The original source code of the model can be found http://sourceforge.net/project/showfiles.php?group_id=60538
While further information on the model including a UML diagram of the model structure can be found at http://valuenetwork.sourceforge.net/

To run a verision of the model click here (Sorry it will only work in Windows). For instructions on how to run a Repast model see the Repast website.