DoubleGenotype class. More...
![Inheritance graph](classfarsa_1_1DoubleGenotype__inherit__graph.png)
Public Member Functions | |
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. | |
virtual double | at (unsigned int i)=0 |
Return the i-th genes represented. | |
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 | |
virtual void | set (unsigned int i, double value)=0 |
Set the i-th genes. | |
![]() | |
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. | |
virtual Genotype * | clone () const |
Create an exact copy of this Genotype. | |
virtual void | configure (ConfigurationParameters ¶ms, QString prefix) |
Configure the object using the ConfigurationParameters specified. | |
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. | |
virtual Genotype & | operator= (const Genotype &genotype) |
Assign operator (performs same operation of Copy-constructor) Due to virtual attribute, Subclasses can customize the behaviour of this operator=, for an easy way to copy Genotype data the protected method copyDataFrom is provided and it behaves like this implementation of operator=. | |
virtual void | randomize () |
Randomize the value contained (attention, this method destroys previous data) | |
double | rank () const |
Return the rank of this Genotype. | |
virtual void | save (ConfigurationParameters ¶ms, QString prefix) |
Save the actual status of parameters into the ConfigurationParameters object passed. | |
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 |
Protected Attributes | |
unsigned int | bitprec |
bit precision | |
double | maxv |
max absolute value | |
double | minv |
max absolute value | |
unsigned int | numgenes |
num of Genes | |
![]() | |
unsigned int | allocated |
Allocated memory. | |
unsigned char * | data |
Data represented as a char vector allocated in memory. | |
QVector< double > | fitnessv |
Objective values of the Fitness. | |
QString | notesv |
Notes about this Genotype. | |
double | rankv |
Rank. | |
unsigned int | sizev |
Size. | |
Additional Inherited Members | |
![]() | |
enum | Property |
![]() | |
static void | describe (QString type) |
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups. | |
static bool | rankGreaterThanComparator (const Genotype *g1, const Genotype *g2) |
Utility function comparing two genotype pointers on their rank. | |
![]() | |
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) |
Detailed Description
DoubleGenotype class.
- Description
- A gene is a double value within the range specificed by minValue and maxValue methods.
This is an abstract class defining the common interface among different encoding of double numbers inside a gene.
- Warnings
Definition at line 38 of file doublegenotype.h.
Constructor & Destructor Documentation
DoubleGenotype | ( | unsigned int | numGenes, |
double | min, | ||
double | max, | ||
unsigned int | bitPrec | ||
) |
Construct a un-initialized DoubleGenotype
\param numGenes is the number of double values contained by this DoubleGenotype \param max is the maximum absolute value represented \param min is the minimum absolute value represented \param bitPrec is the bit precision used for encode a double value \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 DoubleGenotype. They are related by the multiplication:
Definition at line 25 of file doublegenotype.cpp.
References DoubleGenotype::bitprec, DoubleGenotype::bitPrecision(), DoubleGenotype::maxv, DoubleGenotype::minv, DoubleGenotype::numGenes(), and DoubleGenotype::numgenes.
|
virtual |
Destructor.
Definition at line 33 of file doublegenotype.cpp.
DoubleGenotype | ( | const DoubleGenotype & | genotype | ) |
Copy-constructor.
Definition at line 37 of file doublegenotype.cpp.
References DoubleGenotype::bitprec, DoubleGenotype::maxv, DoubleGenotype::minv, and DoubleGenotype::numgenes.
Member Function Documentation
|
pure virtual |
Return the i-th genes represented.
Implemented in SignedRangeGenotype, and RealGenotype.
Referenced by GaussianFloat::mutate().
unsigned int bitPrecision | ( | ) |
Return the bit precision, i.e.
the number of bit used to encode one double value
Definition at line 57 of file doublegenotype.cpp.
References DoubleGenotype::bitprec.
Referenced by DoubleGenotype::DoubleGenotype().
|
virtual |
Convert the index of the given bit to the index of the gene that this bit is part of.
Reimplemented from Genotype.
Definition at line 65 of file doublegenotype.cpp.
References DoubleGenotype::bitprec.
|
virtual |
Convert the index of the given gene to the index of the start of the bit(s) that encode this gene.
Reimplemented from Genotype.
Definition at line 61 of file doublegenotype.cpp.
References DoubleGenotype::bitprec.
Referenced by RandomFloat::mutate(), and GaussianFloat::mutate().
double maxValue | ( | ) |
Return the max absolute value of genes.
Definition at line 49 of file doublegenotype.cpp.
References DoubleGenotype::maxv.
Referenced by SignedRangeGenotype::configure(), RandomFloat::mutate(), GaussianFloat::mutate(), and SignedRangeGenotype::SignedRangeGenotype().
double minValue | ( | ) |
Return the min absolute value of genes.
Definition at line 53 of file doublegenotype.cpp.
References DoubleGenotype::minv.
Referenced by RandomFloat::mutate(), and GaussianFloat::mutate().
unsigned int numGenes | ( | ) |
return the numGenes
Definition at line 45 of file doublegenotype.cpp.
References DoubleGenotype::numgenes.
Referenced by DoubleGenotype::DoubleGenotype(), RandomFloat::mutate(), and GaussianFloat::mutate().
|
pure virtual |
Set the i-th genes.
Implemented in SignedRangeGenotype, and RealGenotype.
Referenced by RandomFloat::mutate(), and GaussianFloat::mutate().
Member Data Documentation
|
protected |
bit precision
Definition at line 86 of file doublegenotype.h.
Referenced by SignedRangeGenotype::at(), DoubleGenotype::bitPrecision(), DoubleGenotype::bitToGeneIndex(), SignedRangeGenotype::configure(), DoubleGenotype::DoubleGenotype(), DoubleGenotype::geneToBitIndex(), SignedRangeGenotype::operator=(), SignedRangeGenotype::save(), and SignedRangeGenotype::set().
|
protected |
max absolute value
Definition at line 82 of file doublegenotype.h.
Referenced by RealGenotype::configure(), SignedRangeGenotype::configure(), DoubleGenotype::DoubleGenotype(), DoubleGenotype::maxValue(), RealGenotype::operator=(), SignedRangeGenotype::operator=(), RealGenotype::randomize(), SignedRangeGenotype::save(), RealGenotype::save(), and SignedRangeGenotype::set().
|
protected |
max absolute value
Definition at line 84 of file doublegenotype.h.
Referenced by RealGenotype::configure(), SignedRangeGenotype::configure(), DoubleGenotype::DoubleGenotype(), DoubleGenotype::minValue(), RealGenotype::operator=(), SignedRangeGenotype::operator=(), RealGenotype::randomize(), and RealGenotype::save().
|
protected |
num of Genes
Definition at line 80 of file doublegenotype.h.
Referenced by RealGenotype::configure(), SignedRangeGenotype::configure(), DoubleGenotype::DoubleGenotype(), DoubleGenotype::numGenes(), RealGenotype::operator=(), SignedRangeGenotype::operator=(), RealGenotype::randomize(), SignedRangeGenotype::save(), and RealGenotype::save().
The documentation for this class was generated from the following files:
- ga/include/genotypes/doublegenotype.h
- ga/src/genotypes/doublegenotype.cpp