poli.objective_repository.aloha.register.AlohaBlackBox#
- class poli.objective_repository.aloha.register.AlohaBlackBox(batch_size: Optional[int] = None, parallelize: bool = False, num_workers: Optional[int] = None, evaluation_budget: int = inf)#
Black box implementation for the Aloha problem.
The aloha problem is a simple discrete black box problem where the goal is to find the sequence [“A”, “L”, “O”, “H”, “A”] among all 5-letter sequences.
- Parameters
batch_size (int, optional) – The batch size for processing multiple inputs simultaneously, by default None.
parallelize (bool, optional) – Flag indicating whether to parallelize the computation, by default False.
num_workers (int, optional) – The number of workers to use for parallel computation, by default None.
evaluation_budget (int, optional) – The maximum number of function evaluations. Default is infinity.
- alphabet#
The mapping of symbols to their corresponding indices in the alphabet.
- Type
dict
- _black_box(x, context=None)#
The main black box method that performs the computation, i.e. it computes the distance between the 5-letter sequence in x and the target sequence [“A”, “L”, “O”, “H”, “A”].
- __init__(batch_size: Optional[int] = None, parallelize: bool = False, num_workers: Optional[int] = None, evaluation_budget: int = inf)#
Initialize the aloha black box object.
- Parameters
batch_size (int, optional) – The batch size for processing data, by default None.
parallelize (bool, optional) – Flag indicating whether to parallelize the processing, by default False.
num_workers (int, optional) – The number of workers to use for parallel processing, by default None.
evaluation_budget (int, optional) – The maximum number of function evaluations. Default is infinity.
Methods
__init__
([batch_size, parallelize, ...])Initialize the aloha black box 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.