RealGenotype class. More...

Inheritance diagram for RealGenotype:

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 RealGenotypeclone () const
 Create an exact copy of this Genotype.
 
virtual void configure (ConfigurationParameters &params, QString prefix)
 Configure the object using the ConfigurationParameters specified.
 
virtual RealGenotypeoperator= (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 &params, 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.
 
- Public Member Functions inherited from DoubleGenotype
 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
 
- Public Member Functions inherited from Genotype
 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
 
- Public Member Functions inherited from ParameterSettableWithConfigureFunction
void addObserver (RuntimeParameterObserver *obs)
 
getRuntimeParameter (QString paramName)
 
virtual ParameterSettableUIgetUIManager ()
 
 ParameterSettable ()
 
virtual void postConfigureInitialization ()
 
void removeObserver (RuntimeParameterObserver *obs)
 
void setRuntimeParameter (QString paramName, T newvalue)
 
QString typeName () const
 
- Public Member Functions inherited from ParameterSettable
void addObserver (RuntimeParameterObserver *obs)
 
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

- Public Types inherited from ParameterSettableWithConfigureFunction
enum  Property
 
- Public Attributes inherited from ParameterSettableWithConfigureFunction
 AllowMultiple
 
 Default
 
 IsList
 
 IsMandatory
 
- Static Public Attributes inherited from ParameterSettableWithConfigureFunction
static const double Infinity
 
static const int MaxInteger
 
static const int MinInteger
 
- Protected Member Functions inherited from Genotype
void copyDataFrom (Genotype *source)
 Utility method for copying data among Genotype.
 
void resize (unsigned int newsize)
 Resize the Genotype.
 
- Static Protected Member Functions inherited from ParameterSettableWithConfigureFunction
static Descriptor addTypeDescription (QString type, QString shortHelp, QString longHelp=QString(""))
 
static void setGraphicalEditor (QString type)
 
- Protected Attributes inherited from DoubleGenotype
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:

$ size = sizeof(float) \cdot numGenes $

Definition at line 27 of file realgenotype.cpp.

References Genotype::data.

Referenced by RealGenotype::clone().

~RealGenotype ( )
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

double at ( unsigned int  i)
virtual

Return the i-th genes represented.

Implements DoubleGenotype.

Definition at line 102 of file realgenotype.cpp.

References Genotype::size().

RealGenotype * clone ( ) const
virtual

Create an exact copy of this Genotype.

Reimplemented from Genotype.

Definition at line 123 of file realgenotype.cpp.

References RealGenotype::RealGenotype().

void configure ( ConfigurationParameters params,
QString  prefix 
)
virtual

Configure the object using the ConfigurationParameters specified.

Parameters
paramsthe object with configuration parameters
prefixthe 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().

RealGenotype & operator= ( const Genotype genotype)
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.

void randomize ( )
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.

void save ( ConfigurationParameters params,
QString  prefix 
)
virtual

Save the actual status of parameters into the ConfigurationParameters object passed.

Parameters
paramsthe configuration parameters object on which save actual parameters
prefixthe 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().

void set ( unsigned int  i,
double  value 
)
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: