(genome, **args)
return int(mutations)
The mutator of G1DList, Gaussian Gradient Mutator

   Accepts the *rangemin* and *rangemax* genome parameters, both optional. The
   random distribution is set with mu=1.0 and std=0.0333

   The difference between this routine and the normal Gaussian Real is that the
   other function generates a gaussian value and adds it to the value. If the
   mu is 0, and the std is 1, a typical value could be 1.8 or -0.5. These small
   values are fine if your range is 0-10, but if your range is much larger, like
   0-100,000, a relative gradient makes sense.

   This routine generates a gaussian value with mu=1.0 and std=0.0333 and then
   the gene is multiplied by this value. This will cause the gene to drift
   no matter how large it is.
The mutator of G1DList, Gaussian Gradient Mutator
The mutator of G1DList Gaussian Gradient Mutator
def G1DListMutatorRealGaussianGradient(genome, **args):
   """ The mutator of G1DList, Gaussian Gradient Mutator

   Accepts the *rangemin* and *rangemax* genome parameters, both optional. The
   random distribution is set with mu=1.0 and std=0.0333

   The difference between this routine and the normal Gaussian Real is that the
   other function generates a gaussian value and adds it to the value. If the
   mu is 0, and the std is 1, a typical value could be 1.8 or -0.5. These small
   values are fine if your range is 0-10, but if your range is much larger, like
   0-100,000, a relative gradient makes sense.

   This routine generates a gaussian value with mu=1.0 and std=0.0333 and then
   the gene is multiplied by this value. This will cause the gene to drift
   no matter how large it is.

   """
   if args["pmut"] <= 0.0:
      return 0
   listSize = len(genome)
   mutations = args["pmut"] * (listSize)

   mu = Consts.CDefGaussianGradientMU
   sigma = Consts.CDefGaussianGradientSIGMA

   if mutations < 1.0:
      mutations = 0
      for it in xrange(listSize):
         if Util.randomFlipCoin(args["pmut"]):
            final_value = genome[it] * abs(rand_gauss(mu, sigma))

            final_value = min(final_value, genome.getParam("rangemax", Consts.CDefRangeMax))
            final_value = max(final_value, genome.getParam("rangemin", Consts.CDefRangeMin))

            genome[it] = final_value
            mutations += 1
   else:
      for it in xrange(int(round(mutations))):
         which_gene = rand_randint(0, listSize - 1)
         final_value = genome[which_gene] * abs(rand_gauss(mu, sigma))

         final_value = min(final_value, genome.getParam("rangemax", Consts.CDefRangeMax))
         final_value = max(final_value, genome.getParam("rangemin", Consts.CDefRangeMin))

         genome[which_gene] = final_value

   return int(mutations)
def G1DListMutatorRealGaussianGradient ( genome , * * args ) : if args [ "pmut" ] <= 0.0 : return 0 listSize = len ( genome ) mutations = args [ "pmut" ] * ( listSize ) mu = Consts . CDefGaussianGradientMU sigma = Consts . CDefGaussianGradientSIGMA if mutations < 1.0 : mutations = 0 for it in xrange ( listSize ) : if Util . randomFlipCoin ( args [ "pmut" ] ) : final_value = genome [ it ] * abs ( rand_gauss ( mu , sigma ) ) final_value = min ( final_value , genome . getParam ( "rangemax" , Consts . CDefRangeMax ) ) final_value = max ( final_value , genome . getParam ( "rangemin" , Consts . CDefRangeMin ) ) genome [ it ] = final_value mutations += 1 else : for it in xrange ( int ( round ( mutations ) ) ) : which_gene = rand_randint ( 0 , listSize - 1 ) final_value = genome [ which_gene ] * abs ( rand_gauss ( mu , sigma ) ) final_value = min ( final_value , genome . getParam ( "rangemax" , Consts . CDefRangeMax ) ) final_value = max ( final_value , genome . getParam ( "rangemin" , Consts . CDefRangeMin ) ) genome [ which_gene ] = final_value return int ( mutations )