watch

Classes

Pointer

template<class T>
class Pointer : public ioh::logger::Property

A property that access a variable through a pointer.

Note

The pointed variable must be castable to a double.

Public Functions

inline Pointer(const std::string name, const T *const variable, const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

Parameters:
  • name – the name of the property.

  • variable – a pointer to the logged variable.

  • format – a fmt::format specification

inline virtual std::optional<double> operator()(const logger::Info&) const override

Main call interface.

Protected Attributes

const T *const _variable

The managed variable.

PointerReference

template<class T>
class PointerReference : public ioh::logger::Property

A property that access the variable of a variable through a reference to a pointer.

Use this if the variable does not always exists in the logged scope.

Note

The pointed variable must be castable to a double.

Warning

It is your responsability to ensure that the referenced pointer is a nullptr if the variable is out of the logged scope.

Public Types

using PtrType = T*

Typedef for the ptr.

using ConstPtrType = PtrType const

Typedef for the const ptr.

using RefType = ConstPtrType&

Typedef for the const ptr ref.

using ConstRefType = RefType

Typedef for the const const ptr ref.

Public Functions

inline RefType ref_ptr_var() const

Accessor for the internal ptr.

inline PointerReference(const std::string name, ConstRefType ref_ptr_var, const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

Parameters:
  • name – the name of the property.

  • ref_ptr_var – a reference to a pointer to the logged variable.

  • format – a fmt::format specification

inline virtual std::optional<double> operator()(const logger::Info&) const override

Main call interface.

Protected Attributes

ConstRefType _ref_ptr_var

The managed reference to a pointer.

Reference

template<class T>
class Reference : public ioh::logger::Property

A property that access a referenced variable.

Note

The variable must be castable to a double.

Public Functions

inline Reference(const std::string name, const T &variable, const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

Parameters:
  • name – the name of the property.

  • variable – a reference to the logged variable.

  • format – a fmt::format specification

inline virtual std::optional<double> operator()(const logger::Info&) const override

Main call interface.

Protected Attributes

const T &_variable

The managed reference.

Structs

CurrentBestY

struct CurrentBestY : public ioh::logger::Property

A property that access the current best value so far, with transformation and constraints applied.

Public Functions

inline CurrentBestY(const std::string name = "current_y_best", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

Main call interface.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Returns the current value of the managed variable.

The call interface should return an optional, which should be set to std::nullopt if the managed variable cannot be accessed (for instance if it does not exists during the call scope, for example if it’s a dynamic algorithm parameter that is not currently configured).

Parameters:

log_info – The current problem state data.

Returns:

An optional that holds a double if the variable is available, std::nullopt else.

CurrentY

struct CurrentY : public ioh::logger::Property

A property that access the current value so far, with transformation and constraints applied.

Public Functions

inline CurrentY(const std::string name = "current_y", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

Main call interface.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Returns the current value of the managed variable.

The call interface should return an optional, which should be set to std::nullopt if the managed variable cannot be accessed (for instance if it does not exists during the call scope, for example if it’s a dynamic algorithm parameter that is not currently configured).

Parameters:

log_info – The current problem state data.

Returns:

An optional that holds a double if the variable is available, std::nullopt else.

Evaluations

struct Evaluations : public ioh::logger::Property

A property that access the number of evaluations so far.

Public Functions

inline Evaluations(const std::string &name = "evaluations", const std::string &format = "{:d}")

Constructor.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Main call interface.

inline virtual std::string call_to_string(const logger::Info &log_info, const std::string &nan = "") const override

Method to parse the log data into a string.

Parameters:
  • log_info – The current problem state data.

  • nan – The value to log when there is no data.

Returns:

a string representation of the properties’ data

Penalty

struct Penalty : public ioh::logger::Property

A property that accesses the current constraint penalty.

Public Functions

inline Penalty(const std::string name = "penalty", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT, const size_t ci = 0)

Constructor.

Main call interface.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Returns the current value of the managed variable.

The call interface should return an optional, which should be set to std::nullopt if the managed variable cannot be accessed (for instance if it does not exists during the call scope, for example if it’s a dynamic algorithm parameter that is not currently configured).

Parameters:

log_info – The current problem state data.

Returns:

An optional that holds a double if the variable is available, std::nullopt else.

Private Members

size_t ci

Index of the constraint to be logged.

RawY

struct RawY : public ioh::logger::Property

A property that access the cyrrent objective value, without transformation.

Public Functions

inline RawY(const std::string name = "raw_y", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Main call interface.

RawYBest

struct RawYBest : public ioh::logger::Property

A property that access the best value so far, without transformation.

Public Functions

inline RawYBest(const std::string name = "raw_y_best", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Main call interface.

TransformedY

struct TransformedY : public ioh::logger::Property

A property that access the current value so far, with transformation.

Public Functions

inline TransformedY(const std::string name = "transformed_y", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

Main call interface.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Returns the current value of the managed variable.

The call interface should return an optional, which should be set to std::nullopt if the managed variable cannot be accessed (for instance if it does not exists during the call scope, for example if it’s a dynamic algorithm parameter that is not currently configured).

Parameters:

log_info – The current problem state data.

Returns:

An optional that holds a double if the variable is available, std::nullopt else.

TransformedYBest

struct TransformedYBest : public ioh::logger::Property

A property that access the best value found so far, with transformation.

Public Functions

inline TransformedYBest(const std::string name = "transformed_y_best", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

Constructor.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Main call interface.

Violation

struct Violation : public ioh::logger::Property

A property that accesses the current constraint violation.

Public Functions

inline Violation(const std::string name = "violation", const std::string &format = logger::DEFAULT_DOUBLE_FORMAT, const size_t ci = 0)

Constructor.

Main call interface.

inline virtual std::optional<double> operator()(const logger::Info &log_info) const override

Returns the current value of the managed variable.

The call interface should return an optional, which should be set to std::nullopt if the managed variable cannot be accessed (for instance if it does not exists during the call scope, for example if it’s a dynamic algorithm parameter that is not currently configured).

Parameters:

log_info – The current problem state data.

Returns:

An optional that holds a double if the variable is available, std::nullopt else.

Private Members

size_t ci

Index of the constraint to be logged.

Functions

address

template<class T>
Pointer<T> &address(const std::string name, const T *const variable, const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

The value of an extern variable (captured by address).

Parameters:
  • name – the name of the property.

  • variable – a pointer to the logged variable.

  • format – a string to format the variable when logging.

pointer

template<class T>
PointerReference<T> &pointer(const std::string name, const T *const &variable, const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

The value of an extern variable, which may not exists.

Useful for variables that doesn’t exists at some point during the solver run. In that case, if the referenced pointer is a std::nullptr, the value will be indicated as invalid in the logs.

To do so, this captures a reference to a pointer toward your variable. If you update the value of the pointed variables, it will change in the logs. If you need to invalidate the variable, you can set the referenced pointer itself to nullptr.

Warning

It is your responsability to ensure that the referenced pointer is a nullptr if the variable is out of the logged scope.

Parameters:
  • name – the name of the property.

  • variable – a reference to a pointer to the logged variable.

  • format – a fmt::format specification

reference

template<class T>
Reference<T> &reference(const std::string name, const T &variable, const std::string &format = logger::DEFAULT_DOUBLE_FORMAT)

The value of an extern variable (captured by reference).

Parameters:
  • name – the name of the property.

  • variable – a reference to the logged variable.

  • format – a fmt::format specification

Variables

current_y

CurrentY current_y

Objective function value for this call, without transformation.

current_y_best

CurrentBestY current_y_best

Objective function value for this call, without transformation.

evaluations

Evaluations evaluations

Number of evaluations of the objective function called by the solver.

penalty

Penalty penalty

Objective function value for this call, without transformation.

raw_y

RawY raw_y

Current function value, without transformation.

raw_y_best

RawYBest raw_y_best

Best objective function value found so far, without transformation.

transformed_y

TransformedY transformed_y

Objective function value for this call, with transformation.

transformed_y_best

TransformedYBest transformed_y_best

Best objective function value found so far, with transformation.

violation

Violation violation

Objective function value for this call, without transformation.