Removed "using namespace std" statements from header files in EO -- "std::" identifier were added where necessary.
This commit is contained in:
parent
6441ea1ec3
commit
86fa476c67
263 changed files with 2009 additions and 1976 deletions
|
|
@ -77,40 +77,40 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
// 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");
|
||||
|
||||
eoParamParamType & ppSelect = selectionParam.value(); // pair<string,vector<string> >
|
||||
eoParamParamType & ppSelect = selectionParam.value(); // std::pair<std::string,std::vector<std::string> >
|
||||
|
||||
eoSelectOne<EOT>* select ;
|
||||
if (ppSelect.first == string("DetTour"))
|
||||
if (ppSelect.first == std::string("DetTour"))
|
||||
{
|
||||
unsigned detSize;
|
||||
|
||||
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;
|
||||
// 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)
|
||||
detSize = atoi(ppSelect.second[0].c_str());
|
||||
select = new eoDetTournamentSelect<EOT>(detSize);
|
||||
}
|
||||
else if (ppSelect.first == string("StochTour"))
|
||||
else if (ppSelect.first == std::string("StochTour"))
|
||||
{
|
||||
double p;
|
||||
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;
|
||||
// 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)
|
||||
p = atof(ppSelect.second[0].c_str());
|
||||
|
||||
select = new eoStochTournamentSelect<EOT>(p);
|
||||
}
|
||||
else if (ppSelect.first == string("Ranking"))
|
||||
else if (ppSelect.first == std::string("Ranking"))
|
||||
{
|
||||
double p,e;
|
||||
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
|
||||
{
|
||||
cerr << "WARNING, no exponent to Ranking, using 1" << endl;
|
||||
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
|
||||
e = 1;
|
||||
ppSelect.second.push_back(string("1"));
|
||||
ppSelect.second.push_back(std::string("1"));
|
||||
p = atof(ppSelect.second[0].c_str());
|
||||
}
|
||||
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;
|
||||
e=1;
|
||||
// put back in parameter for consistency (and status file)
|
||||
ppSelect.second.resize(2); // just in case
|
||||
ppSelect.second[0] = (string("2"));
|
||||
ppSelect.second[1] = (string("1"));
|
||||
ppSelect.second[0] = (std::string("2"));
|
||||
ppSelect.second[1] = (std::string("1"));
|
||||
}
|
||||
// check for authorized values
|
||||
// pressure in (0,1]
|
||||
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;
|
||||
ppSelect.second[0] = (string("2"));
|
||||
ppSelect.second[0] = (std::string("2"));
|
||||
}
|
||||
// exponent >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;
|
||||
ppSelect.second[1] = (string("1"));
|
||||
ppSelect.second[1] = (std::string("1"));
|
||||
}
|
||||
// now we're OK
|
||||
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
|
||||
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;
|
||||
if (ppSelect.second.size() == 0) // no argument -> default = ordered
|
||||
{
|
||||
b=true;
|
||||
// put back in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(string("ordered"));
|
||||
ppSelect.second.push_back(std::string("ordered"));
|
||||
}
|
||||
else
|
||||
b = !(ppSelect.second[0] == string("unordered"));
|
||||
b = !(ppSelect.second[0] == std::string("unordered"));
|
||||
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>;
|
||||
}
|
||||
else if (ppSelect.first == string("Roulette")) // no argument (yet)
|
||||
else if (ppSelect.first == std::string("Roulette")) // no argument (yet)
|
||||
{
|
||||
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>;
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid selection: ") + ppSelect.first;
|
||||
throw runtime_error(stmp.c_str());
|
||||
std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
|
||||
_state.storeFunctor(select);
|
||||
|
|
@ -228,7 +228,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
|
||||
// first, separate G3 and MGG
|
||||
// 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
|
||||
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!
|
||||
_state.storeFunctor(ptReplace);
|
||||
}
|
||||
else if (replacementParam.first == string("MGG"))
|
||||
else if (replacementParam.first == std::string("MGG"))
|
||||
{
|
||||
float t;
|
||||
unsigned tSize;
|
||||
|
|
@ -245,10 +245,10 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
// the tournament size
|
||||
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;
|
||||
// put back 2 in parameter for consistency (and status file)
|
||||
replacementParam.second.push_back(string("2"));
|
||||
replacementParam.second.push_back(std::string("2"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -259,7 +259,7 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
}
|
||||
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);
|
||||
|
|
@ -280,58 +280,58 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
double t;
|
||||
|
||||
// ---------- General
|
||||
if (replacementParam.first == string("General"))
|
||||
if (replacementParam.first == std::string("General"))
|
||||
{
|
||||
; // defaults OK
|
||||
}
|
||||
// ---------- ESComma
|
||||
else if (replacementParam.first == string("ESComma"))
|
||||
else if (replacementParam.first == std::string("ESComma"))
|
||||
{
|
||||
; // OK too
|
||||
}
|
||||
// ---------- ESPlus
|
||||
else if (replacementParam.first == string("ESPlus"))
|
||||
else if (replacementParam.first == std::string("ESPlus"))
|
||||
{
|
||||
surviveParents = eoHowMany(1.0);
|
||||
}
|
||||
// ---------- Generational
|
||||
else if (replacementParam.first == string("Generational"))
|
||||
else if (replacementParam.first == std::string("Generational"))
|
||||
{
|
||||
; // OK too (we should check nb of offspring)
|
||||
}
|
||||
// ---------- EP
|
||||
else if (replacementParam.first == string("EP"))
|
||||
else if (replacementParam.first == std::string("EP"))
|
||||
{
|
||||
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)
|
||||
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:
|
||||
reduceFinalType = replacementParam;
|
||||
surviveParents = eoHowMany(1.0);
|
||||
}
|
||||
// ---------- SSGA
|
||||
else if (replacementParam.first == string("SSGA"))
|
||||
else if (replacementParam.first == std::string("SSGA"))
|
||||
{
|
||||
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)
|
||||
replacementParam.second.push_back(string("2"));
|
||||
reduceParentType = eoParamParamType(string("DetTour(2)"));
|
||||
replacementParam.second.push_back(std::string("2"));
|
||||
reduceParentType = eoParamParamType(std::string("DetTour(2)"));
|
||||
}
|
||||
else
|
||||
{
|
||||
t = atof(replacementParam.second[0].c_str());
|
||||
if (t>=2)
|
||||
{ // 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
|
||||
{ // 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
|
||||
{
|
||||
throw runtime_error("Invalid replacement type " + replacementParam.first);
|
||||
throw std::runtime_error("Invalid replacement type " + replacementParam.first);
|
||||
}
|
||||
|
||||
ptReplace = & make_general_replacement<EOT>(
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class eoNDPlusReplacement : public eoReplacement<EOT>
|
|||
public:
|
||||
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; }
|
||||
};
|
||||
|
|
@ -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)
|
||||
{
|
||||
// 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();
|
||||
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);
|
||||
else if (selStr == string("NSGA-II"))
|
||||
else if (selStr == std::string("NSGA-II"))
|
||||
p2w = new eoNDSorting_II<EOT>();
|
||||
else if (selStr == string("ParetoRanking"))
|
||||
else if (selStr == std::string("ParetoRanking"))
|
||||
{
|
||||
eoDominanceMap<EOT>& dominance = _state.storeFunctor(new eoDominanceMap<EOT>);
|
||||
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?)
|
||||
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 ;
|
||||
if (ppSelect.first == string("DetTour"))
|
||||
if (ppSelect.first == std::string("DetTour"))
|
||||
{
|
||||
unsigned detSize;
|
||||
|
||||
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;
|
||||
// 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)
|
||||
detSize = atoi(ppSelect.second[0].c_str());
|
||||
select = new eoDetTournamentWorthSelect<EOT>(*p2w, detSize);
|
||||
}
|
||||
else if (ppSelect.first == string("StochTour"))
|
||||
else if (ppSelect.first == std::string("StochTour"))
|
||||
{
|
||||
double p;
|
||||
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;
|
||||
// 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)
|
||||
p = atof(ppSelect.second[0].c_str());
|
||||
|
||||
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;
|
||||
// if (ppSelect.second.size() == 0) // no argument -> default = ordered
|
||||
// {
|
||||
// b=true;
|
||||
// // put back in parameter for consistency (and status file)
|
||||
// ppSelect.second.push_back(string("ordered"));
|
||||
// ppSelect.second.push_back(std::string("ordered"));
|
||||
// }
|
||||
// else
|
||||
// b = !(ppSelect.second[0] == string("unordered"));
|
||||
// b = !(ppSelect.second[0] == std::string("unordered"));
|
||||
// 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);
|
||||
}
|
||||
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>;
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid selection: ") + ppSelect.first;
|
||||
throw runtime_error(stmp.c_str());
|
||||
std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
|
||||
_state.storeFunctor(select);
|
||||
|
|
|
|||
|
|
@ -76,40 +76,40 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
// 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");
|
||||
|
||||
eoParamParamType & ppSelect = selectionParam.value(); // pair<string,vector<string> >
|
||||
eoParamParamType & ppSelect = selectionParam.value(); // std::pair<std::string,std::vector<std::string> >
|
||||
|
||||
eoSelectOne<EOT>* select ;
|
||||
if (ppSelect.first == string("DetTour"))
|
||||
if (ppSelect.first == std::string("DetTour"))
|
||||
{
|
||||
unsigned detSize;
|
||||
|
||||
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;
|
||||
// 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)
|
||||
detSize = atoi(ppSelect.second[0].c_str());
|
||||
select = new eoDetTournamentSelect<EOT>(detSize);
|
||||
}
|
||||
else if (ppSelect.first == string("StochTour"))
|
||||
else if (ppSelect.first == std::string("StochTour"))
|
||||
{
|
||||
double p;
|
||||
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;
|
||||
// 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)
|
||||
p = atof(ppSelect.second[0].c_str());
|
||||
|
||||
select = new eoStochTournamentSelect<EOT>(p);
|
||||
}
|
||||
else if (ppSelect.first == string("Ranking"))
|
||||
else if (ppSelect.first == std::string("Ranking"))
|
||||
{
|
||||
double p,e;
|
||||
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
|
||||
{
|
||||
cerr << "WARNING, no exponent to Ranking, using 1" << endl;
|
||||
std::cerr << "WARNING, no exponent to Ranking, using 1" << std::endl;
|
||||
e = 1;
|
||||
ppSelect.second.push_back(string("1"));
|
||||
ppSelect.second.push_back(std::string("1"));
|
||||
p = atof(ppSelect.second[0].c_str());
|
||||
}
|
||||
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;
|
||||
e=1;
|
||||
// put back in parameter for consistency (and status file)
|
||||
ppSelect.second.resize(2); // just in case
|
||||
ppSelect.second[0] = (string("2"));
|
||||
ppSelect.second[1] = (string("1"));
|
||||
ppSelect.second[0] = (std::string("2"));
|
||||
ppSelect.second[1] = (std::string("1"));
|
||||
}
|
||||
// check for authorized values
|
||||
// pressure in (0,1]
|
||||
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;
|
||||
ppSelect.second[0] = (string("2"));
|
||||
ppSelect.second[0] = (std::string("2"));
|
||||
}
|
||||
// exponent >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;
|
||||
ppSelect.second[1] = (string("1"));
|
||||
ppSelect.second[1] = (std::string("1"));
|
||||
}
|
||||
// now we're OK
|
||||
eoPerf2Worth<EOT> & p2w = _state.storeFunctor( new eoRanking<EOT>(p,e) );
|
||||
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;
|
||||
if (ppSelect.second.size() == 0) // no argument -> default = ordered
|
||||
{
|
||||
b=true;
|
||||
// put back in parameter for consistency (and status file)
|
||||
ppSelect.second.push_back(string("ordered"));
|
||||
ppSelect.second.push_back(std::string("ordered"));
|
||||
}
|
||||
else
|
||||
b = !(ppSelect.second[0] == string("unordered"));
|
||||
b = !(ppSelect.second[0] == std::string("unordered"));
|
||||
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>;
|
||||
}
|
||||
else if (ppSelect.first == string("Random")) // no argument
|
||||
else if (ppSelect.first == std::string("Random")) // no argument
|
||||
{
|
||||
select = new eoRandomSelect<EOT>;
|
||||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid selection: ") + ppSelect.first;
|
||||
throw runtime_error(stmp.c_str());
|
||||
std::string stmp = std::string("Invalid selection: ") + ppSelect.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
|
||||
_state.storeFunctor(select);
|
||||
|
|
@ -188,62 +188,62 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
// the replacement
|
||||
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 ;
|
||||
if (ppReplace.first == string("Comma")) // Comma == generational
|
||||
if (ppReplace.first == std::string("Comma")) // Comma == generational
|
||||
{
|
||||
replace = new eoCommaReplacement<EOT>;
|
||||
}
|
||||
else if (ppReplace.first == string("Plus"))
|
||||
else if (ppReplace.first == std::string("Plus"))
|
||||
{
|
||||
replace = new eoPlusReplacement<EOT>;
|
||||
}
|
||||
else if (ppReplace.first == string("EPTour"))
|
||||
else if (ppReplace.first == std::string("EPTour"))
|
||||
{
|
||||
unsigned detSize;
|
||||
|
||||
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;
|
||||
// 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)
|
||||
detSize = atoi(ppSelect.second[0].c_str());
|
||||
|
||||
replace = new eoEPReplacement<EOT>(detSize);
|
||||
}
|
||||
else if (ppReplace.first == string("SSGAWorst"))
|
||||
else if (ppReplace.first == std::string("SSGAWorst"))
|
||||
{
|
||||
replace = new eoSSGAWorseReplacement<EOT>;
|
||||
}
|
||||
else if (ppReplace.first == string("SSGADet"))
|
||||
else if (ppReplace.first == std::string("SSGADet"))
|
||||
{
|
||||
unsigned detSize;
|
||||
|
||||
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;
|
||||
// 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)
|
||||
detSize = atoi(ppSelect.second[0].c_str());
|
||||
|
||||
replace = new eoSSGADetTournamentReplacement<EOT>(detSize);
|
||||
}
|
||||
else if (ppReplace.first == string("SSGAStoch"))
|
||||
else if (ppReplace.first == std::string("SSGAStoch"))
|
||||
{
|
||||
double p;
|
||||
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;
|
||||
// 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)
|
||||
p = atof(ppSelect.second[0].c_str());
|
||||
|
|
@ -252,8 +252,8 @@ eoAlgo<EOT> & do_make_algo_scalar(eoParser& _parser, eoState& _state, eoEvalFunc
|
|||
}
|
||||
else
|
||||
{
|
||||
string stmp = string("Invalid replacement: ") + ppReplace.first;
|
||||
throw runtime_error(stmp.c_str());
|
||||
std::string stmp = std::string("Invalid replacement: ") + ppReplace.first;
|
||||
throw std::runtime_error(stmp.c_str());
|
||||
}
|
||||
|
||||
_state.storeFunctor(replace);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
|||
checkpoint->add(*generationCounter);
|
||||
|
||||
// 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
|
||||
eoValueParam<bool>& eraseParam = _parser.createParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
|
||||
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
|
||||
* eoAverageStat : average value in pop - type EOT::Fitness
|
||||
* eoSecondMomentStat: average + stdev - type pair<double, double>
|
||||
* eoSortedPopStat : whole population - type string (!!)
|
||||
* eoScalarFitnessStat: the fitnesses - type vector<double>
|
||||
* eoSecondMomentStat: average + stdev - type std::pair<double, double>
|
||||
* eoSortedPopStat : whole population - type std::string (!!)
|
||||
* eoScalarFitnessStat: the fitnesses - type std::vector<double>
|
||||
*/
|
||||
|
||||
// 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
|
||||
{
|
||||
#ifdef _MSVC
|
||||
string stmp = dirNameParam.value() + "\best.xg";
|
||||
std::string stmp = dirNameParam.value() + "\best.xg";
|
||||
#else
|
||||
string stmp = dirNameParam.value() + "/best.xg";
|
||||
std::string stmp = dirNameParam.value() + "/best.xg";
|
||||
#endif
|
||||
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
|
||||
// save and give to checkpoint
|
||||
|
|
@ -201,7 +201,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
|||
fileMonitor->add(_eval);
|
||||
if (tCounter) // we want the time as well
|
||||
{
|
||||
// cout << "On met timecounter\n";
|
||||
// std::cout << "On met timecounter\n";
|
||||
fileMonitor->add(*tCounter);
|
||||
}
|
||||
fileMonitor->add(*bestStat);
|
||||
|
|
@ -211,7 +211,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
|||
#if !defined(NO_GNUPLOT)
|
||||
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>());
|
||||
// save and give to checkpoint
|
||||
_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
|
||||
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
|
||||
_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);
|
||||
// and of course add it to the checkpoint
|
||||
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 );
|
||||
#ifdef _MSVC
|
||||
string stmp = dirNameParam.value() + "\generations";
|
||||
std::string stmp = dirNameParam.value() + "\generations";
|
||||
#else
|
||||
string stmp = dirNameParam.value() + "/generations";
|
||||
std::string stmp = dirNameParam.value() + "/generations";
|
||||
#endif
|
||||
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
|
||||
_state.storeFunctor(stateSaver1);
|
||||
|
|
@ -277,9 +277,9 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
|||
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
|
||||
|
||||
#ifdef _MSVC
|
||||
string stmp = dirNameParam.value() + "\time";
|
||||
std::string stmp = dirNameParam.value() + "\time";
|
||||
#else
|
||||
string stmp = dirNameParam.value() + "/time";
|
||||
std::string stmp = dirNameParam.value() + "/time";
|
||||
#endif
|
||||
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
|
||||
_state.storeFunctor(stateSaver2);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
|||
_state.storeFunctor(increment);
|
||||
|
||||
// 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
|
||||
eoValueParam<bool>& eraseParam = _parser.createParam(false, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
|
||||
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
|
||||
* eoAverageStat : average value in pop - type EOT::Fitness
|
||||
* eoSecondMomentStat: average + stdev - type pair<double, double>
|
||||
* eoSortedPopStat : whole population - type string (!!)
|
||||
* eoScalarFitnessStat: the fitnesses - type vector<double>
|
||||
* eoSecondMomentStat: average + stdev - type std::pair<double, double>
|
||||
* eoSortedPopStat : whole population - type std::string (!!)
|
||||
* eoScalarFitnessStat: the fitnesses - type std::vector<double>
|
||||
* eoDFCSTat : FDC wrt best in pop or absolute best - type double
|
||||
* requires an eoDistance. See eoFDCStat.h
|
||||
* 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
|
||||
{
|
||||
string stmp = dirNameParam.value() + "/best.xg";
|
||||
std::string stmp = dirNameParam.value() + "/best.xg";
|
||||
eoFileMonitor *fileMonitor = new eoFileMonitor(stmp);
|
||||
// save and give to checkpoint
|
||||
_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
|
||||
{
|
||||
string stmp = dirNameParam.value() + "_gnu_best.xg";
|
||||
std::string stmp = dirNameParam.value() + "_gnu_best.xg";
|
||||
eoGnuplot1DMonitor *gnuMonitor = new eoGnuplot1DMonitor(stmp,minimizing_fitness<EOT>());
|
||||
// save and give to checkpoint
|
||||
_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
|
||||
eoGnuplot1DSnapshot *fitSnapshot = new eoGnuplot1DSnapshot(dirNameParam.value());
|
||||
_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);
|
||||
// and of course add it to the checkpoint
|
||||
checkpoint->add(*fitSnapshot);
|
||||
|
|
@ -271,7 +271,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
|||
dirOK = testDirRes(dirNameParam.value(), eraseParam.value()); // TRUE
|
||||
|
||||
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);
|
||||
_state.storeFunctor(stateSaver1);
|
||||
checkpoint->add(*stateSaver1);
|
||||
|
|
@ -285,7 +285,7 @@ eoCheckPoint<EOT>& do_make_checkpoint(eoParser& _parser, eoState& _state, eoEval
|
|||
if (! dirOK )
|
||||
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);
|
||||
_state.storeFunctor(stateSaver2);
|
||||
checkpoint->add(*stateSaver2);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
|
|||
checkpoint.add(increment);
|
||||
|
||||
// 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
|
||||
eoValueParam<bool>& eraseParam = _parser.createParam(true, "eraseDir", "erase files in dirName if any", '\0', "Output - Disk");
|
||||
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
|
||||
*
|
||||
* 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)
|
||||
bool boolGnuplot = _parser.createParam(false, "plotFront", "Objective plots (requires corresponding files - see frontFileFrequency", '\0', "Output - Graphical").value();
|
||||
#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());
|
||||
if (frequency) // something to plot
|
||||
{
|
||||
unsigned nbPlot = fPlot.second.size();
|
||||
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
|
||||
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
|
||||
{
|
||||
char s[1024];
|
||||
ostrstream os(s, 1022);
|
||||
os << "Obj. " << obj1 << ends;
|
||||
std::ostrstream os(s, 1022);
|
||||
os << "Obj. " << obj1 << std::ends;
|
||||
fStat = new eoMOFitnessStat<EOT>(obj1, s);
|
||||
_state.storeFunctor(fStat);
|
||||
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
|
||||
{
|
||||
char s2[1024];
|
||||
ostrstream os2(s2, 1022);
|
||||
os2 << "Obj. " << obj2 << ends;
|
||||
std::ostrstream os2(s2, 1022);
|
||||
os2 << "Obj. " << obj2 << std::ends;
|
||||
fStat = new eoMOFitnessStat<EOT>(obj2, s2);
|
||||
_state.storeFunctor(fStat);
|
||||
bStat[obj2]=true;
|
||||
|
|
@ -132,8 +132,8 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
|
|||
|
||||
// then the fileSnapshots
|
||||
char s3[1024];
|
||||
ostrstream os3(s3, 1022);
|
||||
os3 << "Front." << obj1 << "." << obj2 << "." << ends;
|
||||
std::ostrstream os3(s3, 1022);
|
||||
os3 << "Front." << obj1 << "." << obj2 << "." << std::ends;
|
||||
eoFileSnapshot & snapshot = _state.storeFunctor(new
|
||||
eoFileSnapshot(dirName, frequency, s3 ) );
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
|
|||
eoSortedPopStat<EOT> * popStat;
|
||||
if ( printPop ) // we do want pop dump
|
||||
{
|
||||
cout << "On cree printpop\n";
|
||||
std::cout << "On cree printpop\n";
|
||||
popStat = & _state.storeFunctor(new eoSortedPopStat<EOT>);
|
||||
// add it to the checkpoint
|
||||
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 );
|
||||
#ifdef _MSVC
|
||||
string stmp = dirName + "\generations";
|
||||
std::string stmp = dirName + "\generations";
|
||||
#else
|
||||
string stmp = dirName + "/generations";
|
||||
std::string stmp = dirName + "/generations";
|
||||
#endif
|
||||
eoCountedStateSaver *stateSaver1 = new eoCountedStateSaver(freq, _state, stmp);
|
||||
_state.storeFunctor(stateSaver1);
|
||||
|
|
@ -223,9 +223,9 @@ eoCheckPoint<EOT>& do_make_checkpoint_pareto(eoParser& _parser, eoState& _state,
|
|||
dirOK = testDirRes(dirName, eraseParam.value()); // TRUE
|
||||
|
||||
#ifdef _MSVC
|
||||
string stmp = dirName + "\time";
|
||||
std::string stmp = dirName + "\time";
|
||||
#else
|
||||
string stmp = dirName + "/time";
|
||||
std::string stmp = dirName + "/time";
|
||||
#endif
|
||||
eoTimedStateSaver *stateSaver2 = new eoTimedStateSaver(saveTimeIntervalParam.value(), _state, stmp);
|
||||
_state.storeFunctor(stateSaver2);
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ eoContinue<Indi> & do_make_continue(eoParser& _parser, eoState& _state, eoEvalFu
|
|||
|
||||
// now check that there is at least one!
|
||||
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
|
||||
_state.storeFunctor(continuator);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ eoContinue<Indi> & do_make_continue_pareto(eoParser& _parser, eoState& _state, e
|
|||
|
||||
// now check that there is at least one!
|
||||
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
|
||||
_state.storeFunctor(continuator);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,64 +47,64 @@ eoReduce<EOT> & decode_reduce(eoParamParamType & _ppReduce, eoState & _state)
|
|||
eoReduce<EOT> * ptReduce;
|
||||
|
||||
// ---------- Deterministic
|
||||
if (_ppReduce.first == string("Deterministic"))
|
||||
if (_ppReduce.first == std::string("Deterministic"))
|
||||
{
|
||||
ptReduce = new eoTruncate<EOT>;
|
||||
}
|
||||
// ---------- EP
|
||||
else if (_ppReduce.first == string("EP"))
|
||||
else if (_ppReduce.first == std::string("EP"))
|
||||
{
|
||||
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;
|
||||
// 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)
|
||||
detSize = atoi(_ppReduce.second[0].c_str());
|
||||
ptReduce = new eoEPReduce<EOT>(detSize);
|
||||
}
|
||||
// ---------- DetTour
|
||||
else if (_ppReduce.first == string("DetTour"))
|
||||
else if (_ppReduce.first == std::string("DetTour"))
|
||||
{
|
||||
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;
|
||||
// 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)
|
||||
detSize = atoi(_ppReduce.second[0].c_str());
|
||||
ptReduce = new eoDetTournamentTruncate<EOT>(detSize);
|
||||
}
|
||||
else if (_ppReduce.first == string("StochTour"))
|
||||
else if (_ppReduce.first == std::string("StochTour"))
|
||||
{
|
||||
double p;
|
||||
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;
|
||||
// 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)
|
||||
{
|
||||
p = atof(_ppReduce.second[0].c_str());
|
||||
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);
|
||||
}
|
||||
else if (_ppReduce.first == string("Uniform"))
|
||||
else if (_ppReduce.first == std::string("Uniform"))
|
||||
{
|
||||
ptReduce = new eoRandomReduce<EOT>;
|
||||
}
|
||||
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
|
||||
_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)
|
||||
* 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
|
||||
* weak - elite patents compete AFTER replacement with best offspring
|
||||
* eoHowMany _surviveParents number of parents after parents recuction
|
||||
|
|
|
|||
|
|
@ -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
|
||||
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" );
|
||||
|
||||
if (loadNameParam.value() != "") // something to load
|
||||
|
|
|
|||
Reference in a new issue