vopy.maximization_problem
- class vopy.maximization_problem.BraninCurrin(noise_var: float)
A continuous optimization problem combining the Branin and Currin functions. This problem was first utilized by [Belakaria2019] for multi-objective optimization tasks, where both objectives are evaluated over the same input domain.
- Parameters:
noise_var (float) – The variance of the noise added to the output evaluations.
- References:
- [Belakaria2019]
Belakaria, Deshwal, Doppa. Max-value Entropy Search for Multi-Objective Bayesian Optimization. Neural Information Processing Systems (NeurIPS), 2019.
- evaluate_true(x: numpy.ndarray) numpy.ndarray
Evaluates the true (noiseless) outputs of the Branin and Currin functions, normalized for each output dimension.
- Parameters:
x (np.ndarray) – Input points to evaluate, with shape (N, 2).
- Returns:
A 2D array with normalized Branin and Currin function values for each input.
- Return type:
np.ndarray
- class vopy.maximization_problem.ContinuousProblem(noise_var: float)
Abstract base class for continuous optimization problems. It includes noise handling for outputs based on a specified noise variance. It should have the following attribute defined:
out_dim
:int
- Parameters:
noise_var (float) – The variance of the noise to be added to the outputs.
- evaluate(x: numpy.ndarray, noisy: bool = True) numpy.ndarray
Evaluates the problem at given points with optional Gaussian noise.
- Parameters:
x (np.ndarray) – Input points to evaluate, given as an array of shape (N, 2).
noisy (bool) – If True, adds Gaussian noise to the output based on the specified noise variance. Defaults to True.
- Returns:
A 2D array with evaluated Branin and Currin values for each input, with optional noise.
- Return type:
np.ndarray
- class vopy.maximization_problem.DecoupledEvaluationProblem(problem: Problem)
Wrapper around a
Problem
instance that allows for decoupled evaluations of objective functions. This class enables selective evaluation of specific objectives by indexing into the output of the underlying problem.- evaluate(x: numpy.ndarray, evaluation_index: int | List[int] | None = None, **evaluate_kwargs: dict) numpy.ndarray
Evaluates the underlying problem at the given points and returns either the full output or specific objectives as specified by evaluation_index.
- Parameters:
x (np.ndarray) – The input points to evaluate, given as an array of shape (N, in_dim).
evaluation_index (Optional[Union[int, List[int]]]) – Specifies which objectives to return. Can be: - None (default) to return all objectives, - an int to return a specific objective across all points, - a list of indices to return specific objectives for each point.
evaluate_kwargs (dict) – Additional keyword arguments to pass to the evaluation function of the underlying problem.
- Returns:
An array of evaluated values, either the full output or specific objectives.
- Return type:
np.ndarray
- Raises:
ValueError – If
evaluation_index
has an invalid format or length.
- class vopy.maximization_problem.Problem
Abstract base class for defining optimization problems. Provides a template for evaluating solutions in a given problem space.
Note
Classes derived from
Problem
must implement theevaluate()
method.- abstract evaluate(x: numpy.ndarray) numpy.ndarray
Evaluates the problem at a given point (or array of points)
x
.- Parameters:
x (np.ndarray) – The input for where to evaluate the problem.
- Returns:
The evaluation result as an array, representing the objective values at
x
.- Return type:
np.ndarray
- class vopy.maximization_problem.ProblemFromDataset(dataset: Dataset, noise_var: float)
Define an evaluatable optimization problem using data from a given dataset.
This class enables the evaluation of points based on nearest neighbor lookup from an offline dataset, with optional Gaussian noise.
- Parameters:
dataset (Dataset) – The dataset containing input and output data for the problem.
noise_var (float) – The variance of the noise to add to the outputs.
- evaluate(x: numpy.ndarray, noisy: bool = True) numpy.ndarray
Evaluates the problem at given points by finding the nearest points in the dataset and optionally adding Gaussian noise.
- Parameters:
x (np.ndarray) – The input points to evaluate, given as an array of shape (N, in_dim).
noisy (bool) – If True, adds Gaussian noise to the output based on the specified noise variance. Defaults to True.
- Returns:
An array of shape (N, out_dim) representing the evaluated output.
- Return type:
np.ndarray
- vopy.maximization_problem.get_continuous_problem(name: str, noise_var: float) ContinuousProblem
Retrieves an instance of a continuous problem by name. If the problem name is not recognized, a ValueError is raised.
- Parameters:
name (str) – The name of the continuous problem class to instantiate.
noise_var (float) – The variance of the noise to apply in the problem.
- Returns:
An instance of the specified continuous problem.
- Return type:
- Raises:
ValueError – If the specified problem name does not exist in the global scope.