#include <genes.h>
Inheritance diagram for BitIntGene:
Public Methods | |
BitIntGene () | |
BitIntGene (const GeneticID &id, int min, int max, int bits, const StringMap ¶ms, double m=1.0) | |
virtual int | getvalue () const |
BitIntGene * | setGrayCoding (bool gray=true) |
virtual void | init () |
virtual bool | pointMutate (const MutationRate &k) |
virtual double | equality (const Genstruct &o) const |
virtual void | copy (const Genstruct &other) |
virtual Genstruct * | replicate () const |
virtual void | print (TextOStream &out) const |
virtual void | recombine (const Genstruct &a, const Genstruct &b) |
virtual void | check () const |
Protected Methods | |
virtual int | calc_len () const |
Protected Attributes | |
Gentainer | mBits |
int | mBitCount |
bool | mGrayCoded |
Because of the vector representation, the values are correlated, which would ne be case with IntGene.
The range of the gene values must be a power of two. For example range [0..1] is 2=2^1, and range [10..265] is 256=2^8.
Definition at line 675 of file genes.h.
|
Default constructor, FORBIDDEN! Exists only because of RTTI system.
Definition at line 679 of file genes.h. Referenced by replicate(). |
|
Standard way to construct the gene.
Definition at line 441 of file genes.cc. References Gentainer::add(), Gentainer::addPrivateGenes(), Genstruct::id, mBitCount, mBits, mGrayCoded, and Gentainer::selfadjust(). |
|
Actually calculates the true length of the genome (recursively).
Reimplemented from Gene. |
|
Standard check operator. Implementation for Object.
Reimplemented from AnyIntGene. Definition at line 501 of file genes.cc. References Gentainer::check(), AnyIntGene::check(), getvalue(), mBitCount, mBits, AnyIntGene::mMax, and AnyIntGene::mMin. |
|
Standard copy operator. Implementation for Genstruct. Reimplemented from AnyIntGene. Definition at line 458 of file genes.cc. References AnyIntGene::copy(). |
|
The genetic distance is calculated as the Hamming distance between the bits that encode the integer value. If the values of the bits do not have an equal significanse for the phenotype, this way of calculating may not be what you want. Reimplemented from Genstruct. Definition at line 727 of file genes.h. References Gentainer::equality(), and mBits. |
|
Returns the decoded phenotypic value of the gene.
Reimplemented from AnyIntGene. Definition at line 469 of file genes.cc. References Gentainer::getGene(), mBitCount, mBits, and AnyIntGene::mMin. Referenced by check(). |
|
Initializes the bits totally randomly.
Reimplemented from Genstruct. Definition at line 715 of file genes.h. References Gentainer::init(), and mBits. |
|
The point mutation forwards the mutation to the Gentainer holding the BinaryGene bits that encode the integer value.
Reimplemented from Genstruct. Definition at line 720 of file genes.h. References mBits, and Gentainer::pointMutate(). |
|
Recursively prints the genome to the given stream. This is most cool. Reimplemented from Genstruct. Definition at line 489 of file genes.cc. References Genstruct::id, mBits, and Gentainer::print(). |
|
Makes this structure a recombination of given parent structures. If no internal recombination actualizes within the structure, the parent 'a' must always be copied. Reimplemented from Genstruct. Definition at line 494 of file genes.cc. References mBits, and Gentainer::recombine(). |
|
Clones a copy of self, RECURSIVELY. It's funny how simple reproduction is nowadays. Reimplemented from Genstruct. Definition at line 729 of file genes.h. References BitIntGene(). |
|
Sets the Gray coding mode on (true) or off (false). The return value makes it possible to use the method as follows: myGenome.add ((new BitIntGene ("myGene", 0, 7, 3, params))->setGrayCoding (true));
Definition at line 710 of file genes.h. References mGrayCoded. |
|
Number of bits in the vector. This can be calculated from the mBits Gentainer, but that would be slow, so we cache the value here. Definition at line 743 of file genes.h. Referenced by BitIntGene(), check(), and getvalue(). |
|
Binary gene vector.
Definition at line 737 of file genes.h. Referenced by BitIntGene(), check(), equality(), getvalue(), init(), pointMutate(), print(), and recombine(). |
|
Gray coding mode flag.
Definition at line 746 of file genes.h. Referenced by BitIntGene(), and setGrayCoding(). |