fix(moeoSPEA2Archive): correct members init order

This commit is contained in:
Johann Dreo 2024-09-10 10:45:18 +02:00
commit df8c457f75

View file

@ -81,7 +81,7 @@ public:
* Default ctor. * Default ctor.
* @param _maxSize the size of archive (must be smaller or equal to the population size) * @param _maxSize the size of archive (must be smaller or equal to the population size)
*/ */
moeoSPEA2Archive(unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), indiComparator(defaultComparator), distance(defaultDistance) moeoSPEA2Archive(unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(defaultComparator), defaultDistance(), distance(defaultDistance)
{} {}
@ -90,7 +90,7 @@ public:
* @param _dist the distance used * @param _dist the distance used
* @param _maxSize the size of archive (must be smaller or egal to the population size) * @param _maxSize the size of archive (must be smaller or egal to the population size)
*/ */
moeoSPEA2Archive(moeoDistance <MOEOT, double>& _dist, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), indiComparator(defaultComparator), distance(_dist) moeoSPEA2Archive(moeoDistance <MOEOT, double>& _dist, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(defaultComparator), distance(_dist)
{} {}
@ -99,7 +99,7 @@ public:
* @param _comparator the functor used to compare objective vectors * @param _comparator the functor used to compare objective vectors
* @param _maxSize the size of archive (must be smaller or egal to the population size) * @param _maxSize the size of archive (must be smaller or egal to the population size)
*/ */
moeoSPEA2Archive(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), indiComparator(defaultComparator), distance(defaultDistance) moeoSPEA2Archive(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(defaultComparator), defaultDistance(), distance(defaultDistance)
{} {}
@ -108,7 +108,7 @@ public:
* @param _indiComparator the functor used to compare MOEOT * @param _indiComparator the functor used to compare MOEOT
* @param _maxSize the size of archive (must be smaller or egal to the population size) * @param _maxSize the size of archive (must be smaller or egal to the population size)
*/ */
moeoSPEA2Archive(moeoComparator <MOEOT>& _indiComparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), indiComparator(_indiComparator), distance(defaultDistance) moeoSPEA2Archive(moeoComparator <MOEOT>& _indiComparator, unsigned int _maxSize=100): moeoFixedSizeArchive < MOEOT >(true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(_indiComparator), defaultDistance(), distance(defaultDistance)
{} {}
@ -119,7 +119,7 @@ public:
* @param _comparator the functor used to compare objective vectors * @param _comparator the functor used to compare objective vectors
* @param _maxSize the size of archive (must be smaller or egal to the population size) * @param _maxSize the size of archive (must be smaller or egal to the population size)
*/ */
moeoSPEA2Archive(moeoComparator <MOEOT>& _indiComparator, moeoDistance <MOEOT, double>& _dist, moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100) : moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), indiComparator(_indiComparator), distance(_dist) moeoSPEA2Archive(moeoComparator <MOEOT>& _indiComparator, moeoDistance <MOEOT, double>& _dist, moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, unsigned int _maxSize=100) : moeoFixedSizeArchive < MOEOT >(_comparator, true), maxSize(_maxSize), borne(0), defaultComparator(), indiComparator(_indiComparator), distance(_dist)
{} {}
@ -283,11 +283,12 @@ public:
private: private:
/** archive max size */ /** archive max size */
unsigned int maxSize; unsigned int maxSize;
/** archive size */ /** archive size */
unsigned int borne; unsigned int borne;
/** default moeoComparator*/
moeoFitnessThenDiversityComparator < MOEOT > defaultComparator;
/** /**
* Wrapper which allow to used an moeoComparator in std::sort * Wrapper which allow to used an moeoComparator in std::sort
* @param _comp the comparator to used * @param _comp the comparator to used
@ -314,12 +315,10 @@ private:
moeoComparator < MOEOT > & comp; moeoComparator < MOEOT > & comp;
} }
indiComparator; indiComparator;
/** default moeoComparator*/
moeoFitnessThenDiversityComparator < MOEOT > defaultComparator;
/** distance */
moeoDistance <MOEOT, double>& distance;
/** default distance */ /** default distance */
moeoEuclideanDistance < MOEOT > defaultDistance; moeoEuclideanDistance < MOEOT > defaultDistance;
/** distance */
moeoDistance <MOEOT, double>& distance;
/** /**