[GRASS-SVN] r54886 - in grass-addons/grass7/raster/r.agent: . libagent tests
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Feb 3 14:45:48 PST 2013
Author: mic
Date: 2013-02-03 14:45:48 -0800 (Sun, 03 Feb 2013)
New Revision: 54886
Modified:
grass-addons/grass7/raster/r.agent/libagent/aco.py
grass-addons/grass7/raster/r.agent/r.agent.aco
grass-addons/grass7/raster/r.agent/tests/test_aco.py
Log:
basic aco structure prepared
Modified: grass-addons/grass7/raster/r.agent/libagent/aco.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/aco.py 2013-02-03 21:45:21 UTC (rev 54885)
+++ grass-addons/grass7/raster/r.agent/libagent/aco.py 2013-02-03 22:45:48 UTC (rev 54886)
@@ -22,6 +22,10 @@
"""World class for using the Ant Colony Optimization Algorithm for
modelling Agent Based worlds."""
def __init__(self):
+ """
+ Create a world based on the natural laws of the Ant Colony Optimization
+ algorithm (plus adaptions honouring the complexity of the raster case).
+ """
# get all attributes from the basic world
super(ACO, self).__init__(ant.Ant)
# add the main layers
@@ -29,8 +33,60 @@
self.addlayertopg("sitemap")
## one containing the time cost for traversing cells
self.addlayertopg("penaltymap")
+ ## allow overwriting the cost map
+ self.overwritepenalty = False
## and finally the markings from the agents
self.addlayertopg("pheromap")
+ ## allow overwriting the main map (if it exists)
+ self.overwritepheormone = False
# list of the points of origin / sites
self.holes = []
+ # default values
+ ## how many rounds to go
+ self.rounds = 0
+ ## when to produce output
+ self.outrounds = 0
+ ## let ant die if penalty grows too big
+ self.maxpenalty = 0
+ ## max/min possible value of pheromone intensity
+ self.maxpheromone = maxsize
+ self.minpheromone = 10
+ ## half value period for pheromone
+ self.volatilizationtime = 1
+ ## ants mark every step with this pheromone value
+ self.stepintensity = 10
+ ## ants mark every found path with this pheromone intensity
+ self.pathintensity = 10000
+ ## penalty values above this point an ant considers as illegal
+ self.highcostlimit = 0
+ ## penalty values below this point an ant considers as illegal
+ self.lowcostlimit = 0
+ ## how to weigh the values found on the playground
+ self.pheroweight = 1
+ self.randomweight = 1
+ self.costweight = 1
+ ## maximum number of ants on the playground
+ self.maxants = 100
+ ## the ants ttl will be set by user or based on playground size
+ self.antslife = 0
+#TODO self.decisionbase = "default"
+#TODO self.rememberbase = "default"
+ def letantsdance(self):
+ """
+ Organize the agents and the pheromone on the playground.
+ """
+ pass
+
+ def volatilize(self):
+ """
+ Let the pheromone evaporate over time.
+ """
+ pass
+
+ def writeout(self):
+ """
+ Write the results back onto the maps.
+ """
+ pass
+
Modified: grass-addons/grass7/raster/r.agent/r.agent.aco
===================================================================
--- grass-addons/grass7/raster/r.agent/r.agent.aco 2013-02-03 21:45:21 UTC (rev 54885)
+++ grass-addons/grass7/raster/r.agent/r.agent.aco 2013-02-03 22:45:48 UTC (rev 54886)
@@ -14,7 +14,7 @@
"""
#%Module
-#% description: Creates a special kind of world, that follows the rules of ACO - with ant-like agents in it.
+#% description: Agents wander around on the terrain, marking paths to new locations.
#%End
#%option
#% key: outputmap
Modified: grass-addons/grass7/raster/r.agent/tests/test_aco.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_aco.py 2013-02-03 21:45:21 UTC (rev 54885)
+++ grass-addons/grass7/raster/r.agent/tests/test_aco.py 2013-02-03 22:45:48 UTC (rev 54886)
@@ -35,5 +35,14 @@
def test_kill(self):
pass
+ def letantsdance(self):
+ pass
+
+ def volatilize(self):
+ pass
+
+ def writeout(self):
+ pass
+
# def tearDown(self):
More information about the grass-commit
mailing list