ECF 1.7
GEP::GEPChromosome Class Reference

GEPChromosome class - implements genotype as a Gene Expression Programming chromosome. More...

#include <GEPChromosome.h>

Inheritance diagram for GEP::GEPChromosome:
Genotype

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::TreetoTree (uint gene)
Tree::TreemakeCellTree ()
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::TreecellTree
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

Detailed Description

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.

Constructor & Destructor Documentation

◆ GEPChromosome()

GEP::GEPChromosome::GEPChromosome ( )

Definition at line 5 of file GEPChromosome.cpp.

Member Function Documentation

◆ addFunction()

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.

◆ assemble()

void GEP::GEPChromosome::assemble ( )

Definition at line 684 of file GEPChromosome.cpp.

◆ copy()

GEPChromosome * GEP::GEPChromosome::copy ( )
virtual

Create an identical copy of the genotype object.

Implements Genotype.

Definition at line 13 of file GEPChromosome.cpp.

◆ execute()

void GEP::GEPChromosome::execute ( void * result)

Definition at line 693 of file GEPChromosome.cpp.

◆ generateChromosome()

void GEP::GEPChromosome::generateChromosome ( )

Definition at line 61 of file GEPChromosome.cpp.

◆ getCrossoverOp()

std::vector< CrossoverOpP > GEP::GEPChromosome::getCrossoverOp ( )
virtual

Create and return a vector of crossover operators.

Reimplemented from Genotype.

Definition at line 20 of file GEPChromosome.cpp.

◆ getMutationOp()

std::vector< MutationOpP > GEP::GEPChromosome::getMutationOp ( )
virtual

Create and return a vector of mutation operators.

Reimplemented from Genotype.

Definition at line 30 of file GEPChromosome.cpp.

◆ initialize()

bool GEP::GEPChromosome::initialize ( StateP state)
virtual

Initialize a genotype object (read parameters, perform sanity check, build data).

Implements Genotype.

Definition at line 98 of file GEPChromosome.cpp.

◆ initializeFirst()

void GEP::GEPChromosome::initializeFirst ( GEPChromosome * home)

Definition at line 126 of file GEPChromosome.cpp.

◆ makeCellTree()

Tree::Tree * GEP::GEPChromosome::makeCellTree ( )

Definition at line 622 of file GEPChromosome.cpp.

◆ read()

void GEP::GEPChromosome::read ( XMLNode & xGEPChromosomeInd)
virtual

Read genotype data from XMLNode.

Implements Genotype.

Definition at line 432 of file GEPChromosome.cpp.

◆ registerParameters()

void GEP::GEPChromosome::registerParameters ( StateP state)
virtual

Register genotype's parameters (called before Genotype::initialize).

Reimplemented from Genotype.

Definition at line 39 of file GEPChromosome.cpp.

◆ setTerminalValue()

void GEP::GEPChromosome::setTerminalValue ( std::string name,
void * value )

Set a terminal's value.

Parameters
nameterminal's name
valueterminal's value

Definition at line 716 of file GEPChromosome.cpp.

◆ toTree()

Tree::Tree * GEP::GEPChromosome::toTree ( uint gene)

Definition at line 543 of file GEPChromosome.cpp.

◆ write()

void GEP::GEPChromosome::write ( XMLNode & xGEPChromosome)
virtual

Write genotype data to XMLNode.

Implements Genotype.

Definition at line 394 of file GEPChromosome.cpp.

Member Data Documentation

◆ cellTree

Tree::Tree* GEP::GEPChromosome::cellTree

Definition at line 52 of file GEPChromosome.h.

◆ dcLength

uint GEP::GEPChromosome::dcLength

length of the constant values domain

Definition at line 42 of file GEPChromosome.h.

◆ ercSet_

Tree::PrimitiveSetP GEP::GEPChromosome::ercSet_

Definition at line 49 of file GEPChromosome.h.

◆ geneLength

uint GEP::GEPChromosome::geneLength

total length of each gene

Definition at line 43 of file GEPChromosome.h.

◆ genes

uint GEP::GEPChromosome::genes

number of genes

Definition at line 46 of file GEPChromosome.h.

◆ headLength

uint GEP::GEPChromosome::headLength

length of the head. User-specified

Definition at line 40 of file GEPChromosome.h.

◆ linkFunctionSet_

Tree::PrimitiveSetP GEP::GEPChromosome::linkFunctionSet_

Definition at line 48 of file GEPChromosome.h.

◆ linkHeadLength

uint GEP::GEPChromosome::linkHeadLength

length of the linking function gene's head

Definition at line 44 of file GEPChromosome.h.

◆ linkTailLength

uint GEP::GEPChromosome::linkTailLength

length of the linking function gene's tail

Definition at line 45 of file GEPChromosome.h.

◆ primitiveSet_

Tree::PrimitiveSetP GEP::GEPChromosome::primitiveSet_

Definition at line 47 of file GEPChromosome.h.

◆ state_

StateP GEP::GEPChromosome::state_
protected

Definition at line 36 of file GEPChromosome.h.

◆ staticLink

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.

◆ subtrees

std::vector<Tree::Tree*> GEP::GEPChromosome::subtrees

Definition at line 53 of file GEPChromosome.h.

◆ tailLength

uint GEP::GEPChromosome::tailLength

length of the tail. Automatically calculated.

Definition at line 41 of file GEPChromosome.h.

◆ userFunctions_

std::vector<Tree::PrimitiveP> GEP::GEPChromosome::userFunctions_
protected

Definition at line 37 of file GEPChromosome.h.

◆ userTerminals_

std::vector<Tree::PrimitiveP> GEP::GEPChromosome::userTerminals_
protected

Definition at line 38 of file GEPChromosome.h.

◆ usesERC

bool GEP::GEPChromosome::usesERC

whether or not the chromosome uses random constants

Definition at line 50 of file GEPChromosome.h.


The documentation for this class was generated from the following files: