change '>' to '<'
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@312 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
335b1f9fc1
commit
6fed261e47
1 changed files with 25 additions and 11 deletions
|
|
@ -30,17 +30,27 @@ template < class MOEOT >
|
||||||
class moeoObjectiveComparator : public moeoComparator < MOEOT >
|
class moeoObjectiveComparator : public moeoComparator < MOEOT >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if _moeo1 is greater than _moeo2 on the first objective, then on the second, and so on
|
* Returns true if _moeo1 < _moeo2 on the first objective, then on the second, and so on
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
return _moeo1.objectiveVector() > _moeo2.objectiveVector();
|
return cmp(_moeo1.objectiveVector(), _moeo2.objectiveVector());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/** the objective vector type of the solutions */
|
||||||
|
typedef typename MOEOT::ObjectiveVector ObjectiveVector;
|
||||||
|
/** the corresponding comparator for objective vectors */
|
||||||
|
moeoObjectiveObjectiveVectorComparator < ObjectiveVector > cmp;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functor allowing to compare two solutions according to one objective.
|
* Functor allowing to compare two solutions according to one objective.
|
||||||
*/
|
*/
|
||||||
|
|
@ -62,17 +72,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if _moeo1 is greater than _moeo2 on the obj objective
|
* Returns true if _moeo1 < _moeo2 on the obj objective
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
|
||||||
{
|
{
|
||||||
return _moeo1.objectiveVector()[obj] > _moeo2.objectiveVector()[obj];
|
return _moeo1.objectiveVector()[obj] < _moeo2.objectiveVector()[obj];
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** the index of objective */
|
/** the index of objective */
|
||||||
unsigned obj;
|
unsigned obj;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -85,8 +95,9 @@ template < class MOEOT >
|
||||||
class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT >
|
class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if _moeo1 is greater than _moeo2 according to their fitness values, then according to their diversity values
|
* Returns true if _moeo1 < _moeo2 according to their fitness values, then according to their diversity values
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
|
|
@ -94,13 +105,14 @@ public:
|
||||||
{
|
{
|
||||||
if (_moeo1.fitness() == _moeo2.fitness())
|
if (_moeo1.fitness() == _moeo2.fitness())
|
||||||
{
|
{
|
||||||
return _moeo1.diversity() > _moeo2.diversity();
|
return _moeo1.diversity() < _moeo2.diversity();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return _moeo1.fitness() > _moeo2.fitness();
|
return _moeo1.fitness() < _moeo2.fitness();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -111,8 +123,9 @@ template < class MOEOT >
|
||||||
class moeoDiversityThenFitnessComparator : public moeoComparator < MOEOT >
|
class moeoDiversityThenFitnessComparator : public moeoComparator < MOEOT >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if _moeo1 is greater than _moeo2 according to their diversity values, then according to their fitness values
|
* Returns true if _moeo1 < _moeo2 according to their diversity values, then according to their fitness values
|
||||||
* @param _moeo1 the first solution
|
* @param _moeo1 the first solution
|
||||||
* @param _moeo2 the second solution
|
* @param _moeo2 the second solution
|
||||||
*/
|
*/
|
||||||
|
|
@ -120,13 +133,14 @@ public:
|
||||||
{
|
{
|
||||||
if (_moeo1.diversity() == _moeo2.diversity())
|
if (_moeo1.diversity() == _moeo2.diversity())
|
||||||
{
|
{
|
||||||
return _moeo1.fitness() > _moeo2.fitness();
|
return _moeo1.fitness() < _moeo2.fitness();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return _moeo1.diversity() > _moeo2.diversity();
|
return _moeo1.diversity() < _moeo2.diversity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue