Modifications 22/02/2007

git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@183 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
legrand 2007-02-22 15:38:01 +00:00
commit 8312d91a84
19 changed files with 930 additions and 805 deletions

View file

@ -14,20 +14,24 @@
#define MOEOCOMPARATOR_H_
#include <eoFunctor.h>
#include <eoPop.h>
/**
* Functor allowing to compare two solutions.
* Functor allowing to compare two solutions
*/
template < class MOEOT >
class moeoComparator : public eoBF < const MOEOT &, const MOEOT &, const bool >
{};
template < class MOEOT > class moeoComparator:public eoBF < const MOEOT &, const MOEOT &,
const bool >
{
public:
// virtual const bool operator () (const MOEOT & _moeo1, const MOEOT & _moeo){}
};
/**
* Functor allowing to compare two solutions according to their first objective value, then their second, and so on.
* Functor allowing to compare two solutions according to their first objective value, then their second, and so on
*/
template < class MOEOT >
class moeoObjectiveComparator : public moeoComparator < MOEOT >
template < class MOEOT > class moeoObjectiveComparator:public moeoComparator <
MOEOT >
{
public:
/**
@ -35,56 +39,56 @@ public:
* @param _moeo1 the first solution
* @param _moeo2 the second solution
*/
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
{
return _moeo1.objectiveVector() < _moeo2.objectiveVector();
}
const bool operator () (const MOEOT & _moeo1, const MOEOT & _moeo2)
{
return _moeo1.objectiveVector () < _moeo2.objectiveVector ();
}
};
/**
* Functor allowing to compare two solutions according to their fitness values.
* Functor allowing to compare two solutions according to their fitness values
*/
template < class MOEOT >
class moeoFitnessComparator : public moeoComparator < MOEOT >
{
public:
/**
* Returns true if the fitness value of _moeo1 is smaller than the fitness value of _moeo2
* @param _moeo1 the first solution
* @param _moeo2 the second solution
*/
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
{
return _moeo1.fitness() < _moeo2.fitness();
}
};
//template < class MOEOT >
//class moeoFitnessComparator : public moeoComparator < MOEOT >
//{
//public:
// /**
// * Returns true if the fitness value of _moeo1 is smaller than the fitness value of _moeo2
// * @param _moeo1 the first solution
// * @param _moeo2 the second solution
// */
// const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
// {
// return _moeo1.fitness() < _moeo2.fitness();
// }
//};
//
//
///**
// * Functor allowing to compare two solutions according to their diversity values
// */
//template < class MOEOT >
//class moeoDiversityComparator : public moeoComparator < MOEOT >
//{
//public:
// /**
// * Returns true if the diversity value of _moeo1 is smaller than the diversity value of _moeo2
// * @param _moeo1 the first solution
// * @param _moeo2 the second solution
// */
// const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
// {
// return _moeo1.diversity() < _moeo2.diversity();
// }
//};
/**
* Functor allowing to compare two solutions according to their diversity values.
* Functor allowing to compare two solutions according to their fitness values, then according to their diversity values
*/
template < class MOEOT >
class moeoDiversityComparator : public moeoComparator < MOEOT >
{
public:
/**
* Returns true if the diversity value of _moeo1 is smaller than the diversity value of _moeo2
* @param _moeo1 the first solution
* @param _moeo2 the second solution
*/
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
{
return _moeo1.diversity() < _moeo2.diversity();
}
};
/**
* Functor allowing to compare two solutions according to their fitness values, then according to their diversity values.
*/
template < class MOEOT >
class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT >
template < class MOEOT > class moeoFitnessThenDiversityComparator:public moeoComparator <
MOEOT >
{
public:
/**
@ -92,25 +96,25 @@ public:
* @param _moeo1 the first solution
* @param _moeo2 the second solution
*/
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
{
if (_moeo1.fitness() == _moeo2.fitness())
{
return _moeo1.diversity() < _moeo2.diversity();
}
else
{
return _moeo1.fitness() < _moeo2.fitness();
}
}
const bool operator () (const MOEOT & _moeo1, const MOEOT & _moeo2)
{
if (_moeo1.fitness () == _moeo2.fitness ())
{
return _moeo1.diversity () < _moeo2.diversity ();
}
else
{
return _moeo1.fitness () < _moeo2.fitness ();
}
}
};
/**
* Functor allowing to compare two solutions according to their diversity values, then according to their fitness values.
* Functor allowing to compare two solutions according to their diversity values, then according to their fitness values
*/
template < class MOEOT >
class moeoDiversityThenFitnessComparator : public moeoComparator < MOEOT >
template < class MOEOT > class moeoDiversityThenFitnessComparator:public moeoComparator <
MOEOT >
{
public:
/**
@ -118,22 +122,22 @@ public:
* @param _moeo1 the first solution
* @param _moeo2 the second solution
*/
const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
{
if (_moeo1.diversity() == _moeo2.diversity())
{
return _moeo1.fitness() < _moeo2.fitness();
}
else
{
return _moeo1.diversity() < _moeo2.diversity();
}
}
const bool operator () (const MOEOT & _moeo1, const MOEOT & _moeo2)
{
if (_moeo1.diversity () == _moeo2.diversity ())
{
return _moeo1.fitness () < _moeo2.fitness ();
}
else
{
return _moeo1.diversity () < _moeo2.diversity ();
}
}
};
/**
* Functor allowing to compare two solutions according to Pareto dominance relation. => USEFULL ???
* Functor allowing to compare two solutions according to Pareto dominance relation => USEFULL ???
*
template < class MOEOT >
class moeoParetoDominanceComparator : public moeoComparator < MOEOT >
@ -178,4 +182,4 @@ public:
};
*/
#endif /*MOEOCOMPARATOR_H_*/
#endif /*MOEOCOMPARATOR_H_ */