SignedRangeGenotype class. More...

Inheritance diagram for SignedRangeGenotype:

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 SignedRangeGenotypeclone () const
 Create an exact copy of this Genotype.
 
virtual void configure (ConfigurationParameters &params, QString prefix)
 Configure the object using the ConfigurationParameters specified.
 
virtual SignedRangeGenotypeoperator= (const Genotype &genotype)
 Assign operator (performs same operation of Copy-constructor)
 
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.
 
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
 
- 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

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:

$ size = bitPrecision \cdot numGenes $

Definition at line 40 of file signedrangegenotype.cpp.

References DoubleGenotype::maxValue().

Referenced by SignedRangeGenotype::clone().

~SignedRangeGenotype ( )
virtual

Destructor.

Definition at line 48 of file signedrangegenotype.cpp.

Copy-Constructor (generate a clone of the genoma)

Definition at line 52 of file signedrangegenotype.cpp.

Member Function Documentation

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

SignedRangeGenotype * clone ( ) const
virtual

Create an exact copy of this Genotype.

Reimplemented from Genotype.

Definition at line 152 of file signedrangegenotype.cpp.

References SignedRangeGenotype::SignedRangeGenotype().

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

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

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 98 of file signedrangegenotype.cpp.

References DoubleGenotype::bitprec, ConfigurationParameters::createParameter(), Genotype::fitnessv, DoubleGenotype::maxv, Genotype::notesv, DoubleGenotype::numgenes, Genotype::rankv, and Genotype::toCompressedString().

void set ( unsigned int  i,
double  value 
)
virtual

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