Use the fitness type instead of the objective vectors in fitness assignments

This commit is contained in:
Johann Dreo 2013-06-25 15:42:56 +02:00
commit e6beab8e5c
2 changed files with 7 additions and 6 deletions

View file

@ -38,6 +38,7 @@ protected:
public: public:
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
typedef typename ObjectiveVector::Type Type; typedef typename ObjectiveVector::Type Type;
typedef typename MOEOT::Fitness Fitness;
using moeoExpBinaryIndicatorBasedFitnessAssignment<MOEOT>::values; using moeoExpBinaryIndicatorBasedFitnessAssignment<MOEOT>::values;
@ -146,10 +147,10 @@ protected:
} }
} }
virtual Type computeFitness(const unsigned int _idx) virtual Fitness computeFitness(const unsigned int _idx)
{ {
// Type result( 0.0, values[_idx][_idx].is_feasible() ); // Fitness result( 0.0, values[_idx][_idx].is_feasible() );
Type result( 0.0, values[_idx][_idx].is_feasible() ); Fitness result( 0.0, values[_idx][_idx].is_feasible() );
for (unsigned int i=0; i<values.size(); i++) { for (unsigned int i=0; i<values.size(); i++) {
if (i != _idx) { if (i != _idx) {
result -= exp(-values[i][_idx]/kappa); result -= exp(-values[i][_idx]/kappa);

View file

@ -57,8 +57,8 @@ class moeoExpBinaryIndicatorBasedFitnessAssignment : public moeoBinaryIndicatorB
/** The type of objective vector */ /** The type of objective vector */
typedef typename MOEOT::ObjectiveVector ObjectiveVector; typedef typename MOEOT::ObjectiveVector ObjectiveVector;
typedef typename ObjectiveVector::Type Type; typedef typename ObjectiveVector::Type Type;
typedef typename MOEOT::Fitness Fitness;
/** /**
* Ctor. * Ctor.
@ -211,9 +211,9 @@ class moeoExpBinaryIndicatorBasedFitnessAssignment : public moeoBinaryIndicatorB
* Returns the fitness value of the _idx th individual of the population * Returns the fitness value of the _idx th individual of the population
* @param _idx the index * @param _idx the index
*/ */
virtual Type computeFitness(const unsigned int _idx) virtual Fitness computeFitness(const unsigned int _idx)
{ {
Type result(0.0); Fitness result(0.0);
for (unsigned int i=0; i<values.size(); i++) for (unsigned int i=0; i<values.size(); i++)
{ {
if (i != _idx) if (i != _idx)