Removed "using namespace std" statements from header files in EO -- "std::" identifier were added where necessary.

This commit is contained in:
okoenig 2003-02-27 19:28:07 +00:00
commit 86fa476c67
263 changed files with 2009 additions and 1976 deletions

View file

@ -10,6 +10,8 @@
#include <eo> // all usefull eo stuff #include <eo> // all usefull eo stuff
#include "mastermind.h" // Chrom eoChromInit eoChromMutation eoChromXover eoChromEvaluator #include "mastermind.h" // Chrom eoChromInit eoChromMutation eoChromXover eoChromEvaluator
using namespace std;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// global variables // global variables
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -23,7 +23,7 @@ typedef float phenotype;
// genotype // genotype
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
typedef vector<int> genotype; typedef std::vector<int> genotype;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Chrom // Chrom
@ -67,12 +67,12 @@ phenotype eoChromEvaluator(const Chrom& chrom)
const unsigned default_length = 8; const unsigned default_length = 8;
const unsigned default_colors = 8; const unsigned default_colors = 8;
const string default_solution = "01234567"; const std::string default_solution = "01234567";
unsigned num_colors; unsigned num_colors;
void init_eoChromEvaluator(const unsigned& c, const unsigned& l, string s) void init_eoChromEvaluator(const unsigned& c, const unsigned& l, std::string s)
{ {
num_colors = c; num_colors = c;
@ -82,14 +82,14 @@ void init_eoChromEvaluator(const unsigned& c, const unsigned& l, string s)
// check length // check length
if (l != default_length && s.size() != l) if (l != default_length && s.size() != l)
{ {
cerr << "solution length != length" << endl; std::cerr << "solution length != length" << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
// check number of colors // check number of colors
if (c != default_colors && c < *max_element(s.begin(), s.end()) - '0') if (c != default_colors && c < *max_element(s.begin(), s.end()) - '0')
{ {
cerr << "too high color number found!" << endl; std::cerr << "too high color number found!" << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }
@ -160,12 +160,12 @@ class eoChromMutation: public eoMonOp<Chrom>
case 1: case 1:
{ {
// transposition // transposition
swap(chrom[position()], chrom[position()]); std::swap(chrom[position()], chrom[position()]);
break; break;
} }
default: default:
{ {
cerr << "unknown operator!" << endl; std::cerr << "unknown operator!" << std::endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
break; break;
} }

View file

@ -34,5 +34,5 @@ AC_TYPE_SIZE_T
dnl Checks for library functions. dnl Checks for library functions.
AC_CHECK_FUNCS(select) AC_CHECK_FUNCS(select)
AC_OUTPUT(src/obsolete/Makefile doc/Makefile src/Makefile src/utils/Makefile src/other/Makefile win/Makefile src/gp/Makefile src/es/Makefile src/ga/Makefile src/do/Makefile test/Makefile contrib/Makefile Makefile app/Makefile app/gprop/Makefile app/mastermind/Makefile app/gpsymreg/Makefile) AC_OUTPUT(src/obsolete/Makefile doc/Makefile src/Makefile src/utils/Makefile src/other/Makefile win/Makefile src/gp/Makefile src/es/Makefile src/ga/Makefile test/Makefile contrib/Makefile Makefile app/Makefile app/gprop/Makefile app/mastermind/Makefile app/gpsymreg/Makefile)

View file

@ -18,7 +18,7 @@
Contact: todos@geneura.ugr.es, http://geneura.ugr.es Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr Marc.Schoenauer@polytechnique.fr
CVS Info: $Date: 2001-12-03 16:28:30 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/contrib/MGE/VirusOp.h,v 1.2 2001-12-03 16:28:30 evomarc Exp $ $Author: evomarc $ CVS Info: $Date: 2003-02-27 19:26:43 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/contrib/MGE/VirusOp.h,v 1.3 2003-02-27 19:26:43 okoenig Exp $ $Author: okoenig $
*/ */
#ifndef VirusOp_h #ifndef VirusOp_h
@ -28,7 +28,7 @@ CVS Info: $Date: 2001-12-03 16:28:30 $ $Header: /home/nojhan/dev/eodev/eodev_cvs
#include <iostream> // ostream, istream #include <iostream> // ostream, istream
#include <functional> // bind2nd #include <functional> // bind2nd
#include <string> // string #include <string> // std::string
#include <utils/eoRNG.h> #include <utils/eoRNG.h>
#include "../contrib/MGE/eoVirus.h" #include "../contrib/MGE/eoVirus.h"
@ -40,7 +40,7 @@ template<class FitT>
class VirusBitFlip: public eoMonOp<eoVirus<FitT> > { class VirusBitFlip: public eoMonOp<eoVirus<FitT> > {
public: public:
/// The class name. /// The class name.
virtual string className() const { return "VirusBitFlip"; }; virtual std::string className() const { return "VirusBitFlip"; };
/** /**
* Change one bit. * Change one bit.
@ -57,7 +57,7 @@ template<class FitT>
class VirusMutation: public eoMonOp<eoVirus<FitT> > { class VirusMutation: public eoMonOp<eoVirus<FitT> > {
public: public:
/// The class name. /// The class name.
virtual string className() const { return "VirusMutation"; }; virtual std::string className() const { return "VirusMutation"; };
/** /**
* Change one bit. * Change one bit.
@ -65,7 +65,7 @@ class VirusMutation: public eoMonOp<eoVirus<FitT> > {
*/ */
bool operator()(eoVirus<FitT>& _chrom) { bool operator()(eoVirus<FitT>& _chrom) {
// Search for virus bits // Search for virus bits
vector<unsigned> bitsSet; std::vector<unsigned> bitsSet;
for ( unsigned i = 0; i < _chrom.size(); i ++ ) { for ( unsigned i = 0; i < _chrom.size(); i ++ ) {
if ( _chrom.virusBit(i) ) { if ( _chrom.virusBit(i) ) {
bitsSet.push_back( i ); bitsSet.push_back( i );
@ -90,7 +90,7 @@ class VirusShiftMutation: public eoMonOp<eoVirus<FitT> > {
VirusShiftMutation( ) {}; VirusShiftMutation( ) {};
/// The class name. /// The class name.
virtual string className() const { return "VirusShiftMutation"; }; virtual std::string className() const { return "VirusShiftMutation"; };
/** /**
* Change one bit. * Change one bit.
@ -125,7 +125,7 @@ template<class FitT>
class VirusTransmission: public eoBinOp<eoVirus<FitT> > { class VirusTransmission: public eoBinOp<eoVirus<FitT> > {
public: public:
/// The class name. /// The class name.
virtual string className() const { return "VirusTransmission"; }; virtual std::string className() const { return "VirusTransmission"; };
/** /**
* Change one bit. * Change one bit.

View file

@ -18,7 +18,7 @@
Contact: todos@geneura.ugr.es, http://geneura.ugr.es Contact: todos@geneura.ugr.es, http://geneura.ugr.es
Marc.Schoenauer@polytechnique.fr Marc.Schoenauer@polytechnique.fr
CVS Info: $Date: 2001-05-17 10:08:25 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/contrib/MGE/eoVirus.h,v 1.1 2001-05-17 10:08:25 jmerelo Exp $ $Author: jmerelo $ CVS Info: $Date: 2003-02-27 19:26:44 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/contrib/MGE/eoVirus.h,v 1.2 2003-02-27 19:26:44 okoenig Exp $ $Author: okoenig $
*/ */
#ifndef eoVirus_h #ifndef eoVirus_h
@ -28,7 +28,7 @@ CVS Info: $Date: 2001-05-17 10:08:25 $ $Header: /home/nojhan/dev/eodev/eodev_cvs
#include <iostream> // ostream, istream #include <iostream> // ostream, istream
#include <functional> // bind2nd #include <functional> // bind2nd
#include <string> // string #include <string> // std::string
#include <ga/eoBit.h> #include <ga/eoBit.h>
@ -49,13 +49,13 @@ template <class FitT> class eoVirus: public eoBit<FitT>
/** /**
* (Default) Constructor. * (Default) Constructor.
* @param size Size of the binary string. * @param size Size of the binary std::string.
*/ */
eoVirus(unsigned _size = 0, bool _value = false, bool _virValue = false): eoVirus(unsigned _size = 0, bool _value = false, bool _virValue = false):
eoBit<FitT>(_size, _value), virus( _size, _virValue) {} eoBit<FitT>(_size, _value), virus( _size, _virValue) {}
/// My class name. /// My class name.
virtual string className() const { virtual std::string className() const {
return "eoVirus"; return "eoVirus";
} }
@ -78,33 +78,33 @@ template <class FitT> class eoVirus: public eoBit<FitT>
* To print me on a stream. * To print me on a stream.
* @param os The ostream. * @param os The ostream.
*/ */
virtual void printOn(ostream& os) const { virtual void printOn(std::ostream& os) const {
EO<FitT>::printOn(os); EO<FitT>::printOn(os);
os << ' '; os << ' ';
os << size() << ' '; os << size() << ' ';
copy(begin(), end(), ostream_iterator<bool>(os)); std::copy(begin(), end(), std::ostream_iterator<bool>(os));
cout << endl; std::cout << std::endl;
copy(virus.begin(), virus.end(), ostream_iterator<bool>(os)); std::copy(virus.begin(), virus.end(), std::ostream_iterator<bool>(os));
} }
/** /**
* To read me from a stream. * To read me from a stream.
* @param is The istream. * @param is The istream.
*/ */
virtual void readFrom(istream& is){ virtual void readFrom(std::istream& is){
eoBit<FitT>::readFrom(is); eoBit<FitT>::readFrom(is);
unsigned s; unsigned s;
is >> s; is >> s;
string bits; std::string bits;
is >> bits; is >> bits;
if (is) { if (is) {
virus.resize(bits.size()); virus.resize(bits.size());
transform(bits.begin(), bits.end(), virus.begin(), std::transform(bits.begin(), bits.end(), virus.begin(),
bind2nd(equal_to<char>(), '1')); std::bind2nd(std::equal_to<char>(), '1'));
} }
} }
private: private:
vector<bool> virus; std::vector<bool> virus;
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -29,7 +29,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include <iostream> // istream, ostream #include <iostream> // istream, ostream
#include <string> // para string #include <std::string> // para std::string
using namespace std; using namespace std;
@ -71,7 +71,7 @@ class eoAged: public Object
it's got code as an example of implementation. Only "leaf" classes it's got code as an example of implementation. Only "leaf" classes
can be non-virtual. can be non-virtual.
*/ */
virtual string className() const { return string("eoAged")+Object::className(); }; virtual std::string className() const { return std::string("eoAged")+Object::className(); };
/** /**
* Read object. * Read object.

View file

@ -27,7 +27,7 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#include <stdexcept> // runtime_error #include <stdexcept> // std::runtime_error
#include <eoObject.h> // eoObject #include <eoObject.h> // eoObject
#include <eoPersistent.h> // eoPersistent #include <eoPersistent.h> // eoPersistent
@ -59,7 +59,7 @@ public:
/// Return fitness value. /// Return fitness value.
Fitness fitness() const { Fitness fitness() const {
if (invalid()) if (invalid())
throw runtime_error("invalid fitness"); throw std::runtime_error("invalid fitness");
return repFitness; return repFitness;
} }
@ -90,23 +90,23 @@ public:
//@{ //@{
/** Return the class id. /** Return the class id.
* @return the class name as a string * @return the class name as a std::string
*/ */
virtual string className() const { return "EO"; } virtual std::string className() const { return "EO"; }
/** /**
* Read object.\\ * Read object.\\
* Calls base class, just in case that one had something to do. * Calls base class, just in case that one had something to do.
* The read and print methods should be compatible and have the same format. * The read and print methods should be compatible and have the same format.
* In principle, format is "plain": they just print a number * In principle, format is "plain": they just print a number
* @param _is a istream. * @param _is a std::istream.
* @throw runtime_exception If a valid object can't be read. * @throw runtime_std::exception If a valid object can't be read.
*/ */
virtual void readFrom(istream& _is) { virtual void readFrom(std::istream& _is) {
// the new version of the reafFrom function. // the new version of the reafFrom function.
// It can distinguish between valid and invalid fitness values. // It can distinguish between valid and invalid fitness values.
string fitness_str; std::string fitness_str;
int pos = _is.tellg(); int pos = _is.tellg();
_is >> fitness_str; _is >> fitness_str;
@ -124,9 +124,9 @@ public:
/** /**
* Write object. Called printOn since it prints the object _on_ a stream. * Write object. Called printOn since it prints the object _on_ a stream.
* @param _os A ostream. * @param _os A std::ostream.
*/ */
virtual void printOn(ostream& _os) const { virtual void printOn(std::ostream& _os) const {
// the latest version of the code. Very similar to the old code // the latest version of the code. Very similar to the old code

View file

@ -30,7 +30,7 @@
#include <vector> #include <vector>
/** /**
Applies a unary function to a vector of things. Applies a unary function to a std::vector of things.
*/ */
template <class EOT> template <class EOT>
void apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _pop) void apply(eoUF<EOT&, void>& _proc, std::vector<EOT>& _pop)

View file

@ -77,40 +77,40 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
// the selection // the selection
eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", "Selection: Roulette, Ranking(p,e), DetTour(T), StochTour(t), Sequential(ordered/unordered) or EliteSequentialSelect", 'S', "Evolution Engine"); eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", "Selection: Roulette, Ranking(p,e), DetTour(T), StochTour(t), Sequential(ordered/unordered) or EliteSequentialSelect", 'S', "Evolution Engine");
eoParamParamType & ppSelect = selectionParam.value(); // pair<string,vector<string> > eoParamParamType & ppSelect = selectionParam.value(); // std::pair<std::string,std::vector<std::string> >
eoSelectOne<EOT>* select ; eoSelectOne<EOT>* select ;
if (ppSelect.first == string("DetTour")) if (ppSelect.first == std::string("DetTour"))
{ {
unsigned detSize; unsigned detSize;
if (!ppSelect.second.size()) // no parameter added if (!ppSelect.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to DetTour, using 2" << endl; std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2; detSize = 2;
// put back 2 in parameter for consistency (and status file) // put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(string("2")); ppSelect.second.push_back(std::string("2"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
detSize = atoi(ppSelect.second[0].c_str()); detSize = atoi(ppSelect.second[0].c_str());
select = new eoDetTournamentSelect<EOT>(detSize); select = new eoDetTournamentSelect<EOT>(detSize);
} }
else if (ppSelect.first == string("StochTour")) else if (ppSelect.first == std::string("StochTour"))
{ {
double p; double p;
if (!ppSelect.second.size()) // no parameter added if (!ppSelect.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to StochTour, using 1" << endl; std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1; p = 1;
// put back p in parameter for consistency (and status file) // put back p in parameter for consistency (and status file)
ppSelect.second.push_back(string("1")); ppSelect.second.push_back(std::string("1"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
p = atof(ppSelect.second[0].c_str()); p = atof(ppSelect.second[0].c_str());
select = new eoStochTournamentSelect<EOT>(p); select = new eoStochTournamentSelect<EOT>(p);
} }
else if (ppSelect.first == string("Ranking")) else if (ppSelect.first == std::string("Ranking"))
{ {
double p,e; double p,e;
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
@ -120,69 +120,69 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
} }
else if (ppSelect.second.size()==1) // 1 parameter: pressure else if (ppSelect.second.size()==1) // 1 parameter: pressure
{ {
cerr << "WARNING, no exponent to Ranking, using 1" << endl; std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
e = 1; e = 1;
ppSelect.second.push_back(string("1")); ppSelect.second.push_back(std::string("1"));
p = atof(ppSelect.second[0].c_str()); p = atof(ppSelect.second[0].c_str());
} }
else // no parameters ... or garbage else // no parameters ... or garbage
{ {
cerr << "WARNING, no parameter to Ranking, using (2,1)" << endl; std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
p=2; p=2;
e=1; e=1;
// put back in parameter for consistency (and status file) // put back in parameter for consistency (and status file)
ppSelect.second.resize(2); // just in case ppSelect.second.resize(2); // just in case
ppSelect.second[0] = (string("2")); ppSelect.second[0] = (std::string("2"));
ppSelect.second[1] = (string("1")); ppSelect.second[1] = (std::string("1"));
} }
// check for authorized values // check for authorized values
// pressure in (0,1] // pressure in (0,1]
if ( (p<=1) || (p>2) ) if ( (p<=1) || (p>2) )
{ {
cerr << "WARNING, selective pressure must be in (1,2] in Ranking, using 2\n"; std::cerr << "WARNING, selective pressure must be in (1,2] in Ranking, using 2\n";
p=2; p=2;
ppSelect.second[0] = (string("2")); ppSelect.second[0] = (std::string("2"));
} }
// exponent >0 // exponent >0
if (e<=0) if (e<=0)
{ {
cerr << "WARNING, exponent must be positive in Ranking, using 1\n"; std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
e=1; e=1;
ppSelect.second[1] = (string("1")); ppSelect.second[1] = (std::string("1"));
} }
// now we're OK // now we're OK
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) ); eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
select = new eoRouletteWorthSelect<EOT>(p2w); select = new eoRouletteWorthSelect<EOT>(p2w);
} }
else if (ppSelect.first == string("Sequential")) // one after the other else if (ppSelect.first == std::string("Sequential")) // one after the other
{ {
bool b; bool b;
if (ppSelect.second.size() == 0) // no argument -> default = ordered if (ppSelect.second.size() == 0) // no argument -> default = ordered
{ {
b=true; b=true;
// put back in parameter for consistency (and status file) // put back in parameter for consistency (and status file)
ppSelect.second.push_back(string("ordered")); ppSelect.second.push_back(std::string("ordered"));
} }
else else
b = !(ppSelect.second[0] == string("unordered")); b = !(ppSelect.second[0] == std::string("unordered"));
select = new eoSequentialSelect<EOT>(b); select = new eoSequentialSelect<EOT>(b);
} }
else if (ppSelect.first == string("EliteSequential")) // Best first, one after the other in random order afterwards else if (ppSelect.first == std::string("EliteSequential")) // Best first, one after the other in random order afterwards
{ {
select = new eoEliteSequentialSelect<EOT>; select = new eoEliteSequentialSelect<EOT>;
} }
else if (ppSelect.first == string("Roulette")) // no argument (yet) else if (ppSelect.first == std::string("Roulette")) // no argument (yet)
{ {
select = new eoProportionalSelect<EOT>; select = new eoProportionalSelect<EOT>;
} }
else if (ppSelect.first == string("Random")) // no argument else if (ppSelect.first == std::string("Random")) // no argument
{ {
select = new eoRandomSelect<EOT>; select = new eoRandomSelect<EOT>;
} }
else else
{ {
string stmp = string("Invalid selection: ") + ppSelect.first; std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
throw runtime_error(stmp.c_str()); throw std::runtime_error(stmp.c_str());
} }
_state.storeFunctor(select); _state.storeFunctor(select);
@ -228,7 +228,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
// first, separate G3 and MGG // first, separate G3 and MGG
// maybe one day we have a common class - but is it really necessary??? // maybe one day we have a common class - but is it really necessary???
if (replacementParam.first == string("G3")) if (replacementParam.first == std::string("G3"))
{ {
// reduce the parents: by default, survive parents = -2 === 2 parents die // reduce the parents: by default, survive parents = -2 === 2 parents die
eoHowMany surviveParents = _parser.createParam(eoHowMany(-2,false), "surviveParents", "Nb of surviving parents (percentage or absolute)", '\0', "Evolution Engine / Replacement").value(); eoHowMany surviveParents = _parser.createParam(eoHowMany(-2,false), "surviveParents", "Nb of surviving parents (percentage or absolute)", '\0', "Evolution Engine / Replacement").value();
@ -236,7 +236,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
ptReplace = new eoG3Replacement<EOT>(-surviveParents); // must receive nb of eliminated parets! ptReplace = new eoG3Replacement<EOT>(-surviveParents); // must receive nb of eliminated parets!
_state.storeFunctor(ptReplace); _state.storeFunctor(ptReplace);
} }
else if (replacementParam.first == string("MGG")) else if (replacementParam.first == std::string("MGG"))
{ {
float t; float t;
unsigned tSize; unsigned tSize;
@ -245,10 +245,10 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
// the tournament size // the tournament size
if (!replacementParam.second.size()) // no parameter added if (!replacementParam.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to MGG replacement, using 2" << endl; std::cerr << "WARNING, no parameter passed to MGG replacement, using 2" << std::endl;
tSize = 2; tSize = 2;
// put back 2 in parameter for consistency (and status file) // put back 2 in parameter for consistency (and status file)
replacementParam.second.push_back(string("2")); replacementParam.second.push_back(std::string("2"));
} }
else else
{ {
@ -259,7 +259,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
} }
else else
{ {
throw runtime_error("Sorry, only deterministic tournament available at the moment"); throw std::runtime_error("Sorry, only deterministic tournament available at the moment");
} }
} }
ptReplace = new eoMGGReplacement<EOT>(-surviveParents, tSize); ptReplace = new eoMGGReplacement<EOT>(-surviveParents, tSize);
@ -280,58 +280,58 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
double t; double t;
// ---------- General // ---------- General
if (replacementParam.first == string("General")) if (replacementParam.first == std::string("General"))
{ {
; // defaults OK ; // defaults OK
} }
// ---------- ESComma // ---------- ESComma
else if (replacementParam.first == string("ESComma")) else if (replacementParam.first == std::string("ESComma"))
{ {
; // OK too ; // OK too
} }
// ---------- ESPlus // ---------- ESPlus
else if (replacementParam.first == string("ESPlus")) else if (replacementParam.first == std::string("ESPlus"))
{ {
surviveParents = eoHowMany(1.0); surviveParents = eoHowMany(1.0);
} }
// ---------- Generational // ---------- Generational
else if (replacementParam.first == string("Generational")) else if (replacementParam.first == std::string("Generational"))
{ {
; // OK too (we should check nb of offspring) ; // OK too (we should check nb of offspring)
} }
// ---------- EP // ---------- EP
else if (replacementParam.first == string("EP")) else if (replacementParam.first == std::string("EP"))
{ {
if (!replacementParam.second.size()) // no parameter added if (!replacementParam.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to EP replacement, using 6" << endl; std::cerr << "WARNING, no parameter passed to EP replacement, using 6" << std::endl;
// put back 6 in parameter for consistency (and status file) // put back 6 in parameter for consistency (and status file)
replacementParam.second.push_back(string("6")); replacementParam.second.push_back(std::string("6"));
} }
// by coincidence, the syntax for the EP reducer is the same than here: // by coincidence, the syntax for the EP reducer is the same than here:
reduceFinalType = replacementParam; reduceFinalType = replacementParam;
surviveParents = eoHowMany(1.0); surviveParents = eoHowMany(1.0);
} }
// ---------- SSGA // ---------- SSGA
else if (replacementParam.first == string("SSGA")) else if (replacementParam.first == std::string("SSGA"))
{ {
if (!replacementParam.second.size()) // no parameter added if (!replacementParam.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to SSGA replacement, using 2" << endl; std::cerr << "WARNING, no parameter passed to SSGA replacement, using 2" << std::endl;
// put back 2 in parameter for consistency (and status file) // put back 2 in parameter for consistency (and status file)
replacementParam.second.push_back(string("2")); replacementParam.second.push_back(std::string("2"));
reduceParentType = eoParamParamType(string("DetTour(2)")); reduceParentType = eoParamParamType(std::string("DetTour(2)"));
} }
else else
{ {
t = atof(replacementParam.second[0].c_str()); t = atof(replacementParam.second[0].c_str());
if (t>=2) if (t>=2)
{ // build the appropriate deafult value { // build the appropriate deafult value
reduceParentType = eoParamParamType(string("DetTour(") + replacementParam.second[0].c_str() + ")"); reduceParentType = eoParamParamType(std::string("DetTour(") + replacementParam.second[0].c_str() + ")");
} }
else // check for [0.5,1] will be made in make_general_replacement else // check for [0.5,1] will be made in make_general_replacement
{ // build the appropriate deafult value { // build the appropriate deafult value
reduceParentType = eoParamParamType(string("StochTour(") + replacementParam.second[0].c_str() + ")"); reduceParentType = eoParamParamType(std::string("StochTour(") + replacementParam.second[0].c_str() + ")");
} }
} }
// //
@ -340,7 +340,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
} }
else // no replacement recognized else // no replacement recognized
{ {
throw runtime_error("Invalid replacement type " + replacementParam.first); throw std::runtime_error("Invalid replacement type " + replacementParam.first);
} }
ptReplace = & make_general_replacement<EOT>( ptReplace = & make_general_replacement<EOT>(

View file

@ -47,7 +47,7 @@ class eoNDPlusReplacement : public eoReplacement<EOT>
public: public:
eoNDPlusReplacement(eoPerf2Worth<EOT, WorthT>& _perf2worth) : perf2worth(_perf2worth) {} eoNDPlusReplacement(eoPerf2Worth<EOT, WorthT>& _perf2worth) : perf2worth(_perf2worth) {}
struct WorthPair : public pair<WorthT, const EOT*> struct WorthPair : public std::pair<WorthT, const EOT*>
{ {
bool operator<(const WorthPair& other) const { return other.first < first; } bool operator<(const WorthPair& other) const { return other.first < first; }
}; };
@ -96,14 +96,14 @@ template <class EOT>
eoAlgo<EOT> & do_make_algo_pareto(eoParser& _parser, eoState& _state, eoEvalFunc<EOT>& _eval, eoContinue<EOT>& _continue, eoGenOp<EOT>& _op) eoAlgo<EOT> & do_make_algo_pareto(eoParser& _parser, eoState& _state, eoEvalFunc<EOT>& _eval, eoContinue<EOT>& _continue, eoGenOp<EOT>& _op)
{ {
// the selection // the selection
string & selStr = _parser.createParam(string("NSGA-II"), "selCrit", "Pareto Selection Criterion: NSGA, NSGA-II, ParetoRanking", 'S', "Evolution Engine").value(); std::string & selStr = _parser.createParam(std::string("NSGA-II"), "selCrit", "Pareto Selection Criterion: NSGA, NSGA-II, ParetoRanking", 'S', "Evolution Engine").value();
double nicheSize = _parser.createParam(1.0, "nicheSize", "Size of niche for NSGA-I", '\0', "Evolution Engine").value(); double nicheSize = _parser.createParam(1.0, "nicheSize", "Size of niche for NSGA-I", '\0', "Evolution Engine").value();
eoPerf2Worth<EOT, double> *p2w; eoPerf2Worth<EOT, double> *p2w;
if ( (selStr == string("NSGA")) || (selStr == string("NSGA-I") ) ) if ( (selStr == std::string("NSGA")) || (selStr == std::string("NSGA-I") ) )
p2w = new eoNDSorting_I<EOT>(nicheSize); p2w = new eoNDSorting_I<EOT>(nicheSize);
else if (selStr == string("NSGA-II")) else if (selStr == std::string("NSGA-II"))
p2w = new eoNDSorting_II<EOT>(); p2w = new eoNDSorting_II<EOT>();
else if (selStr == string("ParetoRanking")) else if (selStr == std::string("ParetoRanking"))
{ {
eoDominanceMap<EOT>& dominance = _state.storeFunctor(new eoDominanceMap<EOT>); eoDominanceMap<EOT>& dominance = _state.storeFunctor(new eoDominanceMap<EOT>);
p2w = new eoParetoRanking<EOT>(dominance); p2w = new eoParetoRanking<EOT>(dominance);
@ -116,64 +116,64 @@ eoAlgo<EOT> & do_make_algo_pareto(eoParser& _parser, eoState& _state, eoEvalFunc
// only the ranking is not re-implemented (yet?) // only the ranking is not re-implemented (yet?)
eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", "Selection: Roulette, DetTour(T), StochTour(t) or Random", 'S', "Evolution Engine"); eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", "Selection: Roulette, DetTour(T), StochTour(t) or Random", 'S', "Evolution Engine");
eoParamParamType & ppSelect = selectionParam.value(); // pair<string,vector<string> > eoParamParamType & ppSelect = selectionParam.value(); // std::pair<std::string,std::vector<std::string> >
eoSelectOne<EOT>* select ; eoSelectOne<EOT>* select ;
if (ppSelect.first == string("DetTour")) if (ppSelect.first == std::string("DetTour"))
{ {
unsigned detSize; unsigned detSize;
if (!ppSelect.second.size()) // no parameter added if (!ppSelect.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to DetTour, using 2" << endl; std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2; detSize = 2;
// put back 2 in parameter for consistency (and status file) // put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(string("2")); ppSelect.second.push_back(std::string("2"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
detSize = atoi(ppSelect.second[0].c_str()); detSize = atoi(ppSelect.second[0].c_str());
select = new eoDetTournamentWorthSelect<EOT>(*p2w, detSize); select = new eoDetTournamentWorthSelect<EOT>(*p2w, detSize);
} }
else if (ppSelect.first == string("StochTour")) else if (ppSelect.first == std::string("StochTour"))
{ {
double p; double p;
if (!ppSelect.second.size()) // no parameter added if (!ppSelect.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to StochTour, using 1" << endl; std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1; p = 1;
// put back p in parameter for consistency (and status file) // put back p in parameter for consistency (and status file)
ppSelect.second.push_back(string("1")); ppSelect.second.push_back(std::string("1"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
p = atof(ppSelect.second[0].c_str()); p = atof(ppSelect.second[0].c_str());
select = new eoStochTournamentWorthSelect<EOT>(*p2w, p); select = new eoStochTournamentWorthSelect<EOT>(*p2w, p);
} }
// else if (ppSelect.first == string("Sequential")) // one after the other // else if (ppSelect.first == std::string("Sequential")) // one after the other
// { // {
// bool b; // bool b;
// if (ppSelect.second.size() == 0) // no argument -> default = ordered // if (ppSelect.second.size() == 0) // no argument -> default = ordered
// { // {
// b=true; // b=true;
// // put back in parameter for consistency (and status file) // // put back in parameter for consistency (and status file)
// ppSelect.second.push_back(string("ordered")); // ppSelect.second.push_back(std::string("ordered"));
// } // }
// else // else
// b = !(ppSelect.second[0] == string("unordered")); // b = !(ppSelect.second[0] == std::string("unordered"));
// select = new eoSequentialWorthSelect<EOT>(b); // select = new eoSequentialWorthSelect<EOT>(b);
// } // }
else if (ppSelect.first == string("Roulette")) // no argument (yet) else if (ppSelect.first == std::string("Roulette")) // no argument (yet)
{ {
select = new eoRouletteWorthSelect<EOT>(*p2w); select = new eoRouletteWorthSelect<EOT>(*p2w);
} }
else if (ppSelect.first == string("Random")) // no argument, no perf2Worth else if (ppSelect.first == std::string("Random")) // no argument, no perf2Worth
{ {
select = new eoRandomSelect<EOT>; select = new eoRandomSelect<EOT>;
} }
else else
{ {
string stmp = string("Invalid selection: ") + ppSelect.first; std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
throw runtime_error(stmp.c_str()); throw std::runtime_error(stmp.c_str());
} }
_state.storeFunctor(select); _state.storeFunctor(select);

View file

@ -76,40 +76,40 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
// the selection // the selection
eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", "Selection: Roulette, Ranking(p,e), DetTour(T), StochTour(t) or Sequential(ordered/unordered)", 'S', "Evolution Engine"); eoValueParam<eoParamParamType>& selectionParam = _parser.createParam(eoParamParamType("DetTour(2)"), "selection", "Selection: Roulette, Ranking(p,e), DetTour(T), StochTour(t) or Sequential(ordered/unordered)", 'S', "Evolution Engine");
eoParamParamType & ppSelect = selectionParam.value(); // pair<string,vector<string> > eoParamParamType & ppSelect = selectionParam.value(); // std::pair<std::string,std::vector<std::string> >
eoSelectOne<EOT>* select ; eoSelectOne<EOT>* select ;
if (ppSelect.first == string("DetTour")) if (ppSelect.first == std::string("DetTour"))
{ {
unsigned detSize; unsigned detSize;
if (!ppSelect.second.size()) // no parameter added if (!ppSelect.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to DetTour, using 2" << endl; std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2; detSize = 2;
// put back 2 in parameter for consistency (and status file) // put back 2 in parameter for consistency (and status file)
ppSelect.second.push_back(string("2")); ppSelect.second.push_back(std::string("2"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
detSize = atoi(ppSelect.second[0].c_str()); detSize = atoi(ppSelect.second[0].c_str());
select = new eoDetTournamentSelect<EOT>(detSize); select = new eoDetTournamentSelect<EOT>(detSize);
} }
else if (ppSelect.first == string("StochTour")) else if (ppSelect.first == std::string("StochTour"))
{ {
double p; double p;
if (!ppSelect.second.size()) // no parameter added if (!ppSelect.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to StochTour, using 1" << endl; std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1; p = 1;
// put back p in parameter for consistency (and status file) // put back p in parameter for consistency (and status file)
ppSelect.second.push_back(string("1")); ppSelect.second.push_back(std::string("1"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
p = atof(ppSelect.second[0].c_str()); p = atof(ppSelect.second[0].c_str());
select = new eoStochTournamentSelect<EOT>(p); select = new eoStochTournamentSelect<EOT>(p);
} }
else if (ppSelect.first == string("Ranking")) else if (ppSelect.first == std::string("Ranking"))
{ {
double p,e; double p,e;
if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent if (ppSelect.second.size()==2) // 2 parameters: pressure and exponent
@ -119,65 +119,65 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
} }
else if (ppSelect.second.size()==1) // 1 parameter: pressure else if (ppSelect.second.size()==1) // 1 parameter: pressure
{ {
cerr << "WARNING, no exponent to Ranking, using 1" << endl; std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
e = 1; e = 1;
ppSelect.second.push_back(string("1")); ppSelect.second.push_back(std::string("1"));
p = atof(ppSelect.second[0].c_str()); p = atof(ppSelect.second[0].c_str());
} }
else // no parameters ... or garbage else // no parameters ... or garbage
{ {
cerr << "WARNING, no parameter to Ranking, using (2,1)" << endl; std::cerr << "WARNING, no parameter to Ranking, using (2,1)" << std::endl;
p=2; p=2;
e=1; e=1;
// put back in parameter for consistency (and status file) // put back in parameter for consistency (and status file)
ppSelect.second.resize(2); // just in case ppSelect.second.resize(2); // just in case
ppSelect.second[0] = (string("2")); ppSelect.second[0] = (std::string("2"));
ppSelect.second[1] = (string("1")); ppSelect.second[1] = (std::string("1"));
} }
// check for authorized values // check for authorized values
// pressure in (0,1] // pressure in (0,1]
if ( (p<=1) || (p>2) ) if ( (p<=1) || (p>2) )
{ {
cerr << "WARNING, selective pressure must be in (0,1] in Ranking, using 2\n"; std::cerr << "WARNING, selective pressure must be in (0,1] in Ranking, using 2\n";
p=2; p=2;
ppSelect.second[0] = (string("2")); ppSelect.second[0] = (std::string("2"));
} }
// exponent >0 // exponent >0
if (e<=0) if (e<=0)
{ {
cerr << "WARNING, exponent must be positive in Ranking, using 1\n"; std::cerr << "WARNING, exponent must be positive in Ranking, using 1\n";
e=1; e=1;
ppSelect.second[1] = (string("1")); ppSelect.second[1] = (std::string("1"));
} }
// now we're OK // now we're OK
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) ); eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
select = new eoRouletteWorthSelect<EOT>(p2w); select = new eoRouletteWorthSelect<EOT>(p2w);
} }
else if (ppSelect.first == string("Sequential")) // one after the other else if (ppSelect.first == std::string("Sequential")) // one after the other
{ {
bool b; bool b;
if (ppSelect.second.size() == 0) // no argument -> default = ordered if (ppSelect.second.size() == 0) // no argument -> default = ordered
{ {
b=true; b=true;
// put back in parameter for consistency (and status file) // put back in parameter for consistency (and status file)
ppSelect.second.push_back(string("ordered")); ppSelect.second.push_back(std::string("ordered"));
} }
else else
b = !(ppSelect.second[0] == string("unordered")); b = !(ppSelect.second[0] == std::string("unordered"));
select = new eoSequentialSelect<EOT>(b); select = new eoSequentialSelect<EOT>(b);
} }
else if (ppSelect.first == string("Roulette")) // no argument (yet) else if (ppSelect.first == std::string("Roulette")) // no argument (yet)
{ {
select = new eoProportionalSelect<EOT>; select = new eoProportionalSelect<EOT>;
} }
else if (ppSelect.first == string("Random")) // no argument else if (ppSelect.first == std::string("Random")) // no argument
{ {
select = new eoRandomSelect<EOT>; select = new eoRandomSelect<EOT>;
} }
else else
{ {
string stmp = string("Invalid selection: ") + ppSelect.first; std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
throw runtime_error(stmp.c_str()); throw std::runtime_error(stmp.c_str());
} }
_state.storeFunctor(select); _state.storeFunctor(select);
@ -188,62 +188,62 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
// the replacement // the replacement
eoValueParam<eoParamParamType>& replacementParam = _parser.createParam(eoParamParamType("Comma"), "replacement", "Replacement: Comma, Plus or EPTour(T), SSGAWorst, SSGADet(T), SSGAStoch(t)", 'R', "Evolution Engine"); eoValueParam<eoParamParamType>& replacementParam = _parser.createParam(eoParamParamType("Comma"), "replacement", "Replacement: Comma, Plus or EPTour(T), SSGAWorst, SSGADet(T), SSGAStoch(t)", 'R', "Evolution Engine");
eoParamParamType & ppReplace = replacementParam.value(); // pair<string,vector<string> > eoParamParamType & ppReplace = replacementParam.value(); // std::pair<std::string,std::vector<std::string> >
eoReplacement<EOT>* replace ; eoReplacement<EOT>* replace ;
if (ppReplace.first == string("Comma")) // Comma == generational if (ppReplace.first == std::string("Comma")) // Comma == generational
{ {
replace = new eoCommaReplacement<EOT>; replace = new eoCommaReplacement<EOT>;
} }
else if (ppReplace.first == string("Plus")) else if (ppReplace.first == std::string("Plus"))
{ {
replace = new eoPlusReplacement<EOT>; replace = new eoPlusReplacement<EOT>;
} }
else if (ppReplace.first == string("EPTour")) else if (ppReplace.first == std::string("EPTour"))
{ {
unsigned detSize; unsigned detSize;
if (!ppReplace.second.size()) // no parameter added if (!ppReplace.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to EPTour, using 6" << endl; std::cerr << "WARNING, no parameter passed to EPTour, using 6" << std::endl;
detSize = 6; detSize = 6;
// put back in parameter for consistency (and status file) // put back in parameter for consistency (and status file)
ppReplace.second.push_back(string("6")); ppReplace.second.push_back(std::string("6"));
} }
else // parameter passed by user as EPTour(T) else // parameter passed by user as EPTour(T)
detSize = atoi(ppSelect.second[0].c_str()); detSize = atoi(ppSelect.second[0].c_str());
replace = new eoEPReplacement<EOT>(detSize); replace = new eoEPReplacement<EOT>(detSize);
} }
else if (ppReplace.first == string("SSGAWorst")) else if (ppReplace.first == std::string("SSGAWorst"))
{ {
replace = new eoSSGAWorseReplacement<EOT>; replace = new eoSSGAWorseReplacement<EOT>;
} }
else if (ppReplace.first == string("SSGADet")) else if (ppReplace.first == std::string("SSGADet"))
{ {
unsigned detSize; unsigned detSize;
if (!ppReplace.second.size()) // no parameter added if (!ppReplace.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to SSGADet, using 2" << endl; std::cerr << "WARNING, no parameter passed to SSGADet, using 2" << std::endl;
detSize = 2; detSize = 2;
// put back in parameter for consistency (and status file) // put back in parameter for consistency (and status file)
ppReplace.second.push_back(string("2")); ppReplace.second.push_back(std::string("2"));
} }
else // parameter passed by user as SSGADet(T) else // parameter passed by user as SSGADet(T)
detSize = atoi(ppSelect.second[0].c_str()); detSize = atoi(ppSelect.second[0].c_str());
replace = new eoSSGADetTournamentReplacement<EOT>(detSize); replace = new eoSSGADetTournamentReplacement<EOT>(detSize);
} }
else if (ppReplace.first == string("SSGAStoch")) else if (ppReplace.first == std::string("SSGAStoch"))
{ {
double p; double p;
if (!ppReplace.second.size()) // no parameter added if (!ppReplace.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to SSGAStoch, using 1" << endl; std::cerr << "WARNING, no parameter passed to SSGAStoch, using 1" << std::endl;
p = 1; p = 1;
// put back in parameter for consistency (and status file) // put back in parameter for consistency (and status file)
ppReplace.second.push_back(string("1")); ppReplace.second.push_back(std::string("1"));
} }
else // parameter passed by user as SSGADet(T) else // parameter passed by user as SSGADet(T)
p = atof(ppSelect.second[0].c_str()); p = atof(ppSelect.second[0].c_str());
@ -252,8 +252,8 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
} }
else else
{ {
string stmp = string("Invalid replacement: ") + ppReplace.first; std::string stmp = std::string("Invalid replacement: ") + ppReplace.first;
throw runtime_error(stmp.c_str()); throw std::runtime_error(stmp.c_str());
} }
_state.storeFunctor(replace); _state.storeFunctor(replace);

View file

@ -66,7 +66,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
checkpoint->add(*generationCounter); checkpoint->add(*generationCounter);
// dir for DISK output // dir for DISK output
eoValueParam<string>& dirNameParam = _parser.createParam(string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk"); eoValueParam<std::string>& dirNameParam = _parser.createParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk");
// shoudl we empty it if exists // shoudl we empty it if exists
eoValueParam<bool>& eraseParam = _parser.createParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk"); eoValueParam<bool>& eraseParam = _parser.createParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
bool dirOK = false; // not tested yet bool dirOK = false; // not tested yet
@ -79,9 +79,9 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
* *
* eoBestFitnessStat : best value in pop - type EOT::Fitness * eoBestFitnessStat : best value in pop - type EOT::Fitness
* eoAverageStat : average value in pop - type EOT::Fitness * eoAverageStat : average value in pop - type EOT::Fitness
* eoSecondMomentStat: average + stdev - type pair<double, double> * eoSecondMomentStat: average + stdev - type std::pair<double, double>
* eoSortedPopStat : whole population - type string (!!) * eoSortedPopStat : whole population - type std::string (!!)
* eoScalarFitnessStat: the fitnesses - type vector<double> * eoScalarFitnessStat: the fitnesses - type std::vector<double>
*/ */
// Best fitness in population // Best fitness in population
@ -188,9 +188,9 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
if (fileBestParam.value()) // A file monitor for best & secondMoment if (fileBestParam.value()) // A file monitor for best & secondMoment
{ {
#ifdef _MSVC #ifdef _MSVC
string stmp = dirNameParam.value() + "\best.xg"; std::string stmp = dirNameParam.value() + "\best.xg";
#else #else
string stmp = dirNameParam.value() + "/best.xg"; std::string stmp = dirNameParam.value() + "/best.xg";
#endif #endif
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp); eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
// save and give to checkpoint // save and give to checkpoint
@ -201,7 +201,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
fileMonitor->add(_eval); fileMonitor->add(_eval);
if (tCounter) // we want the time as well if (tCounter) // we want the time as well
{ {
// cout << "On met timecounter\n"; // std::cout << "On met timecounter\n";
fileMonitor->add(*tCounter); fileMonitor->add(*tCounter);
} }
fileMonitor->add(*bestStat); fileMonitor->add(*bestStat);
@ -211,7 +211,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
#if !defined(NO_GNUPLOT) #if !defined(NO_GNUPLOT)
if (plotBestParam.value()) // an eoGnuplot1DMonitor for best & average if (plotBestParam.value()) // an eoGnuplot1DMonitor for best & average
{ {
string stmp = dirNameParam.value() + "/gnu_best.xg"; std::string stmp = dirNameParam.value() + "/gnu_best.xg";
eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>()); eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>());
// save and give to checkpoint // save and give to checkpoint
_state.storeFunctor(gnuMonitor); _state.storeFunctor(gnuMonitor);
@ -236,7 +236,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
// a gnuplot-based monitor for snapshots: needs a dir name // a gnuplot-based monitor for snapshots: needs a dir name
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value()); eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
_state.storeFunctor(fitSnapshot); _state.storeFunctor(fitSnapshot);
// add any stat that is a vector<double> to it // add any stat that is a std::vector<double> to it
fitSnapshot->add(*fitStat); fitSnapshot->add(*fitStat);
// and of course add it to the checkpoint // and of course add it to the checkpoint
checkpoint->add(*fitSnapshot); checkpoint->add(*fitSnapshot);
@ -259,9 +259,9 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX ); unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
#ifdef _MSVC #ifdef _MSVC
string stmp = dirNameParam.value() + "\generations"; std::string stmp = dirNameParam.value() + "\generations";
#else #else
string stmp = dirNameParam.value() + "/generations"; std::string stmp = dirNameParam.value() + "/generations";
#endif #endif
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp); eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
_state.storeFunctor(stateSaver1); _state.storeFunctor(stateSaver1);
@ -277,9 +277,9 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
#ifdef _MSVC #ifdef _MSVC
string stmp = dirNameParam.value() + "\time"; std::string stmp = dirNameParam.value() + "\time";
#else #else
string stmp = dirNameParam.value() + "/time"; std::string stmp = dirNameParam.value() + "/time";
#endif #endif
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp); eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
_state.storeFunctor(stateSaver2); _state.storeFunctor(stateSaver2);

View file

@ -62,7 +62,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
_state.storeFunctor(increment); _state.storeFunctor(increment);
// dir for DISK output // dir for DISK output
eoValueParam<string>& dirNameParam = _parser.createParam(string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk"); eoValueParam<std::string>& dirNameParam = _parser.createParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk");
// shoudl we empty it if exists // shoudl we empty it if exists
eoValueParam<bool>& eraseParam = _parser.createParam(false, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk"); eoValueParam<bool>& eraseParam = _parser.createParam(false, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
bool dirOK = false; // not tested yet bool dirOK = false; // not tested yet
@ -75,9 +75,9 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
* *
* eoBestFitnessStat : best value in pop - type EOT::Fitness * eoBestFitnessStat : best value in pop - type EOT::Fitness
* eoAverageStat : average value in pop - type EOT::Fitness * eoAverageStat : average value in pop - type EOT::Fitness
* eoSecondMomentStat: average + stdev - type pair<double, double> * eoSecondMomentStat: average + stdev - type std::pair<double, double>
* eoSortedPopStat : whole population - type string (!!) * eoSortedPopStat : whole population - type std::string (!!)
* eoScalarFitnessStat: the fitnesses - type vector<double> * eoScalarFitnessStat: the fitnesses - type std::vector<double>
* eoDFCSTat : FDC wrt best in pop or absolute best - type double * eoDFCSTat : FDC wrt best in pop or absolute best - type double
* requires an eoDistance. See eoFDCStat.h * requires an eoDistance. See eoFDCStat.h
* also computes all elements for the FDC scatter plot * also computes all elements for the FDC scatter plot
@ -199,7 +199,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
if (fileBestParam.value()) // A file monitor for best & secondMoment if (fileBestParam.value()) // A file monitor for best & secondMoment
{ {
string stmp = dirNameParam.value() + "/best.xg"; std::string stmp = dirNameParam.value() + "/best.xg";
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp); eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
// save and give to checkpoint // save and give to checkpoint
_state.storeFunctor(fileMonitor); _state.storeFunctor(fileMonitor);
@ -213,7 +213,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
if (plotBestParam.value()) // an eoGnuplot1DMonitor for best & average if (plotBestParam.value()) // an eoGnuplot1DMonitor for best & average
{ {
string stmp = dirNameParam.value() + "_gnu_best.xg"; std::string stmp = dirNameParam.value() + "_gnu_best.xg";
eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>()); eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>());
// save and give to checkpoint // save and give to checkpoint
_state.storeFunctor(gnuMonitor); _state.storeFunctor(gnuMonitor);
@ -250,7 +250,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
// a gnuplot-based monitor for snapshots: needs a dir name // a gnuplot-based monitor for snapshots: needs a dir name
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value()); eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
_state.storeFunctor(fitSnapshot); _state.storeFunctor(fitSnapshot);
// add any stat that is a vector<double> to it // add any stat that is a std::vector<double> to it
fitSnapshot->add(*fitStat); fitSnapshot->add(*fitStat);
// and of course add it to the checkpoint // and of course add it to the checkpoint
checkpoint->add(*fitSnapshot); checkpoint->add(*fitSnapshot);
@ -271,7 +271,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX ); unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
string stmp = dirNameParam.value() + "/generations"; std::string stmp = dirNameParam.value() + "/generations";
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp); eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
_state.storeFunctor(stateSaver1); _state.storeFunctor(stateSaver1);
checkpoint->add(*stateSaver1); checkpoint->add(*stateSaver1);
@ -285,7 +285,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
if (! dirOK ) if (! dirOK )
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
string stmp = dirNameParam.value() + "/time"; std::string stmp = dirNameParam.value() + "/time";
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp); eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
_state.storeFunctor(stateSaver2); _state.storeFunctor(stateSaver2);
checkpoint->add(*stateSaver2); checkpoint->add(*stateSaver2);

View file

@ -69,7 +69,7 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
checkpoint.add(increment); checkpoint.add(increment);
// dir for DISK output // dir for DISK output
string & dirName = _parser.getORcreateParam(string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk").value(); std::string & dirName = _parser.getORcreateParam(std::string("Res"), "resDir", "Directory to store DISK outputs", '\0', "Output - Disk").value();
// shoudl we empty it if exists // shoudl we empty it if exists
eoValueParam<bool>& eraseParam = _parser.createParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk"); eoValueParam<bool>& eraseParam = _parser.createParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
bool dirOK = false; // not tested yet bool dirOK = false; // not tested yet
@ -80,22 +80,22 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
/** /**
* existing stats for Pareto as of today, Jan. 31. 2002 * existing stats for Pareto as of today, Jan. 31. 2002
* *
* eoSortedPopStat : whole population - type string (!!) * eoSortedPopStat : whole population - type std::string (!!)
*/ */
eoValueParam<eoParamParamType>& fPlotParam = _parser.createParam(eoParamParamType("1(0,1)"), "frontFileFrequency", "File save frequency in objective spaces (pairs of comma-separated objectives in 1 single parentheses pair)", '\0', "Output - Disk"); eoValueParam<eoParamParamType>& fPlotParam = _parser.createParam(eoParamParamType("1(0,1)"), "frontFileFrequency", "File save frequency in objective spaces (std::pairs of comma-separated objectives in 1 single parentheses std::pair)", '\0', "Output - Disk");
#if !defined(NO_GNUPLOT) #if !defined(NO_GNUPLOT)
bool boolGnuplot = _parser.createParam(false, "plotFront", "Objective plots (requires corresponding files - see frontFileFrequency", '\0', "Output - Graphical").value(); bool boolGnuplot = _parser.createParam(false, "plotFront", "Objective plots (requires corresponding files - see frontFileFrequency", '\0', "Output - Graphical").value();
#endif #endif
eoParamParamType & fPlot = fPlotParam.value(); // pair<string,vector<string> > eoParamParamType & fPlot = fPlotParam.value(); // std::pair<std::string,std::vector<std::string> >
unsigned frequency = atoi(fPlot.first.c_str()); unsigned frequency = atoi(fPlot.first.c_str());
if (frequency) // something to plot if (frequency) // something to plot
{ {
unsigned nbPlot = fPlot.second.size(); unsigned nbPlot = fPlot.second.size();
if ( nbPlot % 2 ) // odd! if ( nbPlot % 2 ) // odd!
throw runtime_error("Odd number of front description in make_checkpoint_pareto"); throw std::runtime_error("Odd number of front description in make_checkpoint_pareto");
// only create the necessary stats // only create the necessary stats
std::vector<bool> bStat(nObj, false); // track of who's already there std::vector<bool> bStat(nObj, false); // track of who's already there
@ -110,8 +110,8 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
if (!bStat[obj1]) // not already there: create it if (!bStat[obj1]) // not already there: create it
{ {
char s[1024]; char s[1024];
ostrstream os(s, 1022); std::ostrstream os(s, 1022);
os << "Obj. " << obj1 << ends; os << "Obj. " << obj1 << std::ends;
fStat = new eoMOFitnessStat<EOT>(obj1, s); fStat = new eoMOFitnessStat<EOT>(obj1, s);
_state.storeFunctor(fStat); _state.storeFunctor(fStat);
bStat[obj1]=true; bStat[obj1]=true;
@ -121,8 +121,8 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
if (!bStat[obj2]) // not already there: create it if (!bStat[obj2]) // not already there: create it
{ {
char s2[1024]; char s2[1024];
ostrstream os2(s2, 1022); std::ostrstream os2(s2, 1022);
os2 << "Obj. " << obj2 << ends; os2 << "Obj. " << obj2 << std::ends;
fStat = new eoMOFitnessStat<EOT>(obj2, s2); fStat = new eoMOFitnessStat<EOT>(obj2, s2);
_state.storeFunctor(fStat); _state.storeFunctor(fStat);
bStat[obj2]=true; bStat[obj2]=true;
@ -132,8 +132,8 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
// then the fileSnapshots // then the fileSnapshots
char s3[1024]; char s3[1024];
ostrstream os3(s3, 1022); std::ostrstream os3(s3, 1022);
os3 << "Front." << obj1 << "." << obj2 << "." << ends; os3 << "Front." << obj1 << "." << obj2 << "." << std::ends;
eoFileSnapshot & snapshot = _state.storeFunctor(new eoFileSnapshot & snapshot = _state.storeFunctor(new
eoFileSnapshot(dirName, frequency, s3 ) ); eoFileSnapshot(dirName, frequency, s3 ) );
@ -160,7 +160,7 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
eoSortedPopStat<EOT> * popStat; eoSortedPopStat<EOT> * popStat;
if ( printPop ) // we do want pop dump if ( printPop ) // we do want pop dump
{ {
cout << "On cree printpop\n"; std::cout << "On cree printpop\n";
popStat = & _state.storeFunctor(new eoSortedPopStat<EOT>); popStat = & _state.storeFunctor(new eoSortedPopStat<EOT>);
// add it to the checkpoint // add it to the checkpoint
checkpoint.add(*popStat); checkpoint.add(*popStat);
@ -205,9 +205,9 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX ); unsigned freq = (saveFrequencyParam.value()>0 ? saveFrequencyParam.value() : UINT_MAX );
#ifdef _MSVC #ifdef _MSVC
string stmp = dirName + "\generations"; std::string stmp = dirName + "\generations";
#else #else
string stmp = dirName + "/generations"; std::string stmp = dirName + "/generations";
#endif #endif
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp); eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
_state.storeFunctor(stateSaver1); _state.storeFunctor(stateSaver1);
@ -223,9 +223,9 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
#ifdef _MSVC #ifdef _MSVC
string stmp = dirName + "\time"; std::string stmp = dirName + "\time";
#else #else
string stmp = dirName + "/time"; std::string stmp = dirName + "/time";
#endif #endif
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp); eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
_state.storeFunctor(stateSaver2); _state.storeFunctor(stateSaver2);

View file

@ -146,7 +146,7 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
// now check that there is at least one! // now check that there is at least one!
if (!continuator) if (!continuator)
throw runtime_error("You MUST provide a stopping criterion"); throw std::runtime_error("You MUST provide a stopping criterion");
// OK, it's there: store in the eoState // OK, it's there: store in the eoState
_state.storeFunctor(continuator); _state.storeFunctor(continuator);

View file

@ -97,7 +97,7 @@ eoContinue<Indi> & do_make_continue_pareto(eoParser& _parser, eoState& _state, e
// now check that there is at least one! // now check that there is at least one!
if (!continuator) if (!continuator)
throw runtime_error("You MUST provide a stopping criterion"); throw std::runtime_error("You MUST provide a stopping criterion");
// OK, it's there: store in the eoState // OK, it's there: store in the eoState
_state.storeFunctor(continuator); _state.storeFunctor(continuator);

View file

@ -47,64 +47,64 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
eoReduce<EOT> * ptReduce; eoReduce<EOT> * ptReduce;
// ---------- Deterministic // ---------- Deterministic
if (_ppReduce.first == string("Deterministic")) if (_ppReduce.first == std::string("Deterministic"))
{ {
ptReduce = new eoTruncate<EOT>; ptReduce = new eoTruncate<EOT>;
} }
// ---------- EP // ---------- EP
else if (_ppReduce.first == string("EP")) else if (_ppReduce.first == std::string("EP"))
{ {
if (!_ppReduce.second.size()) // no parameter added if (!_ppReduce.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to EP, using 6" << endl; std::cerr << "WARNING, no parameter passed to EP, using 6" << std::endl;
detSize = 6; detSize = 6;
// put back 6 in parameter for consistency (and status file) // put back 6 in parameter for consistency (and status file)
_ppReduce.second.push_back(string("6")); _ppReduce.second.push_back(std::string("6"));
} }
else // parameter passed by user as EP(T) else // parameter passed by user as EP(T)
detSize = atoi(_ppReduce.second[0].c_str()); detSize = atoi(_ppReduce.second[0].c_str());
ptReduce = new eoEPReduce<EOT>(detSize); ptReduce = new eoEPReduce<EOT>(detSize);
} }
// ---------- DetTour // ---------- DetTour
else if (_ppReduce.first == string("DetTour")) else if (_ppReduce.first == std::string("DetTour"))
{ {
if (!_ppReduce.second.size()) // no parameter added if (!_ppReduce.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to DetTour, using 2" << endl; std::cerr << "WARNING, no parameter passed to DetTour, using 2" << std::endl;
detSize = 2; detSize = 2;
// put back 2 in parameter for consistency (and status file) // put back 2 in parameter for consistency (and status file)
_ppReduce.second.push_back(string("2")); _ppReduce.second.push_back(std::string("2"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
detSize = atoi(_ppReduce.second[0].c_str()); detSize = atoi(_ppReduce.second[0].c_str());
ptReduce = new eoDetTournamentTruncate<EOT>(detSize); ptReduce = new eoDetTournamentTruncate<EOT>(detSize);
} }
else if (_ppReduce.first == string("StochTour")) else if (_ppReduce.first == std::string("StochTour"))
{ {
double p; double p;
if (!_ppReduce.second.size()) // no parameter added if (!_ppReduce.second.size()) // no parameter added
{ {
cerr << "WARNING, no parameter passed to StochTour, using 1" << endl; std::cerr << "WARNING, no parameter passed to StochTour, using 1" << std::endl;
p = 1; p = 1;
// put back p in parameter for consistency (and status file) // put back p in parameter for consistency (and status file)
_ppReduce.second.push_back(string("1")); _ppReduce.second.push_back(std::string("1"));
} }
else // parameter passed by user as DetTour(T) else // parameter passed by user as DetTour(T)
{ {
p = atof(_ppReduce.second[0].c_str()); p = atof(_ppReduce.second[0].c_str());
if ( (p<=0.5) || (p>1) ) if ( (p<=0.5) || (p>1) )
throw runtime_error("Stochastic tournament size should be in [0.5,1]"); throw std::runtime_error("Stochastic tournament size should be in [0.5,1]");
} }
ptReduce = new eoStochTournamentTruncate<EOT>(p); ptReduce = new eoStochTournamentTruncate<EOT>(p);
} }
else if (_ppReduce.first == string("Uniform")) else if (_ppReduce.first == std::string("Uniform"))
{ {
ptReduce = new eoRandomReduce<EOT>; ptReduce = new eoRandomReduce<EOT>;
} }
else // no known reduction entered else // no known reduction entered
{ {
throw runtime_error("Unknown reducer: " + _ppReduce.first); throw std::runtime_error("Unknown reducer: " + _ppReduce.first);
} }
// all done, stores and return a reference // all done, stores and return a reference
_state.storeFunctor(ptReduce); _state.storeFunctor(ptReduce);
@ -117,7 +117,7 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
* *
* eoHowMany _elite the number of elite parents (0 = no elitism) * eoHowMany _elite the number of elite parents (0 = no elitism)
* see below * see below
* bool _strongElitism if elite > 0, string elitism or weak elitism * bool _strongElitism if elite > 0, std::string elitism or weak elitism
* strong = elite parents survive, whatever the offspring * strong = elite parents survive, whatever the offspring
* weak - elite patents compete AFTER replacement with best offspring * weak - elite patents compete AFTER replacement with best offspring
* eoHowMany _surviveParents number of parents after parents recuction * eoHowMany _surviveParents number of parents after parents recuction

View file

@ -58,7 +58,7 @@ eoPop<EOT>& do_make_pop(eoParser & _parser, eoState& _state, eoInit<EOT> & _ini
// create an empty pop and let the state handle the memory // create an empty pop and let the state handle the memory
eoPop<EOT>& pop = _state.takeOwnership(eoPop<EOT>()); eoPop<EOT>& pop = _state.takeOwnership(eoPop<EOT>());
eoValueParam<string>& loadNameParam = _parser.createParam(string(""), "Load","A save file to restart from",'L', "Persistence" ); eoValueParam<std::string>& loadNameParam = _parser.createParam(std::string(""), "Load","A save file to restart from",'L', "Persistence" );
eoValueParam<bool> & recomputeFitnessParam = _parser.createParam(false, "recomputeFitness", "Recompute the fitness after re-loading the pop.?", 'r', "Persistence" ); eoValueParam<bool> & recomputeFitnessParam = _parser.createParam(false, "recomputeFitness", "Recompute the fitness after re-loading the pop.?", 'r', "Persistence" );
if (loadNameParam.value() != "") // something to load if (loadNameParam.value() != "") // something to load

View file

@ -18,7 +18,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Contact: todos@geneura.ugr.es, http://geneura.ugr.es Contact: todos@geneura.ugr.es, http://geneura.ugr.es
CVS Info: $Date: 2001-04-12 16:46:55 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/src/eoCloneOps.h,v 1.1 2001-04-12 16:46:55 evomarc Exp $ $Author: evomarc $ CVS Info: $Date: 2003-02-27 19:26:09 $ $Header: /home/nojhan/dev/eodev/eodev_cvs/eo/src/eoCloneOps.h,v 1.2 2003-02-27 19:26:09 okoenig Exp $ $Author: okoenig $
*/ */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -46,7 +46,7 @@ class eoMonCloneOp: public eoMonOp<EOT>
public: public:
/// Ctor /// Ctor
eoMonCloneOp() : eoMonOp<EOT>() {} eoMonCloneOp() : eoMonOp<EOT>() {}
virtual string className() const {return "eoMonCloneOp";} virtual std::string className() const {return "eoMonCloneOp";}
virtual bool operator()(EOT&){return false;} virtual bool operator()(EOT&){return false;}
}; };
@ -59,7 +59,7 @@ class eoBinCloneOp: public eoBinOp<EOT>
public: public:
/// Ctor /// Ctor
eoBinCloneOp() : eoBinOp<EOT>() {} eoBinCloneOp() : eoBinOp<EOT>() {}
virtual string className() const {return "eoBinCloneOp";} virtual std::string className() const {return "eoBinCloneOp";}
virtual bool operator()(EOT&, const EOT&){return false;} virtual bool operator()(EOT&, const EOT&){return false;}
}; };
@ -71,7 +71,7 @@ class eoQuadCloneOp: public eoQuadOp<EOT>
public: public:
/// Ctor /// Ctor
eoQuadCloneOp():eoQuadOp<EOT>() {} eoQuadCloneOp():eoQuadOp<EOT>() {}
virtual string className() const {return "eoQuadCloneOp";} virtual std::string className() const {return "eoQuadCloneOp";}
virtual bool operator()(EOT& , EOT& ) {return false;} virtual bool operator()(EOT& , EOT& ) {return false;}
}; };

View file

@ -31,7 +31,7 @@
Combined continuators - logical AND: Combined continuators - logical AND:
Continues until one of the embedded continuators says halt! Continues until one of the embedded continuators says halt!
20/11/00 MS: Changed the 2-continuator construct to a vector<eoContinue<EOT> > 20/11/00 MS: Changed the 2-continuator construct to a std::vector<eoContinue<EOT> >
to be consistent with other Combined constructs to be consistent with other Combined constructs
and allow to easily handle more than 2 continuators and allow to easily handle more than 2 continuators

Some files were not shown because too many files have changed in this diff Show more