From 2d12525bc590287e0971e286e417bf6fbc536134 Mon Sep 17 00:00:00 2001 From: jeggermo Date: Sat, 3 Nov 2001 22:10:11 +0000 Subject: [PATCH] the name of the eoGpDepthInitializer class (initializer for parse_tree's has been changed to eoParseTreeDepthInit but backward compatibility is maintained by using a #define statement: #define eoGpDepthInitializer eoParseTreeDepthInit The initializer for strongly typed GP has been changed to eoStParseTreeDepthInit the gpsymreg application has been changed to use the new name --- eo/app/gpsymreg/main.cc | 2 +- eo/config.cache | 39 +++++++++++++++--------------- eo/src/gp/eoParseTreeDepthInit.h | 21 +++++++++------- eo/src/gp/eoStParseTreeDepthInit.h | 14 +++++------ 4 files changed, 39 insertions(+), 37 deletions(-) diff --git a/eo/app/gpsymreg/main.cc b/eo/app/gpsymreg/main.cc index abf8a587..ee4c2943 100644 --- a/eo/app/gpsymreg/main.cc +++ b/eo/app/gpsymreg/main.cc @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) RegFitness eval(generationCounter, initSequence, parameter); // Depth Initializor, defaults to grow method. - eoGpDepthInitializer initializer(parameter.InitMaxDepth, initSequence); + eoParseTreeDepthInit initializer(parameter.InitMaxDepth, initSequence); // create the initial population Pop pop(parameter.population_size, initializer); diff --git a/eo/config.cache b/eo/config.cache index b1e24a92..8f137b2a 100644 --- a/eo/config.cache +++ b/eo/config.cache @@ -12,23 +12,22 @@ # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # -ac_cv_type_size_t=${ac_cv_type_size_t='yes'} -ac_cv_func_select=${ac_cv_func_select='yes'} -ac_cv_path_install=${ac_cv_path_install='/usr/bin/install -c'} -ac_cv_prog_CXX=${ac_cv_prog_CXX='c++'} -ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB='ranlib'} -ac_cv_prog_cxx_cross=${ac_cv_prog_cxx_cross='no'} -ac_cv_lib_eo_main=${ac_cv_lib_eo_main='no'} -ac_cv_c_const=${ac_cv_c_const='yes'} -ac_cv_prog_LN_S=${ac_cv_prog_LN_S='ln -s'} -ac_cv_header_limits_h=${ac_cv_header_limits_h='yes'} -ac_cv_header_stdc=${ac_cv_header_stdc='yes'} -ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set='yes'} -ac_cv_prog_cxx_works=${ac_cv_prog_cxx_works='yes'} -ac_cv_c_inline=${ac_cv_c_inline='inline'} -ac_cv_lib_m_main=${ac_cv_lib_m_main='yes'} -ac_cv_lib_eoutils_main=${ac_cv_lib_eoutils_main='no'} -ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g='yes'} -ac_cv_prog_gxx=${ac_cv_prog_gxx='yes'} -ac_cv_prog_CPP=${ac_cv_prog_CPP='cc -E'} - +ac_cv_c_const=${ac_cv_c_const=yes} +ac_cv_c_inline=${ac_cv_c_inline=inline} +ac_cv_func_select=${ac_cv_func_select=yes} +ac_cv_header_limits_h=${ac_cv_header_limits_h=yes} +ac_cv_header_stdc=${ac_cv_header_stdc=yes} +ac_cv_lib_eo_main=${ac_cv_lib_eo_main=no} +ac_cv_lib_eoutils_main=${ac_cv_lib_eoutils_main=no} +ac_cv_lib_m_main=${ac_cv_lib_m_main=yes} +ac_cv_path_install=${ac_cv_path_install=$'/usr/bin/install -c'} +ac_cv_prog_CPP=${ac_cv_prog_CPP=$'cc -E'} +ac_cv_prog_CXX=${ac_cv_prog_CXX=c++} +ac_cv_prog_LN_S=${ac_cv_prog_LN_S=$'ln -s'} +ac_cv_prog_RANLIB=${ac_cv_prog_RANLIB=ranlib} +ac_cv_prog_cxx_cross=${ac_cv_prog_cxx_cross=no} +ac_cv_prog_cxx_g=${ac_cv_prog_cxx_g=yes} +ac_cv_prog_cxx_works=${ac_cv_prog_cxx_works=yes} +ac_cv_prog_gxx=${ac_cv_prog_gxx=yes} +ac_cv_prog_make_make_set=${ac_cv_prog_make_make_set=yes} +ac_cv_type_size_t=${ac_cv_type_size_t=yes} diff --git a/eo/src/gp/eoParseTreeDepthInit.h b/eo/src/gp/eoParseTreeDepthInit.h index 85cc8efe..dfefacf7 100644 --- a/eo/src/gp/eoParseTreeDepthInit.h +++ b/eo/src/gp/eoParseTreeDepthInit.h @@ -43,13 +43,16 @@ bool lt_arity(const Node &node1, const Node &node2) return (node1.arity() < node2.arity()); } -/** eoGpDepthInitializer : the initializer class for eoParseTree -\class eoGpDepthInitializer eoParseTreeDepthInit.h gp/eoParseTreeDepthInit.h +/** eoParseTreeDepthInit : the initializer class for eoParseTree +\class eoParseTreeDepthInit eoParseTreeDepthInit.h gp/eoParseTreeDepthInit.h \ingroup ParseTree */ +// eoGpDepthInitializer is defined for backward compatibility +#define eoGpDepthInitializer eoParseTreeDepthInit + template -class eoGpDepthInitializer : public eoInit< eoParseTree > +class eoParseTreeDepthInit : public eoInit< eoParseTree > { public : @@ -61,7 +64,7 @@ class eoGpDepthInitializer : public eoInit< eoParseTree > * @param _initializor A vector containing the possible nodes * @param _grow False results in a full tree, True result is a randomly grown tree */ - eoGpDepthInitializer( + eoParseTreeDepthInit( unsigned _max_depth, const vector& _initializor, bool _grow = true) @@ -73,14 +76,14 @@ class eoGpDepthInitializer : public eoInit< eoParseTree > { if(initializor.empty()) { - throw logic_error("eoGpDepthInitializer: uhm, wouldn't you rather give a non-empty set of Nodes?"); + throw logic_error("eoParseTreeDepthInit: uhm, wouldn't you rather give a non-empty set of Nodes?"); } // lets sort the initializor vector according to arity (so we can be sure the terminals are in front) // we use stable_sort so that if element i was in front of element j and they have the same arity i remains in front of j stable_sort(initializor.begin(), initializor.end(), lt_arity); } /// My class name - virtual string className() const { return "eoDepthInitializer"; }; + virtual string className() const { return "eoParseTreeDepthInit"; }; /**initialize a tree * @param _tree : the tree to be initialized @@ -168,11 +171,11 @@ void eoInitRampedHalfAndHalf(eoPop< eoParseTree > &pop, unsigned in // initialize with Depth's (D) -> 2 for(m=init_max_depth; m >= 2; m--) { - eoGpDepthInitializer grow_initializer(m, initializor, true); + eoParseTreeDepthInit grow_initializer(m, initializor, true); Pop grow(part_pop_size, grow_initializer); pop.insert(pop.begin(), grow.begin(), grow.end()); - eoGpDepthInitializer full_initializer(m, initializor, false); + eoParseTreeDepthInit full_initializer(m, initializor, false); Pop full(part_pop_size, full_initializer); pop.insert(pop.begin(), full.begin(), full.end()); } @@ -180,7 +183,7 @@ void eoInitRampedHalfAndHalf(eoPop< eoParseTree > &pop, unsigned in bool g = true; while (pop.size() < population_size) { - eoGpDepthInitializer initializer(init_max_depth, initializor, g); + eoParseTreeDepthInit initializer(init_max_depth, initializor, g); Pop p(1, initializer); pop.insert(pop.begin(), p.begin(), p.end()); g= !g; diff --git a/eo/src/gp/eoStParseTreeDepthInit.h b/eo/src/gp/eoStParseTreeDepthInit.h index f17ad00d..7307d063 100644 --- a/eo/src/gp/eoStParseTreeDepthInit.h +++ b/eo/src/gp/eoStParseTreeDepthInit.h @@ -1,7 +1,7 @@ // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- //----------------------------------------------------------------------------- -// eoStDepthInit.h : initializor strongly type GP +// eoStParseTreeDepthInit.h : initializor strongly type GP // (c) Jeroen Eggermont 2001 /* This library is free software; you can redistribute it and/or @@ -53,13 +53,13 @@ using namespace std; Tree pruning strongly typed trees is not possible at the moment. */ -/** eoStDepthInit : the initializer class for strongly typed tree-based genetic programming -\class eoStDepthInit eoStDepthInit.h gp/eoStDepthInit.h +/** eoStParseTreeDepthInit : the initializer class for strongly typed tree-based genetic programming +\class eoStParseTreeDepthInit eoStParseTreeDepthInit.h gp/eoStParseTreeDepthInit.h \ingroup StParseTree */ template -class eoStDepthInit : public eoInit< eoParseTree > +class eoStParseTreeDepthInit : public eoInit< eoParseTree > { public : @@ -71,7 +71,7 @@ class eoStDepthInit : public eoInit< eoParseTree > * @param _initializor A vector containing the possible nodes * @param _grow False results in a full tree, True result is a randomly grown tree */ - eoStDepthInit( + eoStParseTreeDepthInit( unsigned _max_depth, const vector& _node, const int& _return_type, @@ -84,7 +84,7 @@ class eoStDepthInit : public eoInit< eoParseTree > { if(_node.empty()) { - throw logic_error("eoGpDepthInitializer: uhm, wouldn't you rather give a non-empty set of Nodes?"); + throw logic_error("eoStParseTreeDepthInit: uhm, wouldn't you rather give a non-empty set of Nodes?"); } @@ -118,7 +118,7 @@ class eoStDepthInit : public eoInit< eoParseTree > } /// My class name - virtual string className() const { return "eoStDepthInit"; }; + virtual string className() const { return "eoStParseTreeDepthInit"; }; /**initialize a tree * @param _tree : the tree to be initialized