GEGELATI

Loading...
Searching...
No Matches
Public Member Functions | List of all members
Selector::TruncationSelector Class Reference

Selection class that will do a selection with a truncation. This is the classic selection methods used in the earliest works of TPGs. More...

`#include <truncationSelector.h>`

Inheritance diagram for Selector::TruncationSelector:

## Public Member Functions
| TruncationSelector (std::shared_ptr< TPG::TPGGraph > graph, const Learn::LearningParameters &params)
| Constructor for Selector.
virtual void | doSelection (std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results, Mutator::RNG &rng) override
| override of doSelection method
Public Member Functions inherited from Selector::Selector
| Selector (std::shared_ptr< TPG::TPGGraph > graph, const Learn::LearningParameters &params)
| Constructor for Selector.
virtual void | launchSelection (std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results, Mutator::RNG &rng)
| This method execute the doSelection method.
virtual std::shared_ptr< SelectionMetrics > | createSelectionMetrics ()
virtual void | keepBestPolicy ()
| This method keeps only the bes tRoot policy in the TPGGraph.
virtual void | updateEvaluationRecords (const std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
| Update the bestRoot and resultsPerRoot attributes.
virtual void | updateResultsPerRoot (const std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
| Update the resultsPerRoot.
virtual void | updateBestRoot (const std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
| Update the bestRoot attribute.
virtual const std::pair< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > & | getBestRoot () const
| Get the best root TPG::Vertex encountered since the last init.
virtual std::shared_ptr< TPG::TPGGraph > | getGraph ()
| Getter for the TPGGraph built by the LearningAgent.
virtual void | forgetPreviousResults ()
| This method resets the previous registered scores per root.
virtual const std::map< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > & | getResultsPerRoot () const
| Return the resultsPerRoot map.
virtual const SelectionContext & | updateContext ()
| Update the SelectionContext structure and return it.
virtual void | updateAfterPopulate ()
| Method to call at the end of TPGMutator::populateTPG.

## Additional Inherited Members
Protected Attributes inherited from Selector::Selector
std::shared_ptr< TPG::TPGGraph > | graph
| TPGGraph on which the TPGVertex can be selected or deleted.
const Learn::LearningParameters & | params
| Parameters for the selection.
std::pair< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > | bestRoot {nullptr, nullptr}
std::map< const TPG::TPGVertex *, std::shared_ptr< Learn::EvaluationResult > > | resultsPerRoot
| Map associating root TPG::TPGVertex to their EvaluationResult.
SelectionContext | context
| context used by the TPGMutator to populate the TPGGraph.

## Detailed Description

Selection class that will do a selection with a truncation. This is the classic selection methods used in the earliest works of TPGs.

## Constructor & Destructor Documentation

## ◆ TruncationSelector()

Selector::TruncationSelector::TruncationSelector | ( | std::shared_ptr< TPG::TPGGraph > | graph,
|  | const Learn::LearningParameters & | params )
| inline

Constructor for Selector.

Parameters

  [in] | graph | shared pointer of the graph on which the selection is done.
  [in] | params | parameters used by the Selector.

## Member Function Documentation

## ◆ doSelection()

void Selector::TruncationSelector::doSelection | ( | std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > & | results,
|  | Mutator::RNG & | rng )
| override virtual

override of doSelection method

Removed the worst agents from the population with a truncation process where the worst proportion set in the parameters is deleted.

Parameters

  [in,out] | results | a multimap containing root TPGVertex associated to their score during an evaluation.
  [in] | rng | Random Number Generator used in the mutation process.

Reimplemented from Selector::Selector.

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

- D:/a/gegelati/gegelati/gegelatilib/include/selector/truncationSelector.h
- D:/a/gegelati/gegelati/gegelatilib/src/selector/truncationSelector.cpp