DoubleGenotype Class Reference
DoubleGenotype class. More...

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. | |
Protected Attributes | |
unsigned int | bitprec |
bit precision | |
double | maxv |
max absolute value | |
double | minv |
max absolute value | |
unsigned int | numgenes |
num of Genes |
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
- Parameters:
-
numGenes is the number of double values contained by this DoubleGenotype max is the maximum absolute value represented min is the minimum absolute value represented 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.
~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 RealGenotype, and SignedRangeGenotype.
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 RealGenotype, and SignedRangeGenotype.
Referenced by RandomFloat::mutate(), and GaussianFloat::mutate().
Member Data Documentation
unsigned int bitprec [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().
double maxv [protected] |
max absolute value
Definition at line 82 of file doublegenotype.h.
Referenced by SignedRangeGenotype::configure(), RealGenotype::configure(), DoubleGenotype::DoubleGenotype(), DoubleGenotype::maxValue(), SignedRangeGenotype::operator=(), RealGenotype::operator=(), RealGenotype::randomize(), SignedRangeGenotype::save(), RealGenotype::save(), and SignedRangeGenotype::set().
double minv [protected] |
max absolute value
Definition at line 84 of file doublegenotype.h.
Referenced by SignedRangeGenotype::configure(), RealGenotype::configure(), DoubleGenotype::DoubleGenotype(), DoubleGenotype::minValue(), SignedRangeGenotype::operator=(), RealGenotype::operator=(), RealGenotype::randomize(), and RealGenotype::save().
unsigned int numgenes [protected] |
num of Genes
Definition at line 80 of file doublegenotype.h.
Referenced by SignedRangeGenotype::configure(), RealGenotype::configure(), DoubleGenotype::DoubleGenotype(), DoubleGenotype::numGenes(), SignedRangeGenotype::operator=(), RealGenotype::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