#include <genetics.h>
Inheritance diagram for Genstruct:
Public Methods | |
Genstruct (const GeneticID &name=NULL) | |
const Genstruct & | operator[] (const GeneticID &name) const |
Genstruct & | operator[] (const GeneticID &name) |
const GeneticID & | getID () const |
int | length () const |
virtual void | init () |
virtual const Genstruct * | getGene (const GeneticID &name) const |
virtual bool | execute (const GeneticMsg &msg) const |
virtual void | addPrivateGenes (Gentainer &g) |
virtual void | addPrivateGenes (Gentainer &g, const StringMap ¶ms) |
virtual bool | pointMutate (const MutationRate &r) |
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 DataOStream & | operator>> (DataOStream &out) const |
Genstruct & | hide (bool h=true) |
bool | isHidden () const |
virtual int | calc_len () const |
virtual void | check () const |
Protected Methods | |
void | copyGenstr (const Genstruct &other) |
Protected Attributes | |
GeneticID | id |
Friends | |
class | Gentainer |
These structures can be "genes" or "chromosomes" or "genomes", or whatever.
Definition at line 246 of file genetics.h.
|
Creates the structure with the given name. The name can be used to access the structure from Gentainer containers. Definition at line 90 of file genetics.cc. References id. |
|
Adds internal genes to itself. Additional parameters are passed in the String Map.
Reimplemented in Gene, Gentainer, Genome, and DiploidGenome. Definition at line 313 of file genetics.h. |
|
Adds internal genes to itself.
Definition at line 306 of file genetics.h. |
|
Actually calculates the true length of the genome (recursively).
Reimplemented in Gene, BitFloatGene, BitIntGene, Gentainer, and DiploidGenome. Definition at line 376 of file genetics.h. Referenced by length(). |
|
Implementation for Object.
Reimplemented in Gene, AnyFloatGene, FloatGene, BitFloatGene, AnyIntGene, IntGene, BitIntGene, Gentainer, and Genome. Definition at line 121 of file genetics.cc. Referenced by Gentainer::check(), and Gene::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 in Gene, BinaryGene, AnyFloatGene, FloatGene, BitFloatGene, AnyIntGene, IntGene, BitIntGene, InterGene, Gentainer, and DiploidGenome. Definition at line 351 of file genetics.h. Referenced by recombine(). |
|
Inheritors should use this method to copy the contents.
Definition at line 387 of file genetics.h. References id, mHidden, and size. Referenced by Gentainer::copy(), InterGene::copy(), and Gene::copy(). |
|
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 in BinaryGene, FloatGene, BitFloatGene, IntGene, BitIntGene, Gentainer, and DiploidGenome. Definition at line 340 of file genetics.h. |
|
Transmits a sad order to execute a gene. The receiver of the message reads in the upper left corner of the message. It should then execute itself. It's good that objects don't have feelings. (Hmm, they don't?) Reimplemented in InterGene, and Gentainer. Definition at line 300 of file genetics.h. |
|
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 in Gene, and Gentainer. Definition at line 293 of file genetics.h. Referenced by operator[](). |
|
Retrieves the name (ID) of the structure.
Definition at line 273 of file genetics.h. References id. Referenced by Gentainer::equality(), and Gentainer::recombine(). |
|
Sets the hide-flag of the structure, for example for printing methods, etc.
Definition at line 369 of file genetics.h. Referenced by Selector::addGenesTo(), and MutationRate::addGenesTo(). |
|
Generates an initial, random state for the structure.
Reimplemented in BinaryGene, FloatGene, BitFloatGene, IntGene, BitIntGene, InterGene, Gentainer, Genome, and DiploidGenome. Definition at line 285 of file genetics.h. |
|
Is the genstruct hidden from printing?
Definition at line 372 of file genetics.h. |
|
Calculates recursively the total number of genes within the genetic structure.
Reimplemented in DiploidGenome. Definition at line 102 of file genetics.cc. References calc_len(). Referenced by Gentainer::copy(), Gentainer::equality(), and Gentainer::recombine(). |
|
Another structural output operator, implementation from Object.
Reimplemented in BinaryGene, Gentainer, and Genome. Definition at line 114 of file genetics.cc. References id. Referenced by Gentainer::operator>>(). |
|
Gene access operator, just like above, but for non-const objects.
Reimplemented in Gentainer. Definition at line 268 of file genetics.h. |
|
Gene access operator.
Reimplemented in Gentainer. Definition at line 261 of file genetics.h. References getGene(). |
|
Mutates the structure.
Reimplemented in BinaryGene, FloatGene, BitFloatGene, IntGene, BitIntGene, InterGene, Gentainer, and DiploidGenome. Definition at line 322 of file genetics.h. |
|
Recursively prints the genome to the given stream. This is most cool. Reimplemented in BinaryGene, FloatGene, BitFloatGene, IntGene, BitIntGene, InterGene, Gentainer, Genome, and DiploidGenome. Definition at line 109 of file genetics.cc. References id. |
|
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 in BitFloatGene, BitIntGene, Gentainer, and DiploidGenome. Definition at line 328 of file genetics.h. References copy(). |
|
Clones a copy of self, RECURSIVELY. It's funny how simple reproduction is nowadays. Reimplemented in BinaryGene, FloatGene, BitFloatGene, IntGene, BitIntGene, InterGene, Gentainer, and DiploidGenome. Definition at line 345 of file genetics.h. |
|
The Gentainer is your friend. Love the Gentainer. Definition at line 411 of file genetics.h. |
|
The identification label of the structure. It might be a string or it might be a number. But I am a genstruct, I am not a number. Definition at line 396 of file genetics.h. Referenced by BitFloatGene::BitFloatGene(), BitIntGene::BitIntGene(), copyGenstr(), Genstruct(), Gene::getGene(), getID(), operator>>(), BinaryGene::operator>>(), Gentainer::print(), print(), InterGene::print(), BitIntGene::print(), IntGene::print(), BitFloatGene::print(), and FloatGene::print(). |