Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Thursday, February 17, 2022

New Paper: Synthetic Populations with Social Networks

When developing geographically explicit agent-based models, one thing we spend a lot of time on is building synthetic populations and then linking the agents in the synthetic population to each other.  To overcome this issue we have a new paper published in "Computational Urban Science " entitled "A method to create a synthetic population with social networks for geographically-explicit agent-based models" In this paper  Na (Richard) Jiang, Hamdi Kavak, Annetta Burger, William Kennedy and myself present a synthetic population generation method that also includes social networks and use the New York Metro as a study site, which covers an area of 262 x 234 km and is home to over 23 million people. 

To show the utility of this method we also present three simple applications (e.g., a disease , a disaster  and a traffic model) which utilize different parts of this synthetic population but are all geographically explicit and use networks in some shape or form. If this sounds of interest, below you can read the abstract from the paper, along with seeing some of the figures from our methodology and example applications. While at the bottom of the post we provide the full citation and a link to the paper. The paper itself also has links to actual code that generates the synthetic population and the resulting datasets and models  (code: https://bit.ly/SynPopABM; source and resulting synthetic population data: https://osf.io/3vsaj/) .  

Abstract

Geographically-explicit simulations have become crucial in understanding cities and are playing an important role in urban science. One such approach is that of agent-based modeling which allows us to explore how agents interact with the environment and each other (e.g., social networks), and how through such interactions aggregate patterns emerge (e.g., disease outbreaks, traffic jams). While the use of agent-based modeling has grown, one challenge remains, that of creating realistic, geographically-explicit, synthetic populations which incorporate social networks. To address this challenge, this paper presents a novel method to create a synthetic population which incorporates social networks using the New York Metro Area as a test area. To demonstrate the generalizability of our synthetic population method and data to initialize models, three different types of agent-based models are introduced to explore a variety of urban problems: traffic, disaster response, and the spread of disease. These use cases not only demonstrate how our geographically-explicit synthetic population can be easily utilized for initializing agent populations which can explore a variety of urban problems, but also show how social networks can be integrated into such populations and large-scale simulations.

Keywords: Synthetic Population Generation, Agent-Based Modeling, New York, Traffic Dynamics, Disease, Disaster

Study Area

Workflow for Generation of Synthetic Population and Networks

Creation of Social Networks: (a) Selected Population; (b) Creation of a Household Network; (c) Creation of Work and Educational Networks for each Member of the Household; (d) The Household, its Networks within the Full Census Tract

Model Component Structure of Population Respond to Disaster event

Agents’ Health Status After 1 Minute of the Disaster Event

Full Reference:

Jiang, N., Crooks, A.T., Kavak, H., Burger, A. and Kennedy, W.G. (2022), A Method to Create a Synthetic Population with Social Networks for Geographically Explicit Agent-Based Models, Computational Urban Science, 2:7. Available at https://doi.org/10.1007/s43762-022-00034-1

Thursday, December 02, 2021

Urban life: A model of people and places

We have just wrapped up project that created a simple agent-based simulation of urban life as part of DARPA's Ground Truth Program. To this end we have just published a  new paper entitled "Urban life: a model of people and places" published in Computational and Mathematical Organization Theory, with Andreas Züfle, Carola Wenk, Dieter Pfoser, Joon-Seok Kim, Hamdi Kavak, Umar Manzoor, Hyunjee Jin  and myself. In the paper we provide an overview of the model and how it was used to test and validate human domain research. For interested readers, below you can find the abstract  to the paper along with some images that will give you a sense of our simulation model (which for interested readers was created with MASON and its GIS extension (GeoMason). While at the bottom of the post you can find the full reference and a link to the paper. 

 Abstract

We introduce the Urban Life agent-based simulation used by the Ground Truth program to capture the innate needs of a human-like population and explore how such needs shape social constructs such as friendship and wealth. Urban Life is a spatially explicit model to explore how urban form impacts agents’ daily patterns of life. By meeting up at places agents form social networks, which in turn affect the places the agents visit. In our model, location and co-location affect all levels of decision making as agents prefer to visit nearby places. Co-location is necessary (but not sufficient) to connect agents in the social network. The Urban Life model was used in the Ground Truth program as a virtual world testbed to produce data in a setting in which the underlying ground truth was explicitly known. Data was provided to research teams to test and validate Human Domain research methods to an extent previously impossible. This paper summarizes our Urban Life model’s design and simulation along with a description of how it was used to test the ability of Human Domain research teams to predict future states and to prescribe changes to the simulation to achieve desired outcomes in our simulated world.

Our generated maps colored based on different aggregation levels.

A screenshot of the graphical user interface from a representative model run. Top-Left: The spatial network and agents. Bottom left: Simulation parameters that can be specified prior to simulation start. Top-middle: the social network. Bottom-middle: Summary statistics of the simulation during tun-time such as friendship. Right: Profiles of recreational sites.

Screenshot of the epidemic simulator depicting the French Quarter, New Orleans, LA, USA.

Full Reference:

Züfle, A., Wenk, C., Pfoser, D., Crooks, A.T., Kavak, H., Kim, J-S. and Jin, H. (2021), Urban Life: A Model of People and Places, Computational and Mathematical Organization Theory. Available at https://doi.org/10.1007/s10588-021-09348-7 (pdf)

Wednesday, June 10, 2009

Game of Life on a globe

Always interested in ways to visualize models, I just seen Richard Milton's version of John Conway's Game of Life on a globe model. Richard has has written a short tutorial on how it was done (click here). The the Java applet allows you to explore how different configurations of automata evolve around the globe.


To view the applet click here. Another similar model (shown below) was created by Ventrella to celebrate Earth Day. Click here to see more details about the model.

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.

Thursday, October 30, 2008

Work Update

Readers of the blog might have been wondering why I been interested in Second Life (click here to see blog posts on Second Life), and why I been exploring fine scale modelling of the London housing market and what this has to do with GIS and ABM. As part of the CASA seminar series, I was asked to give a talk about some of my work from the last year. The talk was entitled "Modelling Cities: An Approach using Agent-Based Models and GIS' which pulled together these topics. The abstract or the talk is below:

The Agent-based modelling (ABM) paradigm is becoming an increasingly used technique to study cities. It allows us to grow social structures in artificial worlds specifically how a set of micro-specifications are sufficient to generate the macro-phenomena of interest. Until recently many applications of agent-based models exploring urban phenomena have used a regular partition of space (cells) to represent space. While these models have provided valuable insights into urban phenomena especially as they can capture geographic detail, they miss geometric detail. This area is critical to good applications but is barely touched upon in the literature. Geometry (points, lines and polygons), forms the skeleton of cities from streets and buildings, through to parks, rivers, etc. The ability to represent the urban environment as a series of points, lines, and polygons allows for different size features such as houses and roads to be directly incorporated into the modelling process onto which other physical and social attributes can be added. Additionally the inclusion of geometry allows us to make agent-based models more realistic compared to representing the urban environment as a series of discrete regular cells. This presentation introduces ABM, explore how agent-based models coupled loosely with geographic information systems (GIS) can be created through illustrated examples focusing on residential location. These applications directly consider geometry when building these artificial worlds and running the simulations. Furthermore, these models highlight how the inclusion of geometry impacts on simulation results. Problems and challenges with this approach and ABM in general will be identified. To conclude we will argue the need for fine scale and extensive datasets of the built and socio-economic environments to ground such models, along with the need to communicate and visualise agent-based models. To this extent we introduce our detailed housing and built environment database for London, which will be used as a building block for agent-based models associated with London. We then explore how such models might be communicated and shared with others using advances in technology, specifically Web 2.0 and Second Life.

Some people have asked for the slides of the talk, so I have made them available, they can be downloaded from here (28MB). Accompanying these I have also made a movie of the talk which give a sense of dynamics from such models.



Any thoughts or comments most welcome.

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.

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"


Thursday, March 29, 2007

PropertyWindow class

There was this message on the Repast mailing list the other day:

Dear list,
I want to probe some variables of my agents of the OpenMap Layer. I did this by making the following method:
public String[] gisPropertyList() {

String []gisPropertyList = {"Lat/Lon","getLatLonPointString","nativeCountry","getNativeCountry",

"residence","getResidence","age","getAge","gender","getGender" };


return gisPropertyList;

It works, however when I probe one of my agents I get the screen below. It seems like something is on top of the last fields. How can I fix this? Thanks!


I had exactly the same problem as this is to do with the PropertyWindow class which only permits 4 items to be displayed in the anl.repast.gis.display package. Click here to see my modification that works around this problem. I hope this helps.


Thursday, May 11, 2006

Trove4J

I have just discovered a java library called Trove, which allows you to plug in their versions (eg THashMap) of certain containers (java.util.HashMap, java.util.HashSet, java.util.LinkedList), and use them just like you would with the standard versions gaining performance. For example the THashMap class is a faster than java.util.HashMap. Trove also comes when you download Repast.

Thursday, March 02, 2006

OpenJUMP

A friend of mine has just switched from using OpenMap to OpenJUMP (Java Unified Mapping Platform) and what he showed me was very impressive. Especially as he is integrating it with Repast. OpenJUMP is an open source GIS software written in Java. It is based on JUMP GIS by Vivid Solutions. It is developed and maintained by a group of volunteers (quite impressive). OpenJUMP is a Vector GIS but can read rasters as well.

Basic GIS functions include: built in drawing and geometry editing tools, attribute query, a set of selection tools, image export in Scalable Vector Graphics (SVG) format, a tool to zoom to a user defined map scale, it can show multiple layers dependent on the current map scale. It also has the ability to read and write shapefiles. Sounds like a good Open Source GIS.