class CpuTimer#

A simple timer class, logging elapsed CPU time to stdout.

Public Functions

inline explicit CpuTimer(std::string info_msg = "")#

Constructs a timer, sets start time.


info_msg – The value for info_msg_

inline ~CpuTimer()#

Destructs a timer, prints time elapsed to stdout.

Private Types

using Clock = std::chrono::high_resolution_clock#

The start time of the timer.

Private Members

std::string info_msg_#

A info message to be logged to stdout when the timer completes.

Clock::time_point start_time_#


class FOptimizationType : public ioh::common::HasRepr#

Wrapper class for optimization type, contains comparison operator.

Public Functions

inline FOptimizationType(const OptimizationType type = OptimizationType::MAX)#

Construct a new FOptimizationType object.


type – The optimization type

FOptimizationType(const FOptimizationType&) = default#

Copy constructor.

inline OptimizationType type() const#

Accessor for type_.

inline double initial_value() const#

Accesor for initial_value_.

inline virtual std::string repr() const override#

String representation.

inline bool operator()(const double v1, const double v2) const#

Comparison operator between two values v1 & v2.

> When OptimizationType is MAX, < otherwise.


true if v1 is better than v2

inline bool operator==(const FOptimizationType &other) const#

Equality operato.


other – an FOptimizationType

inline bool operator==(const OptimizationType &other) const#

Equality operato.


other – an OptimizationType

FOptimizationType &operator=(const FOptimizationType&) = default#


Private Members

OptimizationType type_#

The underlying optimization type.

std::function<bool(double, double)> comparator_#

The comparison operator.

double initial_value_#

Default (worst possible value)



template<class Type, class Factory>
struct AutomaticTypeRegistration : public ioh::common::RegistrationInvoker<Type, Factory>#

Helper for factory system.

