eoCounter?

eoEasyEA -- made it copyable again
eoEvalFunc -- added specialized eoEvalFuncCounter
eoEvolutionStrategy -- nothing much
eoGenContinue -- nothing
eoPop -- fixed nth_element_fitness
eoBitOp -- fixed error in xover
eoFileMonitor -- now appends always
eoParam -- worked around memory leak in MSC's strstream
eoParser -- changed -pconfig_file to @config_file
eoParser -- added messages instead of exception when required param is missing
eoStat -- added eoDistanceStat
t-eoFunctor -- don't know
This commit is contained in:
mac 2000-08-23 12:03:01 +00:00
commit ff108477c3
16 changed files with 222 additions and 83 deletions

View file

@ -8,34 +8,37 @@
using namespace std;
void eoFileMonitor::printHeader(std::ostream& os)
{
iterator it = vec.begin();
os << (*it)->longName();
++it;
for (; it != vec.end(); ++it)
{
os << ',' << (*it)->longName();
}
os << '\n';
}
void eoFileMonitor::printHeader()
{
// create file
ofstream os(filename.c_str());
if (!os)
{
string str = "eoFileMonitor: Could not open " + filename;
throw runtime_error(str);
}
printHeader(os);
}
eoMonitor& eoFileMonitor::operator()(void)
{
if (firsttime)
{
firsttime = false;
// create file
ofstream os(filename.c_str());
if (!os)
{
string str = "eoFileMonitor: Could not open " + filename;
throw runtime_error(str);
}
iterator it = vec.begin();
os << (*it)->longName();
++it;
for (; it != vec.end(); ++it)
{
os << ',' << (*it)->longName();
}
}
// ok, now the real saving. append to file
ofstream os(filename.c_str(), ios_base::app);
if (!os)
@ -44,15 +47,21 @@ eoMonitor& eoFileMonitor::operator()(void)
throw runtime_error(str);
}
iterator it = vec.begin();
os << '\n' << (*it)->getValue();
return operator()(os);
}
eoMonitor& eoFileMonitor::operator()(std::ostream& os)
{
iterator it = vec.begin();
os << (*it)->getValue();
for(++it; it != vec.end(); ++it)
{
os << ',' << (*it)->getValue();
}
os << '\n';
return *this;
}