poli.objective_repository.toy_continuous_problem.register.ToyContinuousBlackBox

poli.objective_repository.toy_continuous_problem.register.ToyContinuousBlackBox#

class poli.objective_repository.toy_continuous_problem.register.ToyContinuousBlackBox(function_name: str, n_dimensions: int = 2, embed_in: Optional[int] = None, dimensions_to_embed_in: Optional[List[int]] = None, batch_size: Optional[int] = None, parallelize: bool = False, num_workers: Optional[int] = None, evaluation_budget: int = inf)#

A black box implementation for evaluating the Toy Continuous Problem.

Parameters
  • function_name (str) – The name of the toy continuous function to evaluate, by default None.

  • n_dimensions (int) – The number of dimensions for the toy continuous function, by default 2.

  • embed_in (int, optional) – If not None, the continuous problem is randomly embedded in this dimension. By default, None.

  • dimensions_to_embed_in (List[int], optional) – The dimensions in which to embed the problem, by default None. Only has an effect if embed_in is not None.

  • batch_size (int, optional) – The batch size for parallel evaluation, by default None.

  • parallelize (bool, optional) – Whether to parallelize the evaluation, by default False.

  • num_workers (int, optional) – The number of workers for parallel evaluation, by default None.

  • evaluation_budget (int, optional) – The maximum number of evaluations, by default float(“inf”).

function_name#

The name of the toy continuous function.

Type

str

n_dimensions#

The number of dimensions for the toy continuous function.

Type

int

embed_in#

The dimension in which to embed the problem.

Type

int

function#

The toy continuous problem instance.

Type

ToyContinuousProblem

bounds#

The lower and upper bounds for the toy continuous problem.

Type

Tuple[np.ndarray, np.ndarray]

_black_box(x, context=None)#

Evaluates the toy continuous problem on a continuous input x.

__init__(function_name: str, n_dimensions: int = 2, embed_in: Optional[int] = None, dimensions_to_embed_in: Optional[List[int]] = None, batch_size: Optional[int] = None, parallelize: bool = False, num_workers: Optional[int] = None, evaluation_budget: int = inf)#

Initialize the AbstractBlackBox object.

Parameters
  • batch_size (int, optional) – The batch size for parallel execution, by default None.

  • parallelize (bool, optional) – Flag indicating whether to parallelize the execution, by default False.

  • num_workers (int, optional) – The number of workers for parallel execution, by default we use half the available CPUs.

  • evaluation_budget (int, optional) – The maximum number of evaluations allowed for the black box function, by default float(“inf”).

Methods

__init__(function_name[, n_dimensions, ...])

Initialize the AbstractBlackBox object.

reset_evaluation_budget()

Resets the evaluation budget by setting the number of evaluations made to 0.

set_observer(observer)

Set the observer object for recording observations during evaluation.

terminate()

Terminate the black box optimization problem.