Thursday, November 19, 2015

Using Shapefiles in NetLogo

Carrying on with the theme of linking GIS to NetLogo for creating agent-based models. We would like to showcase two simple models. Both are based on using a shapefile to create Schelling-inspired segregation model.

In the first model (as shown in the movie below) we use the polygons to be individual agents. In this example, we import a shapefile where each polygon is either a red or blue agent; or unoccupied (grey). The agent evaluates its neighborhood (i.e. surrounding polygons) and if dissatisfied with its neighborhood moves to an unoccupied polygon. More information  about the model and simple tutorial can be found here and the code and data can be downloaded from here.

In the second example (as shown in the movie below), we use attributes from the shapefile to add a specific number of agents to each polygon and again, the agents move if they are dissatisfied  with their current location. This is calculated by the agents examining both their geometrical neighboring polygons; and their 8-connected neighbors. The underlying color of the polygon is based on the which agent group is in the majority (i.e. a red polygon has more red agents than blue agents).

In addition to showing how to work with shapefiles within NetLogo we have also added some statics which you might find useful. The ability to calculate  Moran's I and a segregation index. Further  information  about the model can be found here and the code and data can be downloaded from here.

If you are interested in learning more about GIS and agent-based modeling in NetLogo it is worth checking out Yang Zhou's website Geospatial Computational Social Science.

Tuesday, October 13, 2015

Rainfall Model: NetLogo
Now whats seems like a long time ago, we where inspired to by  the NetLogo Grand Canyon Model and created a similar model in GeoMason. Now we have returned to NetLogo to test its ability to handle GIS data. Below you can see our attempt. The model is based on importing a geotiff of the National Elevation Dataset at 1 arc second from the National Map of Crater Lake, Oregon. After which water is added (which could be considered loosely as agents) and flows from high to low elevations, if the water cannot flow over the surface, it pools up.

The first movie below acts as a verification exercise about the basic functioning of the model (i.e. did we build the model right?). Here we have three different map types. The first being flat, the second being a cone and the third being a hill. The idea with these map types is to ensure the basic functioning of the model is correct.

After we were happy with the model, the Crater Lake example was implemented. As the movie below shows, over time, Crater Lake slowly fills up until the water breaches the caldera rim which allows the water to flow out. An extra addition to the model is the addition of erosion. Whereby as water flows over the surface, it picks up some sediment (in this case 1 unit of elevation) and when it stops moving, it deposits the sediment. As a result the terrain in the area changes. 

While carrying out this exercise, we also thought about testing NetLogo's 3D capacity with respect to creating geographically explicit agent-based models. The movie below shows the results.

More information about the models in this post can been seen on Yang Zhou's website. Also the models can be downloaded from GitHub. We hope you enjoy.

Tenure-Track Assistant Professor, Computational Social Science

Readers of this blog might be interested in the following position.

Tenure-Track Assistant Professor, Computational Social Science 

The George Mason University Computational and Data Sciences (CDS) Department in the College of Science invites applicants for a full-time, tenure-track faculty position at the Assistant Professor level. 

Beginning Fall 2016, this position is intended to primarily support the Computational Social Science (CSS) Program within CDS, including support of the Ph.D. degree in CSS, a master’s degree in interdisciplinary studies, and a CSS certificate. This position will also support undergraduate programs that are currently under development.

Potential for success in both research and teaching are the primary criteria for this position. Applicants should have a promising research record, with a deep knowledge of and interest in computation as applied to one or more of the social sciences. While we are open to expertise in all areas of computational social science, we are particularly interested in social network specialists interested in both theory and data. Applicants must have a Ph.D. (expected completion by August 2016 is acceptable) from an accredited institution.

About the Program:

Methodologically, the CSS Program focuses on data-driven social science models using social network and agent-based computational approaches from a complexity perspective. Current faculty members have domain expertise in economics and finance, political science and international relations, geography and geographic information systems, land use and cover change, and public policy. As one of the first programs of its type in the world, CSS has had significant success in both research and professional placement. Our students come from all over the world (the Americas, Europe, Africa, Asia and Australia) and have been placed at a variety of top universities (e.g., University of Oxford, University College London), at government agencies, as well as in the private sector, including start-up companies.

More Information: 

Friday, September 25, 2015

Urban Growth Model in NetLogo

Recently Yang Zhou, a PhD student in the Computational Social Program carried out a partial re-implementation of the SLEUTH urban growth model (without Self Modification). The region of study is Santa Fe, New Mexico. The data was obtained from The National Map. The model demonstrates how several raster layers can be used to initialize a NetLogo model. Hopefully others who want to know how to create spatially explicit models in NetLogo will find this useful. The model and data can be downloaded from Yang's GitHub account.

Also you can export the data to at any time to see how the land cover changes over time. For example in the image below we show the land cover at the initialization of the model (t=0, top) and the land cover at t=10 (bottom).
To find out more about CA models, the movie below by Andreas Flache offers a good introduction:

Mesa: An Agent-Based Modeling Framework in Python

Just a short post to say two of our PhD students, David Masad and Jackie Kazil have been developing an agent-based modeling framework in Python called Mesa.

To quote from David's talk abstract:
"Agent-based modeling is currently a hole in in Python’s robust and growing scientific ecosystem. Mesa is a new open-source package meant to fill that gap. It allows users to quickly create agent-based models using built-in core components (such as agent schedulers and spatial grids) or customized implementations; visualize them using an innovative browser-based interface; and analyze their results using Python’s robust data analysis tools. Its goal is to be a Python 3-based alternative to other popular frameworks based in other languages such as NetLogo, Repast, or MASON."

Below is short presentation outlining Mesa from SciPy 2015: