![]() |
ECF 1.7
|
GEPChromosome class - implements genotype as a Gene Expression Programming chromosome. More...
#include <GEPChromosome.h>
Public Member Functions | |
| GEPChromosome * | copy () |
| Create an identical copy of the genotype object. | |
| std::vector< CrossoverOpP > | getCrossoverOp () |
| Create and return a vector of crossover operators. | |
| std::vector< MutationOpP > | getMutationOp () |
| Create and return a vector of mutation operators. | |
| bool | addFunction (Tree::PrimitiveP func) |
| Add user defined function primitive. Must be called prior to initialization (no impact otherwise). | |
| void | registerParameters (StateP state) |
| Register genotype's parameters (called before Genotype::initialize). | |
| bool | initialize (StateP state) |
| Initialize a genotype object (read parameters, perform sanity check, build data). | |
| void | initializeFirst (GEPChromosome *home) |
| void | write (XMLNode &xGEPChromosome) |
| Write genotype data to XMLNode. | |
| void | read (XMLNode &xGEPChromosomeInd) |
| Read genotype data from XMLNode. | |
| void | execute (void *) |
| Tree::Tree * | toTree (uint gene) |
| Tree::Tree * | makeCellTree () |
| void | assemble () |
| void | generateChromosome () |
| void | setTerminalValue (std::string name, void *value) |
| Set a terminal's value. | |
| Public Member Functions inherited from Genotype | |
| bool | registerParameter (StateP state, std::string name, voidP value, enum ECF::type T, std::string description="") |
| Register a single parameter. | |
| voidP | getParameterValue (StateP state, std::string name) |
| Read single parameter value from Registry. | |
| bool | setParameterValue (StateP state, std::string name, voidP value) |
| Write single parameter value to Registry. | |
| bool | isParameterDefined (StateP state, std::string name) |
| Check if parameter is defined in the configuration. | |
| virtual uint | getGenomeSize () |
| std::string | getName () |
| Return genotype's name (each genotype is uniquely identified with its name). | |
| uint | getGenotypeId () |
| Return this genotype's index in individual structure. | |
| void | setGenotypeId (uint id) |
| Set genotype index in an individual. | |
| std::string | toString () |
| Output genotype to string. | |
Public Attributes | |
| uint | headLength |
| length of the head. User-specified | |
| uint | tailLength |
| length of the tail. Automatically calculated. | |
| uint | dcLength |
| length of the constant values domain | |
| uint | geneLength |
| total length of each gene | |
| uint | linkHeadLength |
| length of the linking function gene's head | |
| uint | linkTailLength |
| length of the linking function gene's tail | |
| uint | genes |
| number of genes | |
| Tree::PrimitiveSetP | primitiveSet_ |
| Tree::PrimitiveSetP | linkFunctionSet_ |
| Tree::PrimitiveSetP | ercSet_ |
| bool | usesERC |
| whether or not the chromosome uses random constants | |
| bool | staticLink |
| whether we are using a static linking function or if it should be allowed to evolve | |
| Tree::Tree * | cellTree |
| std::vector< Tree::Tree * > | subtrees |
Protected Attributes | |
| StateP | state_ |
| std::vector< Tree::PrimitiveP > | userFunctions_ |
| std::vector< Tree::PrimitiveP > | userTerminals_ |
| Protected Attributes inherited from Genotype | |
| std::string | name_ |
| genotype's name | |
| uint | genotypeId_ |
| this genotype's unique index in individual structure | |
GEPChromosome class - implements genotype as a Gene Expression Programming chromosome.
This representation consists of one or more genes, each consisting of two main parts and an optional third component. The first part is called the Head. It has a size specified by the user and may contain any primitive. The second part is called the Tail. It may contain only terminals and has a fixed size (depending on the maximum arity of the primitive set and the head length). These two properties, along with the expression procedure, guarantee that every GEP chromosome encodes a valid expression. The optional third part is called the "Dc domain". It contains the values of random constants and has the same size as the Tail. If used, a constant placeholder primitive "?" is added to the primitive set. GEPChromosome inherits a fixed-size vector of Node objects. Each node points to a Primitive object. Nodes in tree are aligned in a breadth-first notation. Being fixed-size and breadth-first-expressed, this means that non-coding neutral node regions can exist in any given individual. Some primitives are shared among all the trees, but some (such as ERC primitives) belong to a single GEPChromosome.
Definition at line 33 of file GEPChromosome.h.
| GEP::GEPChromosome::GEPChromosome | ( | ) |
Definition at line 5 of file GEPChromosome.cpp.
| bool GEP::GEPChromosome::addFunction | ( | Tree::PrimitiveP | func | ) |
Add user defined function primitive. Must be called prior to initialization (no impact otherwise).
Definition at line 54 of file GEPChromosome.cpp.
| void GEP::GEPChromosome::assemble | ( | ) |
Definition at line 684 of file GEPChromosome.cpp.
|
virtual |
Create an identical copy of the genotype object.
Implements Genotype.
Definition at line 13 of file GEPChromosome.cpp.
| void GEP::GEPChromosome::execute | ( | void * | result | ) |
Definition at line 693 of file GEPChromosome.cpp.
| void GEP::GEPChromosome::generateChromosome | ( | ) |
Definition at line 61 of file GEPChromosome.cpp.
|
virtual |
Create and return a vector of crossover operators.
Reimplemented from Genotype.
Definition at line 20 of file GEPChromosome.cpp.
|
virtual |
Create and return a vector of mutation operators.
Reimplemented from Genotype.
Definition at line 30 of file GEPChromosome.cpp.
|
virtual |
Initialize a genotype object (read parameters, perform sanity check, build data).
Implements Genotype.
Definition at line 98 of file GEPChromosome.cpp.
| void GEP::GEPChromosome::initializeFirst | ( | GEPChromosome * | home | ) |
Definition at line 126 of file GEPChromosome.cpp.
| Tree::Tree * GEP::GEPChromosome::makeCellTree | ( | ) |
Definition at line 622 of file GEPChromosome.cpp.
|
virtual |
Read genotype data from XMLNode.
Implements Genotype.
Definition at line 432 of file GEPChromosome.cpp.
|
virtual |
Register genotype's parameters (called before Genotype::initialize).
Reimplemented from Genotype.
Definition at line 39 of file GEPChromosome.cpp.
| void GEP::GEPChromosome::setTerminalValue | ( | std::string | name, |
| void * | value ) |
Set a terminal's value.
| name | terminal's name |
| value | terminal's value |
Definition at line 716 of file GEPChromosome.cpp.
| Tree::Tree * GEP::GEPChromosome::toTree | ( | uint | gene | ) |
Definition at line 543 of file GEPChromosome.cpp.
|
virtual |
Write genotype data to XMLNode.
Implements Genotype.
Definition at line 394 of file GEPChromosome.cpp.
| Tree::Tree* GEP::GEPChromosome::cellTree |
Definition at line 52 of file GEPChromosome.h.
| uint GEP::GEPChromosome::dcLength |
length of the constant values domain
Definition at line 42 of file GEPChromosome.h.
| Tree::PrimitiveSetP GEP::GEPChromosome::ercSet_ |
Definition at line 49 of file GEPChromosome.h.
| uint GEP::GEPChromosome::geneLength |
total length of each gene
Definition at line 43 of file GEPChromosome.h.
| uint GEP::GEPChromosome::genes |
number of genes
Definition at line 46 of file GEPChromosome.h.
| uint GEP::GEPChromosome::headLength |
length of the head. User-specified
Definition at line 40 of file GEPChromosome.h.
| Tree::PrimitiveSetP GEP::GEPChromosome::linkFunctionSet_ |
Definition at line 48 of file GEPChromosome.h.
| uint GEP::GEPChromosome::linkHeadLength |
length of the linking function gene's head
Definition at line 44 of file GEPChromosome.h.
| uint GEP::GEPChromosome::linkTailLength |
length of the linking function gene's tail
Definition at line 45 of file GEPChromosome.h.
| Tree::PrimitiveSetP GEP::GEPChromosome::primitiveSet_ |
Definition at line 47 of file GEPChromosome.h.
|
protected |
Definition at line 36 of file GEPChromosome.h.
| bool GEP::GEPChromosome::staticLink |
whether we are using a static linking function or if it should be allowed to evolve
Definition at line 51 of file GEPChromosome.h.
| std::vector<Tree::Tree*> GEP::GEPChromosome::subtrees |
Definition at line 53 of file GEPChromosome.h.
| uint GEP::GEPChromosome::tailLength |
length of the tail. Automatically calculated.
Definition at line 41 of file GEPChromosome.h.
|
protected |
Definition at line 37 of file GEPChromosome.h.
|
protected |
Definition at line 38 of file GEPChromosome.h.
| bool GEP::GEPChromosome::usesERC |
whether or not the chromosome uses random constants
Definition at line 50 of file GEPChromosome.h.