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
newmany nearby points by applying a random perturbation of magnituderadius(relative to dimension ranges).When a
Sensitivityanalyzer 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 axisall: 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: whenTrue, 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 remainingnew - 1points 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 ofradiusin per-axis box-normalised units (default: 2.0). Only consulted whenquadratic=True.quadratic_min_r2: minimum weightedR²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 whenquadratic=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 whenquadratic=True. Seefit_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-negativeintpins the rank (0= diagonal in the PCA basis;≥ dim= full quadratic);Noneselects the legacy full quadratic fitted in the raw axis basis."auto"keeps the legacy full quadratic atdim ≤ 2(byte-identical to the previous behaviour on the 2-D battery), engaging the coupling model only atdim ≥ 3where a thin cloud under-determines the cross terms. Only consulted whenquadratic=True. Seefit_quadratic_step().
- Parameters:
strategy (StrategyBase)
name (str)
@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:
strategy (StrategyBase)
name (str)
@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
limitpoints are removed or it is empty.on_new_best(best)React to a new best result by generating nearby candidate points.
Attributes
activeThis is queried by the strategy to determine, if it should still consider it.
eventbusnameThe module's name.
problemresultsstrategy