A Software Infrastructure for Multi-Agent Geosimulation Applications Ivan Blecic, Arnaldo Cecchini, Giuseppe A. Trunfio Laboratory of Analysis and Models for Planning Department of Architecture and Planning University of Sassari Italy Third International Workshop on  "Geographical Analysis,Urban Modeling, Spatial Statistics“ GEOG-AN-MOD 08
Multi-Agent Geosimulation (MAG) modelling phenomena taking place in geographical environments through the use of agent-based approach within high-resolution spatial models GIS geo-spatial datasets (buildings,infrastructures, terrain elements) mobile  artificial agents ( pedestrians, consumers,household, vehicles ) + =
MAG models… … are developed to realistically  represent phenomena taking place in space  (e.g. urban systems) Land-use dynamics Urban patterns (e.g.  householder residential behaviour ) Urban sprawl Pedestrian crowding … …  are used to  execute simulations  with the purpose of: Understanding systems (e.g. the consequences of individual-level choices at a global level) What-if analysis, policy evaluation and decision support … .
Developing and executing MAG applications Development phase : Typically needs some programming skills   issues : efficiency of spatial queries even for moving objects, accessing spatial data, computing spatial relationships among geometries, scheduling, etc. Often needs to  involve experts from different fields Availability of data  for inferring empirical rules, calibration, validation etc. Application phase: The application  must allow to effectively execute simulations for different scenarios Including calibration and validation Interoperability with GIS  for further analysis  of spatial outcomes of the simulation
According to Mandl (2000), four alternatives for coupling simulation applications and GIS: loose coupling : GIS and simulation software are two separate software applications, and the data of one is integrated into another. direct co-operative coupling : GIS and simulation software in a server-client interaction. indirect co-operative coupling : a third programming environment couples GIS and simulation software. tight coupling :  GIS functionality is directly implemented in simulation software  or vice versa. In any case a programmer can exploit the wide availability of libraries and environments Swarm, RePast, etc… GIS libraries Developing and executing Geosimulation applications
Vector vs. Raster in MAG models Mixed Vector/Raster representation : more realistic simulations; Direct use of vector spatial data (e.g. demographic data, land-uses, buildings shapes, etc.), without the need of rasterisation.  better interoperability with GIS applications (the geo-spatial features can directly be mapped to objects and agents of the model, and vice versa); the accuracy of spatial perception engine can take significant advantages from the existing algorithms of computational geometry.  Computationally expensive agents’ spatial perception Raster representation: the dimension of cells determines both the accuracy of the representation of complex shapes (e.g. buildings in a city) and the spatial resolution of agents' movements;  need of rasterising vector data; spatial output only of raster type; fairly efficient spatial perception algorithms.
Development Tools for Agent Simulations Missing dimensions?: model complexity, …
MAGI M ulti A gent  G eosimulation  I nfrastructure Software environment for the design, development and execution of  MAG applications
Main features of  MAGI Enables the development of a  wide range of MAG models The resulting models can be  integrated with different computational approaches Offers an  effective graphical user interface   Simulation monitoring Simulation steering Model development support
Main features of  MAGI Development phase : Simulation phase : Different models  (on-line and/or off-line coupling with MAGI) Outcomes for post-processing
The main ingredients of  MAGI Portable C++ libraries: GEOS  (Geometry Engine Open Source) Leaf-prior Update   R-Tree  (spatial indexing for moving objects) OpenTreads  (Threads management) Windows Development and Simulation Environment: MinGW  (Minimalist GNU for Windows – C++ open source development tool) GDAL/OGR ( open source library for accessing raster and vector geospatial data formats)
GEOS GEOS  is an API of 2D spatial predicates and functions  It has the following design goals:  It conforms to the  Simple Features Specification for SQL  published by the  Open GIS Consortium   It provides a complete, consistent, robust implementation of fundamental  2D spatial algorithms   It is fast enough for production use  It is written in C++  It is  open source
GEOS & MAGI Each agent is associated to a geometry In addition, each agent has: Properties   (i.e. C++ objects, representing integer, real numbers, vectors, list, graphs, etc., which define the agent’s  state ) Behavioral rules   (e.g. for updating the agent’s properties or geometry) Spatial contexts,   which can be dynamically updated Point LineString LinearRing Polygon
MAGI Agents Agents can represent  static geographic objects … … or  cells   this enables the development of  Cellular Automata  models
MAGI Agents Agents can  move  in and  interact  with the environment
Layers Agents are organized  in  layers Global parameter and functions  are also allowed (e.g. a parameter may affect more than one layers) Layer parameters   are variables accounting for relevant properties which can influence the agents’ behaviour Layer functions   can be defined and scheduled for execution during simulations (e.g. layer functions can update layer parameters)
Agent’s spatial context Each agent holds a  spatial context :  (i.e. the lists of entities of interest for the agent itself) MAGI allows: Standard CA  neighbourhoods   (static) Spatial contexts  resulting from a  (spatial) perception activity (dynamic) Custom  neighbourhoods   (static) On regular tessellations
Spatial perception Dynamic spatial contexts can be  defined by custom  spatial queries  which are iterated with a specified frequency during the simulation :
Spatial perception The C++ library offers specific  spatial queries   implementing  visual perception  algorithms which operate on vector data
Spatial perception spatial queries are  inherently computationally expensive In MAGI spatial queries are robust and efficient thanks to:  a  spatial indexing technique specific for moving objects ; the use of  binary predicates offered by GEOS ;
Spatial perception: indexing agents MAGI class library: includes a  spatial indexing specific for moving objects  (i.e. the  Leaf-prior Update R-Tree) which makes efficient both the execution of spatial queries and the index updating operations (required when an agent change its position in space)
Spatial perception:  binary Predicates MAGI  supports, through GEOS, a complete set of  geometric binary predicates.  Binary predicate methods take two geometries as arguments and return a boolean indicating whether the geometries are in the named  spatial relationship .  The relationships supported are:  equals, disjoint, intersects, touches, crosses, within, contains, overlaps   Binary predicates can be used by agent’s  behavioral rules  and  spatial queries  for  updating of its spatial context,  in order to simulate spatial perception and reasoning B A
Spatial perception: computational efficiency A) agents avoid collisions but ignore other agents;  B) agents avoid collisions and perceive other agents in their field of vision Moving agents perceiving other moving agents in a vector space  can be computationally expensive as the number of agents increases
Agent behaviour The agent behaviour is defined by  actions Actions can update the state of the agent itself, the state of the environment or the state of other agents
Scheduling The simulation proceeds in  time-steps Two main types of scheduling: Simultaneous updating : agents are  assumed to change simultaneously (like cells’ states in Cellular Automata) conflicts can arise when agents compete over limited resources Sequential updating :  agents’ states change in sequence (each agent observes the reality left by the previous one)  conflicts between agents are resolved but the order of updating may influence results. Sequential random updating  is also available;
MAGI GUI Model structure editing Editing of behavioral rules and queries Model building Model execution
MAGI GUI XML model structure editing
MAGI GUI MAGI  provides interfaces for exchanging raster and vector spatial data with  GIS through GDAL/OGR GDAL/OGR is provided by the  Open Source Geospatial Foundation . It presents a single abstract data model to the calling application for all supported formats.  Samples are mapped into agent states
MAGI GUI Parameter monitoring and editing
A model step-by-step Number and type of global parameters Global functions Layers  Step 1 : definition of model structure For each layer: Name Type of agent activation  Type of boundary (e.g. toroidal space ?) Type of entities (e.g. cells ?) Number and type of layer parameters Layer functions
A model step-by-step Step 2 : definition of agents Type of geometry Structure of agent’s state (number and type of properties) Actions defining agent’s behaviour (C++ source code) Number and type of  Neighbor lists spatial queries in case of query-based lists
Under development: Application examples Multi-threading  based concurrent computation for exploiting the multi-core processor architectures (the current trends in processor technology indicate that the number of processor cores in one chip will continue to increase)  OpenGL  visualization capabilities

