GEGELATI
laLogger.h
1
37#ifndef LA_LOGGER_H
38#define LA_LOGGER_H
39
40#include <chrono>
41#include <map>
42#include <ostream>
43
44#include "learn/evaluationResult.h"
45#include "log/logger.h"
46#include "tpg/tpgGraph.h"
47
48namespace Learn {
49 class LearningAgent;
50}
51
52namespace Log {
53
63 class LALogger : public Logger
64 {
65 protected:
70 std::shared_ptr<std::chrono::time_point<
71 std::chrono::system_clock, std::chrono::nanoseconds>> const start;
72
77 std::shared_ptr<std::chrono::time_point<std::chrono::system_clock,
78 std::chrono::nanoseconds>>
80
85 double mutationTime = 0;
86
91 double evalTime = 0;
92
97 double validTime = 0;
98
101
108 double getDurationFrom(
109 const std::chrono::time_point<std::chrono::system_clock,
110 std::chrono::nanoseconds>& begin)
111 const;
112
118 std::chrono::time_point<std::chrono::system_clock,
119 std::chrono::nanoseconds>
120 getTime() const;
121
122 public:
126 bool doValidation = false;
127
140 explicit LALogger(Learn::LearningAgent& la,
141 std::ostream& out = std::cout);
142
146 void chronoFromNow();
147
151 virtual void logHeader() = 0;
152
160 virtual void logNewGeneration(uint64_t& generationNumber) = 0;
161
167 virtual void logAfterPopulateTPG() = 0;
168
176 virtual void logAfterEvaluate(
177 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
178 const TPG::TPGVertex*>& results) = 0;
179
184 virtual void logAfterDecimate() = 0;
185
192 virtual void logAfterValidate(
193 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
194 const TPG::TPGVertex*>& results) = 0;
195
199 virtual void logEndOfTraining() = 0;
200 };
201} // namespace Log
202
203#endif
Class used to control the learning steps of a TPGGraph within a given LearningEnvironment.
Definition: learningAgent.h:63
Learning Agent logger class that will be called during LearningAgent executions.
Definition: laLogger.h:64
double mutationTime
Definition: laLogger.h:85
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
virtual void logHeader()=0
Logs the header (e.g. column names) of this logger.
virtual void logAfterDecimate()=0
Method called by the Learning Agent right after the decimation is done.
virtual void logAfterPopulateTPG()=0
Method called by the Learning Agent right after PopulateTPG is done.
void chronoFromNow()
Updates checkpoint to now.
Definition: laLogger.cpp:63
double validTime
Definition: laLogger.h:97
virtual void logNewGeneration(uint64_t &generationNumber)=0
Method called by the LearningAgent at the start of a generation.
Learn::LearningAgent & learningAgent
LearningAgent logged by the LALogger.
Definition: laLogger.h:100
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.
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
virtual void logEndOfTraining()=0
Method called by the Learning Agent when the training is done.
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
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.
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > const start
Definition: laLogger.h:71
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > checkpoint
Definition: laLogger.h:79
bool doValidation
Definition: laLogger.h:126
double evalTime
Definition: laLogger.h:91
Definition: logger.h:48
Abstract class representing the vertices of a TPGGraph.
Definition: tpgVertex.h:49
Definition: adversarialEvaluationResult.h:45
Definition: laBasicLogger.h:44