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

AnyFloatGene Class Reference

Abstract interface class for genes that encode a floating-point value. More...

#include <genes.h>

Inheritance diagram for AnyFloatGene:

Gene Genstruct BitFloatGene FloatGene List of all members.

Public Methods

 AnyFloatGene ()
 AnyFloatGene (const GeneticID &id, double min, double max, double m=1.0)
virtual double getvalue () const
virtual void copy (const Genstruct &other)
virtual void check () const

Protected Attributes

double mMin
double mMax

Detailed Description

Abstract interface class for genes that encode a floating-point value.

You can read about the creation of floating-point genes and how they are inserted in the genomes from the specific subclass documentation. The values of the genes are read from the genome as follows:

double x = dynamic_cast<const AnyFloatGene&> (*individual.getGene("myGene")).getvalue();

This class is actually not abstract, because of technical limitations in the dynamic runtime information system.

Definition at line 234 of file genes.h.


Constructor & Destructor Documentation

AnyFloatGene   [inline]
 

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

Definition at line 239 of file genes.h.

AnyFloatGene const GeneticID &    id,
double    min,
double    max,
double    m = 1.0
 

The subclass should call this constructor to set the name, value range and mutation parameter coefficient.

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 parameter coefficient; the exact semantics of this variable depends on the subclass.

Definition at line 150 of file genes.cc.

References mMax, and mMin.


Member Function Documentation

void check   [virtual]
 

Standard check operator.

Implementation for Object.

Exceptions:
assertion_failed  check_failed

Reimplemented from Gene.

Reimplemented in FloatGene, and BitFloatGene.

Definition at line 167 of file genes.cc.

References Gene::check(), mMax, and mMin.

Referenced by BitFloatGene::check(), and FloatGene::check().

void copy const Genstruct   other [virtual]
 

Standard copy operator.

Implementation for Genstruct.

Reimplemented from Gene.

Reimplemented in FloatGene, and BitFloatGene.

Definition at line 157 of file genes.cc.

References Gene::copy().

Referenced by BitFloatGene::copy(), and FloatGene::copy().

virtual double getvalue   const [inline, virtual]
 

Returns the decoded, phenotypic value of the gene.

The inheritor MUST overload this method.

Exceptions:
must_overload 

Reimplemented in FloatGene, and BitFloatGene.

Definition at line 263 of file genes.h.


Member Data Documentation

double mMax [protected]
 

The upper limit for the gene value.

Definition at line 280 of file genes.h.

Referenced by AnyFloatGene(), BitFloatGene::check(), FloatGene::check(), check(), FloatGene::equality(), FloatGene::FloatGene(), BitFloatGene::getvalue(), FloatGene::init(), and FloatGene::pointMutate().

double mMin [protected]
 

The lower limit for the gene value.

Definition at line 277 of file genes.h.

Referenced by AnyFloatGene(), BitFloatGene::check(), FloatGene::check(), check(), FloatGene::equality(), BitFloatGene::getvalue(), FloatGene::init(), and FloatGene::pointMutate().


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