Blecic Iccsa 2008

32
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

description

Third International Workshop on "Geographical Analysis, Urban Modeling, Spatial Statistics"

Transcript of Blecic Iccsa 2008

Page 1: Blecic Iccsa 2008

A Software Infrastructure for Multi-Agent Geosimulation Applications

Ivan Blecic, Arnaldo Cecchini, Giuseppe A. Trunfio

Laboratory of Analysis and Models for PlanningDepartment of Architecture and Planning

University of SassariItaly

Third International Workshop on

"Geographical Analysis,Urban Modeling, Spatial Statistics“ GEOG-AN-MOD 08

Page 2: Blecic Iccsa 2008

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)

+ =

Page 3: Blecic Iccsa 2008

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– ….

Page 4: Blecic Iccsa 2008

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

Page 5: Blecic Iccsa 2008

• 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

Page 6: Blecic Iccsa 2008

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.

Page 7: Blecic Iccsa 2008

Development Tools for Agent Simulations

Missing dimensions?: model complexity, …

Page 8: Blecic Iccsa 2008

MAGIMultiAgent Geosimulation Infrastructure

• Software environment for the design, development and execution of MAG applications

Page 9: Blecic Iccsa 2008

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 steeringModel development support

Page 10: Blecic Iccsa 2008

Main features of MAGI

• Development phase:

• Simulation phase:

Different models

(on-line and/or off-line coupling with MAGI)

Outcomes for post-processing

Page 11: Blecic Iccsa 2008

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)

Page 12: Blecic Iccsa 2008

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

Page 13: Blecic Iccsa 2008

GEOS & MAGI• Each agent is associated to a geometry

Point LineString LinearRing Polygon

• 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

Page 14: Blecic Iccsa 2008

MAGI Agents

• Agents can represent static geographic objects…

• …or cells – this enables the development

of Cellular Automata models

Page 15: Blecic Iccsa 2008

MAGI Agents

• Agents can move in and interact with the environment

Page 16: Blecic Iccsa 2008

Layers• Agents are organized in 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)

Global parameter and functions are also allowed (e.g. a parameter may affect more than one layers)

Page 17: Blecic Iccsa 2008

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

Page 18: Blecic Iccsa 2008

Spatial perception

• Dynamic spatial contexts can be defined by custom spatial queries which are iterated with a specified frequency during the simulation :

Page 19: Blecic Iccsa 2008

Spatial perception• The C++ library offers specific spatial queries implementing

visual perception algorithms which operate on vector data

Page 20: Blecic Iccsa 2008

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;

Page 21: Blecic Iccsa 2008

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)

Page 22: Blecic Iccsa 2008

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

Page 23: Blecic Iccsa 2008

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

Page 24: Blecic Iccsa 2008

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

Page 25: Blecic Iccsa 2008

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;

Page 26: Blecic Iccsa 2008

MAGI GUI

Model structure editing

Editing of behavioral rules and queries

Model building Model execution

Page 27: Blecic Iccsa 2008

MAGI GUI

XML model structure editing

Page 28: Blecic Iccsa 2008

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

Page 29: Blecic Iccsa 2008

MAGI GUIParameter monitoring and editing

Page 30: Blecic Iccsa 2008

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

Page 31: Blecic Iccsa 2008

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

Page 32: Blecic Iccsa 2008

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