#include <genetics.h>
Inheritance diagram for Gentainer:
Public Methods | |
void | add (Genstruct *newstruct) |
const Genstruct & | operator[] (const GeneticID &name) const |
Genstruct & | operator[] (const GeneticID &name) |
const Genstruct & | operator[] (int i) const |
Genstruct & | operator[] (int i) |
int | size () const |
void | selfadjust (bool val=true) |
void | recombRate (double rate) |
virtual void | init () |
virtual void | addPrivateGenes (Gentainer &g, const StringMap ¶ms) |
virtual const Genstruct * | getGene (const GeneticID &name) const |
virtual bool | pointMutate (const MutationRate &k) |
virtual void | recombine (const Genstruct &a, const Genstruct &b) |
virtual double | equality (const Genstruct &other) const |
virtual Genstruct * | replicate () const |
virtual void | copy (const Genstruct &other) |
virtual void | print (TextOStream &out) const |
virtual bool | execute (const GeneticMsg &msg) const |
virtual DataOStream & | operator>> (DataOStream &out) const |
virtual void | check () const |
Protected Methods | |
virtual int | calc_len () const |
Protected Attributes | |
Array< Genstruct > | substructs |
bool | self_adjust |
double | mRecombRate |
It is a structurally middle-level Genstruct that contains atomic genes as well as other containers. Many genetic operations are implemented here.
Definition at line 430 of file genetics.h.
|
Appends a new substructure to the structure.
Definition at line 152 of file genetics.cc. References substructs. Referenced by MultiMinEAEnv::addFeaturesTo(), FloatTestEAEnv::addFeaturesTo(), BinaryTestEAEnv::addFeaturesTo(), Selector::addGenesTo(), MutationRate::addGenesTo(), addPrivateGenes(), BitFloatGene::BitFloatGene(), BitIntGene::BitIntGene(), and replicate(). |
|
Adds internal genes to itself. Additional parameters are passed in the String Map.
Reimplemented from Genstruct. Reimplemented in Genome, and DiploidGenome. Definition at line 163 of file genetics.cc. References add(), MutationRate::addGenesTo(), and substructs. Referenced by Genome::addPrivateGenes(), BitFloatGene::BitFloatGene(), and BitIntGene::BitIntGene(). |
|
Actually calculates the true length of the genome (recursively).
Reimplemented from Genstruct. Reimplemented in DiploidGenome. Definition at line 363 of file genetics.cc. References substructs. |
|
Implementation for Object.
Reimplemented from Genstruct. Reimplemented in Genome. Definition at line 399 of file genetics.cc. References Genstruct::check(), mRecombRate, and substructs. Referenced by Genome::check(), BitIntGene::check(), and BitFloatGene::check(). |
|
Copies another structure to self (recursively). The other structure must be structurally EXACTLY equivalent to self (for example, replicated previously). This is cool. Reimplemented from Genstruct. Reimplemented in DiploidGenome. Definition at line 318 of file genetics.cc. References Genstruct::copyGenstr(), Genstruct::length(), self_adjust, and substructs. |
|
Compares how genotypically similar the structure is to another. The units of the distance are usually application-dependent. One might, for example, use same euclidean distance or Hamming distance measurement with all genes, but then some genes may really be irrelevant for some problem, and they may have to be weighted. Thus, implementing this method in a generic way may be rather difficult.
Reimplemented from Genstruct. Reimplemented in DiploidGenome. Definition at line 284 of file genetics.cc. References Genstruct::getID(), Genstruct::length(), and substructs. Referenced by Individual::equality(), BitIntGene::equality(), and BitFloatGene::equality(). |
|
Executes a genetic message in the gentainer. Sends the message to every contained genstruct. Implementation for Genstruct. Reimplemented from Genstruct. Definition at line 376 of file genetics.cc. References GeneticMsg::receiver, and substructs. Referenced by Individual::execute(), and Individual::incarnate(). |
|
Fetches a gene from the structure by it's name. To be logical, this really should be a method of Gentainer, but there are cases when some classes can't inherit Gentainer, and they still need this. Reimplemented from Genstruct. Definition at line 195 of file genetics.cc. References substructs. Referenced by Individual::getGene(), BitIntGene::getvalue(), BitFloatGene::getvalue(), MutationRate::MutationRate(), operator[](), Selector::read(), and recombine(). |
|
Generates an initial, random state for the structure.
Reimplemented from Genstruct. Reimplemented in Genome, and DiploidGenome. Definition at line 157 of file genetics.cc. References substructs. Referenced by Genome::init(), BitIntGene::init(), and BitFloatGene::init(). |
|
Another structural output operator, implementation from Object.
Reimplemented from Genstruct. Reimplemented in Genome. Definition at line 405 of file genetics.cc. References Genstruct::operator>>(), and substructs. Referenced by Genome::operator>>(). |
|
Fetches a substructure by it's index number. Non-const version. Definition at line 459 of file genetics.h. References substructs. |
|
Fetches a substructure by it's index number.
Definition at line 457 of file genetics.h. References substructs. |
|
Fetches the gene with the given ID within the structure. This method is not recursive. Non-const version of the above method. Reimplemented from Genstruct. Definition at line 452 of file genetics.h. |
|
Fetches the gene with the given ID within the structure. This method is not recursive. Reimplemented from Genstruct. Definition at line 444 of file genetics.h. References getGene(). |
|
Mutates the structure.
Reimplemented from Genstruct. Reimplemented in DiploidGenome. Definition at line 219 of file genetics.cc. References MutabilityRecord::addBoolMutability(), MutabilityRecord::addFloatMutability(), MutabilityRecord::addFloatVariance(), MutationRate::binaryRate(), MutationRate::doubleRate(), MutationRate::doubleVariance(), and substructs. Referenced by Individual::pointMutate(), BitIntGene::pointMutate(), and BitFloatGene::pointMutate(). |
|
Recursively prints the genome to the given stream. This is most cool. Reimplemented from Genstruct. Reimplemented in Genome, and DiploidGenome. Definition at line 342 of file genetics.cc. References Genstruct::id, and substructs. Referenced by Genome::print(), BitIntGene::print(), and BitFloatGene::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. Reimplemented in DiploidGenome. Definition at line 243 of file genetics.cc. References getGene(), Genstruct::getID(), Genstruct::length(), and substructs. Referenced by Individual::recombine(), BitIntGene::recombine(), and BitFloatGene::recombine(). |
|
Sets the local recombination rate coefficient.
Definition at line 471 of file genetics.h. References mRecombRate. |
|
Clones a copy of self, RECURSIVELY. It's funny how simple reproduction is nowadays. Reimplemented from Genstruct. Reimplemented in DiploidGenome. Definition at line 303 of file genetics.cc. References add(), replicate(), and substructs. Referenced by replicate(). |
|
Enable self-adjusting of mutation rates within the container. When it is enabled, mutation-rate genes are inserted in the genome and used as coefficient for all mutation orders. Definition at line 468 of file genetics.h. References self_adjust. Referenced by BitFloatGene::BitFloatGene(), BitIntGene::BitIntGene(), and SimplePopulation::SimplePopulation(). |
|
Returns the number of immediate substructures contained.
Definition at line 462 of file genetics.h. References substructs. |
|
Recombination rate coefficient. Default: 1 Definition at line 499 of file genetics.h. Referenced by check(), and recombRate(). |
|
Self-adjusting (autoadaptive) mutation rates. Default: false. Definition at line 496 of file genetics.h. Referenced by copy(), and selfadjust(). |
|
Substructures.
Definition at line 493 of file genetics.h. Referenced by add(), addPrivateGenes(), calc_len(), check(), copy(), equality(), execute(), getGene(), init(), operator>>(), operator[](), pointMutate(), print(), recombine(), replicate(), and size(). |