GEGELATI

Loading...
Searching...
No Matches
selectionMetrics.h
1
2
3#ifndef SELECTION_METRICS_H
4#define SELECTION_METRICS_H
5
6#include "learn/learningEnvironment.h"
7#include "tpg/tpgGraph.h"
8
9 namespace Selector {
17 class SelectionMetrics
18 {
19 protected:
23 double score = 0;
24
33 double utility = 0;
34
35 public:
39 SelectionMetrics() = default;
40
47 SelectionMetrics(double score, double utility = 0)
48 : score{score}, utility{utility} {};
49
53 virtual double getScore() const;
54
58 virtual double getUtility() const;
59
69 virtual void initMetrics(
70 const TPG::TPGVertex* agent,
71 const Learn::LearningEnvironment& learningEnvironment) {
72 /* Empty because sub-class does not need to inherrit from it.*/
73 };
74
85 virtual void extractMetricsStep(
86 const TPG::TPGVertex* agent, std::vector<double> actionValues,
87 const Learn::LearningEnvironment& learningEnvironment) {
88 /* Empty because sub-class does not need to inherrit from it.*/
89 };
90
103 virtual void extractMetricsEpisode(
104 const TPG::TPGVertex* agent, size_t nbStepsExecuted,
105 const Learn::LearningEnvironment& learningEnvironment);
106
117 virtual void weightedSum(std::shared_ptr<SelectionMetrics> other,
118 size_t nbEvaluation, size_t nbEvaluationOther);
119 };
120
125 bool operator<(std::shared_ptr<SelectionMetrics> a,
126 std::shared_ptr<SelectionMetrics> b);
127
128}; // namespace Selector
129
130#endif // SELECTION_METRICS_H
Learn::LearningEnvironment
Interface for creating a Learning Environment.
Definition learningEnvironment.h:81
Selector::SelectionMetrics
Class to extract metrics from either the agent or the environment.
Definition selectionMetrics.h:18
Selector::SelectionMetrics::initMetrics
virtual void initMetrics(const TPG::TPGVertex *agent, const Learn::LearningEnvironment &learningEnvironment)
Init the metrics for the agent in the learning environment.
Definition selectionMetrics.h:69
Selector::SelectionMetrics::weightedSum
virtual void weightedSum(std::shared_ptr< SelectionMetrics > other, size_t nbEvaluation, size_t nbEvaluationOther)
Perform a weighted sum between this SelectionMetrics and another.
Definition selectionMetrics.cpp:26
Selector::SelectionMetrics::extractMetricsStep
virtual void extractMetricsStep(const TPG::TPGVertex *agent, std::vector< double > actionValues, const Learn::LearningEnvironment &learningEnvironment)
Extract metrics from the agent in the learning environment.
Definition selectionMetrics.h:85
Selector::SelectionMetrics::SelectionMetrics
SelectionMetrics(double score, double utility=0)
Constructor with score and utility initialization.
Definition selectionMetrics.h:47
Selector::SelectionMetrics::getUtility
virtual double getUtility() const
Definition selectionMetrics.cpp:9
Selector::SelectionMetrics::SelectionMetrics
SelectionMetrics()=default
Default constructor.
Selector::SelectionMetrics::utility
double utility
Definition selectionMetrics.h:33
Selector::SelectionMetrics::extractMetricsEpisode
virtual void extractMetricsEpisode(const TPG::TPGVertex *agent, size_t nbStepsExecuted, const Learn::LearningEnvironment &learningEnvironment)
Extract metrics from the agent in the learning environment.
Definition selectionMetrics.cpp:14
Selector::SelectionMetrics::score
double score
Definition selectionMetrics.h:23
Selector::SelectionMetrics::getScore
virtual double getScore() const
Definition selectionMetrics.cpp:4
TPG::TPGVertex
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Selector
Definition mapElitesArchiveLogger.h:45
Selector::operator<
bool operator<(std::shared_ptr< SelectionMetrics > a, std::shared_ptr< SelectionMetrics > b)
Comparison function to enable sorting of SelectionMetrics with STL.
Definition selectionMetrics.cpp:44