RastriginRotated#

class RastriginRotated(n_dim: int = 10, instance: int = 1, objective: str = 'minimize', modifiers: List[BaseModifier] | None = None, memory: bool = False, collect_data: bool = True, callbacks: Callable | List[Callable] | None = None, catch_errors: Dict[type, float] | None = None)[source]#

f15: Rastrigin Function (Rotated).

Rotated version of the Rastrigin function. The rotation breaks separability.

Properties: - Highly multimodal (~10^D local optima) - Non-separable - Regular structure

property Q: ndarray[source]#

First rotation matrix (orthogonal).

property R: ndarray[source]#

Second rotation matrix (orthogonal).

__call__(params: Dict[str, Any] | ndarray | list | tuple | None = None, *, fidelity: float | None = None, **kwargs)[source]#

Evaluate the objective function.

Args:

params: Parameter values as dict, array, list, or tuple fidelity: Optional fidelity level in (0, 1]. Controls evaluation

cost vs accuracy trade-off for multi-fidelity optimization (e.g. Hyperband, BOHB). None means full-fidelity evaluation. Only supported by ML test functions; ignored by algebraic functions.

**kwargs: Parameters as keyword arguments (only with dict input)

Returns:

The objective function value

batch(X: ArrayLike) ArrayLike[source]#

Evaluate multiple parameter sets in a single call.

Parameters:

X (ArrayLike) – 2D array of shape (n_points, n_dim) where each row is a parameter set.

Returns:

1D array of shape (n_points,) with evaluation results.

Return type:

ArrayLike

Raises:
  • NotImplementedError – If the function does not implement _batch_objective.

  • ValueError – If X has wrong number of dimensions or wrong n_dim.

property callbacks[source]#

Callback management (CallbackAccessor).

property data[source]#

Evaluation data (DataAccessor).

property errors[source]#

Error handler management (ErrorAccessor).

property f_global: float[source]#

Global optimum value for this function instance.

property f_opt: float[source]#

Optimal function value.

f_pen(x: ndarray) float[source]#

Boundary penalty function.

Penalizes solutions outside [-5, 5]^D.

Parameters:

x (np.ndarray) – Input vector.

Returns:

Penalty value (0 if within bounds).

Return type:

float

property func_id: int | None[source]#

Function ID (1-24) within BBOB suite.

Read from the static class-level spec rather than self.spec: func_id is constant per class, and self.spec resolution lifts the per-instance optimum, so keeping func_id off that path avoids any ordering or recursion coupling.

lambda_alpha(alpha: float) ndarray[source]#

Generate diagonal conditioning matrix with condition number alpha.

Parameters:

alpha (float) – Condition number (ratio of largest to smallest eigenvalue).

Returns:

Diagonal matrix of shape (n_dim, n_dim).

Return type:

np.ndarray

property memory[source]#

Memory cache management (MemoryAccessor).

property meta: MetaSpec[source]#

Instance display/identity metadata (a frozen MetaSpec).

Metadata is fully static today, so this returns the class-level MetaSpec resolved at class-definition time.

property modifiers[source]#

Modifier management (ModifierAccessor).

property plot[source]#

Access plotting methods for this function.

pure(params: Dict[str, Any] | ndarray | list | tuple | None = None, *, fidelity: float | None = None, **kwargs)[source]#

Evaluate the function without modifiers.

Returns the true (deterministic) function value, bypassing any configured modifiers. Does not update search_data, n_evaluations, or callbacks. Ignores memory caching.

Parameters:
  • params (dict, array, list, or tuple) – Parameter values to evaluate.

  • fidelity (float or None) – Fidelity level in (0, 1] for multi-fidelity evaluation.

  • **kwargs (dict) – Parameters as keyword arguments.

Returns:

The true function value without modifiers, with direction applied.

Return type:

float or np.ndarray

reset() None[source]#

Reset all state including collected data and memory cache.

property search_space: Dict[str, Any][source]#

Search space for this function (read-only public API).

property spec: FunctionSpec[source]#

Instance-resolved function specification (a frozen FunctionSpec).

type(self)._spec is the static class-level template. This property overlays the fields that genuinely vary per instance (n_dim, n_objectives, f_global, x_global) by lifting them off the instance, so that func.spec.n_dim reflects this instance’s value. It is resolved on every access rather than cached, because some functions (e.g. BBOB) read spec during __init__ before the optimum has been computed, and a cached early value would go stale.

t_asy(x: ndarray, beta: float) ndarray[source]#

Apply asymmetry transformation T_asy^beta.

Breaks symmetry by applying different scaling to positive values.

Parameters:
  • x (np.ndarray) – Input vector.

  • beta (float) – Asymmetry parameter.

Returns:

Transformed vector.

Return type:

np.ndarray

t_osz(x: ndarray) ndarray[source]#

Apply oscillation transformation T_osz.

Creates smooth oscillations around the identity to break symmetry.

Parameters:

x (np.ndarray) – Input vector.

Returns:

Transformed vector.

Return type:

np.ndarray

property x_global: ndarray | None[source]#

Global optimum location for this function instance.

property x_opt: ndarray[source]#

Optimal location in the search space.