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

Talks

Life has been quite hectic for the last couple of weeks. We just come back from Chicago where we attended the Repast Training workshop which introduced us to Repast symphony (which looked quite cool) along with both presenting our work at the Agent 2006 Conference. I gave a paper titled “Exploring Cities Using Agent-based Models and GIS” and Christian’s paper was called “Using Repast to Develop a Prototype Agent-based Pedestrian Evacuation Model.” These papers will be available for download from the agent 2006 website soon.


This week Christian and I are off to Oxford to present at a workshop called: Complexity and Dynamics: Volatility & Stability in City & Regional Systems, which is part of the European Conference on Complex Systems 2006. The workshop focuses on urban dynamics, along with volatility and stability in city and regional systems. Our paper is entitled “From Pedestrians to Cities: Exploring Urban Systems through Agent-Based Modelling”

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.

Friday, August 25, 2006

Slowing Repast simulations

Occasionally, one might want to slow a Repast simulation, say to observe change within your model at a slower pace. There is no built in functionality in Repast to do this. However slowing a simulation down can be achieved using the Tread.sleep comand in the model code. This comand slows (stalls) the program for a specific period of time

You could put this code in your model's stepping function (the function called every 'tick'), or some other place that would be called whenever an action occurs. The argument to sleep is the number of milliseconds you would like your program to sleep. See the Repast emailing list comment by Vos for futher information.

public void step() {
// do normal functionality in step

try {Thread.sleep(100); // sleep a tenth of a second
} catch (Exception ex) {
// ignore this exception
}
}

Alternativly one could alter the speed of the simulation durring the model run eg:

public void step() {
// Pause the simulation according the selected speed
if(simulationSpeed <100){
try {
Thread.sleep(10 * (100 - simulationSpeed));
} catch (InterruptedException e) {
}
}


To hava an adjustable simulation speed, you may want to create say a slider (as the picture shows). To do this include the following bit of code in this in the setup() method:

public void setup(){
// Adjust the simulation speed durring the model run


class SimulationSpeedListener extends SliderListener {
public void execute() {
simulationSpeed = value;
}
}
modelManipulator.addSlider("Simulation speed", 0, 100, 10, new SimulationSpeedListener());

}

Where simulationSpeed refers to a int set in the main program.

Tuesday, August 22, 2006

Regional Science

I just attended Regional Science Annual conference in Jersey, where I presented a paper entitled ‘Experimenting with cities, integrating Agent-Based Models and GIS: Applied to segregation’ The abstract of the talk was:

Cities are faced with many problems such as urban sprawl, congestion, crime, segregation, etc. They are also constantly changing. Computer modelling is becoming an increasingly important tool when examining how cities operate. Agent-Based Models (ABM) provide an environment to test different hypotheses and theories to urban change based on the individual behaviours of agents, thus leading to a greater understanding of how cities work.

This paper presents the development of generic agent-based simulation model for the examination of urban issues focusing on the integration of Geographical Information Systems (GIS) and ABM where space plays a central role, for past ABM have been criticised for not being spatial as they have been developed outside geography in other social sciences (Torrens 2003). The model allows for global patterns emerging from local interactions of individual agents. Using the generic framework, models can be developed rapidly to examine urban issues. One of the types of models will be presented: a segregation model. The model was created with only minor alterations to the basic model structure, highlighting how this approach can be applied to different styles of urban models.

Batty et al. (2004) write that it is hard to find clear examples of segregation process taking place, because it only becomes noticeable when it is clearly underway, and by then a detailed chronology becomes impossible to reconstruct. Schelling (1969) presented a model on the emergence of segregation where he showed that with mild preferences to locate amongst like demographic or economic activity groups, strict segregation would emerge unknowingly. This segregation is all too clear when one walks around the urban area, there are clusters of economic groups and residential groups based on ethnicity or social class.

To highlight this idea of segregation based on simple tastes and preferences, a simple segregation model has been created inheriting much of the features from the generic model. Individuals are given the same initial starting conditions but different preferences for their neighbours. What is clear is that with different percentages of similarity wanted, different patterns will emerge. However these patterns change as time passes, as the agents move to find areas in which they are happy to live in, thus changing the composition of the neighbourhood and the overall appearance of the system. Unlike the traditional segregation models, space is not restricted to discrete homogenous cells, more than one agent is allowed per area, and more intelligent movement, and searching mechanisms are introduced (e.g. agents don’t just move to random locations or the nearest empty cell). System dynamics are introduced with agents entering and leaving the system. To conclude the paper will present future avenues of research.

The PowerPoint of the talk can be downloaded from here: