[GRASS-SVN] r56356 - in grass-addons/grass7/raster/r.agent: . libagent
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 21 09:27:24 PDT 2013
Author: mic
Date: 2013-05-21 09:27:24 -0700 (Tue, 21 May 2013)
New Revision: 56356
Modified:
grass-addons/grass7/raster/r.agent/libagent/ant.py
grass-addons/grass7/raster/r.agent/libagent/anthill.py
grass-addons/grass7/raster/r.agent/libagent/grassland.py
grass-addons/grass7/raster/r.agent/r.agent.aco
Log:
remember number of found paths
Modified: grass-addons/grass7/raster/r.agent/libagent/ant.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/ant.py 2013-05-21 15:57:36 UTC (rev 56355)
+++ grass-addons/grass7/raster/r.agent/libagent/ant.py 2013-05-21 16:27:24 UTC (rev 56356)
@@ -62,6 +62,10 @@
return False
else:
# goal node found!
+ self.world.numberofpaths += 1
+ #TODO for now just drop a line..
+ #self.world.playground.grassinfo("Found a path, total: " + \
+ # str(self.world.numberofpaths))
# add one to the counter
#self.world.nrop += 1
self.done = True
Modified: grass-addons/grass7/raster/r.agent/libagent/anthill.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/anthill.py 2013-05-21 15:57:36 UTC (rev 56355)
+++ grass-addons/grass7/raster/r.agent/libagent/anthill.py 2013-05-21 16:27:24 UTC (rev 56356)
@@ -73,6 +73,7 @@
self.antslife = 0
self.decisionbase = "standard"
self.evaluationbase = "standard"
+ self.numberofpaths = 0
def bear(self):
"""
Modified: grass-addons/grass7/raster/r.agent/libagent/grassland.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/grassland.py 2013-05-21 15:57:36 UTC (rev 56355)
+++ grass-addons/grass7/raster/r.agent/libagent/grassland.py 2013-05-21 16:27:24 UTC (rev 56356)
@@ -28,6 +28,9 @@
raise error.DataError(Grassland.ME,
"Only square raster cells make sense.")
+# def grassinfo(self, msg):
+# grass.info(msg)
+
def setgrasslayer(self, layername, grassmapname, force=False):
"""
Put an existing map from GRASS to the layer collection
Modified: grass-addons/grass7/raster/r.agent/r.agent.aco
===================================================================
--- grass-addons/grass7/raster/r.agent/r.agent.aco 2013-05-21 15:57:36 UTC (rev 56355)
+++ grass-addons/grass7/raster/r.agent/r.agent.aco 2013-05-21 16:27:24 UTC (rev 56356)
@@ -279,6 +279,8 @@
# grass.info(mainloops)
# loop and write out the contents at the end
world.letantsdance(nextwrite)
+ # Print the number of found paths
+ grass.info("Number of found paths: " + str(world.numberofpaths))
# export the value maps
#TODO hopefully not really needed - workaround for broken(?) garray
for i in range(len(world.playground.layers[anthill.Anthill.RESULT])):
More information about the grass-commit
mailing list