REMOVE the generic fitness templates in eoSecondMomentStats in favor of scalar ones ; comment out old unused code

This commit is contained in:
Johann Dreo 2012-11-23 16:52:35 +01:00
commit 188d1b4c56

View file

@ -32,6 +32,7 @@ Contact: http://eodev.sourceforge.net
#ifndef _eoStat_h
#define _eoStat_h
#include <iostream>
#include <numeric> // accumulate
#include <eoFunctor.h>
@ -176,13 +177,24 @@ private :
};
/**
Average fitness + Std. dev. of a population, fitness needs to be scalar.
Average fitness + Std. dev. of a population, fitness HAVE TO BE to be scalar.
*/
template <class EOT>
class eoSecondMomentStats : public eoStat<EOT, std::pair<typename EOT::Fitness, typename EOT::Fitness> >
// FIXME find a way to use generic Fitness types instead of scala fitness here :
// class eoSecondMomentStats : public eoStat<EOT, std::pair<typename EOT::Fitness, typename EOT::Fitness> >
// Here, I failed to find a way to overload eoValueParam::getValue and setValue,
// because there is no way to use the partial specializations located in eoParam.h
// Indeed, eoValueParam is templatized on a ValueType, but the getValue signature does not
// contain this type.
// Thus, in order to use partial specializations the user would have to specify getValue<ValueType>(),
// which is not the case in most of the existing code.
// Overloading getValue in this class does not seems to work, the call falls to eoValueParam::getValue
// and fails on the output stream.
class eoSecondMomentStats : public eoStat<EOT, std::pair<double,double> >
{
public :
typedef typename EOT::Fitness FitT;
// typedef typename EOT::Fitness FitT;
typedef double FitT;
using eoStat<EOT, std::pair<FitT, FitT> >::value;
typedef std::pair<FitT, FitT> SquarePair;
@ -210,8 +222,10 @@ public :
}
virtual std::string className(void) const { return "eoSecondMomentStats"; }
};
/**
The n_th element fitness in the population (see eoBestFitnessStat)
*/
@ -242,6 +256,7 @@ public :
virtual std::string className(void) const { return "eoNthElementFitnessStat"; }
private :
/* Very old code...
struct CmpFitness
{
CmpFitness(unsigned _whichElement, bool _maxim) : whichElement(_whichElement), maxim(_maxim) {}
@ -257,6 +272,7 @@ private :
unsigned whichElement;
bool maxim;
};
*/
// for everything else
template <class T>
@ -327,6 +343,7 @@ public:
private :
/* Very old code...
struct CmpFitness
{
CmpFitness(unsigned _which, bool _maxim) : which(_which), maxim(_maxim) {}
@ -342,6 +359,7 @@ private :
unsigned which;
bool maxim;
};
*/
// default
template<class T>
@ -354,6 +372,7 @@ private :
/** @example t-eoSSGA.cpp
*/
/** Keep the best individual found so far
*/
template <class EOT>