ECF 1.5
Public Member Functions | Public Attributes | Protected Attributes | List of all members
GEPChromosome::GEPChromosome Class Reference

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

#include <GEPChromosome.h>

Inheritance diagram for GEPChromosome::GEPChromosome:
Genotype

Public Member Functions

GEPChromosomecopy ()
 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::TreetoTree (uint gene)
 
Tree::TreemakeCellTree ()
 
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 Genotypecopy ()=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::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 More...
 
uint genotypeId_
 this genotype's unique index in individual structure More...
 

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 32 of file GEPChromosome.h.

Constructor & Destructor Documentation

◆ GEPChromosome()

GEPChromosome::GEPChromosome::GEPChromosome ( )

Definition at line 4 of file GEPChromosome.cpp.

Member Function Documentation

◆ assemble()

void GEPChromosome::GEPChromosome::assemble ( )

Definition at line 660 of file GEPChromosome.cpp.

◆ copy()

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

Create an identical copy of the genotype object.

Implements Genotype.

Definition at line 12 of file GEPChromosome.cpp.

◆ execute()

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

Definition at line 669 of file GEPChromosome.cpp.

◆ generateChromosome()

void GEPChromosome::GEPChromosome::generateChromosome ( )

Definition at line 47 of file GEPChromosome.cpp.

◆ getCrossoverOp()

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

Create and return a vector of crossover operators.

Reimplemented from Genotype.

Definition at line 18 of file GEPChromosome.cpp.

◆ getMutationOp()

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

Create and return a vector of mutation operators.

Reimplemented from Genotype.

Definition at line 28 of file GEPChromosome.cpp.

◆ initialize()

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

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

Implements Genotype.

Definition at line 83 of file GEPChromosome.cpp.

◆ initializeFirst()

void GEPChromosome::GEPChromosome::initializeFirst ( GEPChromosome home)

Definition at line 111 of file GEPChromosome.cpp.

◆ makeCellTree()

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

Definition at line 599 of file GEPChromosome.cpp.

◆ read()

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

Read genotype data from XMLNode.

Implements Genotype.

Definition at line 415 of file GEPChromosome.cpp.

◆ registerParameters()

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

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

Reimplemented from Genotype.

Definition at line 37 of file GEPChromosome.cpp.

◆ setTerminalValue()

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

Set a terminal's value.

Parameters
nameterminal's name
valueterminal's value

Definition at line 691 of file GEPChromosome.cpp.

◆ toTree()

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

Definition at line 521 of file GEPChromosome.cpp.

◆ write()

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

Write genotype data to XMLNode.

Implements Genotype.

Definition at line 378 of file GEPChromosome.cpp.

Member Data Documentation

◆ cellTree

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

Definition at line 51 of file GEPChromosome.h.

◆ dcLength

uint GEPChromosome::GEPChromosome::dcLength

length of the constant values domain

Definition at line 41 of file GEPChromosome.h.

◆ ercSet_

Tree::PrimitiveSetP GEPChromosome::GEPChromosome::ercSet_

Definition at line 48 of file GEPChromosome.h.

◆ geneLength

uint GEPChromosome::GEPChromosome::geneLength

total length of each gene

Definition at line 42 of file GEPChromosome.h.

◆ genes

uint GEPChromosome::GEPChromosome::genes

number of genes

Definition at line 45 of file GEPChromosome.h.

◆ headLength

uint GEPChromosome::GEPChromosome::headLength

length of the head. User-specified

Definition at line 39 of file GEPChromosome.h.

◆ linkFunctionSet_

Tree::PrimitiveSetP GEPChromosome::GEPChromosome::linkFunctionSet_

Definition at line 47 of file GEPChromosome.h.

◆ linkHeadLength

uint GEPChromosome::GEPChromosome::linkHeadLength

length of the linking function gene's head

Definition at line 43 of file GEPChromosome.h.

◆ linkTailLength

uint GEPChromosome::GEPChromosome::linkTailLength

length of the linking function gene's tail

Definition at line 44 of file GEPChromosome.h.

◆ primitiveSet_

Tree::PrimitiveSetP GEPChromosome::GEPChromosome::primitiveSet_

Definition at line 46 of file GEPChromosome.h.

◆ state_

StateP GEPChromosome::GEPChromosome::state_
protected

Definition at line 35 of file GEPChromosome.h.

◆ staticLink

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.

◆ subtrees

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

Definition at line 52 of file GEPChromosome.h.

◆ tailLength

uint GEPChromosome::GEPChromosome::tailLength

length of the tail. Automatically calculated.

Definition at line 40 of file GEPChromosome.h.

◆ userFunctions_

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

Definition at line 36 of file GEPChromosome.h.

◆ userTerminals_

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

Definition at line 37 of file GEPChromosome.h.

◆ usesERC

bool GEPChromosome::GEPChromosome::usesERC

whether or not the chromosome uses random constants

Definition at line 49 of file GEPChromosome.h.


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