[GRASS-SVN] r55667 - grass-addons/grass7/raster/r.agent

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 8 08:07:31 PDT 2013


Author: mic
Date: 2013-04-08 08:07:30 -0700 (Mon, 08 Apr 2013)
New Revision: 55667

Modified:
   grass-addons/grass7/raster/r.agent/r.agent.aco
Log:
start using the main loop

Modified: grass-addons/grass7/raster/r.agent/r.agent.aco
===================================================================
--- grass-addons/grass7/raster/r.agent/r.agent.aco	2013-04-08 15:02:32 UTC (rev 55666)
+++ grass-addons/grass7/raster/r.agent/r.agent.aco	2013-04-08 15:07:30 UTC (rev 55667)
@@ -295,49 +295,51 @@
 
 def main():
 
-    setmaps(options['sitesmap'],
+    try:
+        setmaps(options['sitesmap'],
             options['costmap'], flags['c'],
             options['inputmap'], options['outputmap'], flags['p'])
 
-#    world.playground.setboundsfromlayer("costs")
+#        world.playground.setboundsfromlayer("costs")
 
-    if options['maxpheromone']:
-        world.maxpheromone = int(options['maxpheromone'])
-    if options['minpheromone']:
-        world.minpheromone = int(options['minpheromone'])
-    if options['volatilizationtime']:
-        world.volatilizationtime = int(options['volatilizationtime'])
-    if options['stepintensity']:
-        world.stepintensity = int(options['stepintensity'])
-    if options['pathintensity']:
-        world.pathintensity = int(options['pathintensity'])
-    if options['maxants']:
-        world.maxants = int(options['maxants'])
-    if options['antslife']:
-        world.antslife = int(options['antslife'])
-#    if options['decisionalgorithm']:
-#        world.decisionbase = str(options['decisionalgorithm'])
-#    if options['validposition']:
-#        world.validposition = str(options['validposition'])
-#    if options['agentfreedom']:
-#        world.globalfreedom = int(options['agentfreedom'])
-    if options['pheromoneweight']:
-        world.pheroweight = int(options['pheromoneweight'])
-    if options['randomnessweight']:
-        world.randomweight = int(options['randomnessweight'])
-    if options['costweight']:
-        world.costweight = int(options['costweight'])
-    #if arglist[0] == "stability":
-        #TODO ask silvia..
-    try:
+        if options['maxpheromone']:
+            world.maxpheromone = int(options['maxpheromone'])
+        if options['minpheromone']:
+            world.minpheromone = int(options['minpheromone'])
+        if options['volatilizationtime']:
+            world.volatilizationtime = int(options['volatilizationtime'])
+        if options['stepintensity']:
+            world.stepintensity = int(options['stepintensity'])
+        if options['pathintensity']:
+            world.pathintensity = int(options['pathintensity'])
+        if options['maxants']:
+            world.maxants = int(options['maxants'])
+        if options['antslife']:
+            world.antslife = int(options['antslife'])
+#        if options['decisionalgorithm']:
+#            world.decisionbase = str(options['decisionalgorithm'])
+#        if options['validposition']:
+#            world.validposition = str(options['validposition'])
+#        if options['agentfreedom']:
+#            world.globalfreedom = int(options['agentfreedom'])
+        if options['pheromoneweight']:
+            world.pheroweight = int(options['pheromoneweight'])
+        if options['randomnessweight']:
+            world.randomweight = int(options['randomnessweight'])
+        if options['costweight']:
+            world.costweight = int(options['costweight'])
+        #if arglist[0] == "stability":
+            #TODO ask silvia..
+
+
 #        world.checkvalues()
         if not options['outrounds']:
             options['outrounds'] = 0
-#        letantsdance(int(options['rounds']), int(options['outrounds']))
-        grass.message("FINISH")
     except error.DataError:
-        grass.fatal_error("Failed to parse args..")
+        grass.fatal("Failed to parse args..")
         sys.exit(1)
+    letantsdance(int(options['rounds']), int(options['outrounds']))
+    grass.message("FINISH")
 
 if __name__ == "__main__":
     options, flags = grass.parser()



More information about the grass-commit mailing list