Fix using directives for gcc-4.1
This commit is contained in:
parent
929974805d
commit
10d582b31d
19 changed files with 86 additions and 85 deletions
|
|
@ -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 <gp/eoParseTree.h>
|
||||
#include <eo>
|
||||
|
||||
#include <cmath>
|
||||
#include <cmath>
|
||||
#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<Node> &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<Node> &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<FitnessType, Node> >
|
||||
class RegFitness: public eoEvalFunc< eoParseTree<FitnessType, Node> >
|
||||
{
|
||||
public:
|
||||
|
||||
typedef eoParseTree<FitnessType, Node> EoType;
|
||||
|
||||
|
||||
typedef eoParseTree<FitnessType, Node> 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<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);
|
||||
best[NORMAL] = 1000;
|
||||
tree= "not found";
|
||||
};
|
||||
|
||||
|
||||
~RegFitness()
|
||||
{
|
||||
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
|
||||
Parameters ¶meter; // the parameters
|
||||
FitnessType best; // the best found fitness
|
||||
string tree;
|
||||
string tree;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class eoLinearFitScaling : public eoPerf2Worth<EOT> // false: do not cache fitne
|
|||
{
|
||||
public:
|
||||
|
||||
using eoLinearFitScaling< EOT >::value;
|
||||
using eoPerf2Worth<EOT>::value;
|
||||
|
||||
/* Ctor:
|
||||
@param _p selective pressure (in (1,2])
|
||||
|
|
|
|||
|
|
@ -42,11 +42,12 @@ template <class EOT>
|
|||
class eoNDSorting : public eoPerf2WorthCached<EOT, double>
|
||||
{
|
||||
public :
|
||||
|
||||
using eoNDSorting< EOT >::value;
|
||||
eoNDSorting(bool nasty_flag_ = false) : nasty_declone_flag_that_only_is_implemented_for_two_objectives(nasty_flag_)
|
||||
{}
|
||||
|
||||
|
||||
using eoPerf2WorthCached<EOT, double>::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 EOT>
|
|||
class eoNDSorting_II : public eoNDSorting<EOT>
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
eoNDSorting_II(bool nasty_flag_ = false) : eoNDSorting<EOT>(nasty_flag_) {}
|
||||
|
||||
|
||||
typedef std::pair<double, unsigned> double_index_pair;
|
||||
|
||||
class compare_nodes
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ class eoSequentialOp : public eoOpContainer<EOT>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoOpContainer< EOT >::ops;
|
||||
using eoOpContainer< EOT >::rates;
|
||||
using eoOpContainer<EOT>::ops;
|
||||
using eoOpContainer<EOT>::rates;
|
||||
|
||||
typedef unsigned position_type;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class eoParetoRanking : public eoPerf2WorthCached<EOT, double>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoParetoRanking< EOT>::value;
|
||||
using eoPerf2WorthCached<EOT, double>::value;
|
||||
|
||||
eoParetoRanking(eoDominanceMap<EOT>& _dominanceMap)
|
||||
: eoPerf2WorthCached<EOT, double>(), dominanceMap(_dominanceMap)
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class eoPerf2Worth : public eoUF<const eoPop<EOT>&, void>, public eoValueParam<s
|
|||
{
|
||||
public:
|
||||
|
||||
using eoPerf2Worth<EOT, WorthT>::value;
|
||||
using eoValueParam<std::vector<WorthT> >::value;
|
||||
|
||||
/** @brief default constructor */
|
||||
eoPerf2Worth(std::string _description = "Worths")
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class eoRanking : public eoPerf2Worth<EOT> // false: do not cache fitness
|
|||
{
|
||||
public:
|
||||
|
||||
using eoRanking< EOT >::value;
|
||||
using eoPerf2Worth<EOT>::value;
|
||||
|
||||
/* Ctor:
|
||||
@param _p selective pressure (in (1,2]
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class eoSharing : public eoPerf2Worth<EOT>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoSharing< EOT >::value;
|
||||
using eoPerf2Worth<EOT>::value;
|
||||
|
||||
|
||||
/* Ctor requires a distance - cannot have a default distance! */
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@ class eoEsChromInit : public eoRealInitBounded<EOT>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoEsChromInit<EOT>::size;
|
||||
using eoEsChromInit<EOT>::theBounds;
|
||||
using eoRealInitBounded<EOT>::size;
|
||||
using eoRealInitBounded<EOT>::theBounds;
|
||||
|
||||
typedef typename EOT::Fitness FitT;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class eoEsFull : public eoVector<Fit, double>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoEsFull< Fit >::size;
|
||||
using eoVector<Fit, double>::size;
|
||||
|
||||
|
||||
typedef double Type;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class eoEsStdev : public eoVector<Fit, double>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoEsStdev<Fit>::size;
|
||||
using eoVector<Fit, double>::size;
|
||||
|
||||
typedef double Type;
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@ class eoParseTree : public EO<FType>, public parse_tree<Node>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoParseTree<FType, Node >::back;
|
||||
using eoParseTree<FType, Node >::ebegin;
|
||||
using eoParseTree<FType, Node >::eend;
|
||||
using eoParseTree<FType, Node >::size;
|
||||
using parse_tree<Node>::back;
|
||||
using parse_tree<Node>::ebegin;
|
||||
using parse_tree<Node>::eend;
|
||||
using parse_tree<Node>::size;
|
||||
|
||||
|
||||
typedef typename parse_tree<Node>::subtree Subtree;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class eoAssembledFitnessAverageStat : public eoStat<EOT, double>
|
|||
{
|
||||
public :
|
||||
|
||||
using eoAssembledFitnessAverageStat< EOT >::value;
|
||||
using eoStat<EOT, double>::value;
|
||||
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ class eoAssembledFitnessBestStat : public eoStat<EOT, double>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoAssembledFitnessBestStat< EOT >::value;
|
||||
using eoStat<EOT, double>::value;
|
||||
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class eoFDCStat : public eoStat<EOT, double>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoFDCStat < EOT>::value;
|
||||
using eoStat<EOT, double>::value;
|
||||
|
||||
/** Ctor without the optimum */
|
||||
eoFDCStat(eoDistance<EOT> & _dist, std::string _description = "FDC") :
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class eoFitnessStat : public eoSortedStat<EOT, std::vector<FitT> >
|
|||
{
|
||||
public :
|
||||
|
||||
using eoFitnessStat< EOT, FitT >::value;
|
||||
using eoSortedStat<EOT, std::vector<FitT> >::value;
|
||||
|
||||
eoFitnessStat(std::string _description = "AllFitnesses") :
|
||||
eoSortedStat<EOT,std::vector<FitT> >(std::vector<FitT>(0), _description) {}
|
||||
|
|
@ -67,7 +67,7 @@ class eoMOFitnessStat : public eoSortedStat<EOT, std::vector<PartFitT> >
|
|||
{
|
||||
public:
|
||||
|
||||
using eoMOFitnessStat< EOT, PartFitT >::value;
|
||||
using eoSortedStat<EOT, std::vector<PartFitT> >::value;
|
||||
|
||||
/** Ctor: say what component you want
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class eoPopStat : public eoStat<EOT, std::string>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoPopStat< EOT>::value;
|
||||
using eoStat<EOT, std::string>::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<EOT, std::string>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoSortedPopStat< EOT>::value;
|
||||
using eoSortedStat<EOT, std::string>::value;
|
||||
|
||||
/** default Ctor, void std::string by default, as it appears on
|
||||
the description line once at beginning of evolution. and is
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ class eoScalarFitnessStat : public eoSortedStat<EOT, std::vector<double> >
|
|||
{
|
||||
public:
|
||||
|
||||
using eoScalarFitnessStat< EOT, FitT >::value;
|
||||
using eoSortedStat<EOT, std::vector<double> >::value;
|
||||
|
||||
eoScalarFitnessStat(std::string _description = "FitnessES",
|
||||
eoRealVectorBounds & _bounds = eoDummyVectorNoBounds) :
|
||||
eoSortedStat<EOT, std::vector<double> >(std::vector<double>(0), _description) ,
|
||||
range(*_bounds[0])
|
||||
{}
|
||||
eoRealVectorBounds & _bounds = eoDummyVectorNoBounds)
|
||||
: eoSortedStat<EOT, std::vector<double> >(std::vector<double>(0), _description),
|
||||
range(*_bounds[0])
|
||||
{}
|
||||
|
||||
virtual void operator()(const std::vector<const EOT*>& _popPters)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ template <class EOT> class eoAverageStat : public eoStat<EOT, typename EOT::Fitn
|
|||
{
|
||||
public :
|
||||
|
||||
using eoAverageStat< EOT >::value;
|
||||
using eoStat<EOT, typename EOT::Fitness>::value;
|
||||
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ class eoSecondMomentStats : public eoStat<EOT, std::pair<double, double> >
|
|||
{
|
||||
public :
|
||||
|
||||
using eoSecondMomentStats< EOT >::value;
|
||||
using eoStat<EOT, std::pair<double, double> >::value;
|
||||
|
||||
typedef typename EOT::Fitness fitness_type;
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ class eoNthElementFitnessStat : public eoSortedStat<EOT, typename EOT::Fitness >
|
|||
#endif
|
||||
{
|
||||
public :
|
||||
using eoNthElementFitnessStat< EOT >::value;
|
||||
using eoSortedStat<EOT, typename EOT::Fitness >::value;
|
||||
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
|
|
@ -318,7 +318,7 @@ class eoBestFitnessStat : public eoStat<EOT, typename EOT::Fitness>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoBestFitnessStat< EOT >::value;
|
||||
using eoStat<EOT, typename EOT::Fitness>::value;
|
||||
|
||||
typedef typename EOT::Fitness Fitness;
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class eoIncrementorParam : public eoUpdater, public eoValueParam<T>
|
|||
{
|
||||
public:
|
||||
|
||||
using eoIncrementorParam< T >::value;
|
||||
using eoValueParam<T>::value;
|
||||
|
||||
/** Default Ctor : a name and optionally an increment*/
|
||||
eoIncrementorParam( std::string _name, T _stepsize = 1) :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue