2#include "SymbRegEvalOp.h"
5uint showTree(
Tree::Tree* tree, std::string& output, uint iNode = 0, uint prefix = 0)
7 Tree::PrimitiveP prim = tree->at(iNode)->primitive_;
8 int arity = prim->getNumberOfArguments();
13 else if(prim->getName() ==
"pow") {
16 iNode = showTree(tree, output, iNode, prefix);
19 iNode = showTree(tree, output, iNode, prefix);
25 iNode = showTree(tree, output, iNode, prefix);
26 cout << prim->getName();
28 iNode = showTree(tree, output, iNode, prefix);
32 cout << prim->getName();
34 for(
int child = 0; child < arity; child++) {
36 iNode = showTree(tree, output, iNode, prefix);
44int main(
int argc,
char **argv)
46 StateP state (
new State);
51 state->initialize(argc, argv);
55 std::vector<IndividualP> hof = state->getHoF()->getBest();
56 IndividualP ind = hof[0];
57 std::cout << ind->toString();
std::string getName()
Return genotype's name (each genotype is uniquely identified with its name).
State class - backbone of the framework.
Symbolic regression evaluation operator (using AP genotype).
Tree class - implements genotype as a tree.