From 10d582b31d2c5a779acd1dc950b339d897b07e2b Mon Sep 17 00:00:00 2001 From: kuepper Date: Mon, 27 Mar 2006 18:55:20 +0000 Subject: [PATCH] Fix using directives for gcc-4.1 --- eo/app/gpsymreg/fitness.h | 92 +++++++++++++-------------- eo/src/eoLinearFitScaling.h | 2 +- eo/src/eoNDSorting.h | 15 +++-- eo/src/eoOpContainer.h | 4 +- eo/src/eoParetoRanking.h | 2 +- eo/src/eoPerf2Worth.h | 2 +- eo/src/eoRanking.h | 2 +- eo/src/eoSharing.h | 2 +- eo/src/es/eoEsChromInit.h | 4 +- eo/src/es/eoEsFull.h | 2 +- eo/src/es/eoEsStdev.h | 2 +- eo/src/gp/eoParseTree.h | 8 +-- eo/src/utils/eoAssembledFitnessStat.h | 4 +- eo/src/utils/eoFDCStat.h | 2 +- eo/src/utils/eoMOFitnessStat.h | 4 +- eo/src/utils/eoPopStat.h | 4 +- eo/src/utils/eoScalarFitnessStat.h | 10 +-- eo/src/utils/eoStat.h | 8 +-- eo/src/utils/eoUpdater.h | 2 +- 19 files changed, 86 insertions(+), 85 deletions(-) diff --git a/eo/app/gpsymreg/fitness.h b/eo/app/gpsymreg/fitness.h index b7a34439f..d8a3f5482 100644 --- a/eo/app/gpsymreg/fitness.h +++ b/eo/app/gpsymreg/fitness.h @@ -3,16 +3,16 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - + You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + Contact: todos@geneura.ugr.es, http://geneura.ugr.es jeggermo@liacs.nl */ @@ -23,7 +23,7 @@ #include #include -#include +#include #include "parameters.h" #include "node.h" @@ -82,14 +82,14 @@ double _divides(double arg1, double arg2) { if (arg2 ==0) return 0; - else + else return arg1 / arg2; } double _negate(double arg1) { return -arg1; -} +} @@ -97,36 +97,36 @@ double _negate(double arg1) void init(vector &initSequence) { - + // we have only one variable (X) Operation varX( (unsigned int) 0, string("X") ); - - - // the main binary operators + + + // the main binary operators Operation OpPLUS ( _plus, string("+")); Operation OpMINUS( _minus,string("-")); Operation OpMULTIPLIES(_multiplies,string("*")); // We can use a protected divide function. Operation OpDIVIDE( _divides, string("/") ); - - + + // Now the functions as binary functions Operation PLUS( string("plus"), _plus); Operation MINUS( string("minus"), _minus); Operation MULTIPLIES( string("multiply"), _multiplies); Operation DIVIDE( string("divide"), _divides); - - + + // and some unary functions Operation NEGATE( _negate,string("-")); Operation SIN ( sin, string("sin")); Operation COS ( cos, string("cos")); - + // Now we are ready to add the possible nodes to our initSequence (which is used by the eoDepthInitializer) - + // so lets start with our variable initSequence.push_back(varX); - + // followed by the constants 2, 4, 6 for(unsigned int i=2; i <= 6; i+=2) { @@ -136,81 +136,81 @@ void init(vector &initSequence) initSequence.push_back( op ); // and we add the variable again (so we have get lots of variables); initSequence.push_back( varX ); - } - + } + // next we add the unary functions - + initSequence.push_back( NEGATE ); initSequence.push_back( SIN ); initSequence.push_back( COS ); - + // and the binary functions initSequence.push_back( PLUS); initSequence.push_back( MINUS ); initSequence.push_back( MULTIPLIES ); initSequence.push_back( DIVIDE ); - + // and the binary operators initSequence.push_back( OpPLUS); initSequence.push_back( OpMINUS ); - + initSequence.push_back( OpMULTIPLIES ); initSequence.push_back( OpDIVIDE ); - - + + }; -class RegFitness: public eoEvalFunc< eoParseTree > +class RegFitness: public eoEvalFunc< eoParseTree > { public: - - typedef eoParseTree EoType; - + + typedef eoParseTree EoType; + void operator()(EoType &_eo) { - + vector< double > input(1); // the input variable(s) - double output; + double output(0.); double target; FitnessType fitness; - - + + float x=0; - double fit=0; + double fit=0; for(x=-1; x <= 1; x+=0.1) { input[0] = x; target = sextic_polynomial(x); _eo.apply(output,input); - + fit += pow(target - output, 2); } - + fitness[NORMAL] = fit; - + fitness[SMALLESTSIZE] = _eo.size() / (1.0*parameter.MaxSize); _eo.fitness(fitness); - + if (fitness[NORMAL] < best[NORMAL]) { best[NORMAL] = fitness[NORMAL]; tree=""; _eo.apply(tree); - } - + } + } - - - - RegFitness(eoValueParam &_generationCounter, vector< Node > &initSequence, Parameters &_parameter) : eoEvalFunc(), generationCounter(_generationCounter), parameter(_parameter) + + + + RegFitness(eoValueParam &_generationCounter, vector< Node > &initSequence, Parameters &_parameter) : eoEvalFunc(), generationCounter(_generationCounter), parameter(_parameter) { init(initSequence); best[NORMAL] = 1000; tree= "not found"; }; - + ~RegFitness() { cerr << "Best Fitness= " << best[NORMAL] << endl; @@ -221,7 +221,7 @@ class RegFitness: public eoEvalFunc< eoParseTree > eoValueParam &generationCounter; // so we know the current generation Parameters ¶meter; // the parameters FitnessType best; // the best found fitness - string tree; + string tree; }; #endif diff --git a/eo/src/eoLinearFitScaling.h b/eo/src/eoLinearFitScaling.h index e33858b60..e5f4c8192 100644 --- a/eo/src/eoLinearFitScaling.h +++ b/eo/src/eoLinearFitScaling.h @@ -44,7 +44,7 @@ class eoLinearFitScaling : public eoPerf2Worth // false: do not cache fitne { public: - using eoLinearFitScaling< EOT >::value; + using eoPerf2Worth::value; /* Ctor: @param _p selective pressure (in (1,2]) diff --git a/eo/src/eoNDSorting.h b/eo/src/eoNDSorting.h index 912a24b0b..bbeab38b2 100644 --- a/eo/src/eoNDSorting.h +++ b/eo/src/eoNDSorting.h @@ -42,11 +42,12 @@ template class eoNDSorting : public eoPerf2WorthCached { public : - - using eoNDSorting< EOT >::value; - eoNDSorting(bool nasty_flag_ = false) : nasty_declone_flag_that_only_is_implemented_for_two_objectives(nasty_flag_) - {} - + + using eoPerf2WorthCached::value; + eoNDSorting(bool nasty_flag_ = false) + : nasty_declone_flag_that_only_is_implemented_for_two_objectives(nasty_flag_) + {} + eoNDSorting() : nasty_declone_flag_that_only_is_implemented_for_two_objectives(false) @@ -433,9 +434,9 @@ template class eoNDSorting_II : public eoNDSorting { public: - + eoNDSorting_II(bool nasty_flag_ = false) : eoNDSorting(nasty_flag_) {} - + typedef std::pair double_index_pair; class compare_nodes diff --git a/eo/src/eoOpContainer.h b/eo/src/eoOpContainer.h index 8f19e1638..6a31ced9e 100644 --- a/eo/src/eoOpContainer.h +++ b/eo/src/eoOpContainer.h @@ -89,8 +89,8 @@ class eoSequentialOp : public eoOpContainer { public: - using eoOpContainer< EOT >::ops; - using eoOpContainer< EOT >::rates; + using eoOpContainer::ops; + using eoOpContainer::rates; typedef unsigned position_type; diff --git a/eo/src/eoParetoRanking.h b/eo/src/eoParetoRanking.h index 63e7298b2..cd54ff002 100644 --- a/eo/src/eoParetoRanking.h +++ b/eo/src/eoParetoRanking.h @@ -41,7 +41,7 @@ class eoParetoRanking : public eoPerf2WorthCached { public: - using eoParetoRanking< EOT>::value; + using eoPerf2WorthCached::value; eoParetoRanking(eoDominanceMap& _dominanceMap) : eoPerf2WorthCached(), dominanceMap(_dominanceMap) diff --git a/eo/src/eoPerf2Worth.h b/eo/src/eoPerf2Worth.h index 3e1a5657e..35d2f28e3 100644 --- a/eo/src/eoPerf2Worth.h +++ b/eo/src/eoPerf2Worth.h @@ -44,7 +44,7 @@ class eoPerf2Worth : public eoUF&, void>, public eoValueParam::value; + using eoValueParam >::value; /** @brief default constructor */ eoPerf2Worth(std::string _description = "Worths") diff --git a/eo/src/eoRanking.h b/eo/src/eoRanking.h index 3f06fd9fb..def90dd81 100644 --- a/eo/src/eoRanking.h +++ b/eo/src/eoRanking.h @@ -39,7 +39,7 @@ class eoRanking : public eoPerf2Worth // false: do not cache fitness { public: - using eoRanking< EOT >::value; + using eoPerf2Worth::value; /* Ctor: @param _p selective pressure (in (1,2] diff --git a/eo/src/eoSharing.h b/eo/src/eoSharing.h index 3f28f22c6..bdc0bbd00 100644 --- a/eo/src/eoSharing.h +++ b/eo/src/eoSharing.h @@ -80,7 +80,7 @@ class eoSharing : public eoPerf2Worth { public: - using eoSharing< EOT >::value; + using eoPerf2Worth::value; /* Ctor requires a distance - cannot have a default distance! */ diff --git a/eo/src/es/eoEsChromInit.h b/eo/src/es/eoEsChromInit.h index a90e81b7c..aec08438b 100644 --- a/eo/src/es/eoEsChromInit.h +++ b/eo/src/es/eoEsChromInit.h @@ -56,8 +56,8 @@ class eoEsChromInit : public eoRealInitBounded { public: - using eoEsChromInit::size; - using eoEsChromInit::theBounds; + using eoRealInitBounded::size; + using eoRealInitBounded::theBounds; typedef typename EOT::Fitness FitT; diff --git a/eo/src/es/eoEsFull.h b/eo/src/es/eoEsFull.h index 62f2accca..74920a5d3 100644 --- a/eo/src/es/eoEsFull.h +++ b/eo/src/es/eoEsFull.h @@ -41,7 +41,7 @@ class eoEsFull : public eoVector { public: - using eoEsFull< Fit >::size; + using eoVector::size; typedef double Type; diff --git a/eo/src/es/eoEsStdev.h b/eo/src/es/eoEsStdev.h index ff005b37a..1fdd39c8a 100644 --- a/eo/src/es/eoEsStdev.h +++ b/eo/src/es/eoEsStdev.h @@ -38,7 +38,7 @@ class eoEsStdev : public eoVector { public: - using eoEsStdev::size; + using eoVector::size; typedef double Type; diff --git a/eo/src/gp/eoParseTree.h b/eo/src/gp/eoParseTree.h index 23fa32f40..ca8530d67 100644 --- a/eo/src/gp/eoParseTree.h +++ b/eo/src/gp/eoParseTree.h @@ -55,10 +55,10 @@ class eoParseTree : public EO, public parse_tree { public: - using eoParseTree::back; - using eoParseTree::ebegin; - using eoParseTree::eend; - using eoParseTree::size; + using parse_tree::back; + using parse_tree::ebegin; + using parse_tree::eend; + using parse_tree::size; typedef typename parse_tree::subtree Subtree; diff --git a/eo/src/utils/eoAssembledFitnessStat.h b/eo/src/utils/eoAssembledFitnessStat.h index 1b973c4b3..5dd96c674 100644 --- a/eo/src/utils/eoAssembledFitnessStat.h +++ b/eo/src/utils/eoAssembledFitnessStat.h @@ -47,7 +47,7 @@ class eoAssembledFitnessAverageStat : public eoStat { public : - using eoAssembledFitnessAverageStat< EOT >::value; + using eoStat::value; typedef typename EOT::Fitness Fitness; @@ -88,7 +88,7 @@ class eoAssembledFitnessBestStat : public eoStat { public: - using eoAssembledFitnessBestStat< EOT >::value; + using eoStat::value; typedef typename EOT::Fitness Fitness; diff --git a/eo/src/utils/eoFDCStat.h b/eo/src/utils/eoFDCStat.h index 5de191872..0d2dda730 100644 --- a/eo/src/utils/eoFDCStat.h +++ b/eo/src/utils/eoFDCStat.h @@ -40,7 +40,7 @@ class eoFDCStat : public eoStat { public: - using eoFDCStat < EOT>::value; + using eoStat::value; /** Ctor without the optimum */ eoFDCStat(eoDistance & _dist, std::string _description = "FDC") : diff --git a/eo/src/utils/eoMOFitnessStat.h b/eo/src/utils/eoMOFitnessStat.h index 4d473374c..bb95acbe9 100644 --- a/eo/src/utils/eoMOFitnessStat.h +++ b/eo/src/utils/eoMOFitnessStat.h @@ -37,7 +37,7 @@ class eoFitnessStat : public eoSortedStat > { public : - using eoFitnessStat< EOT, FitT >::value; + using eoSortedStat >::value; eoFitnessStat(std::string _description = "AllFitnesses") : eoSortedStat >(std::vector(0), _description) {} @@ -67,7 +67,7 @@ class eoMOFitnessStat : public eoSortedStat > { public: - using eoMOFitnessStat< EOT, PartFitT >::value; + using eoSortedStat >::value; /** Ctor: say what component you want */ diff --git a/eo/src/utils/eoPopStat.h b/eo/src/utils/eoPopStat.h index 8e89bf118..65bdf44e6 100644 --- a/eo/src/utils/eoPopStat.h +++ b/eo/src/utils/eoPopStat.h @@ -52,7 +52,7 @@ class eoPopStat : public eoStat { public: - using eoPopStat< EOT>::value; + using eoStat::value; /** default Ctor, void std::string by default, as it appears on the description line once at beginning of evolution. and @@ -97,7 +97,7 @@ class eoSortedPopStat : public eoSortedStat { public: - using eoSortedPopStat< EOT>::value; + using eoSortedStat::value; /** default Ctor, void std::string by default, as it appears on the description line once at beginning of evolution. and is diff --git a/eo/src/utils/eoScalarFitnessStat.h b/eo/src/utils/eoScalarFitnessStat.h index 06051cb1e..b7c820d33 100644 --- a/eo/src/utils/eoScalarFitnessStat.h +++ b/eo/src/utils/eoScalarFitnessStat.h @@ -38,13 +38,13 @@ class eoScalarFitnessStat : public eoSortedStat > { public: - using eoScalarFitnessStat< EOT, FitT >::value; + using eoSortedStat >::value; eoScalarFitnessStat(std::string _description = "FitnessES", - eoRealVectorBounds & _bounds = eoDummyVectorNoBounds) : - eoSortedStat >(std::vector(0), _description) , - range(*_bounds[0]) - {} + eoRealVectorBounds & _bounds = eoDummyVectorNoBounds) + : eoSortedStat >(std::vector(0), _description), + range(*_bounds[0]) + {} virtual void operator()(const std::vector& _popPters) { diff --git a/eo/src/utils/eoStat.h b/eo/src/utils/eoStat.h index b511f327e..87706386d 100644 --- a/eo/src/utils/eoStat.h +++ b/eo/src/utils/eoStat.h @@ -110,7 +110,7 @@ template class eoAverageStat : public eoStat::value; + using eoStat::value; typedef typename EOT::Fitness Fitness; @@ -169,7 +169,7 @@ class eoSecondMomentStats : public eoStat > { public : - using eoSecondMomentStats< EOT >::value; + using eoStat >::value; typedef typename EOT::Fitness fitness_type; @@ -212,7 +212,7 @@ class eoNthElementFitnessStat : public eoSortedStat #endif { public : - using eoNthElementFitnessStat< EOT >::value; + using eoSortedStat::value; typedef typename EOT::Fitness Fitness; @@ -318,7 +318,7 @@ class eoBestFitnessStat : public eoStat { public: - using eoBestFitnessStat< EOT >::value; + using eoStat::value; typedef typename EOT::Fitness Fitness; diff --git a/eo/src/utils/eoUpdater.h b/eo/src/utils/eoUpdater.h index c031bb242..f8597c14c 100644 --- a/eo/src/utils/eoUpdater.h +++ b/eo/src/utils/eoUpdater.h @@ -72,7 +72,7 @@ class eoIncrementorParam : public eoUpdater, public eoValueParam { public: - using eoIncrementorParam< T >::value; + using eoValueParam::value; /** Default Ctor : a name and optionally an increment*/ eoIncrementorParam( std::string _name, T _stepsize = 1) :