Subclassed by ioh::problem::BBOProblem< AttractiveSector >, ioh::problem::BBOProblem< AttractiveSector >, ioh::problem::BBOProblem< BentCigar >, ioh::problem::BBOProblem< BentCigar >, ioh::problem::BBOProblem< BuecheRastrigin >, ioh::problem::BBOProblem< BuecheRastrigin >, ioh::problem::BBOProblem< DifferentPowers >, ioh::problem::BBOProblem< DifferentPowers >, ioh::problem::BBOProblem< Discus >, ioh::problem::BBOProblem< Discus >, ioh::problem::BBOProblem< Ellipsoid >, ioh::problem::BBOProblem< Ellipsoid >, ioh::problem::BBOProblem< EllipsoidRotated >, ioh::problem::BBOProblem< EllipsoidRotated >, ioh::problem::BBOProblem< Gallagher101 >, ioh::problem::BBOProblem< Gallagher101 >, ioh::problem::BBOProblem< Gallagher21 >, ioh::problem::BBOProblem< Gallagher21 >, ioh::problem::BBOProblem< GriewankRosenBrock >, ioh::problem::BBOProblem< GriewankRosenBrock >, ioh::problem::BBOProblem< Katsuura >, ioh::problem::BBOProblem< Katsuura >, ioh::problem::BBOProblem< LinearSlope >, ioh::problem::BBOProblem< LinearSlope >, ioh::problem::BBOProblem< LunacekBiRastrigin >, ioh::problem::BBOProblem< LunacekBiRastrigin >, ioh::problem::BBOProblem< Rastrigin >, ioh::problem::BBOProblem< Rastrigin >, ioh::problem::BBOProblem< RastriginRotated >, ioh::problem::BBOProblem< RastriginRotated >, ioh::problem::BBOProblem< Rosenbrock >, ioh::problem::BBOProblem< Rosenbrock >, ioh::problem::BBOProblem< RosenbrockRotated >, ioh::problem::BBOProblem< RosenbrockRotated >, ioh::problem::BBOProblem< Schaffers10 >, ioh::problem::BBOProblem< Schaffers10 >, ioh::problem::BBOProblem< Schaffers1000 >, ioh::problem::BBOProblem< Schaffers1000 >, ioh::problem::BBOProblem< Schwefel >, ioh::problem::BBOProblem< Schwefel >, ioh::problem::BBOProblem< SharpRidge >, ioh::problem::BBOProblem< SharpRidge >, ioh::problem::BBOProblem< Sphere >, ioh::problem::BBOProblem< Sphere >, ioh::problem::BBOProblem< StepEllipsoid >, ioh::problem::BBOProblem< StepEllipsoid >, ioh::problem::BBOProblem< T >, ioh::problem::BBOProblem< T >, ioh::problem::BBOProblem< Weierstrass >, ioh::problem::BBOProblem< Weierstrass >, ioh::problem::submodular::GraphProblemType< MaxCoverage >, ioh::problem::submodular::GraphProblemType< MaxCoverage >, ioh::problem::submodular::GraphProblemType< MaxCut >, ioh::problem::submodular::GraphProblemType< MaxCut >, ioh::problem::submodular::GraphProblemType< MaxInfluence >, ioh::problem::submodular::GraphProblemType< MaxInfluence >, ioh::problem::submodular::GraphProblemType< PackWhileTravel >, ioh::problem::submodular::GraphProblemType< PackWhileTravel >, ioh::suite::IntegerSuite< Integer >, ioh::suite::IntegerSuite< PBO >, ioh::suite::IntegerSuite< Submodular >, ioh::problem::BBOProblem< ProblemType >, ioh::problem::BBOProblem< ProblemType >, ioh::problem::PBOProblem< ProblemType >, ioh::problem::PBOProblem< ProblemType >, ioh::problem::RegisteredProblem< ProblemType, ParentType >, ioh::problem::submodular::GraphProblemType< ProblemType >, ioh::problem::submodular::GraphProblemType< ProblemType >, ioh::suite::IntegerSuite< Derived >, ioh::suite::RealSuite< Derived >, ioh::problem::PBOProblem< ConcatenatedTrap >, ioh::problem::PBOProblem< ConcatenatedTrap >, ioh::problem::PBOProblem< IsingRing >, ioh::problem::PBOProblem< IsingRing >, ioh::problem::PBOProblem< IsingTorus >, ioh::problem::PBOProblem< IsingTorus >, ioh::problem::PBOProblem< IsingTriangular >, ioh::problem::PBOProblem< IsingTriangular >, ioh::problem::PBOProblem< LABS >, ioh::problem::PBOProblem< LABS >, ioh::problem::PBOProblem< LeadingOnes >, ioh::problem::PBOProblem< LeadingOnes >, ioh::problem::PBOProblem< LeadingOnesDummy1 >, ioh::problem::PBOProblem< LeadingOnesDummy1 >, ioh::problem::PBOProblem< LeadingOnesDummy2 >, ioh::problem::PBOProblem< LeadingOnesDummy2 >, ioh::problem::PBOProblem< LeadingOnesEpistasis >, ioh::problem::PBOProblem< LeadingOnesEpistasis >, ioh::problem::PBOProblem< LeadingOnesNeutrality >, ioh::problem::PBOProblem< LeadingOnesNeutrality >, ioh::problem::PBOProblem< LeadingOnesRuggedness1 >, ioh::problem::PBOProblem< LeadingOnesRuggedness1 >, ioh::problem::PBOProblem< LeadingOnesRuggedness2 >, ioh::problem::PBOProblem< LeadingOnesRuggedness2 >, ioh::problem::PBOProblem< LeadingOnesRuggedness3 >, ioh::problem::PBOProblem< LeadingOnesRuggedness3 >, ioh::problem::PBOProblem< Linear >, ioh::problem::PBOProblem< Linear >, ioh::problem::PBOProblem< MIS >, ioh::problem::PBOProblem< MIS >, ioh::problem::PBOProblem< NKLandscapes >, ioh::problem::PBOProblem< NKLandscapes >, ioh::problem::PBOProblem< NQueens >, ioh::problem::PBOProblem< NQueens >, ioh::problem::PBOProblem< OneMax >, ioh::problem::PBOProblem< OneMax >, ioh::problem::PBOProblem< OneMaxDummy1 >, ioh::problem::PBOProblem< OneMaxDummy1 >, ioh::problem::PBOProblem< OneMaxDummy2 >, ioh::problem::PBOProblem< OneMaxDummy2 >, ioh::problem::PBOProblem< OneMaxEpistasis >, ioh::problem::PBOProblem< OneMaxEpistasis >, ioh::problem::PBOProblem< OneMaxNeutrality >, ioh::problem::PBOProblem< OneMaxNeutrality >, ioh::problem::PBOProblem< OneMaxRuggedness1 >, ioh::problem::PBOProblem< OneMaxRuggedness1 >, ioh::problem::PBOProblem< OneMaxRuggedness2 >, ioh::problem::PBOProblem< OneMaxRuggedness2 >, ioh::problem::PBOProblem< OneMaxRuggedness3 >, ioh::problem::PBOProblem< OneMaxRuggedness3 >, ioh::suite::RealSuite< BBOB >, ioh::suite::RealSuite< Real >

