GEGELATI

Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Selector::MapElites::MapElitesSelector Class Reference

Selection class that will do a selection with a Map Elites algorithm. More...

`#include <mapElitesSelector.h>`

Inheritance diagram for Selector::MapElites::MapElitesSelector:

## Public Member Functions
| MapElitesSelector (std::shared_ptr< TPG::TPGGraph > graph, const Learn::LearningParameters &params)
| Constructor for Selector.
virtual std::shared_ptr< const MapElitesArchive > | getMapElitesArchiveAt (std::shared_ptr< const MapElitesDescriptor > descriptor)
| Get the archive corresponding to a given descriptor.
virtual const std::map< std::shared_ptr< const MapElitesDescriptor >, std::shared_ptr< MapElitesArchive > > & | getMapElitesArchives ()
| Get all the map elites archives.
virtual std::shared_ptr< SelectionMetrics > | createSelectionMetrics () override
virtual std::shared_ptr< const MapElitesArchive > | addArchiveFromDescriptor (size_t nbBins, std::shared_ptr< const MapElitesDescriptor > descriptor, Learn::LearningEnvironment &le)
| Add an archive for a given descriptor.
virtual std::shared_ptr< const MapElitesArchive > | addCvtArchiveFromDescriptor (size_t nbCentroids, std::shared_ptr< const MapElitesDescriptor > descriptor, Learn::LearningEnvironment &le, Mutator::RNG &rng, size_t nbIterationInit=300, size_t nbDotsInit=1000, double a1=0.5, double b1=0.5, double a2=0.5, double b2=0.5)
| Add a CVT archive for a given descriptor.
virtual void | doSelection (std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results, Mutator::RNG &rng) override
| override of doSelection method
virtual const SelectionContext & | updateContext () override
| Specialization of updateContext for MapElites purposes.
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 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 void | updateAfterPopulate ()
| Method to call at the end of TPGMutator::populateTPG.

## Protected Attributes
std::map< std::shared_ptr< const MapElitesDescriptor >, std::shared_ptr< MapElitesArchive > > | mapEliteArchives
| Map of descriptor to their corresponding archive.
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 Map Elites algorithm.

The different archives are stored in the mapEliteArchives attribute, each archive corresponding to a descriptor.

## Constructor & Destructor Documentation

## ◆ MapElitesSelector()

Selector::MapElites::MapElitesSelector::MapElitesSelector | ( | 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

## ◆ addArchiveFromDescriptor()

std::shared_ptr< const Selector::MapElites::MapElitesArchive > Selector::MapElites::MapElitesSelector::addArchiveFromDescriptor | ( | size_t | nbBins,
|  | std::shared_ptr< const MapElitesDescriptor > | descriptor,
|  | Learn::LearningEnvironment & | le )
| virtual

Add an archive for a given descriptor.

Parameters

  [in] | nbBins | the number of bins for the archive.
  [in] | descriptor | the descriptor to add an archive for.
  [in] | le | the learning environment used to get size and ranges.

## ◆ addCvtArchiveFromDescriptor()

std::shared_ptr< const Selector::MapElites::MapElitesArchive > Selector::MapElites::MapElitesSelector::addCvtArchiveFromDescriptor | ( | size_t | nbCentroids,
|  | std::shared_ptr< const MapElitesDescriptor > | descriptor,
|  | Learn::LearningEnvironment & | le,
|  | Mutator::RNG & | rng,
|  | size_t | nbIterationInit = 300,
|  | size_t | nbDotsInit = 1000,
|  | double | a1 = 0.5,
|  | double | b1 = 0.5,
|  | double | a2 = 0.5,
|  | double | b2 = 0.5 )
| virtual

Add a CVT archive for a given descriptor.

Parameters

  [in] | nbCentroids | the number of centroids for the CVT archive.
  [in] | descriptor | the descriptor to add an archive for.
  [in] | le | the learning environment used to get size and ranges.
  [in] | rng | the random number generator used for the CVT initialization.
  [in] | nbIterationInit | number of iterations for the CVT initialization.
  [in] | nbDotsInit | number of dots for the CVT initialization.
  [in] | a1 | CVT default parameter.
  [in] | b1 | CVT default parameter.
  [in] | a2 | CVT default parameter.
  [in] | b2 | CVT default parameter.

## ◆ createSelectionMetrics()

std::shared_ptr< Selector::SelectionMetrics > Selector::MapElites::MapElitesSelector::createSelectionMetrics | ( |  | ) |
| override virtual

Specialization of createSelectionMetrics

Creates and return an instance of MapElitesSelectionMetrics

Reimplemented from Selector::Selector.

## ◆ doSelection()

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

override of doSelection method

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.

## ◆ getMapElitesArchiveAt()

std::shared_ptr< const Selector::MapElites::MapElitesArchive > Selector::MapElites::MapElitesSelector::getMapElitesArchiveAt | ( | std::shared_ptr< const MapElitesDescriptor > | descriptor | ) |
| virtual

Get the archive corresponding to a given descriptor.

Parameters

  [in] | descriptor | the descriptor to get the archive for.

## ◆ updateContext()

const Selector::SelectionContext & Selector::MapElites::MapElitesSelector::updateContext | ( |  | ) |
| override virtual

Specialization of updateContext for MapElites purposes.

Reimplemented from Selector::Selector.

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

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