blackboxopt.optimizers.space_filling
SpaceFilling (MultiObjectiveOptimizer)
Sobol sequence based, space filling optimizer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
search_space |
ParameterSpace |
The search space to optimize |
required |
objectives |
List[blackboxopt.base.Objective] |
The objectives of the optimization |
required |
seed |
int |
The sobol sequence is Owen scrambled and can be seeded for reproducibility |
None |
Source code in blackboxopt/optimizers/space_filling.py
class SpaceFilling(MultiObjectiveOptimizer):
"""Sobol sequence based, space filling optimizer.
Args:
search_space: The search space to optimize
objectives: The objectives of the optimization
seed: The sobol sequence is Owen scrambled and can be seeded for reproducibility
"""
def __init__(
self,
search_space: ParameterSpace,
objectives: List[Objective],
seed: int = None,
) -> None:
super().__init__(search_space=search_space, objectives=objectives, seed=seed)
self.sobol = Sobol(d=len(self.search_space), scramble=True, seed=seed)
def generate_evaluation_specification(self) -> EvaluationSpecification:
vector = self.sobol.random().flatten()
configuration = self.search_space.from_numerical(vector)
return EvaluationSpecification(configuration=configuration)
generate_evaluation_specification(self)
Get next configuration and settings to evaluate.
Exceptions:
Type | Description |
---|---|
OptimizationComplete |
When the optimization run is finished, e.g. when the budget has been exhausted. |
OptimizerNotReady |
When the optimizer is not ready to propose a new evaluation specification. |
Source code in blackboxopt/optimizers/space_filling.py
def generate_evaluation_specification(self) -> EvaluationSpecification:
vector = self.sobol.random().flatten()
configuration = self.search_space.from_numerical(vector)
return EvaluationSpecification(configuration=configuration)
report(self, evaluations)
inherited
Report one or more evaluated evaluation specifications.
NOTE: Not all optimizers support reporting results for evaluation specifications that were not proposed by the optimizer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
evaluations |
Union[blackboxopt.evaluation.Evaluation, Iterable[blackboxopt.evaluation.Evaluation]] |
A single evaluated evaluation specifications, or an iterable of many. |
required |
Source code in blackboxopt/optimizers/space_filling.py
def report(self, evaluations: Union[Evaluation, Iterable[Evaluation]]) -> None:
_evals = [evaluations] if isinstance(evaluations, Evaluation) else evaluations
call_functions_with_evaluations_and_collect_errors(
[functools.partial(validate_objectives, objectives=self.objectives)],
_evals,
)