From 27e550bc09a518c016c178b1bc0dd83925a1c768 Mon Sep 17 00:00:00 2001 From: liefooga Date: Fri, 13 Apr 2007 14:50:17 +0000 Subject: [PATCH] add op '<' git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@223 331e1502-861f-0410-8da2-ba01fb791d7f --- branches/paradiseo-moeo-1.0/src/MOEO.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/branches/paradiseo-moeo-1.0/src/MOEO.h b/branches/paradiseo-moeo-1.0/src/MOEO.h index 8408677a5..a283906ad 100644 --- a/branches/paradiseo-moeo-1.0/src/MOEO.h +++ b/branches/paradiseo-moeo-1.0/src/MOEO.h @@ -26,10 +26,6 @@ * All template arguments must have a void and a copy constructor. * Besides, note that, contrary to the mono-objective case (and to EO) where the fitness value of a solution is confused with its objective value, * the fitness value differs of the objectives values in the multi-objective case. - * - * !!!!!!!!!!!!!!!!! !!!!! - * operator '<' et '>' ??? - * !!!!!!!!!!!!!!!!!!!!!!! */ template < class MOEOObjectiveVector, class MOEOFitness, class MOEODiversity > class MOEO : public EO < MOEOObjectiveVector > @@ -212,6 +208,18 @@ public: } + /** + * Returns true if the objective vector of the current solution is smaller than the objective vector of _other on the first objective, + * then on the second, and so on (can be usefull for sorting/printing). + * You should implement another function in the sub-class of MOEO to have another sorting mecanism. + * @param _other the other MOEO object to compare with + */ + bool operator<(const MOEO & _other) const + { + return objectiveVector() < _other.objectiveVector(); + } + + /** * Return the class id (the class name as a std::string) */