delete comparator
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@325 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
b3d982250a
commit
303662d978
1 changed files with 11 additions and 31 deletions
|
|
@ -18,63 +18,43 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selection strategy that selects ONE individual by using roulette wheel process.
|
* Selection strategy that selects ONE individual by using roulette wheel process.
|
||||||
|
* @WARNING This selection only uses fitness values (and not diversity values).
|
||||||
*/
|
*/
|
||||||
template < class MOEOT >
|
template < class MOEOT >
|
||||||
class moeoRouletteSelect:public moeoSelectOne <MOEOT>
|
class moeoRouletteSelect:public moeoSelectOne < MOEOT >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Full Ctor.
|
* Ctor.
|
||||||
* @param _comparator the comparator (used to compare 2 individuals)
|
* @param _tSize the number of individuals in the tournament (default: 2)
|
||||||
* @param _tSize the number of individuals in the tournament (default: 2)
|
|
||||||
*/
|
|
||||||
moeoRouletteSelect (moeoComparator < MOEOT > &_comparator, unsigned _tSize = 2):
|
|
||||||
comparator (_comparator), tSize (_tSize)
|
|
||||||
{
|
|
||||||
// consistency check
|
|
||||||
if (tSize < 2)
|
|
||||||
{
|
|
||||||
std::
|
|
||||||
cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n";
|
|
||||||
tSize = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ctor without comparator. A moeoFitnessThenDiversityComparator is used as default.
|
|
||||||
* @param _tSize the number of individuals in the tournament (default: 2)
|
|
||||||
*/
|
|
||||||
moeoRouletteSelect (unsigned _tSize = 2):
|
|
||||||
comparator (*(new moeoFitnessThenDiversityComparator < MOEOT > ())),
|
|
||||||
tSize (_tSize)
|
|
||||||
{
|
|
||||||
// consistency check
|
|
||||||
if (tSize < 2)
|
|
||||||
{
|
|
||||||
std::
|
|
||||||
cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n";
|
|
||||||
tSize = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply the tournament to the given population
|
|
||||||
*/
|
*/
|
||||||
const MOEOT & operator () (const eoPop < MOEOT > &_pop)
|
moeoRouletteSelect (unsigned _tSize = 2) : tSize (_tSize)
|
||||||
|
{
|
||||||
|
// consistency check
|
||||||
|
if (tSize < 2)
|
||||||
|
{
|
||||||
|
std::
|
||||||
|
cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n";
|
||||||
|
tSize = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the tournament to the given population
|
||||||
|
* @param _pop the population
|
||||||
|
*/
|
||||||
|
const MOEOT & operator () (const eoPop < MOEOT > & _pop)
|
||||||
{
|
{
|
||||||
// use the selector
|
// use the selector
|
||||||
return mo_roulette_wheel(_pop,tSize); //comparator ??
|
return mo_roulette_wheel(_pop,tSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** comparator */
|
/** size */
|
||||||
moeoComparator < MOEOT > &comparator;
|
|
||||||
/** size */
|
|
||||||
double & tSize;
|
double & tSize;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue