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:
liefooga 2007-06-19 07:36:46 +00:00
commit 42e766213e

View file

@ -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)
@ -76,9 +72,11 @@ 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_ */