Blecic Iccsa 2008

  • 1.
    A Software Infrastructurefor Multi-Agent Geosimulation Applications Ivan Blecic, Arnaldo Cecchini, Giuseppe A. Trunfio Laboratory of Analysis and Models for Planning Department of Architecture and Planning University of Sassari Italy Third International Workshop on "Geographical Analysis,Urban Modeling, Spatial Statistics“ GEOG-AN-MOD 08
  • 2.
    Multi-Agent Geosimulation (MAG)modelling phenomena taking place in geographical environments through the use of agent-based approach within high-resolution spatial models GIS geo-spatial datasets (buildings,infrastructures, terrain elements) mobile artificial agents ( pedestrians, consumers,household, vehicles ) + =
  • 3.
    MAG models… …are developed to realistically represent phenomena taking place in space (e.g. urban systems) Land-use dynamics Urban patterns (e.g. householder residential behaviour ) Urban sprawl Pedestrian crowding … … are used to execute simulations with the purpose of: Understanding systems (e.g. the consequences of individual-level choices at a global level) What-if analysis, policy evaluation and decision support … .
  • 4.
    Developing and executingMAG applications Development phase : Typically needs some programming skills issues : efficiency of spatial queries even for moving objects, accessing spatial data, computing spatial relationships among geometries, scheduling, etc. Often needs to involve experts from different fields Availability of data for inferring empirical rules, calibration, validation etc. Application phase: The application must allow to effectively execute simulations for different scenarios Including calibration and validation Interoperability with GIS for further analysis of spatial outcomes of the simulation
  • 5.
    According to Mandl(2000), four alternatives for coupling simulation applications and GIS: loose coupling : GIS and simulation software are two separate software applications, and the data of one is integrated into another. direct co-operative coupling : GIS and simulation software in a server-client interaction. indirect co-operative coupling : a third programming environment couples GIS and simulation software. tight coupling : GIS functionality is directly implemented in simulation software or vice versa. In any case a programmer can exploit the wide availability of libraries and environments Swarm, RePast, etc… GIS libraries Developing and executing Geosimulation applications
  • 6.
    Vector vs. Rasterin MAG models Mixed Vector/Raster representation : more realistic simulations; Direct use of vector spatial data (e.g. demographic data, land-uses, buildings shapes, etc.), without the need of rasterisation. better interoperability with GIS applications (the geo-spatial features can directly be mapped to objects and agents of the model, and vice versa); the accuracy of spatial perception engine can take significant advantages from the existing algorithms of computational geometry. Computationally expensive agents’ spatial perception Raster representation: the dimension of cells determines both the accuracy of the representation of complex shapes (e.g. buildings in a city) and the spatial resolution of agents' movements; need of rasterising vector data; spatial output only of raster type; fairly efficient spatial perception algorithms.
  • 7.
    Development Tools forAgent Simulations Missing dimensions?: model complexity, …
  • 8.
    MAGI M ultiA gent G eosimulation I nfrastructure Software environment for the design, development and execution of MAG applications
  • 9.
    Main features of MAGI Enables the development of a wide range of MAG models The resulting models can be integrated with different computational approaches Offers an effective graphical user interface Simulation monitoring Simulation steering Model development support
  • 10.
    Main features of MAGI Development phase : Simulation phase : Different models (on-line and/or off-line coupling with MAGI) Outcomes for post-processing
  • 11.
    The main ingredientsof MAGI Portable C++ libraries: GEOS (Geometry Engine Open Source) Leaf-prior Update R-Tree (spatial indexing for moving objects) OpenTreads (Threads management) Windows Development and Simulation Environment: MinGW (Minimalist GNU for Windows – C++ open source development tool) GDAL/OGR ( open source library for accessing raster and vector geospatial data formats)
  • 12.
    GEOS GEOS is an API of 2D spatial predicates and functions It has the following design goals: It conforms to the Simple Features Specification for SQL published by the Open GIS Consortium It provides a complete, consistent, robust implementation of fundamental 2D spatial algorithms It is fast enough for production use It is written in C++ It is open source
  • 13.
    GEOS & MAGIEach agent is associated to a geometry In addition, each agent has: Properties (i.e. C++ objects, representing integer, real numbers, vectors, list, graphs, etc., which define the agent’s state ) Behavioral rules (e.g. for updating the agent’s properties or geometry) Spatial contexts, which can be dynamically updated Point LineString LinearRing Polygon
  • 14.
    MAGI Agents Agentscan represent static geographic objects … … or cells this enables the development of Cellular Automata models
  • 15.
    MAGI Agents Agentscan move in and interact with the environment
  • 16.
    Layers Agents areorganized in layers Global parameter and functions are also allowed (e.g. a parameter may affect more than one layers) Layer parameters are variables accounting for relevant properties which can influence the agents’ behaviour Layer functions can be defined and scheduled for execution during simulations (e.g. layer functions can update layer parameters)
  • 17.
    Agent’s spatial contextEach agent holds a spatial context : (i.e. the lists of entities of interest for the agent itself) MAGI allows: Standard CA neighbourhoods (static) Spatial contexts resulting from a (spatial) perception activity (dynamic) Custom neighbourhoods (static) On regular tessellations
  • 18.
    Spatial perception Dynamicspatial contexts can be defined by custom spatial queries which are iterated with a specified frequency during the simulation :
  • 19.
    Spatial perception TheC++ library offers specific spatial queries implementing visual perception algorithms which operate on vector data
  • 20.
    Spatial perception spatialqueries are inherently computationally expensive In MAGI spatial queries are robust and efficient thanks to: a spatial indexing technique specific for moving objects ; the use of binary predicates offered by GEOS ;
  • 21.
    Spatial perception: indexingagents MAGI class library: includes a spatial indexing specific for moving objects (i.e. the Leaf-prior Update R-Tree) which makes efficient both the execution of spatial queries and the index updating operations (required when an agent change its position in space)
  • 22.
    Spatial perception: binary Predicates MAGI supports, through GEOS, a complete set of geometric binary predicates. Binary predicate methods take two geometries as arguments and return a boolean indicating whether the geometries are in the named spatial relationship . The relationships supported are: equals, disjoint, intersects, touches, crosses, within, contains, overlaps Binary predicates can be used by agent’s behavioral rules and spatial queries for updating of its spatial context, in order to simulate spatial perception and reasoning B A
  • 23.
    Spatial perception: computationalefficiency A) agents avoid collisions but ignore other agents; B) agents avoid collisions and perceive other agents in their field of vision Moving agents perceiving other moving agents in a vector space can be computationally expensive as the number of agents increases
  • 24.
    Agent behaviour Theagent behaviour is defined by actions Actions can update the state of the agent itself, the state of the environment or the state of other agents
  • 25.
    Scheduling The simulationproceeds in time-steps Two main types of scheduling: Simultaneous updating : agents are assumed to change simultaneously (like cells’ states in Cellular Automata) conflicts can arise when agents compete over limited resources Sequential updating : agents’ states change in sequence (each agent observes the reality left by the previous one) conflicts between agents are resolved but the order of updating may influence results. Sequential random updating is also available;
  • 26.
    MAGI GUI Modelstructure editing Editing of behavioral rules and queries Model building Model execution
  • 27.
    MAGI GUI XMLmodel structure editing
  • 28.
    MAGI GUI MAGI provides interfaces for exchanging raster and vector spatial data with GIS through GDAL/OGR GDAL/OGR is provided by the Open Source Geospatial Foundation . It presents a single abstract data model to the calling application for all supported formats. Samples are mapped into agent states
  • 29.
    MAGI GUI Parametermonitoring and editing
  • 30.
    A model step-by-stepNumber and type of global parameters Global functions Layers Step 1 : definition of model structure For each layer: Name Type of agent activation Type of boundary (e.g. toroidal space ?) Type of entities (e.g. cells ?) Number and type of layer parameters Layer functions
  • 31.
    A model step-by-stepStep 2 : definition of agents Type of geometry Structure of agent’s state (number and type of properties) Actions defining agent’s behaviour (C++ source code) Number and type of Neighbor lists spatial queries in case of query-based lists
  • 32.
    Under development: Applicationexamples Multi-threading based concurrent computation for exploiting the multi-core processor architectures (the current trends in processor technology indicate that the number of processor cores in one chip will continue to increase) OpenGL visualization capabilities