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

BinaryGene Class Reference

A binary gene with values 0 and 1. More...

#include <genes.h>

Inheritance diagram for BinaryGene:

Gene Genstruct List of all members.

Public Methods

 BinaryGene ()
 BinaryGene (const GeneticID &id, double mut=1.0, double initP=0.5)
BinaryGene & set (bool value)
bool getvalue () const
void setInitP (double initP)
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 DataOStream & operator>> (DataOStream &out) const

Detailed Description

A binary gene with values 0 and 1.

Definition at line 130 of file genes.h.


Constructor & Destructor Documentation

BinaryGene   [inline]
 

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

Definition at line 136 of file genes.h.

Referenced by replicate().

BinaryGene const GeneticID &    id,
double    mut = 1.0,
double    initP = 0.5
 

The standard constructor.

Parameters:
id  Name of the gene.
mut  Local mutation rate coefficient.
initP  Probability of value 1 in initialization. By default the probability of 0 and 1 are uniform (0.5). You can, of course, use this to set the initial value: use 0.0 for value 0, and 1.0 for value 1.

Definition at line 86 of file genes.cc.

References init().


Member Function Documentation

void copy const Genstruct   other [virtual]
 

Implementation for Genstruct.

Reimplemented from Gene.

Definition at line 120 of file genes.cc.

References Gene::copy().

virtual double equality const Genstruct   other const [inline, virtual]
 

Implementation for Genstruct.

The distance is calculated as trivial case of Hamming distance.

Reimplemented from Genstruct.

Definition at line 184 of file genes.h.

bool getvalue   const [inline]
 

Returns the value of the gene as either true (1) or false (0).

Definition at line 159 of file genes.h.

void init   [virtual]
 

Implementation for Genstruct.

Reimplemented from Genstruct.

Definition at line 93 of file genes.cc.

Referenced by BinaryGene().

DataOStream & operator>> DataOStream &    out const [virtual]
 

Implementation for Object.

Reimplemented from Genstruct.

Definition at line 129 of file genes.cc.

References Genstruct::id, and Gene::mutability.

bool pointMutate const MutationRate   k [virtual]
 

Implementation for Genstruct.

Flips the current value over with propability k*c, where c is the gene-local probability coefficient, and k is described below.

Parameters:
k  Mutation rate parameters. Only the binaryrate parameter is usefor for us.

Reimplemented from Genstruct.

Definition at line 97 of file genes.cc.

References MutationRate::autoAdaptation(), MutationRate::binaryRate(), and Gene::mutability.

void print TextOStream &    out const [virtual]
 

Implementation for Genstruct.

Reimplemented from Genstruct.

Definition at line 125 of file genes.cc.

virtual Genstruct* replicate   const [inline, virtual]
 

Implementation for Genstruct.

Reimplemented from Genstruct.

Definition at line 190 of file genes.h.

References BinaryGene().

BinaryGene& set bool    value [inline]
 

Sets the value of the gene.

Definition at line 156 of file genes.h.

void setInitP double    initP [inline]
 

Sets the probability of value 1 in initialization.

The default initialization probability (see the constructor) is 0.5.

Definition at line 164 of file genes.h.


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