Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

FloatGene Class Reference

Floating-point gene with native floating point representation; implementation of Evolution Strategies real-valued genes. More...

#include <genes.h>

Inheritance diagram for FloatGene:

AnyFloatGene Gene Genstruct List of all members.

Public Methods

 FloatGene ()
 FloatGene (const GeneticID &id, double min, double max, double m=1.0, double value=-999)
FloatGene & set (double val)
virtual double getvalue () const
FloatGene & setCircular (bool c)
FloatGene & setMutator (FloatMutator *m)
virtual void init ()
virtual bool pointMutate (const MutationRate &k)
virtual double equality (const Genstruct &other) const
virtual void copy (const Genstruct &other)
virtual Genstructreplicate () const
virtual void print (TextOStream &out) const
virtual void check () const

Protected Attributes

double value
double mVariance
bool mCircular
FloatMutatormMutator

Detailed Description

Floating-point gene with native floating point representation; implementation of Evolution Strategies real-valued genes.

The mutation operation mutates the value every time by a small, normally distributed value (that can be global or self-regulated).

Definition at line 311 of file genes.h.


Constructor & Destructor Documentation

FloatGene   [inline]
 

Default constructor, FORBIDDEN! Exists only because of RTTI system.

Definition at line 316 of file genes.h.

Referenced by replicate().

FloatGene const GeneticID &    id,
double    min,
double    max,
double    m = 1.0,
double    value = -999
 

Standard constructor.

Usually used for example:

myGenome.add (new FloatGene ("myGene", 0.2, 0.8, 0.1));

Parameters:
id  Name of the gene.
min  Lower limit for the floating-point value range.
max  Upper limit for the floating-point value range.
m  Mutation coefficient.

Definition at line 182 of file genes.cc.

References init(), mCircular, AnyFloatGene::mMax, mMutator, mVariance, and value.


Member Function Documentation

void check   [virtual]
 

Standard check operator.

Implementation for Object.

Exceptions:
assertion_failed  check_failed

Reimplemented from AnyFloatGene.

Definition at line 244 of file genes.cc.

References AnyFloatGene::check(), AnyFloatGene::mMax, AnyFloatGene::mMin, and value.

void copy const Genstruct   other [virtual]
 

Standard copy operator.

Implementation for Genstruct.

Reimplemented from AnyFloatGene.

Definition at line 196 of file genes.cc.

References AnyFloatGene::copy().

double equality const Genstruct   other const [virtual]
 

Implementation for Genstruct.

Genetic distance is measured as real-valued distance between the genes. Note that, if the distance is measured for a set of FloatGene genes, the distance will be orthogonal, not euclidean.

Reimplemented from Genstruct.

Definition at line 235 of file genes.cc.

References AnyFloatGene::mMax, AnyFloatGene::mMin, and value.

virtual double getvalue   const [inline, virtual]
 

Implementation for AnyFloatGene.

Returns the "decoded" value of the gene. There actually isn't any "decoding" in this gene class, and the phenotypic value equals the genotypic.

Reimplemented from AnyFloatGene.

Definition at line 340 of file genes.h.

References value.

void init   [virtual]
 

Implementation for Genstruct.

The operator initializes the gene with a random variable with uniform distribution.

Reimplemented from Genstruct.

Definition at line 192 of file genes.cc.

References AnyFloatGene::mMax, AnyFloatGene::mMin, and value.

Referenced by FloatGene().

bool pointMutate const MutationRate   k [virtual]
 

Implementation for Genstruct.

We use two control parameters. First is the mutation rate, which is a probability to make the actual mutation. This parameter is our own addition; with Evolution Strategies the mutation rate is always 1.0 so that a mutation always occurs.

The other control parameter is mutation variance, which controls the usually normally distributed mutation. If, however, the mutation operator has been redefined with setMutator(), the variance-parameter may be used with different semantics.

Parameters:
k  Mutation rate coefficients; mutation rate and variance.

Reimplemented from Genstruct.

Definition at line 207 of file genes.cc.

References MutationRate::autoAdaptation(), MutationRate::doubleRate(), MutationRate::doubleVariance(), AnyFloatGene::mMax, AnyFloatGene::mMin, mMutator, Gene::mutability, FloatMutator::mutate(), mVariance, and value.

void print TextOStream &    out const [virtual]
 

Recursively prints the genome to the given stream.

This is most cool.

Reimplemented from Genstruct.

Definition at line 240 of file genes.cc.

References Genstruct::id, and value.

virtual Genstruct* replicate   const [inline, virtual]
 

Clones a copy of self, RECURSIVELY.

It's funny how simple reproduction is nowadays.

Reimplemented from Genstruct.

Definition at line 392 of file genes.h.

References FloatGene().

FloatGene& set double    val [inline]
 

Sets the gene value.

Definition at line 334 of file genes.h.

References value.

FloatGene& setCircular bool    c [inline]
 

Sets the value range to be handled as circular; if a value near the upper limit is mutated, the result can be a small value.

Returns:
Self.

Definition at line 349 of file genes.h.

References mCircular.

FloatGene& setMutator FloatMutator   m [inline]
 

Sets a customized mutation operator for the gene.

See inheritors of FloatMutator for additional information. The default for FloatGene is to use gaussian mutation.

Returns:
Self.

Definition at line 357 of file genes.h.

References mMutator.


Member Data Documentation

bool mCircular [protected]
 

Should the mutations be done in circular domain?

Definition at line 405 of file genes.h.

Referenced by FloatGene(), and setCircular().

FloatMutator* mMutator [protected]
 

Mutation method.

Definition at line 408 of file genes.h.

Referenced by FloatGene(), pointMutate(), and setMutator().

double mVariance [protected]
 

Local variance modifier for mutation variance.

Definition at line 402 of file genes.h.

Referenced by FloatGene(), and pointMutate().

double value [protected]
 

The genotypic value of the gene.

Definition at line 399 of file genes.h.

Referenced by check(), equality(), FloatGene(), getvalue(), init(), pointMutate(), print(), and set().


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 20:12:01 2005 for NeHeP by doxygen1.2.18