MaGI - LAMP

Geosimulation
• Geosimulation models are developed to
represent phenomena that occur in urban
systems in highly realistic manner
• In particular, Cellular Automata and Multiagent
based geosimulations operate with:
– entities representing human individuals and
infrastructures (e.g. households, homes, urban
services, streets etc.);
– Properties and behaviour of spatial entities;
– Spatial relationships between entities;
– External influences.
Geosimulation
– The modeled entities are associated to
georeferenced objects;
– Properties and phenomena at higher level of
geographic representation emerge as the
product of the dynamic interaction between
spatial entities that form the building blocks of
the simulation model
MAGI
MultiAgent Geosimulation Infrastructure
• Software environment for the design, development and execution of
Geosimulation applications
• Developed by LAMP – Laboratory of Analysis and Models for Planning –
University of Sassari (Italy)
Main features of MAGI
• Enables for the development of a wide range of
geosimulation models
• The resulting models can be integrated with different
computational approaches (both on-line and off-line
coupling are allowed)
• Offers an effective graphical user interface
Model development support
Simulation monitoring
Simulation steering
Main features of MAGI
• Development phase:
• Simulation phase:
Different models
(on-line and/or off-line
coupling with MAGI)
Outcomes for post-processing
MAGI main ingredients
• 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)
– GIS Import/Export libraries (some raster and vector
formats are currently supported: GeoTiff, MID/MIF,
Shapefile)
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
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)
– Neighbor lists, which can be dynamically updated (lists play
a role like neighborhoods in Cellular Automata models)
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
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)
Neighbor lists
• Each agent can hold one or more neighbor list (i.e. the lists
of objects of interest for the agent)
– each list has a target layer which may be different from the layer to
which the agent belongs
• MAGI allows:
On regular tessellations
Standard CA
neighbourhoods
(static)
Custom
neighbourhoods
(static)
Query-based
neighbor lists
(dynamic)
Query-based neighbor list
• A neighbor list can be defined by a spatial query
which is iterated during the simulation with a specified
frequency
• 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)
– Nevertheless, spatial queries are inherently computationally
expensive when involve the evaluation of spatial relationships!
Binary Predicates
• MAGI supports, through GEOS, a complete
set of geometric binary predicates.
A
B
• Binary predicate methods take two
geometries as arguments and return a
boolean indicating whether the geometries
have 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
neighbor lists’ updating, in order to
simulate spatial perception and reasoning
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
– a model may include ‘degenerate’ agents without behavioral
rules (e.g. as part of the agents’ environment)
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;
What kind of agents are they?
• Basically, hybrid reactive - deliberative agents:
– When agent A 'receive' a message from agent B, it can only
react immediately with a standard response (which is
known by B)
– On the other hand, agents can perceive and modify the
environment, they can have an internal state (MAGI
library allows any kind of C++ object as agent state) and
they can execute complex decision algorithms before
acting.
• This kind of agent proved to be suitable for the vast
majority of geosimulation applications where many
‘simple’ agents determine the emergence of a complex
behaviour
MAGI GUI
Model building
Model execution
Editing of behavioral
rules and queries
Model structure editing
MAGI GUI
XML model structure editing
MAGI GUI
• MAGI provides interfaces for exchanging raster
and vector spatial data with GIS
Samples are mapped into
agent properties
MAGI GUI
Parameter monitoring and editing
A model step-by-step
Step 1: definition of model structure
– Number and type of
global parameters
– Global functions
– Layers
– 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
A model step-by-step
Step 3: model plug-in generation
3.1 model source code
generation
3.2 compile and linking
Step 4: model execution
4.1 setting-up an initial
scenario
4.2 run the model
Under development:
• 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)
• Model debugging capabilities
– At the moment advanced debugging can be done in an external
environment (the open source IDE CodeBlocks)
•
•
•
•
OpenGL visualization capabilities
Tests, documentation and examples
Archive of pre-built models
Utilities for “dummy” users