default param are declared as 'private' and not created in the ctor
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@313 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
6fed261e47
commit
42e766213e
1 changed files with 8 additions and 10 deletions
|
|
@ -20,8 +20,7 @@
|
||||||
/**
|
/**
|
||||||
* Selection strategy that selects ONE individual by deterministic tournament.
|
* Selection strategy that selects ONE individual by deterministic tournament.
|
||||||
*/
|
*/
|
||||||
template < class MOEOT > class moeoDetTournamentSelect:public moeoSelectOne <
|
template < class MOEOT > class moeoDetTournamentSelect:public moeoSelectOne < MOEOT >
|
||||||
MOEOT >
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -30,8 +29,7 @@ public:
|
||||||
* @param _comparator the comparator (used to compare 2 individuals)
|
* @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)
|
||||||
*/
|
*/
|
||||||
moeoDetTournamentSelect (moeoComparator < MOEOT > &_comparator, unsigned _tSize = 2):
|
moeoDetTournamentSelect (moeoComparator < MOEOT > & _comparator, unsigned _tSize = 2) : comparator (_comparator), tSize (_tSize)
|
||||||
comparator (_comparator), tSize (_tSize)
|
|
||||||
{
|
{
|
||||||
// consistency check
|
// consistency check
|
||||||
if (tSize < 2)
|
if (tSize < 2)
|
||||||
|
|
@ -47,9 +45,7 @@ public:
|
||||||
* Ctor without comparator. A moeoFitnessThenDiversityComparator is used as default.
|
* Ctor without comparator. A moeoFitnessThenDiversityComparator is used as default.
|
||||||
* @param _tSize the number of individuals in the tournament (default: 2)
|
* @param _tSize the number of individuals in the tournament (default: 2)
|
||||||
*/
|
*/
|
||||||
moeoDetTournamentSelect (unsigned _tSize = 2):
|
moeoDetTournamentSelect (unsigned _tSize = 2) : comparator (defaultComparator), tSize (_tSize)
|
||||||
comparator (*(new moeoFitnessThenDiversityComparator < MOEOT > ())),
|
|
||||||
tSize (_tSize)
|
|
||||||
{
|
{
|
||||||
// consistency check
|
// consistency check
|
||||||
if (tSize < 2)
|
if (tSize < 2)
|
||||||
|
|
@ -65,7 +61,7 @@ public:
|
||||||
* Apply the tournament to the given population
|
* Apply the tournament to the given population
|
||||||
* @param _pop the population
|
* @param _pop the population
|
||||||
*/
|
*/
|
||||||
const MOEOT & operator () (const eoPop < MOEOT > &_pop)
|
const MOEOT & operator() (const eoPop < MOEOT > &_pop)
|
||||||
{
|
{
|
||||||
// use the selector
|
// use the selector
|
||||||
return mo_deterministic_tournament (_pop, tSize, comparator);
|
return mo_deterministic_tournament (_pop, tSize, comparator);
|
||||||
|
|
@ -75,10 +71,12 @@ public:
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** the comparator (used to compare 2 individuals) */
|
/** the comparator (used to compare 2 individuals) */
|
||||||
moeoComparator < MOEOT > &comparator;
|
moeoComparator < MOEOT > & comparator;
|
||||||
|
/** a fitness then diversity comparator can be used as default */
|
||||||
|
moeoFitnessThenDiversityComparator < MOEOT > defaultComparator;
|
||||||
/** the number of individuals in the tournament */
|
/** the number of individuals in the tournament */
|
||||||
unsigned tSize;
|
unsigned tSize;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*MOEODETTOURNAMENTSELECT_H_ */
|
#endif /*MOEODETTOURNAMENTSELECT_H_ */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue