(genome, **args)
return int(mutations)
The mutator of GTree, Real Range Mutator

   Accepts the *rangemin* and *rangemax* genome parameters, both optional.

   .. versionadded:: 0.6
      The *GTreeMutatorRealRange* function
The mutator of GTree, Real Range Mutator
The mutator of GTree Real Range Mutator
def GTreeMutatorRealRange(genome, **args):
   """ The mutator of GTree, Real Range Mutator

   Accepts the *rangemin* and *rangemax* genome parameters, both optional.

   .. versionadded:: 0.6
      The *GTreeMutatorRealRange* function
   """
   if args["pmut"] <= 0.0:
      return 0
   elements = len(genome)
   mutations = args["pmut"] * elements

   range_min = genome.getParam("rangemin", Consts.CDefRangeMin)
   range_max = genome.getParam("rangemax", Consts.CDefRangeMax)

   if mutations < 1.0:
      mutations = 0
      for i in xrange(len(genome)):
         if Util.randomFlipCoin(args["pmut"]):
            mutations += 1
            rand_node = genome.getRandomNode()
            random_real = rand_uniform(range_min, range_max)
            rand_node.setData(random_real)

   else:
      for it in xrange(int(round(mutations))):
         rand_node = genome.getRandomNode()
         random_real = rand_uniform(range_min, range_max)
         rand_node.setData(random_real)

   return int(mutations)
def GTreeMutatorRealRange ( genome , * * args ) : if args [ "pmut" ] <= 0.0 : return 0 elements = len ( genome ) mutations = args [ "pmut" ] * elements range_min = genome . getParam ( "rangemin" , Consts . CDefRangeMin ) range_max = genome . getParam ( "rangemax" , Consts . CDefRangeMax ) if mutations < 1.0 : mutations = 0 for i in xrange ( len ( genome ) ) : if Util . randomFlipCoin ( args [ "pmut" ] ) : mutations += 1 rand_node = genome . getRandomNode ( ) random_real = rand_uniform ( range_min , range_max ) rand_node . setData ( random_real ) else : for it in xrange ( int ( round ( mutations ) ) ) : rand_node = genome . getRandomNode ( ) random_real = rand_uniform ( range_min , range_max ) rand_node . setData ( random_real ) return int ( mutations )