eah#

Namespaces#

Types#

AttainmentMatrix#

using ioh::logger::eah::AttainmentMatrix = std::vector<std::vector<bool>>#

Type used to store a single run attainment bi-dimensional function.

First dimension is error targets, second dimension function evaluations targets.

Note

One expect to have a lot of those matrix in a real-life setting, and the more general case is to have objective-function bounded computation times. It is thus chosen to reduce the memory footprint, using the infamous bool vector specialization instead of the faster vector of char. During our tests, using char was 1.02 times faster, while consuming 1.4 more memory.

AttainmentSuite#

using ioh::logger::eah::AttainmentSuite = std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, AttainmentMatrix>>>>#

Type used to store all bi-dimensional attainment functions.

First dimension is the problem id, second dimension is the dimension id, third dimension is the instance id. fourth dimension is the run id. Every item is an AttainmentMatrix.

Classes#

Scale#

template<class R>
class Scale#

Interface for classes that computes indices from ranges.

The idea is to input [min,max] and the discretization size and to compute the position in [0,size-1] of any value in [min,max].

You can think of it as a way to compute discrete histograms’ bucket indices. Or as a morphism between any 1D “origin” space to another 1D strictly positive integer “indexed” space.

Used in EAH.

Warning

Contrary to what is common in computer science, this uses a closed [min,max] interval for the “origin” values. So that any value at max will be assigned to the size-1th bucket.

Subclassed by ioh::logger::eah::LinearScale< R >, ioh::logger::eah::Log10Scale< R >, ioh::logger::eah::Log2Scale< R >

Public Types

using BoundsType = std::pair<double, double>#

Type returned by the bounds method.

Note

This is a pair of double, whatever the type of the Scale, because one can ask for non-integer buckets limits (e.g. when size > max-min).

Public Functions

inline Scale(const R amin, const R amax, const size_t asize)#

Constructor.

Parameters:
  • amin – the minimum of the scale domain.

  • amax – the maximum of the scale domain.

  • asize – the number of buckets in the scale.

inline R min() const#

Minimum value on the axis.

inline R max() const#

Maximum value on the axis.

inline size_t size() const#

Number of buckets.

inline R length() const#

Span of the axis.

virtual size_t index(double x) const = 0#

Interface: from value to index.

Parameters:

x – The targeted real value.

Returns:

The corresponding index.

virtual BoundsType bounds(size_t i) const = 0#

Interface: from index to bounds values.

Parameters:

i – Targeted index.

Returns:

The {min,max} pair of the bounds of the corresponding bucket.

Protected Attributes

R _min#

Minimum.

R _max#

Maximum.

size_t _size#

Number of buckets.

LinearScale#

template<class R>
class LinearScale : public ioh::logger::eah::Scale<R>#

Linear scale.

Public Types

using BoundsType = typename Scale<R>::BoundsType#

The type in which bounds are stored by the bounds method.

Public Functions

inline LinearScale(const R min, const R max, const size_t size)#

Constructor.

Parameters:
  • min – the minimum of the scale domain.

  • max – the maximum of the scale domain.

  • size – the number of buckets in the scale.

inline virtual size_t index(const double x) const override#

Returns the index of the bucket in which a value falls.

Parameters:

x – the value on the scale.

Returns:

the corresponding bucket index.

inline virtual BoundsType bounds(const size_t i) const override#

Returns the bounds of the corresponding bucket index.

Parameters:

i – the index of the bucket.

Returns:

[min,max[ of the bucket i.

inline R step() const#

Returns the width of a bucket.

Log2Scale#

template<class R>
class Log2Scale : public ioh::logger::eah::Scale<R>#

Logarithmic (base 2) scale.

Warning

This implementation is not very robust to rounding errors especially if you use the bounds method with large lengths.

Public Types

using BoundsType = typename Scale<R>::BoundsType#

The type in which bounds are stored by the bounds method.

Public Functions

inline Log2Scale(const R min, const R max, const size_t size)#

Constructor.

Parameters:
  • min – the minimum of the scale domain.

  • max – the maximum of the scale domain.

  • size – the number of buckets in the scale.

inline virtual size_t index(const double x) const override#

Returns the index of the bucket in which a value falls.

Parameters:

x – the value on the scale.

Returns:

the corresponding bucket index.

inline virtual BoundsType bounds(const size_t i) const override#

Returns the bounds of the corresponding bucket index.

Parameters:

i – the index of the bucket.

Returns:

[min,max[ of the bucket i.

Protected Attributes

const double _m#

The minimum.

const double _l#

Max - min.

const double _s#

The number of buckets.

const double _k#

The log(1+max-min) constant.

Log10Scale#

template<class R>
class Log10Scale : public ioh::logger::eah::Scale<R>#

Logarithmic (base 10) scale.

Warning

This implementation is not very robust to rounding errors especially if you use the bounds method with large lengths.

Public Types

using BoundsType = typename Scale<R>::BoundsType#

The type in which bounds are stored by the bounds method.

Public Functions

inline Log10Scale(const R min, const R max, const size_t size)#

Constructor.

Parameters:
  • min – the minimum of the scale domain.

  • max – the maximum of the scale domain.

  • size – the number of buckets in the scale.

inline virtual size_t index(const double x) const override#

Returns the index of the bucket in which a value falls.

Parameters:

x – the value on the scale.

Returns:

the corresponding bucket index.

inline virtual BoundsType bounds(const size_t i) const override#

Returns the bounds of the corresponding bucket index.

Parameters:

i – the index of the bucket.

Returns:

[min,max[ of the bucket i.

Protected Attributes

const double _m#

The minimum.

const double _l#

Max - min.

const double _s#

The number of buckets.

const double _k#

The log(1+max-min) constant.

Stat#

template<class T>
class Stat#

An interface for classes that computes statistics over the AttainmentSuite computed by an eah::EAH logger.

The template indicates the return type of the functor interface.

Public Types

using Type = T#

Type of the computed statistic.

Public Functions

virtual T operator()(const EAH &logger) = 0#

Call interface.

Functions#

colormap#

template<class T>
std::string ioh::logger::eah::colormap(const std::vector<std::vector<T>> &data, std::pair<const Scale<double>*, const Scale<size_t>*> ranges = {nullptr, nullptr}, bool values = false)#

Print a 2D colormap as a 256-color ASCII-art.

Convenience function to print the 2D vector arrays outputed by histogram or distribution.

Useful to rapidely check or debug the core data structure of the EAH logger.

By default, just display the colormap. If ranges are passed, display axis legends with values.

Note

The y-axis lowver buckets values are printed as vertical numbers. The x-axis legend show both min and max of buckets.

Parameters:
  • data – A 2D vector array.

  • ranges – The pair of Scale used for the computation of data. If given, will add axis legends.

  • values – If true, will display one 2-digits value over two within the colored pixels. Numbers with more than 2 digits are rendered as “++”.

operator<<#

inline std::ostream &ioh::logger::eah::operator<<(std::ostream &out, const AttainmentMatrix &mat)#

Pretty print an AttainmentMatrix.