00001
00002
00003
00004
00005
00006
00007 #include <boost/property_tree/ptree.hpp>
00008 using boost::property_tree::ptree;
00009
00010 #include <iostream>
00011 #include <string>
00012 using namespace std;
00013
00014
00015 #ifndef ALGORITHM_HPP_
00016 #define ALGORITHM_HPP_
00017
00030 class Algorithm {
00031 protected:
00033 size_t _maxiter;
00035 string _outputdirname;
00037 size_t _nextID = 1;
00038
00039
00040
00041
00043 vector< vector <size_t> > _parentsOf;
00045 vector< vector <double> > _tracedMeasures;
00046 protected:
00050 virtual void impl_setup(const ptree & all) = 0;
00052 virtual size_t nextID();
00054 void markAsParents(size_t childID, const vector<size_t> & parentIDs);
00056 void traceMeasures(size_t childID, const vector<double> & measures);
00058 void writeParentHistory(ostream & os) const;
00060 void writeTracedMeasures(ostream & os) const;
00061
00062 public:
00064 Algorithm();
00066 virtual void setup(const ptree & all, const string & outputdirname);
00068 virtual void run();
00069 };
00070
00071 #endif