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

AnyIntGene Class Reference

Abstract interface for any genes that encode an integer value. More...

#include <genes.h>

Inheritance diagram for AnyIntGene:

Gene Genstruct BitIntGene IntGene List of all members.

Public Methods

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

Protected Attributes

int mMin
int mMax

Detailed Description

Abstract interface for any genes that encode an integer value.

You can read about the creation of integer-valued 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 AnyIntGene&> (*individual.getGene("myGene")).getvalue();

Because of technical limitations, the class is not actually abstract.

Definition at line 536 of file genes.h.


Constructor & Destructor Documentation

AnyIntGene   [inline]
 

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

Definition at line 542 of file genes.h.

AnyIntGene const GeneticID &    id,
int    min,
int    max,
double    m = 1.0
 

The subclass should call this constructor to set the name and some variables.

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 342 of file genes.cc.

References mMax, and mMin.


Member Function Documentation

virtual void check   const [inline, virtual]
 

Standard check operator.

Implementation for Object.

Exceptions:
assertion_failed  check_failed

Reimplemented from Gene.

Reimplemented in IntGene, and BitIntGene.

Definition at line 573 of file genes.h.

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

Referenced by BitIntGene::check(), and IntGene::check().

void copy const Genstruct   other [virtual]
 

Standard copy operator.

Implementation for Genstruct.

Reimplemented from Gene.

Reimplemented in IntGene, and BitIntGene.

Definition at line 349 of file genes.cc.

References Gene::copy().

Referenced by BitIntGene::copy(), and IntGene::copy().

virtual int getvalue   const [inline, virtual]
 

Returns the decoded phenotypic value of the gene.

The inheritor MUST overload this method.

Reimplemented in IntGene, and BitIntGene.

Definition at line 563 of file genes.h.


Member Data Documentation

int mMax [protected]
 

The upper limit for the gene value.

Definition at line 580 of file genes.h.

Referenced by AnyIntGene(), check(), BitIntGene::check(), IntGene::check(), IntGene::equality(), IntGene::init(), and IntGene::pointMutate().

int mMin [protected]
 

The lower limit for the gene value.

Definition at line 577 of file genes.h.

Referenced by AnyIntGene(), check(), BitIntGene::check(), IntGene::check(), IntGene::equality(), BitIntGene::getvalue(), and IntGene::init().


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