GEGELATI

Loading...
Searching...
No Matches
evaluationResult.h
1
37#ifndef EVALUATION_RESULT_H
38#define EVALUATION_RESULT_H
39
40#include <cmath>
41#include <memory>
42
43 namespace Learn {
53 class EvaluationResult
54 {
55 protected:
57 double result;
58
68 double utility;
69
71 size_t nbEvaluation;
72
73 public:
77 EvaluationResult() = delete;
78
82 virtual ~EvaluationResult() = default;
83
94 EvaluationResult(const double& res, const size_t& nbEval,
95 const double& uti = std::nan(""))
96 : result{res}, utility{uti}, nbEvaluation{nbEval} {};
97
102 virtual double getResult() const;
103
108 virtual double getUtility() const;
109
114 virtual size_t getNbEvaluation() const;
115
123 virtual EvaluationResult& operator+=(const EvaluationResult& other);
124 };
125
130 bool operator<(const EvaluationResult& a, const EvaluationResult& b);
131} // namespace Learn
132
133 namespace std {
135 template <> struct less<std::shared_ptr<Learn::EvaluationResult>>
136 {
138 bool operator()(const std::shared_ptr<Learn::EvaluationResult>& a,
139 const std::shared_ptr<Learn::EvaluationResult>& b) const
140 {
141 return *a < *b;
142 }
143 };
144}; // namespace std
145
146#endif
Learn::EvaluationResult
Base class for storing all result of a policy evaluation within a LearningEnvironment.
Definition evaluationResult.h:54
Learn::EvaluationResult::nbEvaluation
size_t nbEvaluation
Number of evaluation leading to this result.
Definition evaluationResult.h:71
Learn::EvaluationResult::getResult
virtual double getResult() const
Virtual method to get the default double equivalent of the reward of the EvaluationResult.
Definition evaluationResult.cpp:40
Learn::EvaluationResult::getNbEvaluation
virtual size_t getNbEvaluation() const
Virtual method to get the default number of evaluation of the EvaluationResult.
Definition evaluationResult.cpp:50
Learn::EvaluationResult::result
double result
Double value for the result.
Definition evaluationResult.h:57
Learn::EvaluationResult::EvaluationResult
EvaluationResult(const double &res, const size_t &nbEval, const double &uti=std::nan(""))
Construct a result from a simple double value.
Definition evaluationResult.h:94
Learn::EvaluationResult::~EvaluationResult
virtual ~EvaluationResult()=default
Virtual destructor for polymorphism.
Learn::EvaluationResult::utility
double utility
Definition evaluationResult.h:68
Learn::EvaluationResult::operator+=
virtual EvaluationResult & operator+=(const EvaluationResult &other)
Polymorphic addition assignement operator for EvaluationResult.
Definition evaluationResult.cpp:55
Learn::EvaluationResult::EvaluationResult
EvaluationResult()=delete
Deleted default constructor.
Learn::EvaluationResult::getUtility
virtual double getUtility() const
Virtual method to get the default double equivalent of the utility of the EvaluationResult.
Definition evaluationResult.cpp:45
Learn
Definition adversarialEvaluationResult.h:45
Learn::operator<
bool operator<(const EvaluationResult &a, const EvaluationResult &b)
Comparison function to enable sorting of EvaluationResult with STL.
Definition evaluationResult.cpp:85
std::less< std::shared_ptr< Learn::EvaluationResult > >::operator()
bool operator()(const std::shared_ptr< Learn::EvaluationResult > &a, const std::shared_ptr< Learn::EvaluationResult > &b) const
Comparison operator for sorted containers.
Definition evaluationResult.h:138