Fix using directives for gcc-4.1

This commit is contained in:
kuepper 2006-03-27 18:55:20 +00:00
commit 10d582b31d
19 changed files with 86 additions and 85 deletions

View file

@ -3,16 +3,16 @@
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This library is distributed in the hope that it will be useful, This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details. Lesser General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this library; if not, write to the Free Software along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es Contact: todos@geneura.ugr.es, http://geneura.ugr.es
jeggermo@liacs.nl jeggermo@liacs.nl
*/ */
@ -23,7 +23,7 @@
#include <gp/eoParseTree.h> #include <gp/eoParseTree.h>
#include <eo> #include <eo>
#include <cmath> #include <cmath>
#include "parameters.h" #include "parameters.h"
#include "node.h" #include "node.h"
@ -82,14 +82,14 @@ double _divides(double arg1, double arg2)
{ {
if (arg2 ==0) if (arg2 ==0)
return 0; return 0;
else else
return arg1 / arg2; return arg1 / arg2;
} }
double _negate(double arg1) double _negate(double arg1)
{ {
return -arg1; return -arg1;
} }
@ -97,36 +97,36 @@ double _negate(double arg1)
void init(vector<Node> &initSequence) void init(vector<Node> &initSequence)
{ {
// we have only one variable (X) // we have only one variable (X)
Operation varX( (unsigned int) 0, string("X") ); Operation varX( (unsigned int) 0, string("X") );
// the main binary operators // the main binary operators
Operation OpPLUS ( _plus, string("+")); Operation OpPLUS ( _plus, string("+"));
Operation OpMINUS( _minus,string("-")); Operation OpMINUS( _minus,string("-"));
Operation OpMULTIPLIES(_multiplies,string("*")); Operation OpMULTIPLIES(_multiplies,string("*"));
// We can use a protected divide function. // We can use a protected divide function.
Operation OpDIVIDE( _divides, string("/") ); Operation OpDIVIDE( _divides, string("/") );
// Now the functions as binary functions // Now the functions as binary functions
Operation PLUS( string("plus"), _plus); Operation PLUS( string("plus"), _plus);
Operation MINUS( string("minus"), _minus); Operation MINUS( string("minus"), _minus);
Operation MULTIPLIES( string("multiply"), _multiplies); Operation MULTIPLIES( string("multiply"), _multiplies);
Operation DIVIDE( string("divide"), _divides); Operation DIVIDE( string("divide"), _divides);
// and some unary functions // and some unary functions
Operation NEGATE( _negate,string("-")); Operation NEGATE( _negate,string("-"));
Operation SIN ( sin, string("sin")); Operation SIN ( sin, string("sin"));
Operation COS ( cos, string("cos")); Operation COS ( cos, string("cos"));
// Now we are ready to add the possible nodes to our initSequence (which is used by the eoDepthInitializer) // Now we are ready to add the possible nodes to our initSequence (which is used by the eoDepthInitializer)
// so lets start with our variable // so lets start with our variable
initSequence.push_back(varX); initSequence.push_back(varX);
// followed by the constants 2, 4, 6 // followed by the constants 2, 4, 6
for(unsigned int i=2; i <= 6; i+=2) for(unsigned int i=2; i <= 6; i+=2)
{ {
@ -136,81 +136,81 @@ void init(vector<Node> &initSequence)
initSequence.push_back( op ); initSequence.push_back( op );
// and we add the variable again (so we have get lots of variables); // and we add the variable again (so we have get lots of variables);
initSequence.push_back( varX ); initSequence.push_back( varX );
} }
// next we add the unary functions // next we add the unary functions
initSequence.push_back( NEGATE ); initSequence.push_back( NEGATE );
initSequence.push_back( SIN ); initSequence.push_back( SIN );
initSequence.push_back( COS ); initSequence.push_back( COS );
// and the binary functions // and the binary functions
initSequence.push_back( PLUS); initSequence.push_back( PLUS);
initSequence.push_back( MINUS ); initSequence.push_back( MINUS );
initSequence.push_back( MULTIPLIES ); initSequence.push_back( MULTIPLIES );
initSequence.push_back( DIVIDE ); initSequence.push_back( DIVIDE );
// and the binary operators // and the binary operators
initSequence.push_back( OpPLUS); initSequence.push_back( OpPLUS);
initSequence.push_back( OpMINUS ); initSequence.push_back( OpMINUS );
initSequence.push_back( OpMULTIPLIES ); initSequence.push_back( OpMULTIPLIES );
initSequence.push_back( OpDIVIDE ); initSequence.push_back( OpDIVIDE );
}; };
class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> > class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
{ {
public: public:
typedef eoParseTree<FitnessType, Node> EoType; typedef eoParseTree<FitnessType, Node> EoType;
void operator()(EoType &_eo) void operator()(EoType &_eo)
{ {
vector< double > input(1); // the input variable(s) vector< double > input(1); // the input variable(s)
double output; double output(0.);
double target; double target;
FitnessType fitness; FitnessType fitness;
float x=0; float x=0;
double fit=0; double fit=0;
for(x=-1; x <= 1; x+=0.1) for(x=-1; x <= 1; x+=0.1)
{ {
input[0] = x; input[0] = x;
target = sextic_polynomial(x); target = sextic_polynomial(x);
_eo.apply(output,input); _eo.apply(output,input);
fit += pow(target - output, 2); fit += pow(target - output, 2);
} }
fitness[NORMAL] = fit; fitness[NORMAL] = fit;
fitness[SMALLESTSIZE] = _eo.size() / (1.0*parameter.MaxSize); fitness[SMALLESTSIZE] = _eo.size() / (1.0*parameter.MaxSize);
_eo.fitness(fitness); _eo.fitness(fitness);
if (fitness[NORMAL] < best[NORMAL]) if (fitness[NORMAL] < best[NORMAL])
{ {
best[NORMAL] = fitness[NORMAL]; best[NORMAL] = fitness[NORMAL];
tree=""; tree="";
_eo.apply(tree); _eo.apply(tree);
} }
} }
RegFitness(eoValueParam<unsigned> &_generationCounter, vector< Node > &initSequence, Parameters &_parameter) : eoEvalFunc<EoType>(), generationCounter(_generationCounter), parameter(_parameter) RegFitness(eoValueParam<unsigned> &_generationCounter, vector< Node > &initSequence, Parameters &_parameter) : eoEvalFunc<EoType>(), generationCounter(_generationCounter), parameter(_parameter)
{ {
init(initSequence); init(initSequence);
best[NORMAL] = 1000; best[NORMAL] = 1000;
tree= "not found"; tree= "not found";
}; };
~RegFitness() ~RegFitness()
{ {
cerr << "Best Fitness= " << best[NORMAL] << endl; cerr << "Best Fitness= " << best[NORMAL] << endl;
@ -221,7 +221,7 @@ class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
eoValueParam<unsigned> &generationCounter; // so we know the current generation eoValueParam<unsigned> &generationCounter; // so we know the current generation
Parameters &parameter; // the parameters Parameters &parameter; // the parameters
FitnessType best; // the best found fitness FitnessType best; // the best found fitness
string tree; string tree;
}; };
#endif #endif

View file

@ -44,7 +44,7 @@ class eoLinearFitScaling : public eoPerf2Worth<EOT> // false: do not cache fitne
{ {
public: public:
using eoLinearFitScaling< EOT >::value; using eoPerf2Worth<EOT>::value;
/* Ctor: /* Ctor:
@param _p selective pressure (in (1,2]) @param _p selective pressure (in (1,2])

View file

@ -42,11 +42,12 @@ template <class EOT>
class eoNDSorting : public eoPerf2WorthCached<EOT, double> class eoNDSorting : public eoPerf2WorthCached<EOT, double>
{ {
public : public :
using eoNDSorting< EOT >::value; using eoPerf2WorthCached<EOT, double>::value;
eoNDSorting(bool nasty_flag_ = false) : nasty_declone_flag_that_only_is_implemented_for_two_objectives(nasty_flag_) eoNDSorting(bool nasty_flag_ = false)
{} : nasty_declone_flag_that_only_is_implemented_for_two_objectives(nasty_flag_)
{}
eoNDSorting() eoNDSorting()
: nasty_declone_flag_that_only_is_implemented_for_two_objectives(false) : nasty_declone_flag_that_only_is_implemented_for_two_objectives(false)
@ -433,9 +434,9 @@ template <class EOT>
class eoNDSorting_II : public eoNDSorting<EOT> class eoNDSorting_II : public eoNDSorting<EOT>
{ {
public: public:
eoNDSorting_II(bool nasty_flag_ = false) : eoNDSorting<EOT>(nasty_flag_) {} eoNDSorting_II(bool nasty_flag_ = false) : eoNDSorting<EOT>(nasty_flag_) {}
typedef std::pair<double, unsigned> double_index_pair; typedef std::pair<double, unsigned> double_index_pair;
class compare_nodes class compare_nodes

View file

@ -89,8 +89,8 @@ class eoSequentialOp : public eoOpContainer<EOT>
{ {
public: public:
using eoOpContainer< EOT >::ops; using eoOpContainer<EOT>::ops;
using eoOpContainer< EOT >::rates; using eoOpContainer<EOT>::rates;
typedef unsigned position_type; typedef unsigned position_type;

View file

@ -41,7 +41,7 @@ class eoParetoRanking : public eoPerf2WorthCached<EOT, double>
{ {
public: public:
using eoParetoRanking< EOT>::value; using eoPerf2WorthCached<EOT, double>::value;
eoParetoRanking(eoDominanceMap<EOT>& _dominanceMap) eoParetoRanking(eoDominanceMap<EOT>& _dominanceMap)
: eoPerf2WorthCached<EOT, double>(), dominanceMap(_dominanceMap) : eoPerf2WorthCached<EOT, double>(), dominanceMap(_dominanceMap)

View file

@ -44,7 +44,7 @@ class eoPerf2Worth : public eoUF<const eoPop<EOT>&, void>, public eoValueParam<s
{ {
public: public:
using eoPerf2Worth<EOT, WorthT>::value; using eoValueParam<std::vector<WorthT> >::value;
/** @brief default constructor */ /** @brief default constructor */
eoPerf2Worth(std::string _description = "Worths") eoPerf2Worth(std::string _description = "Worths")

View file

@ -39,7 +39,7 @@ class eoRanking : public eoPerf2Worth<EOT> // false: do not cache fitness
{ {
public: public:
using eoRanking< EOT >::value; using eoPerf2Worth<EOT>::value;
/* Ctor: /* Ctor:
@param _p selective pressure (in (1,2] @param _p selective pressure (in (1,2]

View file

@ -80,7 +80,7 @@ class eoSharing : public eoPerf2Worth<EOT>
{ {
public: public:
using eoSharing< EOT >::value; using eoPerf2Worth<EOT>::value;
/* Ctor requires a distance - cannot have a default distance! */ /* Ctor requires a distance - cannot have a default distance! */

View file

@ -56,8 +56,8 @@ class eoEsChromInit : public eoRealInitBounded<EOT>
{ {
public: public:
using eoEsChromInit<EOT>::size; using eoRealInitBounded<EOT>::size;
using eoEsChromInit<EOT>::theBounds; using eoRealInitBounded<EOT>::theBounds;
typedef typename EOT::Fitness FitT; typedef typename EOT::Fitness FitT;

View file

@ -41,7 +41,7 @@ class eoEsFull : public eoVector<Fit, double>
{ {
public: public:
using eoEsFull< Fit >::size; using eoVector<Fit, double>::size;
typedef double Type; typedef double Type;

View file

@ -38,7 +38,7 @@ class eoEsStdev : public eoVector<Fit, double>
{ {
public: public:
using eoEsStdev<Fit>::size; using eoVector<Fit, double>::size;
typedef double Type; typedef double Type;

View file

@ -55,10 +55,10 @@ class eoParseTree : public EO<FType>, public parse_tree<Node>
{ {
public: public:
using eoParseTree<FType, Node >::back; using parse_tree<Node>::back;
using eoParseTree<FType, Node >::ebegin; using parse_tree<Node>::ebegin;
using eoParseTree<FType, Node >::eend; using parse_tree<Node>::eend;
using eoParseTree<FType, Node >::size; using parse_tree<Node>::size;
typedef typename parse_tree<Node>::subtree Subtree; typedef typename parse_tree<Node>::subtree Subtree;

View file

@ -47,7 +47,7 @@ class eoAssembledFitnessAverageStat : public eoStat<EOT, double>
{ {
public : public :
using eoAssembledFitnessAverageStat< EOT >::value; using eoStat<EOT, double>::value;
typedef typename EOT::Fitness Fitness; typedef typename EOT::Fitness Fitness;
@ -88,7 +88,7 @@ class eoAssembledFitnessBestStat : public eoStat<EOT, double>
{ {
public: public:
using eoAssembledFitnessBestStat< EOT >::value; using eoStat<EOT, double>::value;
typedef typename EOT::Fitness Fitness; typedef typename EOT::Fitness Fitness;

View file

@ -40,7 +40,7 @@ class eoFDCStat : public eoStat<EOT, double>
{ {
public: public:
using eoFDCStat < EOT>::value; using eoStat<EOT, double>::value;
/** Ctor without the optimum */ /** Ctor without the optimum */
eoFDCStat(eoDistance<EOT> & _dist, std::string _description = "FDC") : eoFDCStat(eoDistance<EOT> & _dist, std::string _description = "FDC") :

View file

@ -37,7 +37,7 @@ class eoFitnessStat : public eoSortedStat<EOT, std::vector<FitT> >
{ {
public : public :
using eoFitnessStat< EOT, FitT >::value; using eoSortedStat<EOT, std::vector<FitT> >::value;
eoFitnessStat(std::string _description = "AllFitnesses") : eoFitnessStat(std::string _description = "AllFitnesses") :
eoSortedStat<EOT,std::vector<FitT> >(std::vector<FitT>(0), _description) {} eoSortedStat<EOT,std::vector<FitT> >(std::vector<FitT>(0), _description) {}
@ -67,7 +67,7 @@ class eoMOFitnessStat : public eoSortedStat<EOT, std::vector<PartFitT> >
{ {
public: public:
using eoMOFitnessStat< EOT, PartFitT >::value; using eoSortedStat<EOT, std::vector<PartFitT> >::value;
/** Ctor: say what component you want /** Ctor: say what component you want
*/ */

View file

@ -52,7 +52,7 @@ class eoPopStat : public eoStat<EOT, std::string>
{ {
public: public:
using eoPopStat< EOT>::value; using eoStat<EOT, std::string>::value;
/** default Ctor, void std::string by default, as it appears /** default Ctor, void std::string by default, as it appears
on the description line once at beginning of evolution. and on the description line once at beginning of evolution. and
@ -97,7 +97,7 @@ class eoSortedPopStat : public eoSortedStat<EOT, std::string>
{ {
public: public:
using eoSortedPopStat< EOT>::value; using eoSortedStat<EOT, std::string>::value;
/** default Ctor, void std::string by default, as it appears on /** default Ctor, void std::string by default, as it appears on
the description line once at beginning of evolution. and is the description line once at beginning of evolution. and is

View file

@ -38,13 +38,13 @@ class eoScalarFitnessStat : public eoSortedStat<EOT, std::vector<double> >
{ {
public: public:
using eoScalarFitnessStat< EOT, FitT >::value; using eoSortedStat<EOT, std::vector<double> >::value;
eoScalarFitnessStat(std::string _description = "FitnessES", eoScalarFitnessStat(std::string _description = "FitnessES",
eoRealVectorBounds & _bounds = eoDummyVectorNoBounds) : eoRealVectorBounds & _bounds = eoDummyVectorNoBounds)
eoSortedStat<EOT, std::vector<double> >(std::vector<double>(0), _description) , : eoSortedStat<EOT, std::vector<double> >(std::vector<double>(0), _description),
range(*_bounds[0]) range(*_bounds[0])
{} {}
virtual void operator()(const std::vector<const EOT*>& _popPters) virtual void operator()(const std::vector<const EOT*>& _popPters)
{ {

View file

@ -110,7 +110,7 @@ template <class EOT> class eoAverageStat : public eoStat<EOT, typename EOT::Fitn
{ {
public : public :
using eoAverageStat< EOT >::value; using eoStat<EOT, typename EOT::Fitness>::value;
typedef typename EOT::Fitness Fitness; typedef typename EOT::Fitness Fitness;
@ -169,7 +169,7 @@ class eoSecondMomentStats : public eoStat<EOT, std::pair<double, double> >
{ {
public : public :
using eoSecondMomentStats< EOT >::value; using eoStat<EOT, std::pair<double, double> >::value;
typedef typename EOT::Fitness fitness_type; typedef typename EOT::Fitness fitness_type;
@ -212,7 +212,7 @@ class eoNthElementFitnessStat : public eoSortedStat<EOT, typename EOT::Fitness >
#endif #endif
{ {
public : public :
using eoNthElementFitnessStat< EOT >::value; using eoSortedStat<EOT, typename EOT::Fitness >::value;
typedef typename EOT::Fitness Fitness; typedef typename EOT::Fitness Fitness;
@ -318,7 +318,7 @@ class eoBestFitnessStat : public eoStat<EOT, typename EOT::Fitness>
{ {
public: public:
using eoBestFitnessStat< EOT >::value; using eoStat<EOT, typename EOT::Fitness>::value;
typedef typename EOT::Fitness Fitness; typedef typename EOT::Fitness Fitness;

View file

@ -72,7 +72,7 @@ class eoIncrementorParam : public eoUpdater, public eoValueParam<T>
{ {
public: public:
using eoIncrementorParam< T >::value; using eoValueParam<T>::value;
/** Default Ctor : a name and optionally an increment*/ /** Default Ctor : a name and optionally an increment*/
eoIncrementorParam( std::string _name, T _stepsize = 1) : eoIncrementorParam( std::string _name, T _stepsize = 1) :