EvolvingObjects
eoFileSnapshot Class Reference

Prints snapshots of fitnesses to a (new) file every N generations. More...

#include <eoFileSnapshot.h>

Inheritance diagram for eoFileSnapshot:
eoMonitor eoF< eoMonitor & > eoFunctorBase eoFDCFileSnapshot< EOT > eoGnuplot1DSnapshot

List of all members.

Public Types

typedef std::vector< double > vDouble
typedef eoValueParam
< std::vector< double > > 
vDoubleParam

Public Member Functions

 eoFileSnapshot (std::string _dirname, unsigned _frequency=1, std::string _filename="gen", std::string _delim=" ", unsigned _counter=0, bool _rmFiles=true)
virtual bool hasChanged ()
 accessor: has something changed (for gnuplot subclass)
unsigned getCounter ()
 accessor to the counter: needed by the gnuplot subclass
std::string getFileName ()
 accessor to the current filename: needed by the gnuplot subclass
void setCurrentFileName ()
 sets the current filename depending on the counter
eoMonitoroperator() (void)
 The operator(void): opens the std::ostream and calls the write method.
eoMonitoroperator() (std::ostream &_os)
 The operator(): write on an std::ostream.
virtual const std::string getDirName ()
virtual const std::string baseFileName ()
void add (const eoParam &_param)
 add checks whether it is a std::vector of doubles

Private Attributes

std::string dirname
unsigned frequency
std::string filename
std::string delim
unsigned int counter
std::string currentFileName
bool boolChanged

Detailed Description

Prints snapshots of fitnesses to a (new) file every N generations.

Assumes that the parameters that are passed to the monitor (method add in eoMonitor.h) are eoValueParam<std::vector<double> > of same size.

A dir is created and one file per snapshot is created there - so you can later generate a movie!

Todo:
The counter is handled internally, but this should be changed so that you can pass e.g. an evalcounter (minor)

I failed to templatize everything so that it can handle eoParam<std::vector<T> > for any type T, simply calling their getValue method ...

Definition at line 54 of file eoFileSnapshot.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Friends