eo: added some missing entries

Pop: error in nth_element_fitness
sga: error in eval
eoParseTree: oddities with gcc
checkpointing: added eoParser and eoState
eoParser: support for wrongly entered parameter names
rnd_generators: flip(0.5) -> flip(bias) in binary_generator
selectors.h: ???
This commit is contained in:
mac 2000-09-09 13:43:31 +00:00
commit fd8a2529a5
10 changed files with 77 additions and 25 deletions

View file

@ -63,7 +63,7 @@ void eoParser::doRegisterParam(eoParam& param) const
{
if (param.required() && !isItThere(param))
{
string msg = "required parameter: " + param.longName() + " missing";
string msg = "Required parameter: " + param.longName() + " missing";
messages.push_back(msg);
}
@ -274,3 +274,56 @@ void eoParser::printHelp(ostream& os)
os << '\n';
}
bool eoParser::userNeedsHelp(void)
{
/*
check whether there are long or short names entered
without a corresponding parameter
*/
for (LongNameMapType::const_iterator lIt = longNameMap.begin(); lIt != longNameMap.end(); ++lIt)
{
string entry = lIt->first;
MultiMapType::const_iterator it;
for (it = params.begin(); it != params.end(); ++it)
{
if (entry == it->second->longName())
{
break;
}
}
if (it == params.end())
{
string msg = "Unknown parameter: --" + entry + " entered, type -h or --help to see available parameters";
messages.push_back(msg);
}
}
for (ShortNameMapType::const_iterator sIt = shortNameMap.begin(); sIt != shortNameMap.end(); ++sIt)
{
char entry = sIt->first;
MultiMapType::const_iterator it;
for (it = params.begin(); it != params.end(); ++it)
{
if (entry == it->second->shortName())
{
break;
}
}
if (it == params.end())
{
string entryString(1, entry);
string msg = "Unknown parameter: -" + entryString + " entered, type -h or --help to see available parameters";
messages.push_back(msg);
}
}
return needHelp.value() || !messages.empty();
}