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:
Selector::Selector

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< SelectionMetricscreateSelectionMetrics ()
 
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::TPGGraphgetGraph ()
 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 SelectionContextupdateContext ()
 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::TPGGraphgraph
 TPGGraph on which the TPGVertex can be selected or deleted.
 
const Learn::LearningParametersparams
 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]graphshared pointer of the graph on which the selection is done.
[in]paramsparameters 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 )
overridevirtual

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]resultsa multimap containing root TPGVertex associated to their score during an evaluation.
[in]rngRandom Number Generator used in the mutation process.

Reimplemented from Selector::Selector.


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