ECF 1.5
GEPChromosome.h
1#ifndef GEPCHROMOSOME_H
2#define GEPCHROMOSOME_H
3
4#include "../ECF.h"
5#include "../Tree/Tree.h"
6#include "GEPChromosomeCrsOnePoint.h"
7#include "GEPChromosomeCrsTwoPoint.h"
8#include "GEPChromosomeCrsGene.h"
9#include "GEPChromosomeMutOp.h"
10#include "GEPChromosomeMutGauss.h"
11#include <vector>
12#define GEP_GENE_PREFIX "GENE_"
13namespace GEPChromosome{
14
32 class GEPChromosome : public std::vector<Tree::NodeP>, public Genotype
33 {
34 protected:
35 StateP state_;
36 std::vector<Tree::PrimitiveP> userFunctions_; // programatically added functions
37 std::vector<Tree::PrimitiveP> userTerminals_; // programatically added terminals
38 public:
41 uint dcLength;
45 uint genes;
46 Tree::PrimitiveSetP primitiveSet_; // contains all functions, terminals and the ERC placeholder (if needed)
47 Tree::PrimitiveSetP linkFunctionSet_; // contains all linking functions and genic terminals (integers)
48 Tree::PrimitiveSetP ercSet_; // contains only the ERC ranges
49 bool usesERC;
51 Tree::Tree *cellTree;
52 std::vector<Tree::Tree*> subtrees;
53
55 GEPChromosome* copy();
56 std::vector<CrossoverOpP> getCrossoverOp();
57 std::vector<MutationOpP> getMutationOp();
58 void registerParameters(StateP state);
59 bool initialize(StateP state);
60 void initializeFirst(GEPChromosome* home);
61 void write(XMLNode &xGEPChromosome);
62 void read(XMLNode& xGEPChromosomeInd);
63 void execute(void*);
64 Tree::Tree* toTree(uint gene);
65 Tree::Tree* makeCellTree();
66 void assemble();
67 void generateChromosome();
68 void setTerminalValue(std::string name, void* value);
69 };
70}
71typedef boost::shared_ptr<GEPChromosome::GEPChromosome> GEPChromosomeP;
72#endif // GEPChromosome_h
GEPChromosome class - implements genotype as a Gene Expression Programming chromosome.
Definition: GEPChromosome.h:33
uint linkHeadLength
length of the linking function gene's head
Definition: GEPChromosome.h:43
uint genes
number of genes
Definition: GEPChromosome.h:45
uint tailLength
length of the tail. Automatically calculated.
Definition: GEPChromosome.h:40
bool usesERC
whether or not the chromosome uses random constants
Definition: GEPChromosome.h:49
uint linkTailLength
length of the linking function gene's tail
Definition: GEPChromosome.h:44
bool staticLink
whether we are using a static linking function or if it should be allowed to evolve
Definition: GEPChromosome.h:50
uint dcLength
length of the constant values domain
Definition: GEPChromosome.h:41
uint headLength
length of the head. User-specified
Definition: GEPChromosome.h:39
uint geneLength
total length of each gene
Definition: GEPChromosome.h:42
Genotype base class.
Definition: Genotype.h:36
Tree class - implements genotype as a tree.
Definition: Tree_c.h:29