GEGELATI
Loading...
Searching...
No Matches
mapElitesSelectionMetrics.h
1
36#ifndef MAP_ELITES_SELECTION_METRICS_H
37#define MAP_ELITES_SELECTION_METRICS_H
38
39#include <numeric>
40
41#include "selector/mapElites/mapElitesDescriptor.h"
42#include "selector/selectionMetrics.h"
43
44namespace Selector {
45
46 namespace MapElites {
47
57 {
58 protected:
64 std::map<std::shared_ptr<const MapElitesDescriptor>,
65 std::vector<double>>
67
68 public:
76 std::vector<std::shared_ptr<const MapElitesDescriptor>>
77 descriptors)
78 {
79 for (auto descriptor : descriptors) {
80 mapDescriptors.insert({descriptor, {}});
81 }
82 }
83
93 double score,
94 const std::map<std::shared_ptr<const MapElitesDescriptor>,
95 std::vector<double>>& mapDescriptors)
97
105
109 const std::map<std::shared_ptr<const MapElitesDescriptor>,
110 std::vector<double>>&
111 getMapDescriptors() const;
112
116 void initMetrics(
117 const TPG::TPGVertex* agent,
118 const Learn::LearningEnvironment& learningEnvironment) override;
119
125 const TPG::TPGVertex* agent, std::vector<double> actionValues,
126 const Learn::LearningEnvironment& learningEnvironment) override;
127
133 const TPG::TPGVertex* agent, size_t nbStepsExecuted,
134 const Learn::LearningEnvironment& learningEnvironment) override;
135
140 virtual void weightedSum(std::shared_ptr<SelectionMetrics> other,
141 size_t nbEvaluation,
142 size_t nbEvaluationOther) override;
143 };
144 } // namespace MapElites
145
146}; // namespace Selector
147
148#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:57
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:66
MapElitesSelectionMetrics(std::vector< std::shared_ptr< const MapElitesDescriptor > > descriptors)
Default constructor of MapEliteselectionMetrics with a vector of descriptors.
Definition mapElitesSelectionMetrics.h:75
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:77
MapElitesSelectionMetrics(double score)
Constructor of MapEliteselectionMetrics with a vector of scores.
Definition mapElitesSelectionMetrics.h:104
void initMetrics(const TPG::TPGVertex *agent, const Learn::LearningEnvironment &learningEnvironment) override
Specialization of the initialisation of the metrics.
Definition mapElitesSelectionMetrics.cpp:45
const std::map< std::shared_ptr< const MapElitesDescriptor >, std::vector< double > > & getMapDescriptors() const
Get a const ref to the scorePerClass attribute.
Definition mapElitesSelectionMetrics.cpp:40
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:54
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:92
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:64
Class to extract metrics from either the agent or the environment.
Definition selectionMetrics.h:52
double score
Definition selectionMetrics.h:57
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition mapElitesArchiveLogger.h:45