Skip to content

Commit

Permalink
fix(moeoSPEA2Archive): correct members init order
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreo committed Sep 10, 2024
1 parent 867b1c2 commit df8c457
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions moeo/src/archive/moeoSPEA2Archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class moeoSPEA2Archive : public moeoFixedSizeArchive < MOEOT >
* Default ctor.
* @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)
{}


Expand All @@ -90,7 +90,7 @@ class moeoSPEA2Archive : public moeoFixedSizeArchive < MOEOT >
* @param _dist the distance used
* @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)
{}


Expand All @@ -99,7 +99,7 @@ class moeoSPEA2Archive : public moeoFixedSizeArchive < MOEOT >
* @param _comparator the functor used to compare objective vectors
* @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)
{}


Expand All @@ -108,7 +108,7 @@ class moeoSPEA2Archive : public moeoFixedSizeArchive < MOEOT >
* @param _indiComparator the functor used to compare MOEOT
* @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)
{}


Expand All @@ -119,7 +119,7 @@ class moeoSPEA2Archive : public moeoFixedSizeArchive < MOEOT >
* @param _comparator the functor used to compare objective vectors
* @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)
{}


Expand Down Expand Up @@ -283,11 +283,12 @@ class moeoSPEA2Archive : public moeoFixedSizeArchive < MOEOT >


private:

/** archive max size */
unsigned int maxSize;
/** archive size */
unsigned int borne;
/** default moeoComparator*/
moeoFitnessThenDiversityComparator < MOEOT > defaultComparator;
/**
* Wrapper which allow to used an moeoComparator in std::sort
* @param _comp the comparator to used
Expand All @@ -314,12 +315,10 @@ class moeoSPEA2Archive : public moeoFixedSizeArchive < MOEOT >
moeoComparator < MOEOT > & comp;
}
indiComparator;
/** default moeoComparator*/
moeoFitnessThenDiversityComparator < MOEOT > defaultComparator;
/** distance */
moeoDistance <MOEOT, double>& distance;
/** default distance */
moeoEuclideanDistance < MOEOT > defaultDistance;
/** distance */
moeoDistance <MOEOT, double>& distance;


/**
Expand Down

0 comments on commit df8c457

Please sign in to comment.