/* Oumayma BAHRI Author: Oumayma BAHRI ParadisEO WebSite : http://paradiseo.gforge.inria.fr Contact: paradiseo-help@lists.gforge.inria.fr */ //----------------------------------------------------------------------------- #ifndef MOEOFUZZYARCHIVE_H_ #define MOEOFUZZYARCHIVE_H_ #include #include /** * Abstract class for representing an archive in a fuzzy space of solutions; * an archive is a secondary population that stores non-dominated fuzzy solutions. */ template < class MOEOT > class moeoFuzzyArchive : public eoPop < MOEOT >, public eoUF < const MOEOT &, bool>, public eoUF < const eoPop < MOEOT > &, bool> { public: using eoPop < MOEOT > :: size; using eoPop < MOEOT > :: operator[]; using eoPop < MOEOT > :: back; using eoPop < MOEOT > :: pop_back; /** * The type of an objective vector for a solution */ typedef typename MOEOT::ObjectiveVector ObjectiveVector; /** * ctor. * The FuzzyComparator is used to compare fuzzy solutions based on Pareto dominance * @param _replace boolean which determine if a solution with the same objectiveVector than another one, can replace it or not */ moeoFuzzyArchive(FuzzyComparator< ObjectiveVector > & _comparator, bool _replace=true) : eoPop < MOEOT >(), comparator(_comparator), replace(_replace) {} /** * Returns true if the current archive dominates _objectiveVector according to the moeoObjectiveVectorComparator given in the constructor * @param _objectiveVector the objective vector to compare with the current archive */ bool dominates (const ObjectiveVector & _objectiveVector) const { for (unsigned int i = 0; i & _pop) = 0; /** * Returns true if the current archive contains the same objective vectors than the given archive _arch * @param _arch the given archive */ bool equals (const moeoFuzzyArchive < MOEOT > & _arch) { for (unsigned int i=0; i & _pop) { bool res = false; bool tmp = false; for (unsigned int i=0; i<_pop.size(); i++) { tmp = (*this).update(_pop[i]); res = tmp || res; } return res; } /** A comparator based on fuzzy Pareto dominance (used as default) */ moeoFuzzyParetoComparator < ObjectiveVector > FuzzyComparator; /** boolean */ bool replace; }; #endif /*MOEOFUZZYARCHIVE_H_ */