[GRASS-SVN] r55327 - in grass-addons/grass7/raster/r.agent: libagent tests
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 11 13:34:43 PDT 2013
Author: mic
Date: 2013-03-11 13:34:42 -0700 (Mon, 11 Mar 2013)
New Revision: 55327
Modified:
grass-addons/grass7/raster/r.agent/libagent/anthill.py
grass-addons/grass7/raster/r.agent/libagent/world.py
grass-addons/grass7/raster/r.agent/tests/test_agent.py
Log:
change argument position
Modified: grass-addons/grass7/raster/r.agent/libagent/anthill.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/anthill.py 2013-03-11 20:29:47 UTC (rev 55326)
+++ grass-addons/grass7/raster/r.agent/libagent/anthill.py 2013-03-11 20:34:42 UTC (rev 55327)
@@ -26,16 +26,13 @@
COST = "penaltymap"
RESULT = "pheromap"
- def __init__(self, pg=False):
+ def __init__(self, pg=None):
"""
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
- if pg:
- super(Anthill, self).__init__(ant.Ant, pg)
- else:
- super(Anthill, self).__init__(ant.Ant)
+ super(Anthill, self).__init__(pg, ant.Ant)
# add the main layers
## one containing the points of interest
self.addlayertopg(Anthill.SITE)
Modified: grass-addons/grass7/raster/r.agent/libagent/world.py
===================================================================
--- grass-addons/grass7/raster/r.agent/libagent/world.py 2013-03-11 20:29:47 UTC (rev 55326)
+++ grass-addons/grass7/raster/r.agent/libagent/world.py 2013-03-11 20:34:42 UTC (rev 55327)
@@ -26,7 +26,7 @@
### theoretical fix penalty value for diagonal walking
DIAGONAL = sqrt(2)-1
- def __init__(self, agenttype=None, pg=None):
+ def __init__(self, pg=None, agenttype=None):
"""
Create a World, a place with a playground, where agents meet
@param type optional, the default agent type for this world
Modified: grass-addons/grass7/raster/r.agent/tests/test_agent.py
===================================================================
--- grass-addons/grass7/raster/r.agent/tests/test_agent.py 2013-03-11 20:29:47 UTC (rev 55326)
+++ grass-addons/grass7/raster/r.agent/tests/test_agent.py 2013-03-11 20:34:42 UTC (rev 55327)
@@ -8,7 +8,7 @@
def setUp(self):
self.pg = playground.Playground()
self.pg.setregion(3,3)
- self.world = world.World(None, self.pg)
+ self.world = world.World(self.pg, None)
self.world.bear(1, [1,1], agent.Agent)
self.agent = self.world.agents[0]
More information about the grass-commit
mailing list