GEGELATI
Loading...
Searching...
No Matches
timingSelectionMetrics.h
1#ifndef TIMING_SELECTION_METRICS_H
2#define TIMING_SELECTION_METRICS_H
3
4#include "selector/selectionMetrics.h"
5
6namespace Selector {
9 {
10 protected:
12 std::shared_ptr<SelectionMetrics> wrapped;
13
15 double agentTime = 0;
16
18 double leTime = 0;
19
21 size_t nbActions = 0;
22
23 public:
25 virtual ~TimingSelectionMetrics() = default;
26
29 double getAgentTime() const
30 {
31 return agentTime;
32 }
33
36 double getLeTime() const
37 {
38 return leTime;
39 }
40
43 size_t getNbActions() const
44 {
45 return nbActions;
46 }
47
51 double getScore() const override
52 {
53 return wrapped->getScore();
54 };
55
59 double getUtility() const override
60 {
61 return wrapped->getUtility();
62 };
63
66 explicit TimingSelectionMetrics(std::shared_ptr<SelectionMetrics> obj)
67 : wrapped(obj){};
68
71 const TPG::TPGVertex* agent, const std::vector<double> actionValues,
72 const Learn::LearningEnvironment& learningEnvironment) override;
73
83 const TPG::TPGVertex* agent, size_t nbStepsExecuted,
84 const Learn::LearningEnvironment& learningEnvironment,
85 double agentTimeEpisode, double leTimeEpisode);
86
88 void weightedSum(std::shared_ptr<SelectionMetrics> other,
89 size_t nbEvaluation,
90 size_t nbEvaluationOther) override;
91 };
92
95 bool operator<(std::shared_ptr<TimingSelectionMetrics> a,
96 std::shared_ptr<TimingSelectionMetrics> b);
97
100 bool operator<(std::shared_ptr<SelectionMetrics> a,
101 std::shared_ptr<TimingSelectionMetrics> b);
102
105 bool operator<(std::shared_ptr<TimingSelectionMetrics> a,
106 std::shared_ptr<SelectionMetrics> b);
107}; // namespace Selector
108
109#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:18
Decorator on SelectionMetrics class to add timing informations.
Definition timingSelectionMetrics.h:9
double agentTime
Execution time of learning agent.
Definition timingSelectionMetrics.h:15
std::shared_ptr< SelectionMetrics > wrapped
wrapped SelectionMetrics to time.
Definition timingSelectionMetrics.h:12
TimingSelectionMetrics(std::shared_ptr< SelectionMetrics > obj)
Constructor for the SelectionMetrics with timing.
Definition timingSelectionMetrics.h:66
double getUtility() const override
Definition timingSelectionMetrics.h:59
size_t nbActions
Number of actions performed.
Definition timingSelectionMetrics.h:21
double getAgentTime() const
Return the execution time of learning agent.
Definition timingSelectionMetrics.h:29
size_t getNbActions() const
Return the number of actions performed.
Definition timingSelectionMetrics.h:43
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:22
double leTime
Execution time of learning environment.
Definition timingSelectionMetrics.h:18
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:10
void extractMetricsStep(const TPG::TPGVertex *agent, const std::vector< double > actionValues, const Learn::LearningEnvironment &learningEnvironment) override
Forward to wrapped method.
Definition timingSelectionMetrics.cpp:3
double getScore() const override
Definition timingSelectionMetrics.h:51
virtual ~TimingSelectionMetrics()=default
Default destructor.
double getLeTime() const
Return the execution time of learning environment.
Definition timingSelectionMetrics.h:36
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:40