problem#
Namespaces#
Types#
AutomaticProblemRegistration#
-
template<class Derived, class Parent>
using ioh::problem::AutomaticProblemRegistration = common::AutomaticTypeRegistration<Derived, ProblemRegistryType<Parent>># Automatic Factory registration type def.
- Template Parameters:
Derived – type of the problem
Parent – type of the problem
Bounds#
-
template<typename T>
using ioh::problem::Bounds = BoxConstraint<T># BoxConstraint object alias.
CalculateObjectiveFunction#
-
template<typename T, typename R>
using ioh::problem::CalculateObjectiveFunction = std::function<Solution<T, R>(const int, const int)># typedef for functions which compute a value for an optimum based on a given instance, dimension combination Used in wrap_problem
- Template Parameters:
T – type of the problem
R – the returntype of the problem
ConstraintFunction#
ConstraintPtr#
-
template<typename T>
using ioh::problem::ConstraintPtr = std::shared_ptr<Constraint<T>># Convienence typedef: shared_ptr of a Contraint.
- Template Parameters:
T – numeric type for the contraint
Constraints#
-
template<typename T>
using ioh::problem::Constraints = std::vector<ConstraintPtr<T>># Convienence typedef: vector of ContraintPtr.
- Template Parameters:
T – numeric type for the contraint
IntegerSingleObjective#
-
using ioh::problem::IntegerSingleObjective = SingleObjectiveProblem<int>#
Type def for Integer problems.
MultiObjective#
-
using ioh::problem::MultiObjective = std::vector<double>#
Typedef for mutliobjective problems.
ObjectiveFunction#
-
template<typename T, typename R>
using ioh::problem::ObjectiveFunction = std::function<R(const std::vector<T>&)># typedef for functions which can be wrapped in SingleObjectiveWrappedProblem
- Template Parameters:
T – type of the problem
R – the returntype of the problem
ObjectiveTransformationFunction#
ProblemFactoryType#
-
template<typename ProblemType>
using ioh::problem::ProblemFactoryType = common::Factory<ProblemType, int, int># Factory type def.
- Template Parameters:
ProblemType – type of the problem
ProblemRegistry#
-
template<class Parent>
using ioh::problem::ProblemRegistry = ProblemRegistryType<Parent># Registry type def.
- Template Parameters:
Parent – type of the problem
ProblemRegistryType#
-
template<typename ProblemType>
using ioh::problem::ProblemRegistryType = common::RegisterWithFactory<ProblemType, int, int># Registry type def.
- Template Parameters:
ProblemType – type of the problem
RealSingleObjective#
-
using ioh::problem::RealSingleObjective = SingleObjectiveProblem<double>#
Type def for Real problems.
SingleObjective#
-
using ioh::problem::SingleObjective = double#
Typedef for single objective problems
VariablesTransformationFunction#
Classes#
BBOB#
-
class BBOB : public ioh::problem::SingleObjectiveProblem<double>#
BBOB base class.
Subclassed by ioh::problem::BBOProblem< AttractiveSector >, ioh::problem::BBOProblem< BentCigar >, ioh::problem::BBOProblem< BuecheRastrigin >, ioh::problem::BBOProblem< DifferentPowers >, ioh::problem::BBOProblem< Discus >, ioh::problem::BBOProblem< Ellipsoid >, ioh::problem::BBOProblem< EllipsoidRotated >, ioh::problem::BBOProblem< Gallagher101 >, ioh::problem::BBOProblem< Gallagher21 >, ioh::problem::BBOProblem< GriewankRosenBrock >, ioh::problem::BBOProblem< Katsuura >, ioh::problem::BBOProblem< LinearSlope >, ioh::problem::BBOProblem< LunacekBiRastrigin >, ioh::problem::BBOProblem< Rastrigin >, ioh::problem::BBOProblem< RastriginRotated >, ioh::problem::BBOProblem< Rosenbrock >, ioh::problem::BBOProblem< RosenbrockRotated >, ioh::problem::BBOProblem< Schaffers10 >, ioh::problem::BBOProblem< Schaffers1000 >, ioh::problem::BBOProblem< Schwefel >, ioh::problem::BBOProblem< SharpRidge >, ioh::problem::BBOProblem< Sphere >, ioh::problem::BBOProblem< StepEllipsoid >, ioh::problem::BBOProblem< T >, ioh::problem::BBOProblem< Weierstrass >, ioh::problem::BBOProblem< ProblemType >
Public Functions
-
inline BBOB(const int problem_id, const int instance, const int n_variables, const std::string &name, const double condition = sqrt(10.0))#
Construct a new BBOB object.
- Parameters:
problem_id – The id of the problem
instance – The instance of the problem
n_variables – the dimension of the problem
name – the name of the problem
condition – the conditioning of the problem
Protected Functions
Protected Attributes
-
struct ioh::problem::BBOB::TransformationState transformation_state_#
The current transformation state.
-
struct TransformationState#
Container for BBOB transformation data.
Public Functions
-
inline TransformationState(const long problem_id, const int instance, const int n_variables, const double condition = sqrt(10.0))#
Construct a new Transformation State object.
- Parameters:
problem_id – the id of the problem
instance – the instance of the problem
n_variables – the dimension of the problem
condition – the conditioning of the problem
-
inline std::vector<std::vector<double>> compute_rotation(const long rotation_seed, const int n_variables) const#
Compute a rotation for a problem.
- Parameters:
rotation_seed – the seed of the rotation
n_variables – the dimension of the problem
- Returns:
std::vector<std::vector<double>> the rotation
Public Members
-
long seed#
The seed.
-
std::vector<double> exponents = {}#
A vector with exponents.
-
std::vector<double> conditions = {}#
A vector with conditions.
-
std::vector<std::vector<double>> transformation_matrix = {}#
Main transformation matrix.
-
std::vector<double> transformation_base = {}#
Main transformation vector.
-
std::vector<std::vector<double>> second_transformation_matrix = {}#
Second transformation matrix.
-
std::vector<std::vector<double>> first_rotation = {}#
First rotation matrix.
-
std::vector<std::vector<double>> second_rotation = {}#
Second rotation matrix.
-
inline TransformationState(const long problem_id, const int instance, const int n_variables, const double condition = sqrt(10.0))#
-
inline BBOB(const int problem_id, const int instance, const int n_variables, const std::string &name, const double condition = sqrt(10.0))#
BBOProblem#
-
template<typename ProblemType>
class BBOProblem : public ioh::problem::BBOB, private ioh::common::AutomaticTypeRegistration<ProblemType, BBOB>, private ioh::common::AutomaticTypeRegistration<ProblemType, RealSingleObjective># CRTP class for BBOB problems.
Inherit from this class when defining new BBOB problems
- Template Parameters:
ProblemType – The New BBOB problem class
Public Functions
-
inline BBOProblem(const int problem_id, const int instance, const int n_variables, const std::string &name, const double condition = sqrt(10.0))#
Construct a new BBOProblem object.
- Parameters:
problem_id – The id of the problem
instance – The instance of the problem
n_variables – the dimension of the problem
name – the name of the problem
condition – the conditioning of the problem
Constraint#
-
template<typename T>
class Constraint : public ioh::common::HasRepr# Abstract type for constraints.
- Template Parameters:
T – the data type, matches problem data type
Subclassed by ioh::problem::BoxConstraint< T >, ioh::problem::FunctionalConstraint< T >
Public Functions
-
inline Constraint(const constraint::Enforced enforced = constraint::Enforced::NOT, const double weight = 1.0, const double exponent = 1.0)#
Construct a new contraint object.
- Parameters:
enforced – policy for enforcing the penalty on the constraint see constraint::Enforced
weight – the penalty weight
exponent – the penalty exponent
-
inline double operator()(const std::vector<T> &x, const double y)#
apply the constraint, and return a (potentially) penalized value for y
- Parameters:
x – the search space value
y – the objective space value
- Returns:
penalized value for y
-
inline bool is_feasible(const std::vector<T> &x)#
Checks whether the x and y values are in the feasible domain.
- Parameters:
x – the search space value
- Returns:
true if both x and y are feasible, false otherwise
-
inline bool cached_is_feasible() const#
The value for is_feasibile_ is cached, in order not to call compute_violation again.
This value corresponse to the last call of is_feasible
- Returns:
is_feasible_
-
virtual bool compute_violation(const std::vector<T> &x) = 0#
Compute if x or y has any violations of the constraint.
This should set violation_.
- Parameters:
x – the search space value
- Returns:
true when there is violation and false otherwise.
-
inline virtual double penalize(const double y) const#
Penalize the y value.
This method is only called when there is a violation, and is_feasible returns a false value, see operator().
- Parameters:
y – the objective space value
- Returns:
the penalized value for y.
-
inline virtual double violation() const#
Accessor for violation_.
-
inline virtual double penalty() const#
Accessor for penalty.
FunctionalConstraint#
-
template<typename T>
class FunctionalConstraint : public ioh::problem::Constraint<T># Wrapper for functions, that compute a constraint violation.
- Template Parameters:
T – the numeric type for the search space values
Public Functions
-
inline FunctionalConstraint(ConstraintFunction<T> fn, const double weight = 1.0, const double exponent = 1.0, const constraint::Enforced enforced = constraint::Enforced::SOFT, const std::string &name = "")#
Construct a new functional constraint.
- Parameters:
fn – the function that computes the violation
weight – the constraint penalty weight, used to penalize the y value as weight * violation ^ exponent
exponent – the constraint penalty exponent, used to penalize the y value as weight * violation ^ exponent
enforced – enforcement policy, see constraint::Enforced
name – a name for this constraint, only used for the string representation.
-
inline virtual bool compute_violation(const std::vector<T> &x) override#
Override for Constraint::compute_violation, calls fn_ to compute violation_ value.
- Parameters:
x – the search space value
- Returns:
true when the absolute value for violation_ > 0 false otherwise
-
inline virtual std::string repr() const override#
Override string representation.
PBO#
-
class PBO : public ioh::problem::SingleObjectiveProblem<int>#
PBO base class.
Subclassed by ioh::problem::PBOProblem< ProblemType >, ioh::problem::PBOProblem< ConcatenatedTrap >, ioh::problem::PBOProblem< IsingRing >, ioh::problem::PBOProblem< IsingTorus >, ioh::problem::PBOProblem< IsingTriangular >, ioh::problem::PBOProblem< LABS >, ioh::problem::PBOProblem< LeadingOnes >, ioh::problem::PBOProblem< LeadingOnesDummy1 >, ioh::problem::PBOProblem< LeadingOnesDummy2 >, ioh::problem::PBOProblem< LeadingOnesEpistasis >, ioh::problem::PBOProblem< LeadingOnesNeutrality >, ioh::problem::PBOProblem< LeadingOnesRuggedness1 >, ioh::problem::PBOProblem< LeadingOnesRuggedness2 >, ioh::problem::PBOProblem< LeadingOnesRuggedness3 >, ioh::problem::PBOProblem< Linear >, ioh::problem::PBOProblem< MIS >, ioh::problem::PBOProblem< NKLandscapes >, ioh::problem::PBOProblem< NQueens >, ioh::problem::PBOProblem< OneMax >, ioh::problem::PBOProblem< OneMaxDummy1 >, ioh::problem::PBOProblem< OneMaxDummy2 >, ioh::problem::PBOProblem< OneMaxEpistasis >, ioh::problem::PBOProblem< OneMaxNeutrality >, ioh::problem::PBOProblem< OneMaxRuggedness1 >, ioh::problem::PBOProblem< OneMaxRuggedness2 >, ioh::problem::PBOProblem< OneMaxRuggedness3 >
Public Functions
Protected Functions
-
inline std::vector<int> transform_variables(std::vector<int> x) override#
Variables transformation method.
-
inline virtual double transform_objectives(const double y) override#
Objectives transformation method.
-
inline std::vector<int> reset_transform_variables(std::vector<int> x)#
Optimum before transformation.
-
inline std::vector<int> transform_variables(std::vector<int> x) override#
PBOProblem#
-
template<typename ProblemType>
class PBOProblem : public ioh::problem::PBO, private ioh::common::AutomaticTypeRegistration<ProblemType, PBO>, private ioh::common::AutomaticTypeRegistration<ProblemType, IntegerSingleObjective># CRTP class for PBO problems.
Inherit from this class when defining new PBO problems
- Template Parameters:
ProblemType – The New PBO problem class
Public Functions
Problem#
-
template<typename T, typename R>
class Problem# Problem Base class.
- Template Parameters:
T – type of the problem
R – the returntype of the problem (evaluate)
Public Types
Public Functions
-
inline Problem(MetaData meta_data, Bounds<T> bounds, ConstraintSet<T> constraintset, State<T, R> state, Solution<T, R> optimum)#
Default constructor.
-
virtual ~Problem() = default#
destructor
-
inline virtual void reset()#
Reset method, resets problem state and logger if attached.
-
inline void detach_logger()#
Dettach a logger.
-
inline void enforce_bounds(const double weight = 1.0, const constraint::Enforced how = constraint::Enforced::SOFT, const double exponent = 1.0)#
Enforced the bounds(box-constraints) as constraint.
- Parameters:
weight – The weight for computing the penalty
how – The constraint::Enforced strategy
exponent – the exponent for scaling the contraint
-
inline ConstraintSet<T> &constraints()#
Accessor for
constraintset_
-
inline void add_constraint(const ConstraintPtr<T> &c)#
Alias for constraints().add.
-
inline void remove_constraint(const ConstraintPtr<T> &c)#
Alias for constraints().remove.
Protected Functions
-
inline bool check_input_dimensions(const std::vector<T> &x)#
Method for checking the input given to the problem has the correct dimension.
- Parameters:
x – the input vector
- Returns:
true input is correct
- Returns:
false input is incorrect
-
template<typename Integer = T>
inline std::enable_if<std::is_integral<Integer>::value, bool>::type check_input(const std::vector<T> &x)# Check input given to problem for Integer types.
- Template Parameters:
Integer – integer type
- Parameters:
x – the input
- Returns:
true if correct
-
template<typename Floating = T>
inline std::enable_if<std::is_floating_point<Floating>::value, bool>::type check_input(const std::vector<T> &x)# Check input given to problem for Floating point types.
- Template Parameters:
Floating – floating type
- Parameters:
x – the input
- Returns:
true if correct
Protected Attributes
-
ConstraintSet<T> constraintset_#
The associated constraints constriants.
SingleObjectiveProblem#
-
template<typename T>
class SingleObjectiveProblem : public ioh::problem::Problem<T, SingleObjective># CRTP class for Single objective problems.
- Template Parameters:
T – the type of the problem
Subclassed by ioh::problem::BBOB, ioh::problem::PBO, ioh::problem::SingleObjectiveWrappedProblem< T >, ioh::problem::submodular::GraphProblem, ioh::problem::WModel
Public Functions
-
inline explicit SingleObjectiveProblem(MetaData meta_data, Bounds<T> bounds, ConstraintSet<T> constraints, Solution<T, SingleObjective> optimum)#
Construct a new Problem object.
- Parameters:
meta_data – meta data for the problem
bounds – the bounds to the problem
constraints – a set of constraints for the problem
optimum – the solution to the problem
-
inline explicit SingleObjectiveProblem(MetaData meta_data, Bounds<T> bounds = Bounds<T>(), ConstraintSet<T> constraints = {})#
Construct a new Problem object with an unkown solution.
- Parameters:
meta_data – meta data for the problem
bounds – the bounds to the problem
constraints – a set of constraint for the problem
SingleObjectiveWrappedProblem#
-
template<typename T>
class SingleObjectiveWrappedProblem : public ioh::problem::SingleObjectiveProblem<T># Wrapper class for new single objective problems.
- Template Parameters:
T –
Public Functions
-
inline SingleObjectiveWrappedProblem(ObjectiveFunction<T, SingleObjective> f, const std::string &name, const int n_variables, const int problem_id = 0, const int instance_id = 0, const common::OptimizationType optimization_type = common::OptimizationType::MIN, Bounds<T> bounds = {}, VariablesTransformationFunction<T> transform_variables_function = utils::identity<std::vector<T>, int>, ObjectiveTransformationFunction<SingleObjective> transform_objectives_function = utils::identity<double, int>, std::optional<Solution<T, double>> objective = std::nullopt, ConstraintSet<T> constraints = {})#
Construct a new Wrapped Problem object.
- Parameters:
f – a function to be wrapped
name – the name for the new function in the registry
n_variables – the dimension of the problem
problem_id – the problem id
instance_id – the problem instance
optimization_type – the type of optimization
bounds – the box-constraints for the problem
transform_variables_function – function which transforms the variables of the search problem prior to calling f.
transform_objectives_function – a function which transforms the objective value of the search problem after calling f.
objective – the value for the objective
constraints – the constraints applied to the problem
Protected Functions
-
inline virtual std::vector<T> transform_variables(std::vector<T> x) override#
Variables transformation function.
-
inline virtual double transform_objectives(const double y) override#
Objectives transformation function.
Protected Attributes
-
ObjectiveFunction<T, SingleObjective> function_#
Wrapped objective function.
-
VariablesTransformationFunction<T> transform_variables_function_#
Wrapped variables transformation function.
-
ObjectiveTransformationFunction<SingleObjective> transform_objectives_function_#
Wrapped objective transformation function.
WModel#
-
class WModel : public ioh::problem::SingleObjectiveProblem<int>#
Base class for WModel problems.
Subclassed by ioh::problem::wmodel::WModelLeadingOnes, ioh::problem::wmodel::WModelOneMax
Public Functions
-
inline WModel(const int problem_id, const int instance, const int n_variables, const std::string &name, const double dummy_select_rate, const int epistasis_block_size, const int neutrality_mu, const int ruggedness_gamma)#
Construct a new WModel object.
- Parameters:
problem_id – the problem id
name – the name of the problem
instance – instance id
n_variables – the dimension of the problem
dummy_select_rate – select rate
epistasis_block_size – block size
neutrality_mu – neutrality parameter
ruggedness_gamma – ruggedness parameter
Protected Functions
-
inline virtual std::vector<int> transform_variables(std::vector<int> x) override#
Apply a random transformation to the solution itself.
Transformations are seeded on the instance ID (passed to the constructor). If the
instance
is in ]1, 50], it’s random flips. If theinstance
is in ]50,100], it’s random reorder. Ifinstance
is anything else, no transformation is applied.You may disable this transformation by subclassing and returning
x
instead of calling this function.
-
inline virtual double transform_objectives(const double y) override#
Apply a random shift and a scaling to the objective function’s value.
The transformation is seeded on the instance ID (passed to the constructor). The shift adds a random number in [-0.2, 4.8] and the scale multiplies by a random number in [1e3, 2e3].]
You may disable this transformation by subclassing and returning
y
instead of calling this function.
-
inline double evaluate(const std::vector<int> &x) override#
Evaluation method.
Protected Attributes
-
std::vector<int> dummy_info_#
Dummy variables.
-
double dummy_select_rate_ = 0#
select rate
-
int epistasis_block_size_ = 0#
block size
-
int neutrality_mu_ = 0#
Neutrality parameter.
-
int ruggedness_gamma_ = 0#
Ruggedness parameter.
-
std::vector<int> ruggedness_info_#
Ruggedness dummy parameter.
-
inline WModel(const int problem_id, const int instance, const int n_variables, const std::string &name, const double dummy_select_rate, const int epistasis_block_size, const int neutrality_mu, const int ruggedness_gamma)#
Structs#
BoxConstraint#
-
template<typename T>
struct BoxConstraint : public ioh::problem::Constraint<T># Box-BoxConstraint object.
Public Functions
-
inline BoxConstraint(const std::vector<T> &lower, const std::vector<T> &upper, constraint::Enforced enforced = constraint::Enforced::NOT)#
Construct a new BoxConstraint object.
- Parameters:
lower – lower bound
upper – upper bound
enforced – enforcement policy
-
inline explicit BoxConstraint(const int size = 1, const T lower = std::numeric_limits<T>::lowest(), const T upper = std::numeric_limits<T>::max(), constraint::Enforced enforced = constraint::Enforced::NOT)#
Construct a new BoxConstraint object.
- Parameters:
size – size of the BoxConstraint
lower – lower bound
upper – upper bound
enforced – enforcement policy
-
inline void fit(const int s)#
Initialization helper, resize the constraint.
Fills the entire constraint with the first value both the lower and upper bound.
- Parameters:
s – the new size
-
inline virtual bool compute_violation(const std::vector<T> &x) override#
Check if the BoxConstraints are violated, override Constraint::compute_violation.
-
inline BoxConstraint<T> resize(const int s) const#
Return resize version of BoxConstraint.
-
inline virtual std::string repr() const override#
String representation.
-
inline BoxConstraint(const std::vector<T> &lower, const std::vector<T> &upper, constraint::Enforced enforced = constraint::Enforced::NOT)#
ConstraintSet#
-
template<typename T>
struct ConstraintSet : public ioh::common::HasRepr# Wrapper class for multiple constraints.
Every problem has an associated ConstrainSet, which can be empty. Constraints can be added and modified via this interface.
- Template Parameters:
T – the numeric type for the Constraint
Public Functions
-
inline ConstraintSet(const Constraints<T> &cs = {})#
Construct a new ConstrainSet object from a set of constrains (default constructor)
- Parameters:
cs – the constraints
-
inline ConstraintSet(const ConstraintPtr<T> &c)#
Construct a new ConstrainSet object from a single ConstraintPtr.
- Parameters:
c – the constraint
-
inline bool hard_violation(const std::vector<T> &x)#
Calls is_feasible for every constraint in order to check whether any of the constraints is violated.
- Parameters:
x – the search space value
- Returns:
true when there is violation, false otherwise
-
inline double penalty() const#
Aggregates Contraint::penalty(), by the sum of the penalties of all the constraints in the set.
- Returns:
the aggregated penalty value
-
inline double violation() const#
Aggregates Contraint::violation(), by the sum of the violations of all the constraints in the set.
- Returns:
the aggregated violation value
-
inline double penalize(const double y) const#
Override voor penalize.
If any of the constraints has a OVERRIDE enforcement policy and is not feasible, the penalize method for that constraint will be returned by this method (by first occurence). Otherwise, y is penalized by y + penalty(), which is the sum of all penalty values for each constraint.
- Parameters:
y – objective space value
- Returns:
penalized objective value
-
inline void add(const ConstraintPtr<T> &c)#
Add a constraint to the set.
If the constraint is already added, do nothing.
- Parameters:
c – the constraint to be added.
-
inline void remove(const ConstraintPtr<T> &c)#
Remove a constraint for the set, if it exists.
- Parameters:
c – the constraint to be removed.
-
inline size_t n() const#
alias for constraints.size()
- Returns:
the number of constraints
-
inline ConstraintPtr<T> &operator[](size_t i)#
Alias for constraints.at()
- Parameters:
i – index
- Returns:
a reference to constraints[i]
-
inline virtual std::string repr() const override#
String representation.
Public Members
-
Constraints<T> constraints#
The set of contained constraints.
InstanceBasedProblem#
-
struct InstanceBasedProblem#
Defintion interface of problems that are defined in static files.
Subclassed by ioh::problem::submodular::GraphProblemType< MaxCoverage >, ioh::problem::submodular::GraphProblemType< MaxCut >, ioh::problem::submodular::GraphProblemType< MaxInfluence >, ioh::problem::submodular::GraphProblemType< PackWhileTravel >, ioh::problem::submodular::GraphProblemType< ProblemType >
Public Types
-
template<typename T, typename ...Args>
using Constructor = std::function<T(Args&&...)># A problem class with multiple instances defined, where each instance is a single unique problem, with its own dimension etc.
Every fid has only 1 instance, and only one dimension. A constructor function
-
template<typename T, typename ...Args>
using Constructors = std::vector<std::pair<Constructor<T, Args...>, int>># A vector of constructors-id pairs.
Public Static Functions
-
template<typename T, typename ...Args>
static inline Constructors<T, Args...> load_instances(const std::optional<fs::path> &definitions = std::nullopt)# Method to load instances.
- Template Parameters:
T – The type of the problem
Args – the arguments of the constructor
- Parameters:
definitions – the file with instance defintions
- Returns:
Constructors<T, Args…> a vector of constrcutor functions
-
template<typename T, typename ...Args>
MetaData#
-
struct MetaData : public ioh::common::HasRepr#
struct of problem meta data
Public Functions
-
inline MetaData(const int problem_id, const int instance, std::string name, const int n_variables, const common::OptimizationType optimization_type = common::OptimizationType::MIN)#
Construct a new Meta Data object.
- Parameters:
problem_id – The id of the problem
instance – The instance of the problem
name – the name of the problem
n_variables – the dimension of the problem
optimization_type – optimization type
-
inline MetaData(const int instance, const std::string &name, const int n_variables, const common::OptimizationType optimization_type = common::OptimizationType::MIN)#
Construct a new Meta Data object.
- Parameters:
instance – The instance of the problem
name – the name of the problem
n_variables – the dimension of the problem
optimization_type – optimization type
-
inline virtual std::string repr() const override#
Representation of the object.
-
inline MetaData(const int problem_id, const int instance, std::string name, const int n_variables, const common::OptimizationType optimization_type = common::OptimizationType::MIN)#
RegisteredProblem#
-
template<typename ProblemType, typename ParentType>
struct RegisteredProblem : public ParentType, public ioh::common::AutomaticTypeRegistration<ProblemType, ParentType># CRTP class for automatically registering problems in the apropriate factory.
you should inherit from this class when defining new real problems.
- Template Parameters:
ProblemType – The new problem type
ParentType – The parent problem type
Solution#
-
template<typename T, typename R>
struct Solution#
Solution< T, MultiObjective >#
-
template<typename T>
struct Solution<T, MultiObjective> : public ioh::common::HasRepr# Solution object.
Public Functions
-
inline Solution(const std::vector<T> &x, const std::vector<double> &y)#
Construct a new Solution object.
- Parameters:
x – variables
y – objective values
-
Solution() = default#
Default constructible.
-
inline bool exists() const#
Returns true if the solution’s objective has been set.
-
inline bool operator==(const Solution<T, MultiObjective> &other) const#
Equality operator.
-
inline virtual std::string repr() const override#
String representation.
-
inline Solution(const std::vector<T> &x, const std::vector<double> &y)#
Solution< T, SingleObjective >#
-
template<typename T>
struct Solution<T, SingleObjective> : public ioh::common::HasRepr# Solution object.
Public Functions
-
inline Solution(const std::vector<T> &x, const double y)#
Construct a new Solution object.
- Parameters:
x – variables
y – objective value
-
inline Solution(const int n_variables, const common::OptimizationType optimization_type)#
Shorthand constructor for use with unknown optimum.
-
Solution() = default#
Default Constructible.
-
inline bool exists() const#
Returns true if the solution’s objective has been set.
-
inline virtual std::string repr() const override#
Representation of the object.
-
inline Solution(const std::vector<T> &x, const double y)#
State#
-
template<typename T, typename R>
struct State#
State< T, double >#
-
template<typename T>
struct State<T, double> : public ioh::common::HasRepr# Problem State`.
Public Functions
-
State() = default#
-
inline State(Solution<T, double> initial)#
Construct a new State object.
- Parameters:
initial – initial objective value
-
inline void reset()#
reset the state
-
inline void update(const MetaData &meta_data, const Solution<T, double> &objective)#
Update the state.
-
inline virtual std::string repr() const override#
Representation of the object.
Public Members
-
int evaluations = 0#
Current number of evaluations.
-
bool optimum_found = false#
Is optimum found?
-
Solution<T, double> current_best_internal = {}#
Current best x-transformed, y-raw w. constraints applied.
-
double y_unconstrained#
Current y transformed w.o. constraints applied.
-
double y_unconstrained_best#
Current y transformed w.o. constraints applied.
-
bool has_improved#
Tracks whether the last update has caused an improvement.
-
State() = default#
State< T, MultiObjective >#
-
template<typename T>
struct State<T, MultiObjective> : public ioh::common::HasRepr# Problem State`.
Functions#
wrap_function#
-
template<typename T, typename R>
void ioh::problem::wrap_function(ObjectiveFunction<T, R> f, const std::string &name, const common::OptimizationType optimization_type = common::OptimizationType::MIN, const std::optional<T> lb = std::nullopt, const std::optional<T> ub = std::nullopt, std::optional<VariablesTransformationFunction<T>> transform_variables_function = std::nullopt, std::optional<ObjectiveTransformationFunction<R>> transform_objectives_function = std::nullopt, std::optional<CalculateObjectiveFunction<T, R>> calculate_optimum = std::nullopt, ConstraintSet<T> constraints = {})# Shorthand for wrapping function in a problem.
- Template Parameters:
T – type of the problem
R – the returntype of the problem
- Parameters:
f – a function to be wrapped
name – the name for the new function in the registry
optimization_type – the type of optimization
lb – lower bound for the BoxConstraint of the problem
ub – upper bound for the BoxConstraint of the problem
transform_variables_function – function which transforms the variables of the search problem prior to calling f.
transform_objectives_function – a function which transforms the objective value of the search problem after calling f.
calculate_optimum – a function which returns the optimum based on a given problem dimension and instance.
constraints – the constraints