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 | None)
Abstract base class for continuous optimization problems. It includes noise handling for outputs based on a specified noise variance.
- Parameters:
noise_var (Optional[float]) – The variance of the noise to be added to the outputs. If the problem has intrinsic noise, this should be set to None. Defaults to None.
- 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
Probleminstance 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. Therefore, this class is not suitable for real-time evaluations 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_indexhas an invalid format or length.
- class vopy.maximization_problem.FixedPointsProblem(in_points: numpy.typing.ArrayLike, out_dim: int, objective: Callable[[numpy.typing.ArrayLike], numpy.typing.ArrayLike] | None = None, bounds: numpy.ndarray | None = None)
Define an evaluatable optimization problem using fixed points and an objective function. Noise is assumed to be intrinsic to the objective function.
- Parameters:
in_points (ArrayLike) – The fixed input points to evaluate the objective function.
out_dim (int) – The dimension of the output space of the objective function.
objective (Optional[Callable[[ArrayLike], ArrayLike]]) – The objective function to evaluate at the fixed input points. Defaults to None.
bounds (Optional[np.ndarray]) – Optional bounds for the input points, given as a 2D array of shape (in_dim, 2). If not provided, bounds are inferred from the input points.
- evaluate(x: numpy.ndarray) numpy.ndarray
Evaluates the problem at given points.
- Parameters:
x (np.ndarray) – The input points to evaluate, given as an array of shape (N, in_dim).
- Returns:
An array of shape (N, out_dim) representing the evaluated output.
- Return type:
np.ndarray
- 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
Problemmust implement theevaluate()method. Also, they should have the following attributes defined:in_dim:intout_dim:intbounds:List[Tuple[float, float]]
- 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 | None = None) 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 (Optional[float]) – The variance of the noise to apply in the problem. If None, no additive noise is applied. Defaults to None.
- Returns:
An instance of the specified continuous problem.
- Return type:
- Raises:
ValueError – If the specified problem name does not exist in the global scope.