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

@ -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);