DoubleGenotype Class Reference

DoubleGenotype class. More...

Inheritance diagram for DoubleGenotype:

List of all members.

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:
numGenesis the number of double values contained by this DoubleGenotype
maxis the maximum absolute value represented
minis the minimum absolute value represented
bitPrecis 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 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


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