Public Members

InvokeApplyOnConstruction<Type, Factory> &invoker = RegistrationInvoker<Type, Factory>::registration_invoker#

Forces creation of invoker


template<class AbstractType, typename ...Args>
struct Factory#

Class for generating classes for a given abtract type.

Template Parameters:
  • AbstractType – the parent type of the classes to be generator

  • Args – the arguments of the common constructor for children of AbtractType

Public Types

using Type = std::shared_ptr<AbstractType>#

A shared ptr to AbstractType.

using Creator = std::function<Type(Args&&...)>#

Creator method for instances of Type.

Public Functions

inline void include(const std::string &name, const int id, Creator creator)#

Include a new element to the factory.

inline int check_or_get_next_available(const int id) const#

Get the next available id.

inline int check_or_get_next_available(const int id, const std::string &name) const#

Get the next available id.

inline std::vector<std::string> names() const#

Accessor for the list of registered names.

inline std::vector<int> ids() const#

Accessor for the list of registered ids.

inline std::map<int, std::string> map() const#

Accessor for the map from id to name.

inline Type create(const std::string &name, Args... params) const#

Create a new instance of Type using the Creator registered.

inline Type create(const int id, Args... params) const#

Create a new instance of Type using the Creator registered.

Public Static Functions

static inline Factory &instance()#

Accessor to static instance.

Private Functions

Factory() = default#
Factory(const Factory&) = delete#

Private Members

std::map<std::string, Creator> name_map#
std::map<int, std::string> id_map#


struct HasRepr#

Interface which defines a repr method.

Subclassed by ioh::problem::Constraint< int >, ioh::common::FOptimizationType, ioh::logger::analyzer::structures::AlgorithmInfo, ioh::logger::analyzer::structures::Attribute< T >, ioh::logger::analyzer::structures::BestPoint, ioh::logger::analyzer::structures::ExperimentInfo, ioh::logger::analyzer::structures::RunInfo, ioh::logger::analyzer::structures::ScenarioInfo, ioh::problem::Constraint< T >, ioh::problem::ConstraintSet< T >, ioh::problem::MetaData, ioh::problem::Solution< T, MultiObjective >, ioh::problem::Solution< T, SingleObjective >, ioh::problem::State< T, double >, ioh::problem::State< T, MultiObjective >, ioh::problem::submodular::graph::Graph

Public Functions

virtual std::string repr() const = 0#

Representation of the object.


inline friend std::ostream &operator<<(std::ostream &os, const HasRepr &obj)#

Default string stream method.


template<bool IsProblem>
struct IdGetter#

Helper to get a new ID for a given class.

IdGetter< false >#

struct IdGetter<false>#

Helper to get a new ID for a non problem class.

Public Static Functions

template<typename T>
static inline int get_id(const std::vector<int> &ids)#

Gets an id.

IdGetter< true >#

struct IdGetter<true>#

Helper to get a new ID for a problem class.

Public Static Functions

template<typename T>
static inline int get_id(const std::vector<int>&)#

Gets an from the class meta_data.


template<class Type, class Factory>
struct InvokeApplyOnConstruction#

Helper for factory system.

Public Functions

inline InvokeApplyOnConstruction()#


