diff --git a/eo/NEWS b/eo/NEWS index 3e2ceb7b..d61451b4 100644 --- a/eo/NEWS +++ b/eo/NEWS @@ -1,7 +1,7 @@ * release 0.9.4 - Update introductory pages of documentation and webpage. - Remove support for pre-standard C++ compiler (i.e. gcc-2.x), which allows to - clean up the code considerably. + clean up the code considerably. Assume availability of sstream and limits. * releases 0.9.3... (latest release is 0.9.3zz, 1. Oct. 2005) diff --git a/eo/src/eoSequentialSelect.h b/eo/src/eoSequentialSelect.h index 8abbf4ea..9cbfbc40 100644 --- a/eo/src/eoSequentialSelect.h +++ b/eo/src/eoSequentialSelect.h @@ -27,6 +27,12 @@ #ifndef eoSequential_h #define eoSequential_h +#include + +#include "utils/eoData.h" +#include "utils/eoRNG.h" +#include "eoSelectOne.h" + /** Contains the following classes: * - eoSequentialSelect, returns all individuals one by one, * either sorted or shuffled @@ -34,33 +40,23 @@ * starting with best, continuing shuffled (see G3 engine) */ -#include -#include -#include -//----------------------------------------------------------------------------- -/** eoSequentialSelect: returns all individual in order - * looping back to the beginning when exhasuted - * can be from best to worse, or in random order - * - * It is the eoSelectOne equivalent of eoDetSelect - - * though eoDetSelect always returns individuals from best to worst - */ -//----------------------------------------------------------------------------- +/** All Individuals in order +Looping back to the beginning when exhausted, can be from best to +worse, or in random order. + +It is the eoSelectOne equivalent of eoDetSelect - though eoDetSelect +always returns individuals from best to worst +*/ template class eoSequentialSelect: public eoSelectOne { public: - /** Ctor: sets the current pter to MAXINT so init will take place first time + /** Ctor: sets the current pter to numeric_limits::max() so init will take place first time not very elegant, maybe ... */ -#ifdef _MSC_VER eoSequentialSelect(bool _ordered = true) - : ordered(_ordered), current(std::MAXINT) {} -#else - eoSequentialSelect(bool _ordered = true) - : ordered(_ordered), current(MAXINT) {} -#endif + : ordered(_ordered), current(std::numeric_limits::max()) {} void setup(const eoPop& _pop) { @@ -88,28 +84,24 @@ private: }; -//----------------------------------------------------------------------------- -/** eoEliteSequentialSelect: returns the best individual first, - * then the others in sequence (random order). - * for G3 evolution engine, see Deb, Anad and Joshi, CEC 2002 - * - * As eoSequentialSelect, it is an eoSelectOne to be used within the eoEaseyEA - * algo, but conceptually it should be a global eoSelect, as - * it selects a bunch of guys in one go (done in the setup function now) - */ +/** All Individuals in order + +The best individual first, then the others in sequence (random order). +for G3 evolution engine, see Deb, Anad and Joshi, CEC 2002 + +As eoSequentialSelect, it is an eoSelectOne to be used within the +eoEaseyEA algo, but conceptually it should be a global eoSelect, as it +selects a bunch of guys in one go (done in the setup function now) +*/ template class eoEliteSequentialSelect: public eoSelectOne { public: - /** Ctor: sets the current pter to MAXINT so init will take place first time + /** Ctor: sets the current pter to numeric_limits::max() so init will take place first time not very elegant, maybe ... */ - #ifdef _MSC_VER - eoEliteSequentialSelect(): current(std::MAXINT) {} - #else - eoEliteSequentialSelect(): current(MAXINT) {} - #endif + eoEliteSequentialSelect(): current(std::numeric_limits::max()) {} void setup(const eoPop& _pop) { @@ -150,4 +142,3 @@ private: #endif - diff --git a/eo/src/utils/eoData.cpp b/eo/src/utils/eoData.cpp index d43f2719..7e445707 100644 --- a/eo/src/utils/eoData.cpp +++ b/eo/src/utils/eoData.cpp @@ -1,27 +1,8 @@ // Copyright (C) 2005 Jochen Küpper -// -// This program is free software; you can redistribute it and/or modify it under -// the terms of the GNU General Public License as published by the Free Software -// Foundation; either version 2 of the License, or (at your option) any later -// version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along with -// this program; see the file License. if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. #include "eoData.h" -#ifdef HAVE_NUMERIC_LIMITS -int MAXINT = numeric_limits::max(); -#else -#include -int MAXINT = INT_MAX; -#endif // Local Variables: diff --git a/eo/src/utils/eoData.h b/eo/src/utils/eoData.h index 8e973c22..a6a94cc4 100644 --- a/eo/src/utils/eoData.h +++ b/eo/src/utils/eoData.h @@ -25,11 +25,6 @@ #ifndef EODATA_H #define EODATA_H -#ifdef MAXINT -#undef MAXINT -#endif -extern int MAXINT; - #ifndef _MSC_VER #include #define _isnan isnan