GEGELATI
Loading...
Searching...
No Matches
mapElitesDescriptor.h
1
36#ifndef MAP_ELITES_DESCRIPTORS_H
37#define MAP_ELITES_DESCRIPTORS_H
38
39#include "learn/learningEnvironment.h"
40#include "tpg/tpgGraph.h"
41
42namespace Selector {
43 namespace MapElites {
44
54 {
55
56 protected:
59
61 double minRange;
62
64 double maxRange;
65
68 bool init = false;
69
70 public:
75 virtual bool isInit() const
76 {
77 return this->init;
78 };
79
87 virtual void initDescriptor(
88 const TPG::TPGGraph& graph,
89 const Learn::LearningEnvironment& learningEnvironment) = 0;
90
94 virtual std::string getName() const = 0;
95
99 virtual std::pair<double, double> getMinAndMaxRange() const
100 {
101 return std::make_pair(this->minRange, this->maxRange);
102 };
103
107 virtual size_t getNbDescriptors() const
108 {
109 return this->nbDescriptors;
110 };
121 virtual void extractMetricsStep(
122 std::vector<double>& metrics, const TPG::TPGVertex* agent,
123 std::vector<double> actionValues,
124 const Learn::LearningEnvironment& learningEnvironment) const {
125 /* Empty because sub-class does not need to inherrit from it.*/
126 };
127
139 std::vector<double>& metrics, const TPG::TPGVertex* agent,
140 size_t nbStepsExecuted,
141 const Learn::LearningEnvironment& learningEnvironment) const {
142 /* Empty because sub-class does not need to inherrit from it.*/
143 };
144 };
145
146 }; // namespace MapElites
147}; // namespace Selector
148
149#endif // MAP_ELITES_DESCRIPTORS_H
Interface for creating a Learning Environment.
Definition learningEnvironment.h:81
Abstract class representing a descriptor for Map Elites selection.
Definition mapElitesDescriptor.h:54
virtual void extractMetricsEpisode(std::vector< double > &metrics, const TPG::TPGVertex *agent, size_t nbStepsExecuted, const Learn::LearningEnvironment &learningEnvironment) const
Extract the metrics at the end of the evaluation episode.
Definition mapElitesDescriptor.h:138
bool init
Definition mapElitesDescriptor.h:68
double maxRange
Maximum value in the archive.
Definition mapElitesDescriptor.h:64
size_t nbDescriptors
Number of descriptor.
Definition mapElitesDescriptor.h:58
virtual std::string getName() const =0
abstract method returning the name of the descriptor.
virtual bool isInit() const
method that return if the initDescriptor method has been executed
Definition mapElitesDescriptor.h:75
virtual std::pair< double, double > getMinAndMaxRange() const
Get the min and max range of the descriptor.
Definition mapElitesDescriptor.h:99
double minRange
Minimum value in the archive.
Definition mapElitesDescriptor.h:61
virtual size_t getNbDescriptors() const
Get the number of the descriptor.
Definition mapElitesDescriptor.h:107
virtual void initDescriptor(const TPG::TPGGraph &graph, const Learn::LearningEnvironment &learningEnvironment)=0
initiate the descriptor attribute (such as nbDescriptors and min/max ranges)
virtual void extractMetricsStep(std::vector< double > &metrics, const TPG::TPGVertex *agent, std::vector< double > actionValues, const Learn::LearningEnvironment &learningEnvironment) const
Extract the metrics at each step of the evaluation.
Definition mapElitesDescriptor.h:121
Class for storing a Tangled-Program-Graph.
Definition tpgGraph.h:58
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition mapElitesArchiveLogger.h:45