From d229324172e2916b70e5028b4c9260fbf90bfbee Mon Sep 17 00:00:00 2001 From: liefooga Date: Thu, 26 Jun 2008 10:05:07 +0000 Subject: [PATCH] doc added git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1208 331e1502-861f-0410-8da2-ba01fb791d7f --- .../moeoDominanceCountFitnessAssignment.h | 50 +++++++++++------ ...eoDominanceCountRankingFitnessAssignment.h | 54 ++++++++++--------- .../moeoDominanceRankFitnessAssignment.h | 44 +++++++++------ 3 files changed, 92 insertions(+), 56 deletions(-) diff --git a/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountFitnessAssignment.h b/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountFitnessAssignment.h index 4a19514a5..3572a067f 100644 --- a/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountFitnessAssignment.h +++ b/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountFitnessAssignment.h @@ -50,78 +50,94 @@ #include /** - * moeoDominanceCountFitnessAssignment is a fitness assignment which count for each moeot the others moeot it dominates. + * Fitness assignment sheme that computes how many solutions does each solution dominate. */ template < class MOEOT > class moeoDominanceCountFitnessAssignment : public moeoParetoBasedFitnessAssignment < MOEOT > { public: + /** the objective vector type of the solutions */ typedef typename MOEOT::ObjectiveVector ObjectiveVector; + /** * Default ctor - * @param _nocopy boolean to move away copies + * @param _nocopy boolean to move away clone individuals (default = false) */ - moeoDominanceCountFitnessAssignment(bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy) + moeoDominanceCountFitnessAssignment(bool _nocopy=false) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy) {} + /** * Ctor where you can choose your own archive - * @param _archive the archive used - * @param _nocopy boolean to move away copies + * @param _archive an archive to be included in the fitness assignment process + * @param _nocopy boolean to penalize clone individuals (default = false) */ - moeoDominanceCountFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), matrix(_nocopy) + moeoDominanceCountFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(paretoComparator), archive(_archive), matrix(_nocopy) {} + /** * Ctor where you can choose your own way to compare objective vectors * @param _comparator the functor used to compare objective vectors - * @param _nocopy boolean to move away copies + * @param _nocopy boolean to penalize clone individuals (default = false) */ - moeoDominanceCountFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy) + moeoDominanceCountFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=false) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy) {} + /** * Ctor where you can choose your own archive and your own way to compare objective vectors * @param _comparator the functor used to compare objective vectors - * @param _archive the archive used - * @param _nocopy boolean to move away copies + * @param _archive an archive to be included in the fitness assignment process + * @param _nocopy boolean to penalize clone individuals (default = false) */ - moeoDominanceCountFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy) + moeoDominanceCountFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, bool _nocopy=false) : comparator(_comparator), archive(_archive), matrix(_comparator, _nocopy) {} + /** - * Sets the fitness values for every solution contained in the population _pop and in archive + * Sets the fitness values for every solution contained in the population _pop (and in the archive) * @param _pop the population */ - void operator()(eoPop < MOEOT > & _pop) { + void operator()(eoPop < MOEOT > & _pop) + { unsigned int j= _pop.size(); unsigned int i= archive.size(); matrix(archive,_pop); for (unsigned int k=0; k & _pop, ObjectiveVector & _objVec) { - //not yet implemented + std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountFitnessAssignment" << std::endl; } + private: + /** Functor to compare two objective vectors */ moeoObjectiveVectorComparator < ObjectiveVector > & comparator; /** Functor to compare two objective vectors according to Pareto dominance relation */ moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator; - /** Archive */ + /** Archive to be included in the fitness assignment process */ moeoArchive < MOEOT > & archive; /** Default archive */ moeoUnboundedArchive < MOEOT > defaultArchive; /** Dominance Matrix */ moeoDominanceMatrix < MOEOT > matrix; + }; #endif /*MOEODOMINANCECOUNTFITNESSASSIGNMENT_H_*/ diff --git a/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h b/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h index 0337b4607..57b622c00 100644 --- a/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h +++ b/trunk/paradiseo-moeo/src/fitness/moeoDominanceCountRankingFitnessAssignment.h @@ -51,16 +51,21 @@ #include /** - * moeoDominanceCountRankingFitnessAssignment is a rank fitness assignment with value determine by a count fitness assignment. + * Fitness assignment sheme that sum-up the ranks of all solutions dominated by each solution. + * This strategy is used, for instance, in SPEA2. + * E. Zitzler, M. Laumanns, and L. Thiele. SPEA2: Improving the Strength Pareto Evolutionary Algorithm. Technical Report 103, + * Computer Engineering and Networks Laboratory (TIK), ETH Zurich, Zurich, Switzerland, 2001. */ template < class MOEOT > class moeoDominanceCountRankingFitnessAssignment : public moeoParetoBasedFitnessAssignment < MOEOT > { public: + /** the objective vector type of the solutions */ typedef typename MOEOT::ObjectiveVector ObjectiveVector; + /** * Default ctor * @param _nocopy boolean to move away copies @@ -68,6 +73,7 @@ public: moeoDominanceCountRankingFitnessAssignment(bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), matrix(_nocopy) {} + /** * Ctor where you can choose your own archive * @param _archive the archive used @@ -76,6 +82,7 @@ public: moeoDominanceCountRankingFitnessAssignment(moeoArchive < MOEOT > & _archive, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), matrix(_nocopy) {} + /** * Ctor where you can choose your own way to compare objective vectors * @param _comparator the functor used to compare objective vectors @@ -84,6 +91,7 @@ public: moeoDominanceCountRankingFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), matrix(_comparator, _nocopy) {} + /** * Ctor where you can choose your own archive and your own way to compare objective vectors * @param _comparator the functor used to compare objective vectors @@ -95,57 +103,55 @@ public: /** - * Sets the fitness values for every solution contained in the population _pop and in archive + * Sets the fitness values for every solution contained in the population _pop (and in the archive) * @param _pop the population */ void operator()(eoPop < MOEOT > & _pop) { - /*std::cout <<"\n\n"; - for(unsigned k=0;k<_pop.size();k++){ - std::cout << "pop " << k << " :\n"; - for(unsigned l=0 ; l<2 ; l++) - std::cout << "\tobjVec " << l << " : " << _pop[k].objectiveVector()[l] << "\n"; - } - for(unsigned k=0;k & _pop, ObjectiveVector & _objVec) { - //not yet implemented + std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceCountRankingFitnessAssignment" << std::endl; } private: + /** Functor to compare two objective vectors */ moeoObjectiveVectorComparator < ObjectiveVector > & comparator; /** Functor to compare two objective vectors according to Pareto dominance relation */ moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator; - /** Archive */ + /** Archive to be included in the fitness assignment process */ moeoArchive < MOEOT > & archive; /** Default archive */ moeoUnboundedArchive < MOEOT > defaultArchive; - /** Dominance Matrix*/ + /** Dominance Matrix */ moeoDominanceMatrix matrix; - double countRanking(unsigned int _i) { + + /** + * + * @param _i + */ + double countRanking(unsigned int _i) + { double res=0; - for (unsigned int k=0; k /** - * moeoDominanceRankFitnessAssignment is a fitness assignment which count for each moeot how many others dominates it. + * Fitness assignment sheme that computes how many solutions each solution is dominated by. */ template < class MOEOT > class moeoDominanceRankFitnessAssignment : public moeoParetoBasedFitnessAssignment < MOEOT > { public: + /** the objective vector type of the solutions */ typedef typename MOEOT::ObjectiveVector ObjectiveVector; + /** * Default ctor * @param _start a start value used to determine the fitness (default _start = 1.0) - * @param _nocopy boolean to move away copies + * @param _nocopy boolean to penalize clone individuals (default = false) */ moeoDominanceRankFitnessAssignment(double _start=1.0, bool _nocopy=true) : comparator(paretoComparator), archive(defaultArchive), start(_start), matrix(_nocopy) {} + /** * Ctor where you can choose your own archive - * @param _archive the archive used + * @param _archive an archive to be included in the fitness assignment process * @param _start a start value used to determine the fitness (default _start = 1.0) - * @param _nocopy boolean to move away copies + * @param _nocopy boolean to penalize clone individuals (default = false) */ moeoDominanceRankFitnessAssignment(moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=true) : comparator(paretoComparator), archive(_archive), start(_start), matrix(_nocopy) {} + /** * Ctor where you can choose your own way to compare objective vectors * @param _comparator the functor used to compare objective vectors * @param _start a start value used to determine the fitness (default _start = 1.0) - * @param _nocopy boolean to move away copies + * @param _nocopy boolean to penalize clone individuals (default = false) */ moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, double _start=1.0, bool _nocopy=true) : comparator(_comparator), archive(defaultArchive), start(_start), matrix(_comparator, _nocopy) {} + /** * Ctor where you can choose your own archive and your own way to compare objective vectors * @param _comparator the functor used to compare objective vectors - * @param _archive the archive used + * @param _archive an archive to be included in the fitness assignment process * @param _start a start value used to determine the fitness (default _start = 1.0) - * @param _nocopy boolean to move away copies + * @param _nocopy boolean to penalize clone individuals (default = false) */ moeoDominanceRankFitnessAssignment(moeoObjectiveVectorComparator < ObjectiveVector > & _comparator, moeoArchive < MOEOT > & _archive, double _start=1.0, bool _nocopy=true) : comparator(_comparator), archive(_archive), start(_start), matrix(_comparator, _nocopy) {} + /** - * Sets the fitness values for every solution contained in the population _pop and in archive + * Sets the fitness values for every solution contained in the population _pop (and in the archive) * @param _pop the population */ void operator()(eoPop < MOEOT > & _pop) @@ -105,28 +111,36 @@ public: unsigned int j= _pop.size(); matrix(archive, _pop); for (unsigned int k=0; k & _pop, ObjectiveVector & _objVec) { - //not yet implemented + std::cout << "WARNING : updateByDeleting not implemented in moeoDominanceRankFitnessAssignment" << std::endl; } + private: + /** Functor to compare two objective vectors */ moeoObjectiveVectorComparator < ObjectiveVector > & comparator; /** Functor to compare two objective vectors according to Pareto dominance relation */ moeoParetoObjectiveVectorComparator < ObjectiveVector > paretoComparator; - /** Archive*/ + /** Archive to be included in the fitness assignment process */ moeoArchive < MOEOT > & archive; - /** Default archive*/ + /** Default archive */ moeoUnboundedArchive < MOEOT > defaultArchive; - /** start value*/ + /** Start value */ double start; - /** Dominance Matrix*/ + /** Dominance Matrix */ moeoDominanceMatrix < MOEOT > matrix; };