20 #include "genotypes/realgenotype.h"
21 #include "randomgenerator.h"
23 #include "configurationparameters.h"
29 genes = (
float*)(
data );
38 genes = (
float*)(
data );
47 genes = (
float*)(
data );
54 "RealGenotype::configure",
55 "The ngenes must be present in the config file and its value must be greater than zero" );
56 minv = params.
getValue( prefix + QString(
"minValue" ) ).toDouble();
57 maxv = params.
getValue( prefix + QString(
"maxValue" ) ).toDouble();
59 "RealGenotype::configure",
60 "The minValue and maxValue must be different!! Check you config file" );
62 QString zipdata = params.
getValue( prefix + QString(
"data" ) );
63 if ( !zipdata.isNull() ) {
66 genes = (
float*)(
data );
67 QStringList valuesList = params.
getValue( prefix + QString(
"fitness" ) )
68 .split( QRegExp(
"\\s+"), QString::SkipEmptyParts );
70 foreach( QString avalue, valuesList ) {
73 rankv = params.
getValue( prefix + QString(
"rank" ) ).toDouble();
84 fitstring.append( QString(
"%1 ").arg(avalue) );
97 d.
describeReal(
"fitness" ).
props(
IsList ).
help(
"The fitness of the Genotype",
"The fitness of a Genotype support multi objective fitness; if you specify a vector of values they are considered different objectives of the fitness" );
98 d.
describeString(
"data" ).
help(
"The bits composing the Genotype stored in a compressed string" );
99 d.
describeReal(
"rank" ).
def( 0 ).
help(
"The rank indicate who is more fitted that others and how much; the values are dependent on the kind of GeneticAlgo used" );
103 Q_ASSERT_X( (i+1)*32 <=
size(),
105 "The value requested is beyond the dimension of this Genotype" );
106 return (
double) ( genes[i] );
110 Q_ASSERT_X( (i+1)*32 <=
size(),
112 "The value to be set is beyond the dimension of this Genotype" );
113 genes[i] = (float) ( value );
118 for(
unsigned int i=0; i<
numgenes; i++ ) {