panobbgo.heuristics.nearby.Nearby#

class panobbgo.heuristics.nearby.Nearby(strategy, cap: int = 3, radius: float = 0.01, new: int = 1, axes: str = 'one', sensitivity_scale: float = 1.0, quadratic: bool = False, quadratic_trust: float = 2.0, quadratic_min_r2: float = 0.8, quadratic_weight_sigma: float = 0.35, quadratic_hessian_rank: int | str | None = 'auto')[source]#

Generates new points based on a cheap, fast algorithm.

For each new best point, generates new many nearby points by applying a random perturbation of magnitude radius (relative to dimension ranges).

When a Sensitivity analyzer is active and has produced importance scores, the perturbation along each dimension is scaled proportionally to that dimension’s importance score. This focuses the local search on dimensions that have the greatest impact on the objective, making it significantly more efficient in high-dimensional problems.

Arguments:

  • axes:

    • one: perturb only one randomly chosen axis

    • all: perturb all axes simultaneously

  • new: number of new points to generate per best update (default: 1)

  • radius: perturbation size as a fraction of the dimension’s range (default: 0.01)

  • sensitivity_scale: when sensitivity data is available, scale perturbations by dimension importance raised to this power (default: 1.0). Higher values focus more aggressively on important dimensions; 0.0 disables sensitivity scaling.

  • quadratic: when True, keep a rolling buffer of recent evaluated (x, f(x)) pairs and, on each new best, emit the trust-region Newton minimiser of a locally-fitted quadratic model as the first refinement point (a curvature-aware step; see the module docstring). The remaining new - 1 points stay isotropic perturbations. False (default) is byte-for-byte the classic behaviour — no buffer, no model.

  • quadratic_trust: trust-region radius for the quadratic step, as a multiple of radius in per-axis box-normalised units (default: 2.0). Only consulted when quadratic=True.

  • quadratic_min_r2: minimum weighted R² the local quadratic model must achieve to be trusted (default: 0.8). Below it the step is skipped and the point falls back to an isotropic perturbation — this is what keeps the curvature step from over-exploiting on multimodal landscapes whose neighbourhood straddles several basins. Only consulted when quadratic=True.

  • quadratic_weight_sigma: bandwidth of the Gaussian distance kernel that localises the quadratic fit, as a fraction of the median neighbour distance (default: 0.35). Smaller focuses the model more tightly on the immediate neighbourhood of the incumbent (a better local model of a curved valley, but noisier if pushed too small); larger approaches an unweighted fit over the whole buffer. Only consulted when quadratic=True. See fit_quadratic_step().

  • quadratic_hessian_rank: coupling rank of the local Hessian model (default: "auto"). "auto" fits a diagonal-plus-low-rank quadratic in the weighted-PCA basis and selects the coupling rank per fit by BIC, which recovers the coordinate coupling of a curved (Rosenbrock) valley from a thin local cloud that a ridge-regularised full quadratic shrinks to zero — while still keeping the full model on an isotropic neighbourhood. A non-negative int pins the rank (0 = diagonal in the PCA basis; ≥ dim = full quadratic); None selects the legacy full quadratic fitted in the raw axis basis. "auto" keeps the legacy full quadratic at dim ≤ 2 (byte-identical to the previous behaviour on the 2-D battery), engaging the coupling model only at dim ≥ 3 where a thin cloud under-determines the cross terms. Only consulted when quadratic=True. See fit_quadratic_step().

Parameters:

@type strategy: StrategyBase

__init__(strategy, cap: int = 3, radius: float = 0.01, new: int = 1, axes: str = 'one', sensitivity_scale: float = 1.0, quadratic: bool = False, quadratic_trust: float = 2.0, quadratic_min_r2: float = 0.8, quadratic_weight_sigma: float = 0.35, quadratic_hessian_rank: int | str | None = 'auto')[source]#
Parameters:

@type strategy: StrategyBase

Methods

__init__(strategy[, cap, radius, new, axes, ...])

check_dependencies(analyzers, heuristics)

This method is called by the core initialization to assess, if the dependencies for the given module are met.

clear_output()

emit(points)

This is used to send out new search points for evaluation.

get_points([limit])

Drain the output queue until limit points are removed or it is empty.

on_new_best(best)

React to a new best result by generating nearby candidate points.

Attributes

active

This is queried by the strategy to determine, if it should still consider it.

eventbus

name

The module's name.

problem

results

strategy