00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MOEOFITNESSTHENDIVERSITYCOMPARATOR_H_
00014 #define MOEOFITNESSTHENDIVERSITYCOMPARATOR_H_
00015
00016 #include <comparator/moeoComparator.h>
00017
00021 template < class MOEOT >
00022 class moeoFitnessThenDiversityComparator : public moeoComparator < MOEOT >
00023 {
00024 public:
00025
00031 const bool operator()(const MOEOT & _moeo1, const MOEOT & _moeo2)
00032 {
00033 if (_moeo1.fitness() == _moeo2.fitness())
00034 {
00035 return _moeo1.diversity() < _moeo2.diversity();
00036 }
00037 else
00038 {
00039 return _moeo1.fitness() < _moeo2.fitness();
00040 }
00041 }
00042
00043 };
00044
00045 #endif