- 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 <moeoComparator.h>
    00017 #include <moeoSelectOne.h>
    00018 #include <moeoSelectors.h>
    00019
    00023 template < class MOEOT > class moeoDetTournamentSelect:public moeoSelectOne <
    00024             MOEOT >
    00025 {
    00026 public:
    00027
    00033     moeoDetTournamentSelect (moeoComparator < MOEOT > &_comparator, unsigned _tSize = 2):
    00034             comparator (_comparator), tSize (_tSize)
    00035     {
    00036         // consistency check
    00037         if (tSize < 2)
    00038         {
    00039             std::
    00040             cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n";
    00041             tSize = 2;
    00042         }
    00043     }
    00044
    00045
    00050     moeoDetTournamentSelect (unsigned _tSize = 2):
    00051             comparator (*(new moeoFitnessThenDiversityComparator < MOEOT > ())),
    00052             tSize (_tSize)
    00053     {
    00054         // consistency check
    00055         if (tSize < 2)
    00056         {
    00057             std::
    00058             cout << "Warning, Tournament size should be >= 2\nAdjusted to 2\n";
    00059             tSize = 2;
    00060         }
    00061     }
    00062
    00063
    00068     const MOEOT & operator   () (const eoPop < MOEOT > &_pop)
    00069     {
    00070         // use the selector
    00071         return mo_deterministic_tournament (_pop, tSize, comparator);
    00072     }
    00073
    00074
    00075 protected:
    00076
    00078     moeoComparator < MOEOT > &comparator;
    00079
    00081     unsigned tSize;
    00082 };
    00083
    00084 #endif /*MOEODETTOURNAMENTSELECT_H_ */