GEGELATI
Loading...
Searching...
No Matches
mapElitesDescriptor.h
1
2#ifndef MAP_ELITES_DESCRIPTORS_H
3#define MAP_ELITES_DESCRIPTORS_H
4
5#include "learn/learningEnvironment.h"
6#include "tpg/tpgGraph.h"
7
8namespace Selector {
9 namespace MapElites {
10
20 {
21
22 protected:
25
27 double minRange;
28
30 double maxRange;
31
34 bool init = false;
35
36 public:
41 virtual bool isInit() const
42 {
43 return this->init;
44 };
45
53 virtual void initDescriptor(
54 const TPG::TPGGraph& graph,
55 const Learn::LearningEnvironment& learningEnvironment) = 0;
56
60 virtual std::string getName() const = 0;
61
65 virtual std::pair<double, double> getMinAndMaxRange() const
66 {
67 return std::make_pair(this->minRange, this->maxRange);
68 };
69
73 virtual size_t getNbDescriptors() const
74 {
75 return this->nbDescriptors;
76 };
87 virtual void extractMetricsStep(
88 std::vector<double>& metrics, const TPG::TPGVertex* agent,
89 std::vector<double> actionValues,
90 const Learn::LearningEnvironment& learningEnvironment) const {
91 /* Empty because sub-class does not need to inherrit from it.*/
92 };
93
105 std::vector<double>& metrics, const TPG::TPGVertex* agent,
106 size_t nbStepsExecuted,
107 const Learn::LearningEnvironment& learningEnvironment) const {
108 /* Empty because sub-class does not need to inherrit from it.*/
109 };
110 };
111
112 }; // namespace MapElites
113}; // namespace Selector
114
115#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:20
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:104
bool init
Definition mapElitesDescriptor.h:34
double maxRange
Maximum value in the archive.
Definition mapElitesDescriptor.h:30
size_t nbDescriptors
Number of descriptor.
Definition mapElitesDescriptor.h:24
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:41
virtual std::pair< double, double > getMinAndMaxRange() const
Get the min and max range of the descriptor.
Definition mapElitesDescriptor.h:65
double minRange
Minimum value in the archive.
Definition mapElitesDescriptor.h:27
virtual size_t getNbDescriptors() const
Get the number of the descriptor.
Definition mapElitesDescriptor.h:73
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:87
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