DoubleGenotype class. More...

Inheritance diagram for DoubleGenotype:

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.
 
- 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.
 
virtual Genotypeclone () const
 Create an exact copy of this Genotype.
 
virtual void configure (ConfigurationParameters &params, 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 Genotypeoperator= (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 &params, 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
 
- 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
 

Protected Attributes

unsigned int bitprec
 bit precision
 
double maxv
 max absolute value
 
double minv
 max absolute value
 
unsigned int numgenes
 num of Genes
 
- Protected Attributes inherited from Genotype
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

- Public Types inherited from ParameterSettableWithConfigureFunction
enum  Property
 
- Static Public Member Functions inherited from Genotype
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.
 
- 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)
 

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:

$ size = bitPrecision \cdot numGenes $

Definition at line 25 of file doublegenotype.cpp.

References DoubleGenotype::bitprec, DoubleGenotype::bitPrecision(), DoubleGenotype::maxv, DoubleGenotype::minv, DoubleGenotype::numGenes(), and DoubleGenotype::numgenes.

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

virtual double at ( unsigned int  i)
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().

unsigned int bitToGeneIndex ( unsigned int  bit) const
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.

unsigned int geneToBitIndex ( unsigned int  gene) const
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().

virtual void set ( unsigned int  i,
double  value 
)
pure virtual

Set the i-th genes.

Implemented in SignedRangeGenotype, and RealGenotype.

Referenced by RandomFloat::mutate(), and GaussianFloat::mutate().

Member Data Documentation


The documentation for this class was generated from the following files: