SignedRangeGenotype class. More...
![Inheritance graph](classfarsa_1_1SignedRangeGenotype__inherit__graph.png)
Public Member Functions | |
SignedRangeGenotype (unsigned int numGenes=0, double max=+1, unsigned int bitPrecision=8) | |
Construct a un-initialized SignedRangeGenotype | |
SignedRangeGenotype (const SignedRangeGenotype &genotype) | |
Copy-Constructor (generate a clone of the genoma) | |
virtual | ~SignedRangeGenotype () |
Destructor. | |
virtual double | at (unsigned int i) |
Return the i-th genes represented. | |
virtual SignedRangeGenotype * | clone () const |
Create an exact copy of this Genotype. | |
virtual void | configure (ConfigurationParameters ¶ms, QString prefix) |
Configure the object using the ConfigurationParameters specified. | |
virtual SignedRangeGenotype & | operator= (const Genotype &genotype) |
Assign operator (performs same operation of Copy-constructor) | |
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. | |
virtual void | randomize () |
Randomize the value contained (attention, this method destroys previous data) | |
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
SignedRangeGenotype class.
- Description
- A gene is a double values within the symmetric range specificed in the constructor;
Each gene contained by DoubleGenotype is a double value within the range [-max,+max] where the zero value has two representation: -0 and +0.
The binary is decoded using the first value as sign and the others as absolute value.
- Warnings
Definition at line 39 of file signedrangegenotype.h.
Constructor & Destructor Documentation
SignedRangeGenotype | ( | unsigned int | numGenes = 0 , |
double | max = +1 , |
||
unsigned int | bitPrecision = 8 |
||
) |
Construct a un-initialized SignedRangeGenotype
\param numGenes is the number of double values contained by this SignedRangeGenotype \param max is the maximum absolute value represented \param bitPrecision is the number of bit used for represent a number \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 SignedRangeGenotype. They are related by the multiplication:
Definition at line 40 of file signedrangegenotype.cpp.
References DoubleGenotype::maxValue().
Referenced by SignedRangeGenotype::clone().
|
virtual |
Destructor.
Definition at line 48 of file signedrangegenotype.cpp.
SignedRangeGenotype | ( | const SignedRangeGenotype & | genotype | ) |
Copy-Constructor (generate a clone of the genoma)
Definition at line 52 of file signedrangegenotype.cpp.
Member Function Documentation
|
virtual |
Return the i-th genes represented.
Implements DoubleGenotype.
Definition at line 123 of file signedrangegenotype.cpp.
References Genotype::bit(), DoubleGenotype::bitprec, Genotype::extractUInt(), and Genotype::size().
|
virtual |
Create an exact copy of this Genotype.
Reimplemented from Genotype.
Definition at line 152 of file signedrangegenotype.cpp.
References SignedRangeGenotype::SignedRangeGenotype().
|
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 68 of file signedrangegenotype.cpp.
References DoubleGenotype::bitprec, Genotype::fitnessv, Genotype::fromCompressedString(), ConfigurationParameters::getValue(), DoubleGenotype::maxv, DoubleGenotype::maxValue(), 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 113 of file signedrangegenotype.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 57 of file signedrangegenotype.cpp.
References DoubleGenotype::bitprec, Genotype::copyDataFrom(), 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 98 of file signedrangegenotype.cpp.
References DoubleGenotype::bitprec, ConfigurationParameters::createParameter(), Genotype::fitnessv, DoubleGenotype::maxv, Genotype::notesv, DoubleGenotype::numgenes, Genotype::rankv, and Genotype::toCompressedString().
|
virtual |
Set the i-th genes.
Implements DoubleGenotype.
Definition at line 136 of file signedrangegenotype.cpp.
References DoubleGenotype::bitprec, Genotype::insertUInt(), DoubleGenotype::maxv, Genotype::set(), Genotype::size(), and Genotype::unset().
The documentation for this class was generated from the following files:
- ga/include/genotypes/signedrangegenotype.h
- ga/src/genotypes/signedrangegenotype.cpp