struct Permutation#

Permutation struct.

Public Functions

inline bool operator<(const Permutation &b) const#

sort operator

Public Members

double value#


int index#


Public Static Functions

static inline std::vector<Permutation> sorted(const int n, const int seed)#

sort a set of random permutations


template<typename Parent, typename ...Args>
struct RegisterWithFactory#

Base factory registry.

Template Parameters:
  • Parent – Abstract type

  • Args – Parent constructor args

Public Types

using InstanceBasedProblem = ioh::problem::InstanceBasedProblem#

Typedef for instance based problems.

Public Static Functions

template<class T>
static inline std::enable_if<!std::is_base_of<InstanceBasedProblem, T>::value, void>::type include()#

Include Parent in the factory.

template<class T>
static inline std::enable_if<std::is_base_of<InstanceBasedProblem, T>::value, void>::type include()#

Include specific for instance based problems.

static inline Factory<Parent, Args...> &instance()#

Accessor to static instance.


template<class Type, class Factory>
struct RegistrationInvoker#

Helper for factory system.

Subclassed by ioh::common::AutomaticTypeRegistration< Type, Factory >

Public Static Attributes

static InvokeApplyOnConstruction<Type, Factory> registration_invoker = InvokeApplyOnConstruction<Type, Factory>()#

Forces creation of registration_invoker



enum class ioh::common::OptimizationType#

Enum containing minimization = 0 and maximization = 1 flags.


enumerator MIN#
enumerator MAX#



inline bool ioh::common::all_finite(const std::vector<double> &x)#

Checks a vector of doubles for nan values.


x – vector to be checked


true if x contains a nan value



doxygenfunction: Unable to resolve function “ioh::common::as_vector” with arguments None in doxygen xml output for project “iohcpp” from directory: ../../build/xml/. Potential matches:

- template<typename K, typename V, typename P = std::pair<K, V>> std::vector<P> as_vector(const std::map<K, V*> &m)
- template<typename K, typename V, typename P = std::pair<K, V>> std::vector<P> as_vector(const std::map<K, V> &m)


template<typename T>
std::string ioh::common::class_name()#

Get the type name of the problem.

Template Parameters:

T – the template of the Problem


the name of T


template<typename T>
std::vector<T> ioh::common::concatenate(std::vector<T> a, const std::vector<T> &b)#

concatenates two vectors

Template Parameters:

T – the type of the vectors

  • a – the first vector

  • b – the second vector


the resulting vector, containing the elements of both a and b


inline int ioh::common::get_next_id(const std::vector<int> &ids)#

Function to get the next non zero value in an array of integers.


inline bool ioh::common::has_inf(const std::vector<double> &x)#

Checks a vector of doubles for inf values.


x – vector to be checked


true if x contains a nan value


inline bool ioh::common::has_nan(const std::vector<double> &x)#

Checks a vector of doubles for nan values.


x – vector to be checked


true if x contains a nan value


template<typename K, typename V>
std::vector<K> ioh::common::keys(const std::map<K, V> &m)#

Retrieve the keys from a map.


inline void ioh::common::ltrim(std::string &s)#

trim leading whitespace (in place)


s – the string to trim


template<typename Iterator>
void ioh::common::print(const Iterator x, const std::string &del = " ")#

Helper to print the contents of iterator to stdout.

Template Parameters:


  • x – the iterators to print, for example a std::vector

  • del – the delimeter between each element


inline std::vector<int> ioh::common::range(const int start, const int stop, const int step = 1)#

Returns a range of integers.

  • start – start of the range

  • stop – end of the range

  • step – stepsize of the range


a vector filled with numbers


inline void ioh::common::rtrim(std::string &s)#

trim from end (in place)


s – the string to trim


inline void ioh::common::trim(std::string &s)#

trim from both ends (in pla0ce)


s – the string to trim


template<typename T>
std::string ioh::common::type_name()#

Get the type name of a given template T.

Template Parameters:

T – a type


the name of T


template<typename K, typename V>
std::vector<V> ioh::common::values(const std::map<K, V> &m)#

Retrieve the values from a map.