20 #include "mutations/gaussianfloat.h"
21 #include "core/genotype.h"
22 #include "randomgenerator.h"
23 #include "genotypes/doublegenotype.h"
24 #include "configurationparameters.h"
39 Q_ASSERT_X( rgen != 0,
40 "GaussianFloat::mutate",
41 "In order to use GaussianFloat mutation the Genotypes must be a subclass of DoubleGenotype" );
44 for(
unsigned int i=0; i<rgen->
numGenes(); i++ ) {
47 if ( newvalue > max ) newvalue =
max;
48 if ( newvalue < min ) newvalue =
min;
49 rgen->
set( i, newvalue );
56 double nvarg = params.
getValue( prefix + QString(
"variance" ) ).toDouble();
58 qWarning() <<
"GaussianFloat configuration: variance parameter must be positive";
66 Descriptor d =
addTypeDescription( type,
"Mutate a value accordlying a Gaussian distribution",
"The mutated value is extracted stochastically from a Gaussian distribution centered on the current value of the gene with a variance specified by the variance parameter" );
72 params.
createParameter( prefix, QString(
"variance"), QString(
"%1").arg(varg) );