GEGELATI

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

CVT Map Elites Archive class. More...

`#include <cvtMapElitesArchive.h>`

Inheritance diagram for Selector::MapElites::CvtMapElitesArchive:

## Public Member Functions
| CvtMapElitesArchive (Mutator::RNG &rng, size_t nbCentroids, size_t nbDescriptors, double minValue, double maxValue, size_t nbIterationInit, size_t nbDotsInit, double a1, double b1, double a2, double b2)
| Constructor of the CVT Map Elites Archive.
double | dist_squared (const std::vector< double > &a, const std::vector< double > &b)
| Calculate squared Euclidean distance between two points.
std::vector< double > | add (const std::vector< double > &a, const std::vector< double > &b)
| Vector addition.
std::vector< double > | scalar_mult (const std::vector< double > &a, double s)
| Scalar multiplication.
std::vector< double > | average (const std::vector< std::vector< double > > &points)
| Compute the average of a set of points.
std::vector< double > | random_point (Mutator::RNG &rng)
| Generate a random point within the descriptor bounds.
size_t | nearest (const std::vector< double > &point, const std::vector< std::vector< double > > &centroids)
| Find the nearest centroid to a given point.
void | initialize_cvt (Mutator::RNG &rng)
| Initialize the CVT centroids using Lloyd's algorithm.
size_t | getIndexForDescriptor (const std::vector< double > &descriptors) const
| Get the index for given descriptors.
const std::pair< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > & | getArchiveFromDescriptors (const std::vector< double > &descriptors) const override
| Get the archive content at given descriptors.
void | setArchiveFromDescriptors (const TPG::TPGVertex *vertex, std::shared_ptr< Learn::EvaluationResult > eval, const std::vector< double > &descriptors) override
| Set the archive content at given descriptors.
virtual const std::vector< std::vector< double > > & | getCentroids () const
| Return the centroids used by the CVT.
Public Member Functions inherited from Selector::MapElites::MapElitesArchive
| MapElitesArchive (size_t nbBinPerDescriptor, size_t nbDescriptors, double minValue, double maxValue)
| Constructor of the MapElitesArchive.
uint64_t | size () const
| Get the size of the archive.
std::pair< uint64_t, uint64_t > | getDimensions () const
| Get the dimensions of the archive.
std::vector< double > | getArchiveLimits () const
| get the archive limits
virtual const std::vector< std::pair< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > > & | getAllArchive () const
| Get all the archive content.
virtual const std::pair< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > & | getArchiveAt (const std::vector< uint64_t > &indices) const
| Get the archive content at given indices.
virtual void | setArchiveAt (const TPG::TPGVertex *vertex, std::shared_ptr< Learn::EvaluationResult > eval, const std::vector< uint64_t > &indices)
| Set the archive content at given indices.
virtual uint64_t | getIndexArchive (double value) const
| Get the index in one dimension of the archive from a value.
virtual uint64_t | computeLinearIndex (const std::vector< uint64_t > &indices) const
| Compute the linear index from multi-dimensional indices.
virtual std::vector< uint64_t > | computeIndices (uint64_t index) const
| Compute the multi-dimensional indices from linear index.
virtual bool | containsRoot (const TPG::TPGVertex *root) const
| Check if the archive contains a root TPGVertex.
virtual void | removeRootFromArchiveIfNotComplete (const TPG::TPGVertex *root, size_t maxNbEvaluation)
| Remove a root TPGVertex from the archive if its number of evaluation is below maxNbEvaluation.
virtual void | removeRootFromArchive (const TPG::TPGVertex *root, size_t maxNbEvaluation)
| Remove a root TPGVertex from the archive.
virtual std::set< const TPG::TPGVertex * > | getVerticesInArchive () const
| Return a set with the current vectors in the archive.

## Protected Attributes
size_t | nbCentroids
| Number of centroids.
size_t | nbIterationInit
| Number of iterations for initialization.
size_t | nbDotsInit
| Number of dots for initialization.
double | a1
| CVT parameters.
double | b1
| CVT parameters.
double | a2
| CVT parameters.
double | b2
| CVT parameters.
std::vector< std::vector< double > > | centroids
| Centroids of the CVT.
Protected Attributes inherited from Selector::MapElites::MapElitesArchive
uint64_t | nbBinPerDescriptor
| Number of bins per descriptor.
uint64_t | nbDescriptors
| Number of descriptors for this archive.
double | minValue
| Minimum value for the descriptors.
double | maxValue
| Maximum value for the descriptors.
std::vector< double > | archiveLimits
| Limits of the bins for the descriptors.
std::vector< std::pair< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > > | archive

