#include "Algorithm.hpp" #include using boost::property_tree::ptree; using namespace std; Algorithm::Algorithm(){_maxiter=0; _outputdirname="./";} size_t Algorithm::nextID(){return _nextID++;} /* * We grow the parent trace dynamically, when needed, and use only * indices from 1.. so that a zero-length vector resides at * _parentOf[0]. */ void Algorithm::markAsParents(size_t childID, const vector & parentIDs){ if (_parentsOf.size() < (childID+1)){ _parentsOf.resize(childID+1); } _parentsOf[childID] = parentIDs; } /* * We grow the trace dynamically, when needed, and use only * indices from 1.. so that a zero-length vector resides at * _tracedMeasures[0]. */ void Algorithm::traceMeasures(size_t childID, const vector & measures){ if (_tracedMeasures.size() < (childID+1)) { _tracedMeasures.resize(childID+1); } _tracedMeasures[childID] = measures; } void Algorithm::writeParentHistory(ostream & os) const { for (size_t i=0; i<_parentsOf.size(); ++i){ os << i; for (const auto & id : _parentsOf[i]) os << " " << id; os << endl; } } void Algorithm::writeTracedMeasures(ostream & os) const { for (size_t i=0; i < _tracedMeasures.size(); ++i){ const vector & tr = _tracedMeasures[i]; os << i; for (auto d : tr) os << " " << d; os << endl; } } void Algorithm::setup(const ptree & all, const string & outputdirname){ _outputdirname=outputdirname; } void Algorithm::run(){ }