ECF 1.5
|
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. More... | |
std::vector< CrossoverOpP > | getCrossoverOp () |
Create and return a vector of crossover operators. More... | |
std::vector< MutationOpP > | getMutationOp () |
Create and return a vector of mutation operators. More... | |
void | registerParameters (StateP state) |
Register genotype's parameters (called before Genotype::initialize) More... | |
bool | initialize (StateP state) |
Initialize a genotype object (read parameters, perform sanity check, build data) More... | |
void | initializeFirst (GEPChromosome *home) |
void | write (XMLNode &xGEPChromosome) |
Write genotype data to XMLNode. More... | |
void | read (XMLNode &xGEPChromosomeInd) |
Read genotype data from XMLNode. More... | |
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. More... | |
Public Member Functions inherited from Genotype | |
virtual bool | initialize (StateP state)=0 |
Initialize a genotype object (read parameters, perform sanity check, build data) More... | |
virtual Genotype * | copy ()=0 |
Create an identical copy of the genotype object. More... | |
virtual std::vector< CrossoverOpP > | getCrossoverOp () |
Create and return a vector of crossover operators. More... | |
virtual std::vector< MutationOpP > | getMutationOp () |
Create and return a vector of mutation operators. More... | |
virtual void | registerParameters (StateP) |
Register genotype's parameters (called before Genotype::initialize) More... | |
bool | registerParameter (StateP state, std::string name, voidP value, enum ECF::type T, std::string description="") |
Register a single parameter. More... | |
voidP | getParameterValue (StateP state, std::string name) |
Read single parameter value from Registry. More... | |
bool | setParameterValue (StateP state, std::string name, voidP value) |
Write single parameter value to Registry. More... | |
bool | isParameterDefined (StateP state, std::string name) |
Check if parameter is defined in the configuration. More... | |
virtual void | read (XMLNode &)=0 |
Read genotype data from XMLNode. More... | |
virtual void | write (XMLNode &)=0 |
Write genotype data to XMLNode. More... | |
virtual uint | getGenomeSize () |
std::string | getName () |
Return genotype's name (each genotype is uniquely identified with its name). More... | |
uint | getGenotypeId () |
Return this genotype's index in individual structure. More... | |
void | setGenotypeId (uint id) |
Set genotype index in an individual. More... | |
std::string | toString () |
Output genotype to string. More... | |
Public Attributes | |
uint | headLength |
length of the head. User-specified More... | |
uint | tailLength |
length of the tail. Automatically calculated. More... | |
uint | dcLength |
length of the constant values domain More... | |
uint | geneLength |
total length of each gene More... | |
uint | linkHeadLength |
length of the linking function gene's head More... | |
uint | linkTailLength |
length of the linking function gene's tail More... | |
uint | genes |
number of genes More... | |
Tree::PrimitiveSetP | primitiveSet_ |
Tree::PrimitiveSetP | linkFunctionSet_ |
Tree::PrimitiveSetP | ercSet_ |
bool | usesERC |
whether or not the chromosome uses random constants More... | |
bool | staticLink |
whether we are using a static linking function or if it should be allowed to evolve More... | |
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 More... | |
uint | genotypeId_ |
this genotype's unique index in individual structure More... | |
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 32 of file GEPChromosome.h.
GEPChromosome::GEPChromosome::GEPChromosome | ( | ) |
Definition at line 4 of file GEPChromosome.cpp.
void GEPChromosome::GEPChromosome::assemble | ( | ) |
Definition at line 660 of file GEPChromosome.cpp.
|
virtual |
Create an identical copy of the genotype object.
Implements Genotype.
Definition at line 12 of file GEPChromosome.cpp.
void GEPChromosome::GEPChromosome::execute | ( | void * | result | ) |
Definition at line 669 of file GEPChromosome.cpp.
void GEPChromosome::GEPChromosome::generateChromosome | ( | ) |
Definition at line 47 of file GEPChromosome.cpp.
|
virtual |
Create and return a vector of crossover operators.
Reimplemented from Genotype.
Definition at line 18 of file GEPChromosome.cpp.
|
virtual |
Create and return a vector of mutation operators.
Reimplemented from Genotype.
Definition at line 28 of file GEPChromosome.cpp.
|
virtual |
Initialize a genotype object (read parameters, perform sanity check, build data)
Implements Genotype.
Definition at line 83 of file GEPChromosome.cpp.
void GEPChromosome::GEPChromosome::initializeFirst | ( | GEPChromosome * | home | ) |
Definition at line 111 of file GEPChromosome.cpp.
Tree::Tree * GEPChromosome::GEPChromosome::makeCellTree | ( | ) |
Definition at line 599 of file GEPChromosome.cpp.
|
virtual |
Read genotype data from XMLNode.
Implements Genotype.
Definition at line 415 of file GEPChromosome.cpp.
|
virtual |
Register genotype's parameters (called before Genotype::initialize)
Reimplemented from Genotype.
Definition at line 37 of file GEPChromosome.cpp.
void GEPChromosome::GEPChromosome::setTerminalValue | ( | std::string | name, |
void * | value | ||
) |
Set a terminal's value.
name | terminal's name |
value | terminal's value |
Definition at line 691 of file GEPChromosome.cpp.
Tree::Tree * GEPChromosome::GEPChromosome::toTree | ( | uint | gene | ) |
Definition at line 521 of file GEPChromosome.cpp.
|
virtual |
Write genotype data to XMLNode.
Implements Genotype.
Definition at line 378 of file GEPChromosome.cpp.
Tree::Tree* GEPChromosome::GEPChromosome::cellTree |
Definition at line 51 of file GEPChromosome.h.
uint GEPChromosome::GEPChromosome::dcLength |
length of the constant values domain
Definition at line 41 of file GEPChromosome.h.
Tree::PrimitiveSetP GEPChromosome::GEPChromosome::ercSet_ |
Definition at line 48 of file GEPChromosome.h.
uint GEPChromosome::GEPChromosome::geneLength |
total length of each gene
Definition at line 42 of file GEPChromosome.h.
uint GEPChromosome::GEPChromosome::genes |
number of genes
Definition at line 45 of file GEPChromosome.h.
uint GEPChromosome::GEPChromosome::headLength |
length of the head. User-specified
Definition at line 39 of file GEPChromosome.h.
Tree::PrimitiveSetP GEPChromosome::GEPChromosome::linkFunctionSet_ |
Definition at line 47 of file GEPChromosome.h.
uint GEPChromosome::GEPChromosome::linkHeadLength |
length of the linking function gene's head
Definition at line 43 of file GEPChromosome.h.
uint GEPChromosome::GEPChromosome::linkTailLength |
length of the linking function gene's tail
Definition at line 44 of file GEPChromosome.h.
Tree::PrimitiveSetP GEPChromosome::GEPChromosome::primitiveSet_ |
Definition at line 46 of file GEPChromosome.h.
|
protected |
Definition at line 35 of file GEPChromosome.h.
bool GEPChromosome::GEPChromosome::staticLink |
whether we are using a static linking function or if it should be allowed to evolve
Definition at line 50 of file GEPChromosome.h.
std::vector<Tree::Tree*> GEPChromosome::GEPChromosome::subtrees |
Definition at line 52 of file GEPChromosome.h.
uint GEPChromosome::GEPChromosome::tailLength |
length of the tail. Automatically calculated.
Definition at line 40 of file GEPChromosome.h.
|
protected |
Definition at line 36 of file GEPChromosome.h.
|
protected |
Definition at line 37 of file GEPChromosome.h.
bool GEPChromosome::GEPChromosome::usesERC |
whether or not the chromosome uses random constants
Definition at line 49 of file GEPChromosome.h.