GRASS logo

NAME - Agents wander around on the terrain, marking paths to new locations.


SYNOPSIS --help [-pscal] outputmap=string [inputmap=string] costmap=string sitesmap=string rounds=integer [outrounds=integer] [targetvisibility=integer] [highcostlimit=integer] [lowcostlimit=integer] [maxpheromone=integer] [minpheromone=integer] [volatilizationtime=integer] [stepintensity=integer] [pathintensity=integer] [maxants=integer] [antslife=integer] decisionalgorithm=string evaluateposition=string [agentfreedom=integer] pheromoneweight=integer randomnessweight=integer costweight=integer [--help] [--verbose] [--quiet] [--ui]


Allow overwriting existing pheromone maps
Produce a sequence of pheromone maps (by appending a number)
Overwrite existing cost map (only used with penalty conversion)
Auto-convert cost (slope..) to penalty map (using "tobler", see docu)
Avoid loops on the way back
Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


outputmap=string [required]
Name of pheromone output map
Name of input pheromone raster map (e.g. from prior run)
costmap=string [required]
Name of penalty resp. cost raster map (note conversion checkbox)
sitesmap=string [required]
Name of sites map, vector data with possible points of origin
rounds=integer [required]
Number of iterations/rounds to run
Options: 0-999999
Default: 999
Produce output after running this number of iterations/rounds
Options: 0-999999
Distance to target from where it might be 'sensed'
Options: 0-999999
Penalty values above this point an ant considers as illegal/bogus when in 'costlymarked' modus
Options: 0-<max integer on system would make sense>
Penalty values below this point an ant considers as illegal/bogus when in 'costlymarked' modus
Options: -99999-99999
Absolute maximum of pheromone intensity a position may have
Options: <minpheromone>-<max integer on system would make sense>
Absolute minimum of pheromone intensity to leave on playground
Options: 0-<maxpheromone>
Half-life for pheromone to volatize (e.g. =rounds)
Options: 0-<max integer on system would make sense>
Pheromone intensity to leave on each step
Options: 0-<max integer on system would make sense>
Pheromone intensity to leave on found paths
Options: 0-<max integer on system would make sense>
Maximum amount of ants that may live concurrently (x*y)
Options: 0-<the bigger the playground, the more space they have>
Time to live for an ant (e.g. four times points distance)
Options: 0-<max integer on system would make sense>
decisionalgorithm=string [required]
Algorithm used for walking step
Options: standard, marked, costlymarked, random, test
Default: standard
evaluateposition=string [required]
Algorithm used for finding and remembering paths
Options: standard, avoidloop, forgetloop, avoidorforgetloop
Default: avoidorforgetloop
Number of possible directions the ant can take (4 or 8)
Options: 4, 8
pheromoneweight=integer [required]
How is the pheromone value (P) weighted when walking (p*P:r*R:c*C)
Options: 0-99999
Default: 1
randomnessweight=integer [required]
How is the random value (R) weighted when walking (p*P:r*R:c*C)
Options: 0-99999
Default: 1
costweight=integer [required]
How is the penalty value (C) weighted when walking (p*P:r*R:c*C)
Options: 0-99999
Default: 0

Table of contents


As a first real example of a world there is an ACO-based environment (see Ant Colony Optimization) available.

The basic concept of such an ACO world, is to take some cost surface and transform it to a penalty layer. Even if the algorithm comes from the realm of insects, it might be adopted to different animal kingdoms. Depending on the type of agent this penalty layer must be reinterpreted: if for example we want to talk about human agents the penalty layer may be expressed by the walking velocity, e.g. calculated with the algorithm proposed by Tobler1993. The actors on the playground will wander around on the playground using the time for their paths that correspond with the values in the penalty grid. If they find some attractor, they walk home to the position they originated, marking their way with pheromones. While this pheromone vanishes over time, the following agents are more likely to choose their next steps to a position that smells most.

This first toolset was mainly developed for Topoi Project A-III-4, with some inspirations from previous work conducted at the Uni Bern in 2008.


The state of this software is: "first do it".

ACO works best on dynamic maps -- it constantly tries to improve paths...


A fictive usecase could look something like this (note: at the moment the in- and output variables with libold, are still ascii-files): penaltymap=testpenalty.grid \
  sitesmap=sites.vect rounds=100 outrounds=100 volatilizationtime=5000 \
  antslife=2000 maxants=400 pathintensity=1000000

For running the total test suite on the libraries, i.e. to run all the tests that are at the end of each python file, use this test collection (for certain tests, the following files must exist though: "elev.grid", and "arch.vect"):

user@host:~$ cd /<pathtoaddons>/r.agent/libagent

user@host:libold$ ./


Integrate it directly within grass.

Improve encapsulation of classes.

Find good parameters, or parameter finding strategies for the ACO part. Try to avoid high penalty fields. Think about heuristics too.

Implement other ABM scenarios.



Michael Lustenberger

Last changed: $Date: 2015-11-11 21:14:59 +0100 (Wed, 11 Nov 2015) $


Available at: source code (history)

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

© 2003-2017 GRASS Development Team, GRASS GIS 7.2.3svn Reference Manual