metaheuristic_designer.benchmarks.ioh_wrapper module#

class IOHObjective(fid, dimension, instance=1, problem_class=None, compact_name=False)[source]#

Bases: ObjectiveFunc

Adapts an IOH benchmark problem to the ObjectiveFunc interface.

Parameters:
fidint or str

BBOB function ID (1-24) or name (e.g. "Sphere").

dimensionint

Problem dimensionality.

instanceint, optional

Problem instance (default 1).

problem_classProblemClass, optional

IOH problem type (default ProblemClass.BBOB).

ioh_optionsdict, optional

Extra keyword arguments passed to ioh.get_problem.

compact_namestr, optional

Use a shortened name for the benchmark when compact_name is True.

Attributes:
params

Access parameter values by attribute-style lookup.

Parameters:
  • fid (int | str)

  • dimension (int)

  • instance (int)

  • problem_class (None)

  • compact_name (bool)

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(x)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

attach_logger

detach_logger

objective(x)[source]#

Implementation of the objective function.

Parameters:
solution: Any

The solution for which the fitness will be calculated.

Returns:
objective_value: VectorLike | ScalarLike

Value of the objective function given a solution.

attach_logger(logger)[source]#
detach_logger()[source]#
restart()[source]#

Reset the evaluation counter to zero.

class BBOBObjective(fid, dimension, instance, compact_name=None)[source]#

Bases: IOHObjective

Attributes:
params

Access parameter values by attribute-style lookup.

Methods

__call__(population)

Shorthand for executing the objective function on a vector.

add_parameter_constraints(...)

Attach extra constraint handlers for extended encodings (e.g., PSO).

calculate_fitness(population)

Evaluate fitness for the whole population.

get_params()

Return a copy of the current parameter dictionary.

get_state()

Return a dictionary with the current configuration.

objective(x)

Implementation of the objective function.

repair_population(population)

Transforms an invalid vector into one that satisfies the restrictions of the problem.

restart()

Reset the evaluation counter to zero.

store_kwargs([progress])

Store keyword arguments and evaluate them at the given progress.

update(progress)

Re-evaluate all stored parameters at the current progress.

update_kwargs([progress])

Add or replace parameters and immediately evaluate them.

attach_logger

detach_logger