poli.core.abstract_black_box.NegativeBlackBox

poli.core.abstract_black_box.NegativeBlackBox#

class poli.core.abstract_black_box.NegativeBlackBox(f: AbstractBlackBox)#

A wrapper for a black box that negates the objective function.

If you construct a black-box function f for maximizing, then -f is a black-box function for minimizing. This class is a wrapper for implementing the latter.

The only difference is that the __call__ method returns -f(x) instead of f(x). The _black_box method is the same as the original black box.

__init__(f: AbstractBlackBox)#

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__(f)

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.