## Detailed Description

CVT Map Elites Archive class.

This class implements a CVT (Centroidal Voronoi Tessellation) based Map Elites Archive It inherits from the MapElitesArchive class.

## Constructor & Destructor Documentation

## ◆ CvtMapElitesArchive()

Selector::MapElites::CvtMapElitesArchive::CvtMapElitesArchive | ( | Mutator::RNG & | rng,
|  | size_t | nbCentroids,
|  | size_t | nbDescriptors,
|  | double | minValue,
|  | double | maxValue,
|  | size_t | nbIterationInit,
|  | size_t | nbDotsInit,
|  | double | a1,
|  | double | b1,
|  | double | a2,
|  | double | b2 )
| inline

Constructor of the CVT Map Elites Archive.

Parameters

  [in] | rng | Random number generator
  [in] | nbCentroids | Number of centroids
  [in] | nbDescriptors | Number of descriptors
  [in] | minValue | Minimum value for the descriptors
  [in] | maxValue | Maximum value for the descriptors
  [in] | nbIterationInit | Number of iterations for initialization
  [in] | nbDotsInit | Number of dots for initialization
  [in] | a1 | CVT parameter
  [in] | b1 | CVT parameter
  [in] | a2 | CVT parameter
  [in] | b2 | CVT parameter

## Member Function Documentation

## ◆ add()

std::vector< double > Selector::MapElites::CvtMapElitesArchive::add | ( | const std::vector< double > & | a,
|  | const std::vector< double > & | b )

Vector addition.

Parameters

  [in] | a | First vector
  [in] | b | Second vector

## ◆ average()

std::vector< double > Selector::MapElites::CvtMapElitesArchive::average | ( | const std::vector< std::vector< double > > & | points | ) |

Compute the average of a set of points.

Parameters

  [in] | points | Set of points

## ◆ dist_squared()

double Selector::MapElites::CvtMapElitesArchive::dist_squared | ( | const std::vector< double > & | a,
|  | const std::vector< double > & | b )

Calculate squared Euclidean distance between two points.

Parameters

  [in] | a | First point
  [in] | b | Second point

## ◆ getArchiveFromDescriptors()

const std::pair< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > & Selector::MapElites::CvtMapElitesArchive::getArchiveFromDescriptors | ( | const std::vector< double > & | descriptors | ) | const
| override virtual

Get the archive content at given descriptors.

Reimplemented from Selector::MapElites::MapElitesArchive.

## ◆ getIndexForDescriptor()

size_t Selector::MapElites::CvtMapElitesArchive::getIndexForDescriptor | ( | const std::vector< double > & | descriptors | ) | const

Get the index for given descriptors.

Parameters

  [in] | descriptors | The descriptors to get the index for

## ◆ initialize_cvt()

void Selector::MapElites::CvtMapElitesArchive::initialize_cvt | ( | Mutator::RNG & | rng | ) |

Initialize the CVT centroids using Lloyd's algorithm.

Parameters

  [in] | rng | Random number generator

## ◆ nearest()

size_t Selector::MapElites::CvtMapElitesArchive::nearest | ( | const std::vector< double > & | point,
|  | const std::vector< std::vector< double > > & | centroids )

Find the nearest centroid to a given point.

Parameters

  [in] | point | The point to find the nearest centroid for
  [in] | centroids | The list of centroids

## ◆ random_point()

std::vector< double > Selector::MapElites::CvtMapElitesArchive::random_point | ( | Mutator::RNG & | rng | ) |

Generate a random point within the descriptor bounds.

Parameters

  [in] | rng | Random number generator

## ◆ scalar_mult()

std::vector< double > Selector::MapElites::CvtMapElitesArchive::scalar_mult | ( | const std::vector< double > & | a,
|  | double | s )

Scalar multiplication.

Parameters

  [in] | a | Vector
  [in] | s | Scalar

## ◆ setArchiveFromDescriptors()

void Selector::MapElites::CvtMapElitesArchive::setArchiveFromDescriptors | ( | const TPG::TPGVertex * | vertex,
|  | std::shared_ptr< Learn::EvaluationResult > | eval,
|  | const std::vector< double > & | descriptors )
| override virtual

Set the archive content at given descriptors.

Reimplemented from Selector::MapElites::MapElitesArchive.

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

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