GEGELATI
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
Selector::SelectionMetrics Class Reference

Class to extract metrics from either the agent or the environment. More...

#include <selectionMetrics.h>

Inheritance diagram for Selector::SelectionMetrics:
Selector::ClassificationSelectionMetrics Selector::MapElites::MapElitesSelectionMetrics Selector::TimingSelectionMetrics

Public Member Functions

 SelectionMetrics ()=default
 Default constructor.
 
virtual ~SelectionMetrics ()=default
 Default destructor.
 
 SelectionMetrics (double score, double utility=0)
 Constructor with score and utility initialization.
 
virtual double getScore () const
 
virtual double getUtility () const
 
virtual void initMetrics (const TPG::TPGVertex *agent, const Learn::LearningEnvironment &learningEnvironment)
 Init the metrics for the agent in the learning environment.
 
virtual void extractMetricsStep (const TPG::TPGVertex *agent, std::vector< double > actionValues, const Learn::LearningEnvironment &learningEnvironment)
 Extract metrics from the agent in the learning environment.
 
virtual void extractMetricsEpisode (const TPG::TPGVertex *agent, size_t nbStepsExecuted, const Learn::LearningEnvironment &learningEnvironment)
 Extract metrics from the agent in the learning environment.
 
virtual void weightedSum (std::shared_ptr< SelectionMetrics > other, size_t nbEvaluation, size_t nbEvaluationOther)
 Perform a weighted sum between this SelectionMetrics and another.
 

Static Public Member Functions

template<class T >
static T weightedSum (T value, T valueOther, size_t nbEvaluation, size_t nbEvaluationOther)
 Perform a weighted sum between 2 values.
 

Protected Attributes

double score = 0
 
double utility = 0
 

Friends

bool operator< (const SelectionMetrics &lhs, const SelectionMetrics &rhs)
 Comparison function to enable sorting of SelectionMetrics with STL.
 

Detailed Description

Class to extract metrics from either the agent or the environment.

This metrics can be used to specify the selection of the selector. This class does not implement any metrics, it need to be override by the different selection methods.

Constructor & Destructor Documentation

◆ SelectionMetrics()

Selector::SelectionMetrics::SelectionMetrics ( double score,
double utility = 0 )
inline

Constructor with score and utility initialization.

Parameters
[in]scorethe score obtained by the agent.
[in]utilitythe utility obtained by the agent.

Member Function Documentation

◆ extractMetricsEpisode()

void Selector::SelectionMetrics::extractMetricsEpisode ( const TPG::TPGVertex * agent,
size_t nbStepsExecuted,
const Learn::LearningEnvironment & learningEnvironment )
virtual

Extract metrics from the agent in the learning environment.

This method is called at the end of every episode of the environment evaluation.

Parameters
[in]agentthe TPGVertex representing the agent.
[in]nbStepsExecutednumber of steps executed at the end of the episode.
[in]learningEnvironmentthe learning environment in which the agent is evaluated.

Reimplemented in Selector::ClassificationSelectionMetrics, and Selector::MapElites::MapElitesSelectionMetrics.

◆ extractMetricsStep()

virtual void Selector::SelectionMetrics::extractMetricsStep ( const TPG::TPGVertex * agent,
std::vector< double > actionValues,
const Learn::LearningEnvironment & learningEnvironment )
inlinevirtual

Extract metrics from the agent in the learning environment.

This method is called at every step of the environment evaluation.

Parameters
[in]agentthe TPGVertex representing the agent.
[in]actionValuesthe action values taken by the agent.
[in]learningEnvironmentthe learning environment in which the agent is evaluated.

Reimplemented in Selector::TimingSelectionMetrics, and Selector::MapElites::MapElitesSelectionMetrics.

◆ getScore()

double Selector::SelectionMetrics::getScore ( ) const
virtual

Return the score of the agent.

Copyright or © or Copr. IETR/INSA - Rennes (2025 - 2026) :

Mickaël Dardaillon mdard.nosp@m.ail@.nosp@m.insa-.nosp@m.renn.nosp@m.es.fr (2026) Quentin Vacher qvach.nosp@m.er@i.nosp@m.nsa-r.nosp@m.enne.nosp@m.s.fr (2025)

GEGELATI is an open-source reinforcement learning framework for training artificial intelligence based on Tangled Program Graphs (TPGs).

This software is governed by the CeCILL-C license under French law and abiding by the rules of distribution of free software. You can use, modify and/ or redistribute the software under the terms of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".

As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability.

In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security.

The fact that you are presently reading this means that you have had knowledge of the CeCILL-C license and that you accept its terms.

Reimplemented in Selector::TimingSelectionMetrics.

◆ getUtility()

double Selector::SelectionMetrics::getUtility ( ) const
virtual

Return the utility of the agent.

Reimplemented in Selector::TimingSelectionMetrics.

◆ initMetrics()

virtual void Selector::SelectionMetrics::initMetrics ( const TPG::TPGVertex * agent,
const Learn::LearningEnvironment & learningEnvironment )
inlinevirtual

Init the metrics for the agent in the learning environment.

This method is called at the beginning of the evaluateJob method.

Parameters
[in]agentthe TPGVertex representing the agent.
[in]learningEnvironmentthe learning environment in which the agent is evaluated.

Reimplemented in Selector::ClassificationSelectionMetrics, and Selector::MapElites::MapElitesSelectionMetrics.

◆ weightedSum() [1/2]

void Selector::SelectionMetrics::weightedSum ( std::shared_ptr< SelectionMetrics > other,
size_t nbEvaluation,
size_t nbEvaluationOther )
virtual

Perform a weighted sum between this SelectionMetrics and another.

Parameters
[in]otherthe other SelectionMetrics to combine with this.
[in]nbEvaluationthe number of evaluation used to obtain this SelectionMetrics.
[in]nbEvaluationOtherthe number of evaluation used to obtain the other SelectionMetrics.

Reimplemented in Selector::ClassificationSelectionMetrics, Selector::MapElites::MapElitesSelectionMetrics, and Selector::TimingSelectionMetrics.

◆ weightedSum() [2/2]

template<class T >
static T Selector::SelectionMetrics::weightedSum ( T value,
T valueOther,
size_t nbEvaluation,
size_t nbEvaluationOther )
inlinestatic

Perform a weighted sum between 2 values.

Parameters
[in]valuethe value to combine.
[in]valueOtherthe other value to combine.
[in]nbEvaluationthe number of evaluations to obtain value.
[in]nbEvaluationOtherthe number of evaluations to obtain valueOther.

Member Data Documentation

◆ score

double Selector::SelectionMetrics::score = 0
protected

Score obtained by the agent at the end of an episode

◆ utility

double Selector::SelectionMetrics::utility = 0
protected

Double value for the utility. Utility is used only if the LearningEnvironment override the specific method. The utility represent a score needed for logs but not for learning.

It can be used for comparison with different score rules for example.


The documentation for this class was generated from the following files: