- Main Page
- Classes
- Files

- Search for |

# moeoDetTournamentSelect.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // moeoDetTournamentSelect.h
    00005 // (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007
    00006 /*
    00007     This library...
    00008
    00009     Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr
    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         // consistency check
    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         // consistency check
    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         // use the selector
    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 /*MOEODETTOURNAMENTSELECT_H_ */