- Main Page
- Classes
- Files

- Search for |

# moeoRouletteSelect.h

    00001 // -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*-
    00002
    00003 //-----------------------------------------------------------------------------
    00004 // moeoRouletteSelect.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 MOEOROULETTESELECT_H_
    00014 #define MOEOROULETTESELECT_H_
    00015
    00016 #include <moeoSelectOne.h>
    00017 #include <moeoSelectors.h>
    00018
    00022 template < class MOEOT >
    00023 class moeoRouletteSelect:public moeoSelectOne <MOEOT>
    00024 {
    00025 public:
    00026
    00027
    00033     moeoRouletteSelect (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     moeoRouletteSelect (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
    00066     const MOEOT & operator  () (const eoPop < MOEOT > &_pop)
    00067     {
    00068         // use the selector
    00069         return mo_roulette_wheel(_pop,tSize); //comparator ??
    00070     }
    00071
    00072
    00073 protected:
    00074
    00076     moeoComparator < MOEOT > &comparator;
    00078     double & tSize;
    00079
    00080 };
    00081
    00082 #endif /*MOEOROULETTESELECT_H_ */