GEGELATI
Loading...
Searching...
No Matches
mapElitesSelectionMetrics.h
1
2
3#ifndef MAP_ELITES_SELECTION_METRICS_H
4#define MAP_ELITES_SELECTION_METRICS_H
5
6#include <numeric>
7
8#include "selector/mapElites/mapElitesDescriptor.h"
9#include "selector/selectionMetrics.h"
10
11namespace Selector {
12
13 namespace MapElites {
14
24 {
25 protected:
31 std::map<std::shared_ptr<const MapElitesDescriptor>,
32 std::vector<double>>
34
35 public:
43 std::vector<std::shared_ptr<const MapElitesDescriptor>>
44 descriptors)
45 {
46 for (auto descriptor : descriptors) {
47 mapDescriptors.insert({descriptor, {}});
48 }
49 }
50
60 double score,
61 const std::map<std::shared_ptr<const MapElitesDescriptor>,
62 std::vector<double>>& mapDescriptors)
64
72
76 const std::map<std::shared_ptr<const MapElitesDescriptor>,
77 std::vector<double>>&
78 getMapDescriptors() const;
79
83 void initMetrics(
84 const TPG::TPGVertex* agent,
85 const Learn::LearningEnvironment& learningEnvironment) override;
86
92 const TPG::TPGVertex* agent, std::vector<double> actionValues,
93 const Learn::LearningEnvironment& learningEnvironment) override;
94
100 const TPG::TPGVertex* agent, size_t nbStepsExecuted,
101 const Learn::LearningEnvironment& learningEnvironment) override;
102
107 virtual void weightedSum(std::shared_ptr<SelectionMetrics> other,
108 size_t nbEvaluation,
109 size_t nbEvaluationOther) override;
110 };
111 } // namespace MapElites
112
113}; // namespace Selector
114
115#endif // MAP_ELITES_SELECTION_METRICS_H
Interface for creating a Learning Environment.
Definition learningEnvironment.h:81
Class to extract metrics from either the agent or the environment.
Definition mapElitesSelectionMetrics.h:24
std::map< std::shared_ptr< const MapElitesDescriptor >, std::vector< double > > mapDescriptors
Map storing a descriptor and a Vector storing a double value per descriptor (i.e. per Action) of a cl...
Definition mapElitesSelectionMetrics.h:33
MapElitesSelectionMetrics(std::vector< std::shared_ptr< const MapElitesDescriptor > > descriptors)
Default constructor of MapEliteselectionMetrics with a vector of descriptors.
Definition mapElitesSelectionMetrics.h:42
virtual void weightedSum(std::shared_ptr< SelectionMetrics > other, size_t nbEvaluation, size_t nbEvaluationOther) override
Specialization of weightedSum method to add the score per class and nbEvalPerClass.
Definition mapElitesSelectionMetrics.cpp:44
MapElitesSelectionMetrics(double score)
Constructor of MapEliteselectionMetrics with a vector of scores.
Definition mapElitesSelectionMetrics.h:71
void initMetrics(const TPG::TPGVertex *agent, const Learn::LearningEnvironment &learningEnvironment) override
Specialization of the initialisation of the metrics.
Definition mapElitesSelectionMetrics.cpp:12
const std::map< std::shared_ptr< const MapElitesDescriptor >, std::vector< double > > & getMapDescriptors() const
Get a const ref to the scorePerClass attribute.
Definition mapElitesSelectionMetrics.cpp:7
void extractMetricsStep(const TPG::TPGVertex *agent, std::vector< double > actionValues, const Learn::LearningEnvironment &learningEnvironment) override
Specialization of the extraction of the metrics at the end of an episode.
Definition mapElitesSelectionMetrics.cpp:21
MapElitesSelectionMetrics(double score, const std::map< std::shared_ptr< const MapElitesDescriptor >, std::vector< double > > &mapDescriptors)
Constructor of MapEliteselectionMetrics with a vector of scores.
Definition mapElitesSelectionMetrics.h:59
void extractMetricsEpisode(const TPG::TPGVertex *agent, size_t nbStepsExecuted, const Learn::LearningEnvironment &learningEnvironment) override
Specialization of the extraction of the metrics at the end of an episode.
Definition mapElitesSelectionMetrics.cpp:31
Class to extract metrics from either the agent or the environment.
Definition selectionMetrics.h:18
double score
Definition selectionMetrics.h:23
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition mapElitesArchiveLogger.h:45