RealGenotype class. More...
![Inheritance graph](classfarsa_1_1RealGenotype__inherit__graph.png)
Public Member Functions | |
RealGenotype (unsigned int numGenes=0, float min=FLT_MIN, float max=FLT_MAX) | |
Construct a un-initialized RealGenotype | |
RealGenotype (const RealGenotype &genotype) | |
Copy-Constructor (generate a clone of the genoma) | |
virtual | ~RealGenotype () |
Destructor. | |
virtual double | at (unsigned int i) |
Return the i-th genes represented. | |
virtual RealGenotype * | clone () const |
Create an exact copy of this Genotype. | |
virtual void | configure (ConfigurationParameters ¶ms, QString prefix) |
Configure the object using the ConfigurationParameters specified. | |
virtual RealGenotype & | operator= (const Genotype &genotype) |
Assign operator (performs same operation of Copy-constructor) | |
virtual void | randomize () |
Randomize the value contained (attention, this method destroys previous data) | |
virtual void | save (ConfigurationParameters ¶ms, QString prefix) |
Save the actual status of parameters into the ConfigurationParameters object passed. | |
virtual void | set (unsigned int i, double value) |
Set the i-th genes. | |
![]() | |
DoubleGenotype (unsigned int numGenes, double min, double max, unsigned int bitPrec) | |
Construct a un-initialized DoubleGenotype | |
DoubleGenotype (const DoubleGenotype &genotype) | |
Copy-constructor. | |
virtual | ~DoubleGenotype () |
Destructor. | |
unsigned int | bitPrecision () |
Return the bit precision, i.e. | |
virtual unsigned int | bitToGeneIndex (unsigned int bit) const |
Convert the index of the given bit to the index of the gene that this bit is part of. | |
virtual unsigned int | geneToBitIndex (unsigned int gene) const |
Convert the index of the given gene to the index of the start of the bit(s) that encode this gene. | |
double | maxValue () |
Return the max absolute value of genes. | |
double | minValue () |
Return the min absolute value of genes. | |
unsigned int | numGenes () |
return the numGenes | |
![]() | |
Genotype (unsigned int size=0) | |
Construct a un-initialized Genotype. | |
Genotype (QString, bool compressed=false) | |
Read the values from QString and set the size accordlying to length of QString. | |
Genotype (const Genotype &genotype) | |
Copy-Constructor (generate a clone of the genoma) | |
virtual | ~Genotype () |
Destructor. | |
void | assign (const Genotype *genotype) |
Assign method (it call operator=) | |
bool | bit (unsigned int i) const |
Return the i-th bit. | |
bool | dominatedBy (const Genotype *genotype) |
Return True if this Genotype is dominated by the Genotype specified by param. | |
unsigned int | extractUInt (unsigned int startPos, unsigned int stopPos) |
Utility function for extracting an integer value. | |
double | fitness () const |
Return the fitness of this Genotype. | |
bool | fromCompressedString (QString str) |
Read from compressed data with toCompressedString() | |
void | fromString (QString) |
Configure the bits accordlying to its string representation passed. | |
int | hammingDistance (const Genotype *) |
Calculate the Hamming distance from the Genotype. | |
void | insertUInt (unsigned int value, unsigned int startPos, unsigned int stopPos) |
Utility function for settings an integer value into Genotype. | |
QString | notes () const |
Return the notes of this Genotype. | |
int | numOfObjectives () const |
Return the number of Objectives setted The number of objectives is automatically configured by setObjective method. | |
double | objective (int i) const |
Return the value of the i-th objective of the fitness. | |
double | rank () const |
Return the rank of this Genotype. | |
void | set (unsigned int i) |
Set to One the i-th bit. | |
void | setFitness (double value) |
Set the fitness value of this Genotype. | |
void | setNotes (QString notes) |
Set the notes of this Genotype. | |
void | setObjective (int i, double value) |
Set the i-th objective value of the (multi-objective) fitness. | |
void | setRank (double rank) |
Set the rank of the genotype. | |
unsigned int | size () const |
Return the size of Genotype. | |
QString | toCompressedString () const |
Compress the data; It return a printable String. | |
void | toggle (unsigned int i) |
toggle the i-th bit | |
QString | toString () const |
Return a QString representing this Genotype. | |
void | unset (unsigned int i) |
set to zero the i-th bit | |
![]() | |
void | addObserver (RuntimeParameterObserver *obs) |
T | getRuntimeParameter (QString paramName) |
virtual ParameterSettableUI * | getUIManager () |
ParameterSettable () | |
virtual void | postConfigureInitialization () |
void | removeObserver (RuntimeParameterObserver *obs) |
void | setRuntimeParameter (QString paramName, T newvalue) |
QString | typeName () const |
![]() | |
void | addObserver (RuntimeParameterObserver *obs) |
T | getRuntimeParameter (QString paramName) |
void | removeObserver (RuntimeParameterObserver *obs) |
void | setRuntimeParameter (QString paramName, T newvalue) |
QString | typeName () const |
Static Public Member Functions | |
static void | describe (QString type) |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups. | |
Additional Inherited Members | |
![]() | |
enum | Property |
![]() | |
AllowMultiple | |
Default | |
IsList | |
IsMandatory | |
![]() | |
static const double | Infinity |
static const int | MaxInteger |
static const int | MinInteger |
![]() | |
void | copyDataFrom (Genotype *source) |
Utility method for copying data among Genotype. | |
void | resize (unsigned int newsize) |
Resize the Genotype. | |
![]() | |
static Descriptor | addTypeDescription (QString type, QString shortHelp, QString longHelp=QString("")) |
static void | setGraphicalEditor (QString type) |
![]() | |
unsigned int | bitprec |
bit precision | |
double | maxv |
max absolute value | |
double | minv |
max absolute value | |
unsigned int | numgenes |
num of Genes | |
Detailed Description
RealGenotype class.
- Description
- A gene is a true float value
- Warnings
Definition at line 37 of file realgenotype.h.
Constructor & Destructor Documentation
RealGenotype | ( | unsigned int | numGenes = 0 , |
float | min = FLT_MIN , |
||
float | max = FLT_MAX |
||
) |
Construct a un-initialized RealGenotype
\param numGenes is the number of float values contained by this RealGenotype \param min is the minimum float number allowed \param max is the maximum float number allowed \warning you must explicity call randomize() to get a randomized Genotype \note the Genotype::size() return the number of bits of underlying data, while numGenes is the actual numbers of genes of this RealGenotype. They are related by the multiplication:
Definition at line 27 of file realgenotype.cpp.
References Genotype::data.
Referenced by RealGenotype::clone().
|
virtual |
Destructor.
Definition at line 32 of file realgenotype.cpp.
RealGenotype | ( | const RealGenotype & | genotype | ) |
Copy-Constructor (generate a clone of the genoma)
Definition at line 36 of file realgenotype.cpp.
References Genotype::data.
Member Function Documentation
|
virtual |
Return the i-th genes represented.
Implements DoubleGenotype.
Definition at line 102 of file realgenotype.cpp.
References Genotype::size().
|
virtual |
Create an exact copy of this Genotype.
Reimplemented from Genotype.
Definition at line 123 of file realgenotype.cpp.
References RealGenotype::RealGenotype().
|
virtual |
Configure the object using the ConfigurationParameters specified.
- Parameters
-
params the object with configuration parameters prefix the group in which parameters are expected to be (this is terminated by a separator character). We expect to receive as prefix the group with genotype parameters
Reimplemented from Genotype.
Definition at line 51 of file realgenotype.cpp.
References Genotype::data, Genotype::fitnessv, Genotype::fromCompressedString(), ConfigurationParameters::getValue(), DoubleGenotype::maxv, DoubleGenotype::minv, Genotype::notesv, DoubleGenotype::numgenes, Genotype::rankv, and Genotype::resize().
|
static |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Definition at line 92 of file realgenotype.cpp.
References ParameterSettableWithConfigureFunction::addTypeDescription(), ParameterSettable::IntDescriptor::def(), ParameterSettable::RealDescriptor::def(), ParameterSettable::Descriptor::describeInt(), ParameterSettable::Descriptor::describeReal(), ParameterSettable::Descriptor::describeString(), ParameterSettable::RealDescriptor::help(), ParameterSettable::IntDescriptor::help(), ParameterSettable::StringDescriptor::help(), ParameterSettableWithConfigureFunction::IsList, ParameterSettableWithConfigureFunction::IsMandatory, ParameterSettable::IntDescriptor::limits(), ParameterSettable::IntDescriptor::props(), and ParameterSettable::RealDescriptor::props().
|
virtual |
Assign operator (performs same operation of Copy-constructor)
Reimplemented from Genotype.
Definition at line 41 of file realgenotype.cpp.
References Genotype::copyDataFrom(), Genotype::data, DoubleGenotype::maxv, DoubleGenotype::minv, and DoubleGenotype::numgenes.
|
virtual |
Randomize the value contained (attention, this method destroys previous data)
Reimplemented from Genotype.
Definition at line 117 of file realgenotype.cpp.
References globalRNG, DoubleGenotype::maxv, DoubleGenotype::minv, and DoubleGenotype::numgenes.
|
virtual |
Save the actual status of parameters into the ConfigurationParameters object passed.
- Parameters
-
params the configuration parameters object on which save actual parameters prefix the prefix to use to access the object configuration parameters.
Reimplemented from Genotype.
Definition at line 77 of file realgenotype.cpp.
References ConfigurationParameters::createParameter(), Genotype::fitnessv, DoubleGenotype::maxv, DoubleGenotype::minv, Genotype::notesv, DoubleGenotype::numgenes, Genotype::rankv, and Genotype::toCompressedString().
|
virtual |
Set the i-th genes.
Implements DoubleGenotype.
Definition at line 109 of file realgenotype.cpp.
References Genotype::size().
The documentation for this class was generated from the following files:
- ga/include/genotypes/realgenotype.h
- ga/src/genotypes/realgenotype.cpp