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
67 lines
1.1 KiB
C++
67 lines
1.1 KiB
C++
#include <iostream>
|
|
#include <fstream>
|
|
#include <stdexcept>
|
|
|
|
#include <utils/eoFileMonitor.h>
|
|
#include <utils/compatibility.h>
|
|
#include <utils/eoParam.h>
|
|
|
|
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)
|
|
{
|
|
ofstream os(filename.c_str(), ios_base::app);
|
|
|
|
if (!os)
|
|
{
|
|
string str = "eoFileMonitor: Could not append to " + filename;
|
|
throw runtime_error(str);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|