From d4e4efb5cb288a99b3c51f5661eb09c25e5bc279 Mon Sep 17 00:00:00 2001 From: legrand Date: Fri, 23 Feb 2007 13:24:40 +0000 Subject: [PATCH] Random selection added, need to delete moeoRandomSelectOne.h git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@193 331e1502-861f-0410-8da2-ba01fb791d7f --- .../paradiseo-moeo-1.0/src/moeoRandomSelect.h | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 branches/paradiseo-moeo-1.0/src/moeoRandomSelect.h diff --git a/branches/paradiseo-moeo-1.0/src/moeoRandomSelect.h b/branches/paradiseo-moeo-1.0/src/moeoRandomSelect.h new file mode 100644 index 000000000..98e802c91 --- /dev/null +++ b/branches/paradiseo-moeo-1.0/src/moeoRandomSelect.h @@ -0,0 +1,50 @@ +// -*- mode: c++; c-indent-level: 4; c++-member-init-indent: 8; comment-column: 35; -*- + +//----------------------------------------------------------------------------- +// moeoRandomSelect.h +// (c) OPAC Team (LIFL), Dolphin Project (INRIA), 2007 +/* + This library... + + Contact: paradiseo-help@lists.gforge.inria.fr, http://paradiseo.gforge.inria.fr + */ +//----------------------------------------------------------------------------- + +#ifndef MOEORANDOMSELECT_H_ +#define MOEORANDOMSELECT_H_ + +#include +#include + +/** + * Selection strategy that selects only one element randomly from a whole population. Neither the fitness nor the diversity of the individuals is required here. + */ +template < class MOEOT > class moeoRandomSelect:public moeoSelectOne < MOEOT >, public eoRandomSelect +{ +public: + + /** + * CTor. + */ + moeoRandomSelect(){} + + /* + * Do nothing: we don't need to evaluate the fitness and the diversity; we only select one individual at random. + */ + void setup (eoPop < MOEOT > &_pop) + { + // do nothing + } + + /** + * Return one individual at random. // Need to have a "const" pop ? + */ + const MOEOT & operator () (const eoPop < MOEOT > &_pop) + { + + eoRandomSelect < MOEOT >::operator ()(_pop); + } + +}; + +#endif /*MOEORANDOMSELECT_H_ */