Agent-Based Modelling and Simulation using Repast: A Gallery of GIS Applications Christian J. E. Castle, Andrew T. Crooks, Paul A. Longley, Mike Batty Centre for Advanced Spatial Analysis. University College London, 1-19 Torrington Place, London, WC1E 7HB, England Tel. +44(0)207 679 4260 Fax +44(0)207 813 2843 c.castle@ucl.ac.uk, andrew.crooks@ucl.ac.uk, plongley@geog.ucl.ac.uk, http://www.casa.ucl.ac.uk KEYWORDS: Agent Based Models, Simulation, Toolkits, Repast, CASA 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 inputoutput 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). Charting Parameter Settings Display Behaviour Control Simulations 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. The CAPABLE Project Urban Dynamics in Latin American Cities Segregation Modelling. Pedestrian Modelling 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. Acknowledgments We gratefully acknowledge the financial support of the Economic and Social Research Council (ESRC, Collaborative Award in Science and Engineering (CASE) award PTA-033-2004-00034: Castle, and PTA-033-2003-00008: Crooks; http://www.esrc.ac.uk); Camden Primary Care Trust (PCT http://www.camdenpct.nhs.uk); and the Greater London Authority Economic unit (GLA http://www.london.gov.uk/mayor/economic_unit). 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 Socialscientific 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). Biography Christian Castle is a second year Ph.D. student at the Centre for Advanced Spatial Analysis (CASA; University College London) under the supervision of Professor Paul Longley He is currently undertaking an ESRC CASE studentship with Camden Primary Care Trust (PCT). The project is entitled 'A GIS-Based Spatial Decision Support System (SDSS) for Emergency Services: London’s King’s Cross Redevelopment'. His main research interests focus on pedestrian modelling; emergency evacuation management; and Spatial Decision Support Systems (SDSS). Andrew Crooks is a third year Ph.D. student at CASA under the supervision of Professor Mike Batty. He holds an ESRC CASE award for researching 'Economic Sketch Planning Using Complexity Theory’ supported by GLA Economics. His research explores the modelling of urban areas using ideas from complexity theory and visualisation techniques from sketch planning. Paul Longley is Professor of Geographic Information Science at UCL and serves as Deputy Director of CASA.