GEGELATI
Loading...
Searching...
No Matches
timingSelectionMetrics.h
1
36#ifndef TIMING_SELECTION_METRICS_H
37#define TIMING_SELECTION_METRICS_H
38
39#include "selector/selectionMetrics.h"
40
41namespace Selector {
44 {
45 protected:
47 std::shared_ptr<SelectionMetrics> wrapped;
48
50 double agentTime = 0;
51
53 double leTime = 0;
54
56 size_t nbActions = 0;
57
58 public:
60 virtual ~TimingSelectionMetrics() = default;
61
64 double getAgentTime() const
65 {
66 return agentTime;
67 }
68
71 double getLeTime() const
72 {
73 return leTime;
74 }
75
78 size_t getNbActions() const
79 {
80 return nbActions;
81 }
82
86 double getScore() const override
87 {
88 return wrapped->getScore();
89 };
90
94 double getUtility() const override
95 {
96 return wrapped->getUtility();
97 };
98
101 explicit TimingSelectionMetrics(std::shared_ptr<SelectionMetrics> obj)
102 : wrapped(obj){};
103
106 const TPG::TPGVertex* agent, const std::vector<double> actionValues,
107 const Learn::LearningEnvironment& learningEnvironment) override;
108
118 const TPG::TPGVertex* agent, size_t nbStepsExecuted,
119 const Learn::LearningEnvironment& learningEnvironment,
120 double agentTimeEpisode, double leTimeEpisode);
121
123 void weightedSum(std::shared_ptr<SelectionMetrics> other,
124 size_t nbEvaluation,
125 size_t nbEvaluationOther) override;
126 };
127
130 bool operator<(std::shared_ptr<TimingSelectionMetrics> a,
131 std::shared_ptr<TimingSelectionMetrics> b);
132
135 bool operator<(std::shared_ptr<SelectionMetrics> a,
136 std::shared_ptr<TimingSelectionMetrics> b);
137
140 bool operator<(std::shared_ptr<TimingSelectionMetrics> a,
141 std::shared_ptr<SelectionMetrics> b);
142}; // namespace Selector
143
144#endif // TIMING_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 selectionMetrics.h:52
Decorator on SelectionMetrics class to add timing informations.
Definition timingSelectionMetrics.h:44
double agentTime
Execution time of learning agent.
Definition timingSelectionMetrics.h:50
std::shared_ptr< SelectionMetrics > wrapped
wrapped SelectionMetrics to time.
Definition timingSelectionMetrics.h:47
TimingSelectionMetrics(std::shared_ptr< SelectionMetrics > obj)
Constructor for the SelectionMetrics with timing.
Definition timingSelectionMetrics.h:101
double getUtility() const override
Definition timingSelectionMetrics.h:94
size_t nbActions
Number of actions performed.
Definition timingSelectionMetrics.h:56
double getAgentTime() const
Return the execution time of learning agent.
Definition timingSelectionMetrics.h:64
size_t getNbActions() const
Return the number of actions performed.
Definition timingSelectionMetrics.h:78
void weightedSum(std::shared_ptr< SelectionMetrics > other, size_t nbEvaluation, size_t nbEvaluationOther) override
Specialization of weightedSum to add timings and nbActions.
Definition timingSelectionMetrics.cpp:57
double leTime
Execution time of learning environment.
Definition timingSelectionMetrics.h:53
void extractMetricsEpisodeWithTiming(const TPG::TPGVertex *agent, size_t nbStepsExecuted, const Learn::LearningEnvironment &learningEnvironment, double agentTimeEpisode, double leTimeEpisode)
Specialization of extractMetricsEpisode to add timings.
Definition timingSelectionMetrics.cpp:45
void extractMetricsStep(const TPG::TPGVertex *agent, const std::vector< double > actionValues, const Learn::LearningEnvironment &learningEnvironment) override
Forward to wrapped method.
Definition timingSelectionMetrics.cpp:38
double getScore() const override
Definition timingSelectionMetrics.h:86
virtual ~TimingSelectionMetrics()=default
Default destructor.
double getLeTime() const
Return the execution time of learning environment.
Definition timingSelectionMetrics.h:71
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition mapElitesArchiveLogger.h:45
bool operator<(std::shared_ptr< SelectionMetrics > a, std::shared_ptr< SelectionMetrics > b)
Comparison function to enable sorting of SelectionMetrics with STL.
Definition selectionMetrics.cpp:75