00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef MOEODETTOURNAMENTSELECT_H_
00014 #define MOEODETTOURNAMENTSELECT_H_
00015
00016 #include <comparator/moeoComparator.h>
00017 #include <comparator/moeoFitnessThenDiversityComparator.h>
00018 #include <selection/moeoSelectOne.h>
00019 #include <selection/moeoSelectors.h>
00020
00024 template < class MOEOT > class moeoDetTournamentSelect:public moeoSelectOne < MOEOT >
00025 {
00026 public:
00027
00033 moeoDetTournamentSelect (moeoComparator < MOEOT > & _comparator, unsigned int _tSize = 2) : comparator (_comparator), tSize (_tSize)
00034 {
00035
00036 if (tSize < 2)
00037 {
00038 std::
00039 cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n";
00040 tSize = 2;
00041 }
00042 }
00043
00044
00049 moeoDetTournamentSelect (unsigned int _tSize = 2) : comparator (defaultComparator), tSize (_tSize)
00050 {
00051
00052 if (tSize < 2)
00053 {
00054 std::
00055 cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n";
00056 tSize = 2;
00057 }
00058 }
00059
00060
00065 const MOEOT & operator() (const eoPop < MOEOT > &_pop)
00066 {
00067
00068 return mo_deterministic_tournament (_pop, tSize, comparator);
00069 }
00070
00071
00072 protected:
00073
00075 moeoComparator < MOEOT > & comparator;
00077 moeoFitnessThenDiversityComparator < MOEOT > defaultComparator;
00079 unsigned int tSize;
00080
00081 };
00082
00083 #endif