fix new warnings and escape apply namespace
- `std::apply` is part of C++17 and the compiler wants to use it because of ADL. Thus it is now necessary to escape it as `::apply`. - remove some `using namespace std` remaining in the sources. - fix simple warnings.
This commit is contained in:
parent
c95f5607d8
commit
24bc8edd6f
25 changed files with 125 additions and 125 deletions
|
|
@ -84,7 +84,7 @@ int main(int ac, char** av)
|
|||
eoPop< RealVec >& pop = do_make_pop(parser, state, *init);
|
||||
|
||||
// (2) First evaluation before starting the research algorithm
|
||||
apply(eval, pop);
|
||||
::apply(eval, pop);
|
||||
|
||||
// Prepare bounder class to set bounds of sampling.
|
||||
// This is used by edoSampler.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ int main(int ac, char** av)
|
|||
eoPop< EOT >& pop = do_make_pop(parser, state, *init);
|
||||
|
||||
// (2) First evaluation before starting the research algorithm
|
||||
apply(eval, pop);
|
||||
::apply(eval, pop);
|
||||
|
||||
// Prepare bounder class to set bounds of sampling.
|
||||
// This is used by edoSampler.
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class edoDistribReset : public eoAlgoReset<typename D::EOType>
|
|||
_distrib(distrib)
|
||||
{ }
|
||||
|
||||
virtual void operator()( eoPop<EOType>& pop )
|
||||
virtual void operator()( eoPop<EOType>& /*pop*/ )
|
||||
{
|
||||
if(_has_dim) {
|
||||
_distrib.reset(_dim);
|
||||
|
|
|
|||
|
|
@ -1339,7 +1339,7 @@ HIDE_UNDOC_RELATIONS = YES
|
|||
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
|
||||
# have no effect if this option is set to NO (the default)
|
||||
|
||||
HAVE_DOT = NO
|
||||
HAVE_DOT = YES
|
||||
|
||||
# By default doxygen will write a font called FreeSans.ttf to the output
|
||||
# directory and reference it in all dot files that doxygen generates. This
|
||||
|
|
|
|||
|
|
@ -105,10 +105,10 @@ public:
|
|||
virtual void operator() ()
|
||||
{
|
||||
eoPop<POT> empty_pop;
|
||||
apply(proc, pop);
|
||||
::apply(proc, pop);
|
||||
procPara(empty_pop, pop);
|
||||
apply < POT > (initVelo, pop);
|
||||
apply < POT > (initBest, pop);
|
||||
::apply < POT > (initVelo, pop);
|
||||
::apply < POT > (initBest, pop);
|
||||
topology.setup(pop);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public:
|
|||
/**
|
||||
* Prints the neighborhoods contained in the topology.
|
||||
*/
|
||||
virtual void printOn() = 0;
|
||||
// virtual void printOn() = 0; // Already defined in eoPop
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include "eoParam.h"
|
||||
#include "../eoExceptions.h"
|
||||
|
||||
using namespace std;
|
||||
// using namespace std;
|
||||
|
||||
void eoFileMonitor::printHeader(std::ostream& os)
|
||||
{
|
||||
|
|
@ -33,7 +33,7 @@ void eoFileMonitor::printHeader(std::ostream& os)
|
|||
void eoFileMonitor::printHeader()
|
||||
{
|
||||
// create file
|
||||
ofstream os(filename.c_str());
|
||||
std::ofstream os(filename.c_str());
|
||||
|
||||
if (!os)
|
||||
{
|
||||
|
|
@ -46,11 +46,11 @@ void eoFileMonitor::printHeader()
|
|||
|
||||
eoMonitor& eoFileMonitor::operator()(void)
|
||||
{
|
||||
ofstream os(filename.c_str(),
|
||||
std::ofstream os(filename.c_str(),
|
||||
overwrite ?
|
||||
ios_base::out|ios_base::trunc // truncate
|
||||
std::ios_base::out|std::ios_base::trunc // truncate
|
||||
:
|
||||
ios_base::out|ios_base::app // append
|
||||
std::ios_base::out|std::ios_base::app // append
|
||||
);
|
||||
|
||||
if (!os)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ eoIntBounds* eoGeneralIntBounds::getBoundsFromString(std::string _value)
|
|||
}
|
||||
|
||||
// now create the embedded eoIntBounds object
|
||||
eoIntBounds * locBound;
|
||||
eoIntBounds * locBound = nullptr;
|
||||
if (minBounded && maxBounded)
|
||||
{
|
||||
if (maxBound <= minBound)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ Authors:
|
|||
#include "eoLogger.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
// using namespace std;
|
||||
|
||||
std::ostream& printSectionHeader(std::ostream& os, std::string section)
|
||||
{
|
||||
|
|
@ -76,8 +76,8 @@ eoParameterLoader::~eoParameterLoader()
|
|||
}
|
||||
}
|
||||
|
||||
eoParser::eoParser ( unsigned _argc, char **_argv , string _programDescription,
|
||||
string /*_lFileParamName*/, char /*_shortHand*/) :
|
||||
eoParser::eoParser ( unsigned _argc, char **_argv , std::string _programDescription,
|
||||
std::string /*_lFileParamName*/, char /*_shortHand*/) :
|
||||
programName(_argv[0]),
|
||||
programDescription( _programDescription),
|
||||
needHelpMessage( false ),
|
||||
|
|
@ -92,11 +92,11 @@ eoParser::eoParser ( unsigned _argc, char **_argv , string _programDescription,
|
|||
if(_argv[i][0] == '@')
|
||||
{ // read response file
|
||||
char *pts = _argv[i]+1; // yes a char*, sorry :-)
|
||||
ifstream ifs (pts);
|
||||
std::ifstream ifs (pts);
|
||||
ifs.peek(); // check if it exists
|
||||
if (!ifs)
|
||||
{
|
||||
// string msg = string("Could not open response file: ") + pts;
|
||||
// std::string msg = std::string("Could not open response file: ") + pts;
|
||||
throw eoFileError(pts);
|
||||
}
|
||||
// read - will be overwritten by command-line
|
||||
|
|
@ -105,7 +105,7 @@ eoParser::eoParser ( unsigned _argc, char **_argv , string _programDescription,
|
|||
}
|
||||
}
|
||||
// now read arguments on command-line
|
||||
stringstream stream;
|
||||
std::stringstream stream;
|
||||
for (i = 1; i < _argc; ++i)
|
||||
{
|
||||
stream << _argv[i] << '\n';
|
||||
|
|
@ -159,24 +159,24 @@ void eoParser::doRegisterParam(eoParam& param)
|
|||
{
|
||||
if (param.required() && !isItThere(param))
|
||||
{
|
||||
string msg = "Required parameter: " + param.longName() + " missing";
|
||||
std::string msg = "Required parameter: " + param.longName() + " missing";
|
||||
needHelpMessage = true;
|
||||
messages.push_back(msg);
|
||||
}
|
||||
pair<bool, string> value = getValue(param);
|
||||
std::pair<bool, std::string> value = getValue(param);
|
||||
if (value.first)
|
||||
{
|
||||
param.setValue(value.second);
|
||||
}
|
||||
}
|
||||
|
||||
pair<bool, string> eoParser::getValue(eoParam& _param) const
|
||||
std::pair<bool, std::string> eoParser::getValue(eoParam& _param) const
|
||||
{
|
||||
pair<bool, string> result(false, "");
|
||||
std::pair<bool, std::string> result(false, "");
|
||||
|
||||
if (_param.shortName() != 0)
|
||||
{
|
||||
map<char, string>::const_iterator it = shortNameMap.find(_param.shortName());
|
||||
std::map<char, std::string>::const_iterator it = shortNameMap.find(_param.shortName());
|
||||
if (it != shortNameMap.end())
|
||||
{
|
||||
result.second = it->second;
|
||||
|
|
@ -184,7 +184,7 @@ pair<bool, string> eoParser::getValue(eoParam& _param) const
|
|||
return result;
|
||||
}
|
||||
}
|
||||
map<string, string>::const_iterator it = longNameMap.find(_param.longName());
|
||||
std::map<std::string, std::string>::const_iterator it = longNameMap.find(_param.longName());
|
||||
if (it != longNameMap.end())
|
||||
{
|
||||
result.second = it->second;
|
||||
|
|
@ -205,21 +205,21 @@ void eoParser::updateParameters()
|
|||
}
|
||||
}
|
||||
|
||||
void eoParser::readFrom(istream& is)
|
||||
void eoParser::readFrom(std::istream& is)
|
||||
{
|
||||
string str;
|
||||
std::string str;
|
||||
// we must avoid processing \section{xxx} if xxx is NOT "Parser"
|
||||
bool processing = true;
|
||||
while (is >> str)
|
||||
{
|
||||
if (str.find(string("\\section{"))==0) // found section begin
|
||||
processing = (str.find(string("Parser"))<str.size());
|
||||
if (str.find(std::string("\\section{"))==0) // found section begin
|
||||
processing = (str.find(std::string("Parser"))<str.size());
|
||||
|
||||
if (processing) // right \section (or no \section at all)
|
||||
{
|
||||
if (str[0] == '#')
|
||||
{ // skip the rest of the line
|
||||
string tempStr;
|
||||
std::string tempStr;
|
||||
getline(is, tempStr);
|
||||
}
|
||||
if (str[0] == '-')
|
||||
|
|
@ -233,35 +233,35 @@ void eoParser::readFrom(istream& is)
|
|||
|
||||
if (str[1] == '-') // two consecutive dashes
|
||||
{
|
||||
string::iterator equalLocation = find(str.begin() + 2, str.end(), '=');
|
||||
string value;
|
||||
std::string::iterator equalLocation = find(str.begin() + 2, str.end(), '=');
|
||||
std::string value;
|
||||
|
||||
if (equalLocation == str.end())
|
||||
{ //! @todo it should be the next string
|
||||
{ //! @todo it should be the next std::string
|
||||
value = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
value = string(equalLocation + 1, str.end());
|
||||
value = std::string(equalLocation + 1, str.end());
|
||||
}
|
||||
|
||||
string name(str.begin() + 2, equalLocation);
|
||||
std::string name(str.begin() + 2, equalLocation);
|
||||
longNameMap[name] = value;
|
||||
}
|
||||
else // it should be a char
|
||||
{
|
||||
string value = "1"; // flags do not need a special
|
||||
std::string value = "1"; // flags do not need a special
|
||||
|
||||
if (str.size() >= 2)
|
||||
{
|
||||
if (str[2] == '=')
|
||||
{
|
||||
if (str.size() >= 3)
|
||||
value = string(str.begin() + 3, str.end());
|
||||
value = std::string(str.begin() + 3, str.end());
|
||||
}
|
||||
else
|
||||
{
|
||||
value = string(str.begin() + 2, str.end());
|
||||
value = std::string(str.begin() + 2, str.end());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ void eoParser::readFrom(istream& is)
|
|||
updateParameters();
|
||||
}
|
||||
|
||||
void eoParser::printOn(ostream& os) const
|
||||
void eoParser::printOn(std::ostream& os) const
|
||||
{
|
||||
typedef MultiMapType::const_iterator It;
|
||||
|
||||
|
|
@ -299,12 +299,12 @@ void eoParser::printOn(ostream& os) const
|
|||
if (!isItThere(*param)) // comment out the ones not set by the user
|
||||
os << "# ";
|
||||
|
||||
string str = "--" + param->longName() + "=" + param->getValue();
|
||||
std::string str = "--" + param->longName() + "=" + param->getValue();
|
||||
|
||||
os.setf(ios_base::left, ios_base::adjustfield);
|
||||
os << setfill(' ') << setw(40) << str;
|
||||
os.setf(std::ios_base::left, std::ios_base::adjustfield);
|
||||
os << std::setfill(' ') << std::setw(40) << str;
|
||||
|
||||
os << setw(0) << " # ";
|
||||
os << std::setw(0) << " # ";
|
||||
if (param->shortName())
|
||||
os << '-' << param->shortName() << " : ";
|
||||
os << param->description();
|
||||
|
|
@ -318,11 +318,11 @@ void eoParser::printOn(ostream& os) const
|
|||
}
|
||||
}
|
||||
|
||||
void eoParser::printHelp(ostream& os)
|
||||
void eoParser::printHelp(std::ostream& os)
|
||||
{
|
||||
if (needHelp.value() == false && !messages.empty())
|
||||
{
|
||||
std::copy(messages.begin(), messages.end(), ostream_iterator<string>(os, "\n"));
|
||||
std::copy(messages.begin(), messages.end(), std::ostream_iterator<std::string>(os, "\n"));
|
||||
messages.clear();
|
||||
return;
|
||||
}
|
||||
|
|
@ -333,9 +333,9 @@ void eoParser::printHelp(ostream& os)
|
|||
// print the usage when calling the program from the command line
|
||||
os << "Usage: "<< programName<<" [Options]\n";
|
||||
// only short usage!
|
||||
os << "Options of the form \"-f[=Value]\" or \"--Name[=value]\"" << endl;
|
||||
os << "Options of the form \"-f[=Value]\" or \"--Name[=value]\"" << std::endl;
|
||||
|
||||
os << "Where:"<<endl;
|
||||
os << "Where:"<< std::endl;
|
||||
|
||||
typedef MultiMapType::const_iterator It;
|
||||
|
||||
|
|
@ -383,7 +383,7 @@ bool eoParser::userNeedsHelp(void)
|
|||
// search for unknown long names
|
||||
for (LongNameMapType::const_iterator lIt = longNameMap.begin(); lIt != longNameMap.end(); ++lIt)
|
||||
{
|
||||
string entry = lIt->first;
|
||||
std::string entry = lIt->first;
|
||||
|
||||
MultiMapType::const_iterator it;
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ bool eoParser::userNeedsHelp(void)
|
|||
|
||||
if (it == params.end())
|
||||
{
|
||||
string msg = "Unknown parameter: --" + entry + " entered";
|
||||
std::string msg = "Unknown parameter: --" + entry + " entered";
|
||||
needHelpMessage = true;
|
||||
messages.push_back(msg);
|
||||
}
|
||||
|
|
@ -420,15 +420,15 @@ bool eoParser::userNeedsHelp(void)
|
|||
|
||||
if (it == params.end())
|
||||
{
|
||||
string entryString(1, entry);
|
||||
string msg = "Unknown parameter: -" + entryString + " entered";
|
||||
std::string entryString(1, entry);
|
||||
std::string msg = "Unknown parameter: -" + entryString + " entered";
|
||||
needHelpMessage = true;
|
||||
messages.push_back(msg);
|
||||
}
|
||||
} // for sIt
|
||||
|
||||
if( needHelpMessage ) {
|
||||
string msg = "Use -h or --help to get help about available parameters";
|
||||
std::string msg = "Use -h or --help to get help about available parameters";
|
||||
messages.push_back( msg );
|
||||
}
|
||||
|
||||
|
|
@ -438,13 +438,13 @@ bool eoParser::userNeedsHelp(void)
|
|||
}
|
||||
|
||||
///////////////// I put these here at the moment
|
||||
ostream & operator<<(ostream & _os, const eoParamParamType & _rate)
|
||||
std::ostream & operator<<(std::ostream & _os, const eoParamParamType & _rate)
|
||||
{
|
||||
_rate.printOn(_os);
|
||||
return _os;
|
||||
}
|
||||
|
||||
istream & operator>>(istream & _is, eoParamParamType & _rate)
|
||||
std::istream & operator>>(std::istream & _is, eoParamParamType & _rate)
|
||||
{
|
||||
_rate.readFrom(_is);
|
||||
return _is;
|
||||
|
|
|
|||
|
|
@ -14,31 +14,31 @@
|
|||
#include "../eoObject.h"
|
||||
#include "../eoPersistent.h"
|
||||
|
||||
using namespace std;
|
||||
// using namespace std;
|
||||
|
||||
|
||||
|
||||
void eoState::removeComment(string& str, string comment)
|
||||
void eoState::removeComment(std::string& str, std::string comment)
|
||||
{
|
||||
string::size_type pos = str.find(comment);
|
||||
std::string::size_type pos = str.find(comment);
|
||||
|
||||
if (pos != string::npos)
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
str.erase(pos, str.size());
|
||||
}
|
||||
}
|
||||
|
||||
bool eoState::is_section(const string& str, string& name)
|
||||
bool eoState::is_section(const std::string& str, std::string& name)
|
||||
{
|
||||
string::size_type pos = str.find(_tag_section_so);
|
||||
std::string::size_type pos = str.find(_tag_section_so);
|
||||
|
||||
if (pos == string::npos)
|
||||
if (pos == std::string::npos)
|
||||
return false;
|
||||
//else
|
||||
|
||||
string::size_type end = str.find(_tag_section_sc);
|
||||
std::string::size_type end = str.find(_tag_section_sc);
|
||||
|
||||
if (end == string::npos)
|
||||
if (end == std::string::npos)
|
||||
return false;
|
||||
// else
|
||||
|
||||
|
|
@ -59,9 +59,9 @@ eoState::~eoState(void)
|
|||
|
||||
void eoState::registerObject(eoPersistent& registrant)
|
||||
{
|
||||
string name = createObjectName(dynamic_cast<eoObject*>(®istrant));
|
||||
std::string name = createObjectName(dynamic_cast<eoObject*>(®istrant));
|
||||
|
||||
pair<ObjectMap::iterator,bool> res = objectMap.insert(make_pair(name, ®istrant));
|
||||
std::pair<ObjectMap::iterator,bool> res = objectMap.insert(make_pair(name, ®istrant));
|
||||
|
||||
if (res.second == true)
|
||||
{
|
||||
|
|
@ -73,13 +73,13 @@ void eoState::registerObject(eoPersistent& registrant)
|
|||
}
|
||||
}
|
||||
|
||||
void eoState::load(const string& _filename)
|
||||
void eoState::load(const std::string& _filename)
|
||||
{
|
||||
ifstream is (_filename.c_str());
|
||||
std::ifstream is (_filename.c_str());
|
||||
|
||||
if (!is)
|
||||
{
|
||||
// string str = "Could not open file " + _filename;
|
||||
// std::string str = "Could not open file " + _filename;
|
||||
throw eoFileError(_filename);
|
||||
}
|
||||
|
||||
|
|
@ -89,14 +89,14 @@ void eoState::load(const string& _filename)
|
|||
// FIXME implement parsing and loading of other formats
|
||||
void eoState::load(std::istream& is)
|
||||
{
|
||||
string str;
|
||||
string name;
|
||||
std::string str;
|
||||
std::string name;
|
||||
|
||||
getline(is, str);
|
||||
|
||||
if (is.fail())
|
||||
{
|
||||
// string str = "Error while reading stream";
|
||||
// std::string str = "Error while reading stream";
|
||||
throw eoFileError("stream");
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ void eoState::load(std::istream& is)
|
|||
{ // parse section header
|
||||
if (is_section(str, name))
|
||||
{
|
||||
string fullString;
|
||||
std::string fullString;
|
||||
ObjectMap::iterator it = objectMap.find(name);
|
||||
|
||||
if (it == objectMap.end())
|
||||
|
|
@ -122,7 +122,7 @@ void eoState::load(std::istream& is)
|
|||
|
||||
// now we have the object, get lines, remove comments etc.
|
||||
|
||||
string fullstring;
|
||||
std::string fullstring;
|
||||
|
||||
while (getline(is, str))
|
||||
{
|
||||
|
|
@ -134,7 +134,7 @@ void eoState::load(std::istream& is)
|
|||
removeComment(str, getCommentString());
|
||||
fullstring += str + "\n";
|
||||
}
|
||||
istringstream the_stream(fullstring);
|
||||
std::istringstream the_stream(fullstring);
|
||||
object->readFrom(the_stream);
|
||||
}
|
||||
}
|
||||
|
|
@ -148,13 +148,13 @@ void eoState::load(std::istream& is)
|
|||
|
||||
}
|
||||
|
||||
void eoState::save(const string& filename) const
|
||||
void eoState::save(const std::string& filename) const
|
||||
{ // saves in order of insertion
|
||||
ofstream os(filename.c_str());
|
||||
std::ofstream os(filename.c_str());
|
||||
|
||||
if (!os)
|
||||
{
|
||||
// string msg = "Could not open file: " + filename + " for writing!";
|
||||
// std::string msg = "Could not open file: " + filename + " for writing!";
|
||||
throw eoFileError(filename);
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ void eoState::save(const string& filename) const
|
|||
|
||||
//void eoState::save(std::ostream& os) const
|
||||
//{ // saves in order of insertion
|
||||
// for (vector<ObjectMap::iterator>::const_iterator it = creationOrder.begin(); it != creationOrder.end(); ++it)
|
||||
// for (std::vector<ObjectMap::iterator>::const_iterator it = creationOrder.begin(); it != creationOrder.end(); ++it)
|
||||
// {
|
||||
// os << "\\section{" << (*it)->first << "}\n";
|
||||
// (*it)->second->printOn(os);
|
||||
|
|
@ -171,7 +171,7 @@ void eoState::save(const string& filename) const
|
|||
// }
|
||||
//}
|
||||
|
||||
void eoState::saveSection( std::ostream& os, vector<ObjectMap::iterator>::const_iterator it) const
|
||||
void eoState::saveSection( std::ostream& os, std::vector<ObjectMap::iterator>::const_iterator it) const
|
||||
{
|
||||
os << _tag_section_so << (*it)->first << _tag_section_sc;
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ void eoState::save(std::ostream& os) const
|
|||
// save the first section
|
||||
assert( creationOrder.size() > 0 );
|
||||
// saves in order of insertion
|
||||
vector<ObjectMap::iterator>::const_iterator it = creationOrder.begin();
|
||||
std::vector<ObjectMap::iterator>::const_iterator it = creationOrder.begin();
|
||||
saveSection(os,it);
|
||||
it++;
|
||||
|
||||
|
|
@ -204,23 +204,23 @@ void eoState::save(std::ostream& os) const
|
|||
}
|
||||
|
||||
|
||||
string eoState::createObjectName(eoObject* obj)
|
||||
std::string eoState::createObjectName(eoObject* obj)
|
||||
{
|
||||
if (obj == 0)
|
||||
{
|
||||
ostringstream os;
|
||||
std::ostringstream os;
|
||||
os << objectMap.size();
|
||||
return os.str();
|
||||
}
|
||||
// else
|
||||
|
||||
string name = obj->className();
|
||||
std::string name = obj->className();
|
||||
ObjectMap::const_iterator it = objectMap.find(name);
|
||||
|
||||
unsigned count = 1;
|
||||
while (it != objectMap.end())
|
||||
{
|
||||
ostringstream os;
|
||||
std::ostringstream os;
|
||||
os << obj->className().c_str() << count++;
|
||||
name = os.str();
|
||||
it = objectMap.find(name);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include "eoParser.h"
|
||||
|
||||
using namespace std;
|
||||
// using namespace std;
|
||||
|
||||
/** Generation of the status file, and output of the help message if needed
|
||||
*
|
||||
|
|
@ -47,24 +47,24 @@ using namespace std;
|
|||
void make_help(eoParser & _parser, bool exit_after)
|
||||
{
|
||||
// name of the "status" file where all actual parameter values will be saved
|
||||
string str_status = _parser.ProgramName() + ".status"; // default value
|
||||
eoValueParam<string>& statusParam = _parser.createParam(str_status, "status","Status file",'\0', "Persistence" );
|
||||
std::string str_status = _parser.ProgramName() + ".status"; // default value
|
||||
eoValueParam<std::string>& statusParam = _parser.createParam(str_status, "status","Status file",'\0', "Persistence" );
|
||||
|
||||
// dump status file BEFORE help, so the user gets a chance to use it:
|
||||
// it's probably the case where she/he needs it most!!!
|
||||
// Only help parameter will not be in status file - but who cares???
|
||||
if (statusParam.value() != "")
|
||||
{
|
||||
ofstream os(statusParam.value().c_str());
|
||||
std::ofstream os(statusParam.value().c_str());
|
||||
os << _parser; // and you can use that file as parameter file
|
||||
}
|
||||
// do the following AFTER ALL PARAMETERS HAVE BEEN PROCESSED
|
||||
// i.e. in case you need parameters somewhere else, postpone these
|
||||
if (_parser.userNeedsHelp())
|
||||
{
|
||||
_parser.printHelp(cout);
|
||||
cout << "You can use an edited copy of file " << statusParam.value()
|
||||
<< " as parameter file" << endl;
|
||||
_parser.printHelp(std::cout);
|
||||
std::cout << "You can use an edited copy of file " << statusParam.value()
|
||||
<< " as parameter file" << std::endl;
|
||||
if(exit_after) {
|
||||
exit(0);
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ void make_help(eoParser & _parser, bool exit_after)
|
|||
*/
|
||||
bool testDirRes(std::string _dirName, bool _erase=true)
|
||||
{
|
||||
string s = "test -d " + _dirName;
|
||||
std::string s = "test -d " + _dirName;
|
||||
int res = system(s.c_str());
|
||||
// test for (unlikely) errors
|
||||
if ( (res==-1) || (res==127) )
|
||||
|
|
@ -91,7 +91,7 @@ bool testDirRes(std::string _dirName, bool _erase=true)
|
|||
// now make sure there is a dir without any file in it - or quit
|
||||
if (res) // no dir present
|
||||
{
|
||||
s = string("mkdir ")+ _dirName;
|
||||
s = std::string("mkdir ")+ _dirName;
|
||||
int res = system(s.c_str());
|
||||
(void)res;
|
||||
return true;
|
||||
|
|
@ -99,7 +99,7 @@ bool testDirRes(std::string _dirName, bool _erase=true)
|
|||
// else
|
||||
if (_erase) // OK to erase
|
||||
{
|
||||
s = string("/bin/rm ")+ _dirName + "/*";
|
||||
s = std::string("/bin/rm ")+ _dirName + "/*";
|
||||
int res = system(s.c_str());
|
||||
(void)res;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ int main_function(int argc, char **argv)
|
|||
eoFirstIsBestInit < Indi > localInit;
|
||||
eoPop < Indi > pop;
|
||||
pop.append (POP_SIZE, random);
|
||||
apply(eval, pop);
|
||||
apply < Indi > (veloRandom, pop);
|
||||
apply < Indi > (localInit, pop);
|
||||
::apply(eval, pop);
|
||||
::apply < Indi > (veloRandom, pop);
|
||||
::apply < Indi > (localInit, pop);
|
||||
eoRingTopology<Indi> topology(NEIGHBORHOOD_SIZE);
|
||||
topology.setup(pop);
|
||||
std::cout<<"\n\n\nPopulation :\n\n"<<pop;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ int main(int /*argc*/, char** /*argv*/)
|
|||
|
||||
eoPop<EOT> pop;
|
||||
pop.append(pop_size, init);
|
||||
apply(eval,pop);
|
||||
::apply(eval,pop);
|
||||
|
||||
algo(pop);
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ double binary_value(const Indi & _indi)
|
|||
}
|
||||
// GENERAL
|
||||
//-----------------------------------------------------------------------------
|
||||
void main_function(int argc, char **argv)
|
||||
void main_function(int /*argc*/, char **/*argv*/)
|
||||
{
|
||||
// PARAMETRES
|
||||
// all parameters are hard-coded!
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ double real_value(const Indi & _indi)
|
|||
}
|
||||
// GENERAL
|
||||
//-----------------------------------------------------------------------------
|
||||
void main_function(int argc, char **argv)
|
||||
void main_function(int /*argc*/, char **/*argv*/)
|
||||
{
|
||||
// PARAMETRES
|
||||
// all parameters are hard-coded!
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ double binary_value(const Indi & _indi)
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void main_function(int argc, char **argv)
|
||||
void main_function(int /*argc*/, char **/*argv*/)
|
||||
{
|
||||
const unsigned int SEED = 42; // seed for random number generator
|
||||
const unsigned int VEC_SIZE = 8; // Number of bits in genotypes
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ using namespace std;
|
|||
// GENERAL
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void main_function(int argc, char **argv)
|
||||
void main_function(int /*argc*/, char **/*argv*/)
|
||||
{
|
||||
// PARAMETRES
|
||||
const unsigned int SEED = 42; // seed for random number generator
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ typedef eoBit<double> Indi; // A bitstring with fitness double
|
|||
|
||||
using namespace std;
|
||||
|
||||
void main_function(int argc, char **argv)
|
||||
void main_function(int /*argc*/, char **/*argv*/)
|
||||
{
|
||||
// PARAMETRES
|
||||
const unsigned int SEED = 42; // seed for random number generator
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
* modifies the parent
|
||||
* @param _genotype The parent genotype (will be modified)
|
||||
*/
|
||||
bool operator()(GenotypeT & _genotype)
|
||||
bool operator()(GenotypeT & /*_genotype*/)
|
||||
{
|
||||
bool isModified(true);
|
||||
// START code for mutation of the _genotype object
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
* @param _genotype1 The first parent
|
||||
* @param _genotype2 The second parent
|
||||
*/
|
||||
bool operator()(GenotypeT& _genotype1, GenotypeT & _genotype2)
|
||||
bool operator()(GenotypeT& /*_genotype1*/, GenotypeT & /*_genotype2*/)
|
||||
{
|
||||
bool oneAtLeastIsModified(true);
|
||||
// START code for crossover of _genotype1 and _genotype2 objects
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
*/
|
||||
|
||||
template <class EOT>
|
||||
eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EOT>& _init)
|
||||
eoGenOp<EOT> & do_make_op(eoParameterLoader& _parser, eoState& _state, eoInit<EOT>& /*_init*/)
|
||||
{
|
||||
// this is a temporary version, while Maarten codes the full tree-structured
|
||||
// general operator input
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include <eo>
|
||||
|
||||
// Use functions from namespace std
|
||||
using namespace std;
|
||||
// using namespace std; // Do not do this, this shadows EO's `apply` function.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef eoMinimizingFitness FitT;
|
||||
|
|
@ -33,7 +33,7 @@ FitT real_value (const Particle & _particle)
|
|||
|
||||
|
||||
|
||||
void main_function(int argc, char **argv)
|
||||
void main_function(int /*argc*/, char **/*argv*/)
|
||||
{
|
||||
// PARAMETRES
|
||||
// all parameters are hard-coded!
|
||||
|
|
@ -114,9 +114,9 @@ void main_function(int argc, char **argv)
|
|||
pop.sort();
|
||||
|
||||
// Print (sorted) the initial population (raw printout)
|
||||
cout << "INITIAL POPULATION:" << endl;
|
||||
std::cout << "INITIAL POPULATION:" << std::endl;
|
||||
for (unsigned i = 0; i < pop.size(); ++i)
|
||||
cout << "\t best fit=" << pop[i] << endl;
|
||||
std::cout << "\t best fit=" << pop[i] << std::endl;
|
||||
|
||||
|
||||
///////////////
|
||||
|
|
@ -158,9 +158,9 @@ void main_function(int argc, char **argv)
|
|||
// OUTPUT
|
||||
// Print (sorted) intial population
|
||||
pop.sort();
|
||||
cout << "FINAL POPULATION:" << endl;
|
||||
std::clog << "FINAL POPULATION:" << std::endl;
|
||||
for (unsigned i = 0; i < pop.size(); ++i)
|
||||
cout << "\t best fit=" << pop[i] << endl;
|
||||
std::clog << "\t best fit=" << pop[i] << std::endl;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -173,9 +173,9 @@ int main(int argc, char **argv)
|
|||
{
|
||||
main_function(argc, argv);
|
||||
}
|
||||
catch(exception& e)
|
||||
catch(std::exception& e)
|
||||
{
|
||||
cout << "Exception: " << e.what() << '\n';
|
||||
std::cerr << "Exception: " << e.what() << '\n';
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -45,25 +45,25 @@ FlowShopBenchmarkParser::FlowShopBenchmarkParser(const std::string _benchmarkFil
|
|||
}
|
||||
|
||||
|
||||
const unsigned int FlowShopBenchmarkParser::getM()
|
||||
unsigned int FlowShopBenchmarkParser::getM()
|
||||
{
|
||||
return M;
|
||||
}
|
||||
|
||||
|
||||
const unsigned int FlowShopBenchmarkParser::getN()
|
||||
unsigned int FlowShopBenchmarkParser::getN()
|
||||
{
|
||||
return N;
|
||||
}
|
||||
|
||||
|
||||
const std::vector< std::vector<unsigned int> > FlowShopBenchmarkParser::getP()
|
||||
std::vector< std::vector<unsigned int> > FlowShopBenchmarkParser::getP()
|
||||
{
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<unsigned int> FlowShopBenchmarkParser::getD()
|
||||
std::vector<unsigned int> FlowShopBenchmarkParser::getD()
|
||||
{
|
||||
return d;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,25 +60,25 @@ class FlowShopBenchmarkParser
|
|||
/**
|
||||
* the number of machines
|
||||
*/
|
||||
const unsigned int getM();
|
||||
unsigned int getM();
|
||||
|
||||
|
||||
/**
|
||||
* the number of jobs
|
||||
*/
|
||||
const unsigned int getN();
|
||||
unsigned int getN();
|
||||
|
||||
|
||||
/**
|
||||
* the processing times
|
||||
*/
|
||||
const std::vector < std::vector < unsigned int > > getP();
|
||||
std::vector < std::vector < unsigned int > > getP();
|
||||
|
||||
|
||||
/**
|
||||
* the due-dates
|
||||
*/
|
||||
const std::vector < unsigned int > getD();
|
||||
std::vector < unsigned int > getD();
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@
|
|||
#include <FlowShopObjectiveVectorTraits.h>
|
||||
|
||||
|
||||
bool FlowShopObjectiveVectorTraits::minimizing (int _i)
|
||||
bool FlowShopObjectiveVectorTraits::minimizing (int /*_i*/)
|
||||
{
|
||||
// minimizing both
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FlowShopObjectiveVectorTraits::maximizing (int _i)
|
||||
bool FlowShopObjectiveVectorTraits::maximizing (int /*_i*/)
|
||||
{
|
||||
// minimizing both
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue