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
8 namespace Selector {
9 namespace MapElites {
10
19 class MapElitesDescriptor
20 {
21
22 protected:
24 size_t nbDescriptors;
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
104 virtual void extractMetricsEpisode(
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
Learn::LearningEnvironment
Interface for creating a Learning Environment.
Definition learningEnvironment.h:81
Selector::MapElites::MapElitesDescriptor
Abstract class representing a descriptor for Map Elites selection.
Definition mapElitesDescriptor.h:20
Selector::MapElites::MapElitesDescriptor::extractMetricsEpisode
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
Selector::MapElites::MapElitesDescriptor::init
bool init
Definition mapElitesDescriptor.h:34
Selector::MapElites::MapElitesDescriptor::maxRange
double maxRange
Maximum value in the archive.
Definition mapElitesDescriptor.h:30
Selector::MapElites::MapElitesDescriptor::nbDescriptors
size_t nbDescriptors
Number of descriptor.
Definition mapElitesDescriptor.h:24
Selector::MapElites::MapElitesDescriptor::getName
virtual std::string getName() const =0
abstract method returning the name of the descriptor.
Selector::MapElites::MapElitesDescriptor::isInit
virtual bool isInit() const
method that return if the initDescriptor method has been executed
Definition mapElitesDescriptor.h:41
Selector::MapElites::MapElitesDescriptor::getMinAndMaxRange
virtual std::pair< double, double > getMinAndMaxRange() const
Get the min and max range of the descriptor.
Definition mapElitesDescriptor.h:65
Selector::MapElites::MapElitesDescriptor::minRange
double minRange
Minimum value in the archive.
Definition mapElitesDescriptor.h:27
Selector::MapElites::MapElitesDescriptor::getNbDescriptors
virtual size_t getNbDescriptors() const
Get the number of the descriptor.
Definition mapElitesDescriptor.h:73
Selector::MapElites::MapElitesDescriptor::initDescriptor
virtual void initDescriptor(const TPG::TPGGraph &graph, const Learn::LearningEnvironment &learningEnvironment)=0
initiate the descriptor attribute (such as nbDescriptors and min/max ranges)
Selector::MapElites::MapElitesDescriptor::extractMetricsStep
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
TPG::TPGGraph
Class for storing a Tangled-Program-Graph.
Definition tpgGraph.h:58
TPG::TPGVertex
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Selector
Definition mapElitesArchiveLogger.h:45