GEGELATI

Loading...
Searching...
No Matches
laLogger.h
1
38#ifndef LA_LOGGER_H
39#define LA_LOGGER_H
40
41#include <chrono>
42#include <map>
43#include <ostream>
44
45#include "learn/evaluationResult.h"
46#include "log/logger.h"
47#include "tpg/tpgGraph.h"
48
49 namespace Learn {
50 class LearningAgent;
51}
52
53 namespace Log {
54
64 class LALogger : public Logger
65 {
66 protected:
71 std::shared_ptr<std::chrono::time_point<
72 std::chrono::system_clock, std::chrono::nanoseconds>> const start;
73
78 std::shared_ptr<std::chrono::time_point<std::chrono::system_clock,
79 std::chrono::nanoseconds>>
80 checkpoint;
81
86 double mutationTime = 0;
87
92 double evalTime = 0;
93
98 double validTime = 0;
99
104 double decimationTime = 0;
105
107 Learn::LearningAgent& learningAgent;
108
115 double getDurationFrom(
116 const std::chrono::time_point<std::chrono::system_clock,
117 std::chrono::nanoseconds>& begin)
118 const;
119
125 std::chrono::time_point<std::chrono::system_clock,
126 std::chrono::nanoseconds>
127 getTime() const;
128
129 public:
133 bool doValidation = false;
134
139 bool useUtility = false;
140
153 explicit LALogger(Learn::LearningAgent& la,
154 std::ostream& out = std::cout);
155
159 void chronoFromNow();
160
164 virtual void logHeader() = 0;
165
173 virtual void logNewGeneration(uint64_t& generationNumber) = 0;
174
180 virtual void logAfterPopulateTPG() = 0;
181
189 virtual void logAfterEvaluate(
190 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
191 const TPG::TPGVertex*>& results) = 0;
192
197 virtual void logAfterDecimate() = 0;
198
205 virtual void logAfterValidate(
206 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
207 const TPG::TPGVertex*>& results) = 0;
208
212 virtual void logEndOfTraining() = 0;
213 };
214} // namespace Log
215
216#endif
Learn::LearningAgent
Class used to control the learning steps of a TPGGraph within a given LearningEnvironment.
Definition learningAgent.h:64
Log::LALogger
Learning Agent logger class that will be called during LearningAgent executions.
Definition laLogger.h:65
Log::LALogger::mutationTime
double mutationTime
Definition laLogger.h:86
Log::LALogger::getTime
std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > getTime() const
Gets the current time value, for example to set checkpoint.
Definition laLogger.cpp:48
Log::LALogger::useUtility
bool useUtility
Definition laLogger.h:139
Log::LALogger::logHeader
virtual void logHeader()=0
Logs the header (e.g. column names) of this logger.
Log::LALogger::logAfterDecimate
virtual void logAfterDecimate()=0
Method called by the Learning Agent right after the decimation is done.
Log::LALogger::logAfterPopulateTPG
virtual void logAfterPopulateTPG()=0
Method called by the Learning Agent right after PopulateTPG is done.
Log::LALogger::chronoFromNow
void chronoFromNow()
Updates checkpoint to now.
Definition laLogger.cpp:63
Log::LALogger::validTime
double validTime
Definition laLogger.h:98
Log::LALogger::logNewGeneration
virtual void logNewGeneration(uint64_t &generationNumber)=0
Method called by the LearningAgent at the start of a generation.
Log::LALogger::learningAgent
Learn::LearningAgent & learningAgent
LearningAgent logged by the LALogger.
Definition laLogger.h:107
Log::LALogger::logAfterValidate
virtual void logAfterValidate(std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)=0
Method called by the Learning Agent right after the validation is done.
Log::LALogger::LALogger
LALogger(Learn::LearningAgent &la, std::ostream &out=std::cout)
Constructor defining a given output and setting start and checkpoint as now. Default output is cout.
Definition laLogger.cpp:53
Log::LALogger::logEndOfTraining
virtual void logEndOfTraining()=0
Method called by the Learning Agent when the training is done.
Log::LALogger::getDurationFrom
double getDurationFrom(const std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > &begin) const
Computes the duration from a given time to now.
Definition laLogger.cpp:40
Log::LALogger::logAfterEvaluate
virtual void logAfterEvaluate(std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)=0
Method called by the Learning Agent right after the evaluation is done.
Log::LALogger::decimationTime
double decimationTime
Definition laLogger.h:104
Log::LALogger::start
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > const start
Definition laLogger.h:72
Log::LALogger::checkpoint
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > checkpoint
Definition laLogger.h:80
Log::LALogger::doValidation
bool doValidation
Definition laLogger.h:133
Log::LALogger::evalTime
double evalTime
Definition laLogger.h:92
Log::Logger
Definition logger.h:48
TPG::TPGVertex
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Learn
Definition adversarialEvaluationResult.h:45
Log
Definition cycleDetectionLALogger.h:38