Heuristics Module#

Point generation algorithms (heuristics):

  • Center: Generates center point of search space.

  • Zero: Generates the zero vector point.

  • Random: Uniform random sampling within the best leaf box.

  • LatinHypercube: Stratified sampling (Space-filling).

  • Sobol: Low-discrepancy quasi-random sequence (Sobol’) for one-shot space-filling initial designs — better uniformity than random or Latin Hypercube at the same sample count. Owen-scrambled by default (scramble=True); the quick-mode Rewarding_Diverse strategy ships scramble=False after a 2026-05-31 ledger-evidence-driven codification — at n=16 in the 2-D battery the deterministic Sobol’ grid is optimally space-filling. See planning/SELF_IMPROVEMENT_LOG.md “Codify Sobol.scramble=False in Rewarding_Diverse”.

  • Extremal: Samples from the boundaries of the search space.

  • Nearby: Gaussian perturbations around current best points (sensitivity-aware when paired with the Sensitivity analyzer).

  • WeightedAverage: Averages points in the best region.

  • QuadraticWlsModel: Fits a weighted least-squares quadratic surrogate model to the Splitter’s best box and proposes its minimiser within the problem box. The fit runs in a subprocess and is an on-demand arm: the new_best_box handler only records the latest box (boxes arriving between two pulls coalesce), and produce() sends it to the worker on the scheduler’s thread. Under sync_evaluation the pull waits for the fit, so the run is reproducible; otherwise it hands out the answer on a later pull once it is ready. The event bus is never blocked by a slow fit.

  • GaussianProcessHeuristic: Gaussian Process surrogate with EI / UCB / PI acquisition functions; uses Expected Improvement with Constraints (EIC) when constraints are active.

  • NelderMead: Simplex optimization method.

  • LBFGSB: Multi-start, bound-constrained quasi-Newton local optimizer (Zhu-Byrd-Lu-Nocedal 1997) backed by scipy.optimize.fmin_l_bfgs_b with finite-difference gradients. The only gradient-based arm in the portfolio — it complements the derivative-free generators (DE family, PSO, CMA-ES, Nelder-Mead, COBYQA) on smooth, ill-conditioned valleys such as Rosenbrock, where a curvature estimate converges in a fraction of the evaluations a population method needs (a single dedicated descent solves Rosenbrock_5D at a 200-eval budget, where every default Panobbgo strategy scores 0.0). Runs L-BFGS-B repeatedly — the first descent starts from the box centre, each subsequent descent from a fresh uniform-random restart (random-restart L-BFGS-B), using the whole strategy budget instead of stopping after one convergence; on_restart warm-starts the next descent at the Restart analyzer’s centre. Subprocess-backed (the solver is synchronous; the pipe round-trips f(x)), cap=1 — an on-demand arm built on PipeBridgeHeuristic: it produces its next point when the scheduler asks, on the scheduler’s thread, so it is reproducible under sync_evaluation and cannot be starved by a competitor with a stocked queue. Opt-in: add it to a strategy with strategy.add(...).

  • COBYQA: Powell-family derivative-free trust-region local optimizer (Ragonneau & Zhang 2023) — the modern successor to BOBYQA / COBYLA / NEWUOA / LINCOA. Maintains an interpolation set of 2·n + 1 points and fits an adaptive quadratic model of the objective inside a trust region; natively supports bounds. Curvature-aware and derivative-free at once, dominant on smooth / near-smooth local refinement (e.g. Rosenbrock-like ill-conditioned valleys where Nelder-Mead converges slowly). Subprocess-backed adapter around scipy.optimize.minimize(method="COBYQA") (scipy 1.14+), an on-demand PipeBridgeHeuristic like LBFGSB. Run alone it ends when its trust region converges — roughly 25 evaluations — and does not spend the rest of the budget; pair it with a generator if you want that.

  • TrustRegionQuadratic: a small BOBYQA/NEWUOA-style quadratic trust region written for the event model rather than bridged: a least-squares quadratic (when underdetermined, approximately NEWUOA’s least change of the previous Hessian: a Euclidean minimum-norm correction over all coefficients; used only when its points span all d directions) on the shared archive’s points near the best point (every arm’s results feed the model), the model minimiser in box ∩ trust region, the usual ratio test, coordinate-design geometry points, tabu restarts. On demand and batch-capable: produce(limit) returns the step, shorter steps and geometry points, so it keeps q workers busy. Opt-in (planning/DISCOVERY_2026-09-09.md §66; specs RoundRobin_TRQ and Blocks_warm_CMAES_JSO_TRQ in make_trust_region_strategies(), with RoundRobin_COBYQA, RoundRobin_TRQ_r05, the arm at radius_init=0.5 (§69.5), and the failure-region candidates RoundRobin_TRQ_aware (failure_aware=True) and RoundRobin_TRQ_fa (that plus the FailureModel filter, §71); on the expensive track the opt-in trq measure group).

  • CMAES: Covariance Matrix Adaptation Evolution Strategy with IPOP-CMA-ES restart support (paired with the Restart analyzer) — gold standard for derivative-free continuous optimization, excellent on ill-conditioned/ridge-following problems like Rosenbrock. inject=True (planning/DESIGN_seams_2026-09-11.md §2.1; Hansen 2011, “Injecting external solutions into CMA-ES”, arXiv:1110.4181) lets a foreign result — a point some other heuristic emitted, found via the shared who tag not matching this instance’s own — be ranked alongside the current generation’s own offspring instead of waiting for the next block hand-off: its normalised step is Mahalanobis-clipped to c_y = √n + 2n/(n+2) first, so it can move the mean, the step-size path and the covariance update no further than one clipped step would, capped at max(1, λ // 4) injected points per generation. Default False; without a second arm feeding the shared archive there is never a foreign result, so the option is inert alone.

  • DifferentialEvolution: DE mutation/crossover/selection applied to the accumulated result database — strong on multimodal landscapes (Rastrigin, Schwefel).

  • LSHADE: Linear-population-reduction Success-History Adaptive DE (Tanabe & Fukunaga, CEC 2014 winner). Adapts F and CR per-trial via per-bin Cauchy / Normal memories that update each generation by the weighted Lehmer mean of successful triples; uses the current-to-pbest/1 mutation with an external archive of replaced parents. The population shrinks linearly from NP_init down to NP_min (default 4) over the strategy’s evaluation budget — broad exploration early, focused exploitation late. NP_init defaults to "auto", budget-adaptive sizing: clip(round(3·dim · (budget / (500·dim))^0.25), max(NP_min, 6), 400) (the coefficient is per class, e.g. 4·dim for NLSHADE_LBC), measured on the MA-BBOB battery (planning/DISCOVERY_2026-09-09.md §17); it falls back to 30 when the budget is unknown. An integer fixes the size. Out-of-bounds components are repaired by midpoint reflection. Strictly stronger than the basic DE/rand/1/bin on multimodal benchmarks; opt-in (strategy.add(...)).

  • JSO: jSO (Brest, Maučec & Bošković, CEC 2017 winner) — direct subclass of LSHADE that adds three literature-best refinements to the success-history adaptive DE machinery: a weighted current-to-pbest-w/1 mutation (the pbest direction is re-weighted by a phase-dependent F_w factor — 0.7·F early, 0.8·F mid, 1.2·F late), a linear ``p_best`` schedule that decreases from 0.25 to 0.125 over the budget (as in the authors’ reference code; the paper’s formula rises), with pbest ≠ target in the first half, Cauchy-F clamping that limits sampled F values to 0.7 while progress < 0.6, and CR floors (CR ≥ 0.7 while progress < 0.25, ≥ 0.6 while < 0.5). The history memory uses M_F = 0.3 / M_CR = 0.8 initial values, averages every update with the old value (M ← (mean_WL + M) / 2, iL-SHADE) and reserves the last bin (H − 1) as an anchor sampled as 0.9 / 0.9 — a stable “moderately greedy” parameter source independent of live success history. Inherits LSHADE’s asynchronous pipeline (per-slot pending dict, generation-by-count book-keeping, archive trimming, LPSR shrinking, warm restart) unchanged. shared_pbest=True (planning/DESIGN_seams_2026-09-11.md §2.2) widens the current-to-pbest-w/1 pbest pool from the live top-p_count alone to that pool’s union with the best p_count foreign results (who not starting with this instance’s own tag) drawn from the shared Archive analyzer, with pbest then drawn uniformly over the union using jSO’s own RNG; without an Archive analyzer, or with nothing foreign in it, the pool and the RNG draw are exactly what they are with the option off — no extra draw is spent finding that out. Default False; like CMA-ES’s inject, it is inert without a second arm feeding the archive. Opt-in: add it to a strategy with strategy.add(...).

  • NLSHADE_RSP: NL-SHADE-RSP (Stanovov, Akhmedova & Semenkin, CEC 2021 winner) — direct subclass of LSHADE following the authors’ reference code: Non-Linear Population Size Reduction (NP(r) = round((NP_min − NP_init)·r^(1−r) + NP_init)), rank-based selective pressure on the population draw of r2 (weights exp(−i/NP); r1 is uniform), an archive of 2.1·NP used for r2 with an adaptive probability p_A learned from the archive’s vs. the population’s success, a per-generation choice between binomial and exponential crossover with the sampled CR handed out sorted by fitness (binomial uses CR_b = 0, then 2(r − 0.5)), a pbest share rising 0.2 → 0.4, H = 20·D memory bins initialised at 0.2 with the plain weighted Lehmer mean, and uniform resampling of out-of-box components. No jSO machinery (F cap, anchor bin, F_w, CR floors, memory averaging). Deviations: NP_init="auto" (measured) and the asynchronous generation model (see the heuristic docstring). Opt-in: add it to a strategy with strategy.add(...).

  • NLSHADE_LBC: NL-SHADE-LBC (Stanovov, Akhmedova & Semenkin, CEC 2022 winner) — direct subclass of NLSHADE_RSP that adds Linear Bias Change in the success-history memory update. The standard L-SHADE / jSO / NL-SHADE-RSP Lehmer mean uses fixed exponents (s^2 / s^1); NL-SHADE-LBC generalises the F / CR memory updates to Σ(w·s^p) / Σ(w·s^(p − m)) with the order p linearly scheduled across budget progress — p_F(r) = (1 − r)·p_F_init + r·p_F_final (defaults 3.5 → 1.5) and p_CR(r) = (1 − r)·p_CR_init + r·p_CR_final (defaults 1.0 → 1.5). The spread m is held constant at the literature default 1.5; at p = 2, m = 1 the formula recovers the standard L-SHADE weighted Lehmer mean. The constructor’s lbc_regime kwarg (shipped 2026-06-24) wraps four named regime presets — "cec2022" / "lshade" / "flat" / "aggressive" — so a parameter sweep can flip the whole regime with one argument; mutually exclusive with the five per-field LBC kwargs. Otherwise per the paper: rank pressure exp(−4i/NP) on r2, fixed archive probability 0.5, archive 1.0·NP with fitness-probed replacement, pbest share 0.2 → 0.3, binomial crossover only (fitness-sorted CR), out-of-bounds trials regenerated up to 100 times before the midpoint repair, H = 20·D bins at M_F = 0.5 / M_CR = 0.9. Opt-in: add it to a strategy with strategy.add(...).

  • LSHADE_EpSin: LSHADE-EpSin (Awad, Ali & Suganthan, CEC 2016) — direct subclass of LSHADE that replaces the SHADE Cauchy-from-memory F sampling with an ensemble of two sinusoidal candidates during the first half of the search. Sinusoid 1 uses a fixed frequency (0.5) with a decreasing amplitude envelope (G_max − g)/G_max; Sinusoid 2 draws its frequency from an adaptive Cauchy(μ_freq, 0.1) clamped to (0, 1] and pairs it with an increasing envelope g/G_max and a +π phase shift. Each trial picks one of the two sinusoids with probability p_s updated each generation from a Laplace-smoothed Sinusoid-1 success rate; μ_freq updates via the unweighted Lehmer mean of successful Sinusoid-2 frequencies. Second half (progress ≥ 0.5) reverts to the SHADE Cauchy-from-memory sampling — byte-identical to L-SHADE. CR is always sampled from the SHADE Normal-from-memory bin (unchanged in both phases). The sinusoidal envelope already provides a time-varying F magnitude, so the jSO asymmetric F-cap is intentionally off by default (F_schedule=None). Different branch of the DE family tree from jSO / NL-SHADE-RSP — all the other DE arms adapt F via the SHADE Cauchy memory; EpSin’s deterministic-amplitude sinusoid is algorithmically distinct. Opt-in: add it to a strategy with strategy.add(...). Direct precursor of the CEC-2017 co-winner LSHADE-cnEpSin (the same ensemble plus a covariance-matrix step — not ported here; CMA-ES is already a separate heuristic).

  • DifferentialEvolution / LSHADE / JSO / NLSHADE_RSP / NLSHADE_LBC / LSHADE_EpSin complementarity: Panobbgo offers all six DE-family arms, so a bandit strategy given several of them can pick whichever wins on the current battery — basic DE for byte-identical legacy reproduction, L-SHADE for the established CEC-2014 high-water mark, jSO for the CEC-2017 refinement (Cauchy-F branch), NL-SHADE-RSP for the CEC-2021 refinement, NL-SHADE-LBC for the CEC-2022 refinement, and LSHADE-EpSin for the orthogonal CEC-2016 sinusoidal-F branch (predecessor of the CEC-2017 co-winner LSHADE-cnEpSin). Each variant occupies a distinct exploration / exploitation regime and the literature shows real per-problem complementarity; the small-budget measurements that put the CEC-DE refinements (RSP, LBC) within noise of jSO were taken on the earlier jSO-derived ports; the paper-faithful ports of 2026-09 are unmeasured.

  • PSO: Particle Swarm Optimization with the canonical Clerc–Kennedy (2002) constriction-coefficient parameters — a swarm of particles tracks personal and global bests with momentum, providing exploration dynamics distinct from CMA-ES (covariance) and DE (recombination); supports IPOP-style warm restarts via the Restart analyzer. Four swarm topologies are available via the topology argument: the default fully-connected "gbest" (Kennedy-Eberhart 1995), the wrap-around ring "lbest" of width 2·k_neighbors+1 (Kennedy & Mendes 2002), the 4-connected 2-D toroidal grid "vonneumann" (Kennedy & Mendes 2003; Mendes 2004), and the "random" stochastic informer graph (Mendes 2004; Clerc 2007 / SPSO 2011 — each particle is connected to itself plus k_neighbors random informers re-sampled at on_start and on_restart, plus an optional stagnation_threshold for the stochastic-K mid-run rebuild that re-samples the graph when the swarm fails to lift its global best for N consecutive results) — four complementary information-diffusion regimes (instantaneous / one-hop linear / two-hop planar / asymmetric stochastic), with "vonneumann" widely cited as a stable middle ground and "random" providing a structure-free alternative whose diffusion speed depends on the realised graph. Optional w_end enables the Shi–Eberhart (1998) linearly-decreasing inertia schedule (off by default; constant w reproduces the prior behaviour).

  • RegionUCB: UCB1 allocation over the leaves of the Splitter box decomposition (LA-MCTS-style region bandit) with in-leaf sampling — a configurable fraction of candidates is drawn from a Gaussian around the leaf’s best point (gauss_fraction, gauss_scale), the rest uniformly over the leaf; ucb_c sets the exploration weight. Emits an initial design from on_start, so it can be run as the only arm (until 2026-09 it produced nothing at all without a partner).

  • FeasibleSearch: Actively searches for and repairs feasible solutions via line search towards feasibility.

  • ConstraintGradient: Uses estimated gradients of constraint violations to find feasible regions.

  • LocalPenaltySearch: Optimizes the scalarized penalty function directly with a local scipy optimizer.

  • ConstraintRepair: Projects infeasible best points onto the feasible region using SLSQP.

  • ClaudeHeuristic: Cluster-based adaptive search using Mixture of Gaussians over elite points.

Heuristics#

The following heuristics for generating new points are implemented. They are all derived from Heuristic.

class panobbgo.heuristics.CMAES(strategy, sigma0: float = 0.3, popsize: int | None = None, popsize_min_workers: bool | str = 'auto', min_results_fraction: float = 0.5, ipop_factor: float = 2.0, restart_mode: str = 'ipop', self_restart: bool = True, restart_from: str = 'random', tolx: float = 1e-11, tolfun: float = 1e-11, tolfunhist: float = 1e-12, stagnation: int | None = None, conditioncov: float = 100000000000000.0, noeffectaxis: bool = True, noeffectcoord: bool = True, stagnation_frac: float | None = None, stagnation_rel_tol: float = 1e-08, sigma_divergence: bool = True, sigma_max_frac: float = 0.3, sigma_divergence_gens: int = 5, warm_start: str | None = None, warm_start_cov_shrink: float | None = None, warm_start_cov_cond_max: float | None = None, warm_start_wide_seeds: bool = False, warm_start_sigma_floor: float | None = None, warm_start_keep_cov: bool = False, inject: bool = False, name: str | None = None, boundary: str = 'project', first_start: str = 'center', active: bool = True, active_skip_repaired: bool = True, late_results: str = 'fold', quorum: str = 'dispatched', failure_aware: bool = False)[source]#

Bases: Heuristic

Covariance Matrix Adaptation Evolution Strategy heuristic with IPOP / BIPOP restart.

Maintains a multivariate Gaussian search distribution N(m, σ²C) and adapts it from the history of evaluated points. Particularly effective for functions with elongated or ill-conditioned level sets (e.g. Rosenbrock).

When paired with the Restart analyzer, the heuristic implements either:

  • IPOP-CMA-ES (restart_mode="ipop", default): each restart multiplies the population size by ipop_factor (default 2.0) and resets the search distribution to the new center. Good for moderately multimodal problems.

  • BIPOP-CMA-ES (restart_mode="bipop"): alternates between a large regime (geometric population growth from the base λ) and a small regime (small λ with a random small σ). The regime that has consumed fewer cumulative evaluations is selected next, balancing exploitation and exploration. This is the BBOB-2009 winning strategy and the gold standard for highly multimodal problems with limited budget.

Parameters:
  • strategy (StrategyBase) – The optimization strategy instance.

  • sigma0 (float, optional) – Initial step size as a fraction of the mean box half-range. Defaults to 0.3 (30 % of the search space).

  • popsize (int, optional) – Override the base population size λ = 4 + floor(3·ln n). Useful for low-budget runs. On IPOP restarts the population is multiplied relative to the current λ; in BIPOP mode the large-regime population grows from this base value.

  • popsize_min_workers (bool | str) –

    Raise the default base λ to the number of parallel workers (strategy._n_evaluators(): the virtual clock’s q, the thread / process / dask worker count) when that is larger, so one generation fills the workers. It is the rule the pycma baseline adapter uses (panobbgo.harness_baselines, popsize0 = max(4 + 3 ln n, q)); IPOP/BIPOP grow λ from the raised base. An explicit popsize is never raised. The raised λ is capped by the budget so the run keeps at least MIN_GENERATIONS generations (λ ≤ max(λ_default, max_eval // 10)). The cap applies to the base λ only: IPOP/BIPOP restarts grow λ from it and may exceed it. Without the floor a λ = 8 arm keeps at most about 1.5·λ of 64 virtual workers busy (DISCOVERY §63). The warm start’s archive fit keeps the size it has without the floor (see _warm_start_seeds()): the floor is a throughput decision and must not change how greedy the hand-off is.

    "auto" (default): the floor applies on the virtual clock (evaluation_method = "virtual", where evaluations are expensive by construction) and not on real pools. True: always. False: never, the pre-§63 behaviour. Real backends are off by default on purpose: with a cheap objective on many threads or a large dask cluster, λ = q spends sample efficiency (fewer generations per evaluation) and buys no time; it also stretches the stagnation window (10·λ) and makes BIPOP’s small regime (λ ≥ base) no longer small. Only the virtual clock was measured (§63); set True for a real pool with expensive evaluations.

  • min_results_fraction (float) – Fraction of λ that must arrive before a CMA-ES update may fire early. Default 0.5 (= μ). Under quorum="dispatched" it applies only once every offspring of the generation has left the output queue (see quorum).

  • quorum (str) – When a generation may close before all its results are in (DISCOVERY §64). "dispatched" (default): at min_results_fraction · λ results, but only once no offspring of the generation still waits in this heuristic’s output queue; until then the whole generation. Closing early pays only when it lets the next generation fill workers that would otherwise idle; while the generation still has queued points the workers have work, and an early close would rank the first arrivals only. So one worker (every result but the last arrives with points still queued), few workers against a large λ, and synchronous batches smaller than λ (StrategyRoundRobin asks for 10 points: an IPOP- or BIPOP-grown λ, or an explicit popsize > 10) all rank the whole generation. "fraction": close at the fraction regardless, the rule before §64 — with results one at a time it ranked only the first μ arrivals, left no rank for active CMA’s negative weights and dropped λ − μ evaluated offspring.

  • late_results (str) – What happens to an offspring whose result arrives after its generation closed early (DISCOVERY §64). "fold" (default): it joins the next update like an injected point — its evaluated position (x_eval, not a repaired x) is converted to the oldest open generation’s coordinates and Mahalanobis-clipped to c_y (_clip_injected()); it never counts toward that generation’s quorum, never gets a negative weight under active_skip_repaired and is not charged again. Uncapped: late points took about 40 % of the μ selected slots at q ≥ 16. Their steps are measured from the moved mean (the mean shift is not clipped, so a late y carries about −Δm/σ), which shortens p_σ and pulls σ down: ‖p_σ‖/χ_n 0.83 → 0.76 and mean log10 σ/σ0 −0.61 → −0.87 at d5/q4 against "drop". The shrink is small at q = 2 (−0.73 → −0.81 at d5); at q = 64 σ hardly moves from σ0 in any arm (runs of only about 10 generations). The A/B still favours it (§64). The termination histories (TolFun, stagnation) then mix offspring of two distributions. "fold_capped": at most max(1, λ // 4) late points per update, the best-ranked kept (_maybe_inject’s cap and rule); it measured the same as "fold" (the best late points are the ones that reach the selected slots anyway). "drop": ignored, the behaviour before §64; they were evaluated and charged all the same. n_late_folded / n_late_dropped count them; a result for a flushed generation (restart, warm start) is ignored silently and counted in neither.

  • ipop_factor (float) – Population multiplication factor applied on each IPOP restart. Default 2.0 (standard IPOP doubling). Ignored in BIPOP mode (which always doubles the large regime).

  • restart_mode (str) – Restart scheme selector — "ipop" (default) or "bipop".

  • self_restart (bool) – Watch the internal termination criteria and restart without waiting for a restart event. Default True. False restores the pre-2026-09 behaviour: one CMA-ES run for the whole budget unless the Restart analyzer intervenes.

  • restart_from (str) – Where a self-restart re-centres the search — "random" (default; uniform draw in the box, the reference IPOP behaviour), "best" (the best point this heuristic evaluated) or "center" (the box centre, as on_start() uses). Restarts coming from the restart event always use the analyzer’s centre.

  • tolx (float) – Termination when all components of σ·sqrt(diag C) and σ·p_c fall below tolx · σ0. Default 1e-11 (pycma cma.CMAOptions['tolx']).

  • tolfun (float) – Termination when the range of the best objective values over the last 10 + ⌈30n/λ⌉ generations together with all values of the current generation is below this. Default 1e-11.

  • tolfunhist (float) – Same window, best values only. Default 1e-12 (pycma tolfunhist).

  • stagnation (int, optional) – Window length in generations for the median-based stagnation test of Hansen (2016). None (default) resolves to 20 + ⌈120n/λ⌉; 0 disables the test.

  • conditioncov (float) – Termination when cond(C) exceeds this. Default 1e14 (pycma tolconditioncov).

  • noeffectaxis (bool) – Enable the NoEffectAxis criterion (default True).

  • noeffectcoord (bool) – Enable the NoEffectCoord criterion (default True).

  • stagnation_frac (float, optional) – Budget-relative stagnation window as a fraction of config.max_eval. None (default) disables it and leaves only the reference criteria. The window is max(10·λ, stagnation_frac · max_eval) evaluations; the criterion fires when the best value seen has not improved by more than stagnation_rel_tol (relative) over that window. max_eval is read lazily on each check, never in __init__ — the budget is not always known when the heuristic is constructed.

  • stagnation_rel_tol (float) – Relative improvement that counts as progress for stagnation_frac. Default 1e-8.

  • sigma_divergence (bool) – Enable the σ-divergence criterion (default True): fire when the sampling spread σ·sqrt(diag C) has been at or above sigma_max_frac · range in every coordinate for sigma_divergence_gens consecutive generations. This is the panobbgo analogue of pycma’s tolupsigma “creeping behaviour” stop. A diverged run has no basin worth keeping, so its restart always re-centres on the best point seen, whatever restart_from says.

  • sigma_max_frac (float) – Divergence threshold as a fraction of each coordinate’s box range. Default 0.3 — a cloud whose per-coordinate standard deviation is a third of the box is sampling the box, not a neighbourhood. Measured over 60 standard-battery cells (6 seeds, 2026-09-10) the criterion fired on 11 of them, every firing gained AOCC (mean +0.180, max +0.437), and those cells averaged 0.370 AOCC without it against 0.625 for the battery as a whole.

  • sigma_divergence_gens (int) – Consecutive generations above the threshold before the criterion fires. Default 5.

  • warm_start (str, optional) – Fit the initial search distribution to the shared archive instead of starting from the box centre (planning/DESIGN_warm_start_2026-09-10.md §2). One of the three shared selectors — "archive", "archive_diverse", "archive_leaf", see archive_seed() — or the CMA-ES-only "archive_cov", which additionally seeds C with the covariance of the seed cloud. None (default) is the cold start, statement for statement the behaviour shipped before. Unlike the DE family and PSO, a warm start here saves no evaluations: CMA-ES has no population to fill, so the whole gain is starting in the right basin with the right scale. At t = 0 the archive is empty and the heuristic cold-starts.

  • warm_start_cov_shrink (float, optional) –

    Shrink the "archive_cov" seed covariance toward the identity by its own sample size (§48.3). None (default) is the unregularised estimate every number before 2026-09-14 was measured on. A float is the constant c of

    \[α = \mathrm{clip}\!\left(\frac{k-n-1}{c·n(n+1)/2},\,0,\,1\right), \qquad C = (1-α)·I + α·\hat C\]

    with both the input and the blend re-normalised to unit determinant. k is the number of seeds actually fitted. See _seed_covariance() for why the denominator counts the free parameters of the estimate rather than n.

  • warm_start_cov_cond_max (float, optional) – Cap cond(C) of the seeded covariance at this value by clipping its eigenvalue ratio (not by discarding the estimate). None (default) leaves only the 1e7 hard fallback to I. Order 1e2–1e3 is the useful range: a k-point cloud with k barely above n produces near-zero eigenvalues that no amount of search will ever undo.

  • warm_start_wide_seeds (bool) – Apply the 2n seed floor that "archive_cov" uses to every warm-start mode. Default False. Exists as the location-only control for §48.3: it gives "archive" the exact seed set "archive_cov" fits, so a delta between the two isolates the covariance from the wider sample that also moves m and σ.

  • warm_start_sigma_floor (float, optional) – Floor the warm start’s new σ at this fraction of the arm’s own current σ (§50.4). None (default) leaves only the nominal 1e-6·range floor every number before 2026-09-14 was measured with. A float f ∈ (0, 1] makes the hand-off σ_new = clip(spread, f·σ_self, σ0_cold): the step size may still shrink at every hand-off, but by at most 1 − f of what the arm had, so a sequence of hand-offs from a collapsed archive cloud can no longer pin the receiving arm to a point in one move. The upper clip is unchanged and still wins — a warm start may never be wider than a cold start, floor or no floor. See _warm_start_distribution() for why the floor is relative to the arm’s own σ rather than to σ0.

  • warm_start_keep_cov (bool) – Keep the arm’s own adapted B/D/ C across the warm start instead of resetting them to the identity (§49.4). Default False — the reset every warm-start mode has always done. With it on the hand-off moves m and σ only: the relocation without the reset. Mutually exclusive with warm_start="archive_cov", which by definition overwrites C with the archive’s shape; passing both raises.

  • inject (bool) – Rank foreign results — points this instance did not emit — alongside the current generation’s own offspring (planning/DESIGN_seams_2026-09-11.md §2.1; N. Hansen (2011), “Injecting external solutions into CMA-ES”, arXiv:1110.4181). A foreign point is converted to normalised coordinates y = (x_f - m) / σ and its Mahalanobis norm ‖diag(1/D) Bᵀ y‖ is clipped to c_y = √n + 2n/(n+2) so it cannot drag the mean, the step-size path or the covariance update further than one clipped step would — the stored position is m + σ·y_clipped, not the original point. At most max(1, λ // 4) injected points are kept per generation, the best by penalty. Default False. Without a second arm feeding the shared archive there are no foreign points, so this is inert alone — it only does something inside a portfolio.

  • name (str) – Override the heuristic’s display name, and with it the who tag prefix ("<name>:g<gen>:i<i>") used to tell this instance’s own points from a foreign result. Default "CMAES", matching the tag every point carried before this argument existed.

  • boundary (str) – How an offspring sampled outside the box is handled (DISCOVERY §57, H1). "project" (default, the behaviour every number before 2026-09-26 was measured with): project it onto the box and let the step that reaches the projected point, Mahalanobis-clipped, enter the update (see _emit_generation()). "resample": the scheme of the cmaes library that Optuna’s CmaEsSampler runs — redraw the offspring from N(m, σ²C) up to 10·n times until it lies inside the box, and if none does, draw once more and project that one (then repaired as under "project"). The sampled distribution becomes a truncated Gaussian instead of one with point masses on the faces. "reflect": reflect the out-of-box coordinates back into the box (periodic reflection at the faces, so any distance maps inside) and repair the step as under "project". This is a third bound-handling scheme, not §57’s “mirror test” (that is the reverse experiment on Optuna’s side, Baseline_Optuna_CmaEs_clip in panobbgo.harness_baselines). Every draw comes from rng, the heuristic’s own keyed stream.

  • first_start (str) – Where the first run’s mean starts (§57, H2). "center" (default): the box centre — also the default of Optuna’s CmaEsSampler without x0. "random": a uniform point of the box, drawn from rng — what the harness’s Baseline_Optuna_CmaEs does (it passes a uniform random x0) and what pycma does in our adapter. Restarts are governed by restart_from; a warm start (warm_start) still overrides either when the archive has points.

  • active (bool) – Active CMA-ES (§57, H3): the λ − μ worst offspring enter the rank-μ covariance update with negative weights. Default True since 2026-09-27 (DISCOVERY §60: +0.013 / +0.044 AOCC over the positive-only update on the 24-function BBOB battery at 200·d / 500·d, no function class worse, together with the active_skip_repaired guard); every CMA-ES trajectory changed with that switch. False is the positive-only update every number before §60 was measured with. True follows N. Hansen (2016), “The CMA Evolution Strategy: A Tutorial”, arXiv:1604.00772, exactly: the raw weights of eq. (49) over all λ ranks, the positive ones normalised to sum 1 and the negative ones to min(α_μ⁻, α_μeff⁻, α_posdef⁻) in absolute sum (eq. 50–53), the negative weights rescaled by n / ‖C^{-1/2} y‖² (eq. 46), and the decay factor 1 + c₁δ(h_σ) − c₁ − c_μ Σ w_j of eq. (47). c₁, c_μ and μ_eff are the unchanged Table 1 defaults (they depend on the positive weights only). See _set_population() and _update().

  • failure_aware (bool) – Default False. True: a failed offspring (no finite value – a crash, a timeout, or a candidate the failure filter of panobbgo.analyzers.failure_model rejected) is never among the recombined parents, even when more than λ − μ of a generation failed; it keeps its last rank (and with active its negative weight when the μ best are all finite). Without it, failures are ranked last too, but a generation with fewer than μ finite offspring recombines failed points with positive weights (DISCOVERY §71).

  • active_skip_repaired (bool) –

    Only read with active=True. One switch for two rules, both about ranked steps that are not this instance’s own unmodified samples of N(0, C):

    1. a generation that contains a repaired offspring (one projected onto the box, whose step entered the update truncated) gets the tutorial’s positive-only covariance update instead of the active one;

    2. injected foreign points never receive a negative weight.

    Default True; False turns both off (the tutorial’s update in every generation, as measured in DISCOVERY §58). Rule 1 is deliberately conservative: it skips on any repaired offspring among the λ ranked ones. Skipping only when a repaired one is among the μ selected is within noise on most probes of §59 and ahead by +0.06…+0.08 on two (an ellipsoid with its optimum near a face at d = 10, a small-box ellipsoid at d = 5); it is logged as a follow-up, not adopted. Why the rules (DISCOVERY §58.4, §59): eq. (46)–(47) balance the μ best steps against the λ − μ worst ones, which holds when every ranked step is an unmodified sample of N(0, C). At a box face the best offspring are the projected ones — their repaired steps are cut short at the face — while the worst step inward at full length, so the negative term outweighs the positive one along that coordinate and C collapses there. On BBOB f5 (linear slope, optimum on the face) at 500·d this took the AOCC from 0.94 (no active) to 0.53 at d = 5 and from 0.69 to 0.20 at d = 10; with the guard it is 0.86 and 0.70 (8 seeds; without a box, i.e. no projection, active and positive-only tie at 0.99). Zeroing only the repaired offspring’s own negative weight recovered much less (0.66 / 0.58), since the worst offspring are rarely the projected ones. pycma sidesteps the question — its default BoundTransform runs CMA in the unbounded genotype space, so no step is ever repaired — and zeroes the negative weights of injected solutions (CMA_active_injected = 0), the rule adopted here for injected points (rule 2). The principled alternative to rule 1 would be such a genotype mapping for boundary (TODO.md).

  • strategy

  • name

@type strategy: StrategyBase

MAX_FAILED_GENERATIONS: int = 10#

Consecutive all-failed generations before a restart (see _update_if_quorum()). A last resort for a mean stuck inside a failure region: on ellipsoid_fhs_crash (optimum on the boundary) 3 fired on healthy runs and cost precision (1e-6 -> 42 on one d5 run); 10 never fired there.

MIN_GENERATIONS: int = 10#

a raised λ leaves the run at least this many generations (λ ≤ max_eval // MIN_GENERATIONS). A convention, not tuned: below ~10 generations there is little room for step-size and covariance adaptation to act, and 10 is the shortest window this module’s own stagnation tests use (10·λ evaluations, 10 + ⌈30n/λ⌉ generations for tolfun). It binds on the §63 cells only at q = 64 (d = 2: λ 64 → 20, d = 5: 64 → 50).

Type:

The budget cap of the worker floor

RESAMPLE_PER_DIM: int = 10#

Redraws per offspring under boundary="resample", per dimension: Optuna’s CmaEsSampler passes n_max_resampling = 10 · n to cmaes.CMA (Optuna 5.0.0, optuna/samplers/_cmaes.py).

SUPPORTED_BOUNDARY = ('project', 'resample', 'reflect')#

out-of-box offspring handling.

Type:

Accepted values for boundary

SUPPORTED_FIRST_START = ('center', 'random')#

the first run’s start mean.

Type:

Accepted values for first_start

SUPPORTED_LATE_RESULTS = ('drop', 'fold', 'fold_capped')#

a closed generation’s late offspring.

Type:

Accepted values for late_results

SUPPORTED_QUORUM = ('dispatched', 'fraction')#

when a generation may close early.

Type:

Accepted values for quorum

SUPPORTED_RESTART_FROM = ('random', 'best', 'center')#

Accepted values for the restart_from constructor argument.

SUPPORTED_WARM_START = ('archive', 'archive_diverse', 'archive_leaf', 'archive_cov')#

the shared selectors of WARM_START_MODES plus the CMA-ES-only covariance seed. "archive_cov" is kept separate from "archive" on purpose, so the covariance seed can be measured apart from the mean/σ seed.

Type:

Accepted values for warm_start

property bipop_evals_large: int#

Cumulative evaluations spent in the BIPOP large regime.

property bipop_evals_small: int#

Cumulative evaluations spent in the BIPOP small regime.

property bipop_regime: str#

Current BIPOP regime ("large" or "small").

In IPOP mode this stays at "large".

property last_stop_reason: str#

Name of the termination criterion that fired last ("" if none).

n_late_folded: int#

Late offspring folded into an update / dropped (§64 accounting).

property n_restarts: int#

Total restarts in this run — event-driven plus self-triggered.

property n_self_restarts: int#

Restarts triggered by the internal termination criteria.

on_failed_evaluations(points) → None[source]#

Count a failed offspring (no result: the objective crashed) as the worst of its generation.

Without this the offspring stays pending forever: a generation that loses more than 1 - min_results_fraction of its points to crashes never reaches its quorum, and the arm stops emitting for the rest of the run. It is ranked exactly like a non-finite result.

on_new_results(results) → None[source]#

Collect results and trigger a CMA-ES update when enough have arrived.

on_restart(center: ndarray, reason: str = '') → None[source]#

Reset CMA-ES to center using the configured restart scheme.

Called by the Restart analyzer when stagnation is detected, and by _self_restart_now() when one of the heuristic’s own termination criteria fires (then center comes from restart_from instead of the analyzer). Dispatches to the IPOP or BIPOP sub-routine according to restart_mode. Both schemes:

  • Move the search mean to center (a fresh region of the search space).

  • Recompute μ and all adaptation parameters for the new λ.

  • Reset evolution paths p_c, p_σ and covariance C to the identity.

  • Flush all stale pending and in-flight generation results.

The IPOP scheme (Auger & Hansen, 2005) multiplies λ by ipop_factor and resets σ to its initial fraction. The BIPOP scheme (Hansen, 2009) alternates between a large regime (geometric λ growth from the base population) and a small regime (small λ + random small σ).

Parameters:
  • center (np.ndarray) – New starting mean for the search distribution.

  • reason (str) – Human-readable reason string from the Restart analyzer.

on_start() → None[source]#

Initialise CMA-ES state and emit the first generation.

property restart_count: int#

Number of restarts triggered so far (IPOP or BIPOP).

warm_start: str | None#

Archive selector for _warm_start_distribution(), or None for the cold start. A string, deliberately not a callable: the trigger is warm_start_now().

warm_start_box: Any#

Region the next warm start is restricted to, or None for the whole archive. Written by panobbgo.strategies.blocks.StrategyBlockBandit._apply_pending_region() on the main thread just before a block opens, and cleared again right after — a one-shot hand-off from MetaAnalyst (planning/DESIGN_meta_level_2026-09-10.md §2). Anything archive_seed() accepts as box: a Box or a (dim, 2) bounds array.

warm_start_now() → bool[source]#

Re-fit the search distribution to the shared archive, right now.

The direct-call hook of StrategyBlockBandit; see panobbgo.core.Heuristic.warm_start_now(). Unlike a restart this keeps λ, the regime bookkeeping and _counteval — only the distribution moves — but it does drop the stale generation in flight, exactly as _apply_restart() does, and starts a fresh termination-criteria window.

Nothing is dropped when the archive is empty: the method returns False and the running search is left untouched.

class panobbgo.heuristics.COBYQA(strategy, initial_tr_radius: float | None = None, final_tr_radius: float = 1e-06, maxfev: int | None = None, scale: bool = True, warm_start: str | None = None, name: str | None = None)[source]#

Bases: PipeBridgeHeuristic

COBYQA: Powell-family derivative-free trust-region local optimizer.

Parameters:
  • strategy – The owning StrategyBase.

  • initial_tr_radius – Initial trust-region radius. Sensible values are in the order of one tenth of the greatest expected change to the variables. When None (default) the heuristic uses 0.1 · max(box_width). With scale=True SciPy applies the value in the scaled space [-1, 1]^d (capped at 1), so the default first steps move min(0.05 · max_width, 0.5) of each axis’s width — half the axis on [-5, 5]^d. Must be positive.

  • final_tr_radius – Final trust-region radius — accuracy required in the converged variables. COBYQA terminates once the radius falls below this threshold. Default 1e-6. Must be positive and strictly less than initial_tr_radius.

  • maxfev – Maximum number of function evaluations the underlying scipy.optimize.minimize may consume. When None (default) the strategy’s evaluation budget is the only cap; the subprocess is terminated when the strategy stops. maxfev is useful when the user wants COBYQA to give up earlier than the global budget — e.g. when paired with other heuristics inside the same strategy.

  • scale – When True (default), COBYQA rescales the variables to [-1, 1] based on the box bounds, keeping the interpolation geometry well-conditioned for boxes whose axes span very different magnitudes. Panobbgo problems always have finite bounds, so this is safe.

  • warm_start – None (default): the solve starts at the box centre. One of WARM_START_MODES ("archive"): at the start event, if the shared archive already holds results (a resumed run, or results booked with preload_results()), the solve is restarted at the best of them instead — COBYQA’s interpolation set cannot take the archive, so only its start point is warm. With an empty archive nothing changes.

  • name – Override the heuristic’s display name.

Notes

  • The heuristic spawns one dedicated subprocess per restart (Powell’s interpolation set has to be rebuilt from scratch anyway, so a fresh process is the cleanest unit of restart).

  • Out-of-bounds proposals from the subprocess are projected onto the feasible box by panobbgo.lib.Problem.project() before being emitted; the value the subprocess sees is therefore the objective at the projected (feasible) point.

  • Like LBFGSB, the subprocess uses the "spawn" start method to avoid the deadlocks that fork triggers in multi-threaded processes.

Parameters:

@type strategy: StrategyBase

on_restart(center, reason) → None[source]#

Restart the subprocess around center.

COBYQA’s interpolation set is built from scratch on construction; the cleanest restart strategy is to terminate the subprocess and start a fresh one with center (when provided) as the new starting point. When center is None we fall back to the box centre, matching __start__().

This handler runs on the event-bus thread, so it only records the request; produce() performs it (_bridge_respawn()) on the main loop’s thread. A solve that already converged is restarted too.

on_start() → None[source]#

With warm_start: restart the solve at the best archive point, if there is one.

Runs on the event bus after every preloaded or restored result was published, so the archive holds them. The restart is only recorded here; the first produce() performs it, before the initial (box-centre) worker’s first point is emitted.

warm_start: str | None#

Archive selector for the start point (on_start()), or None for the box centre.

static worker(pipe: Any, output: Any, x0: ndarray, bounds: list, initial_tr_radius: float, final_tr_radius: float, maxfev: int | None, scale: bool) → None[source]#

Subprocess entry point: drive scipy’s COBYQA via pipe-based f(x).

class panobbgo.heuristics.Center(strategy)[source]#

Bases: Heuristic

This heuristic checks the point in the center of the box.

Parameters:

@type strategy: StrategyBase

on_start()[source]#
class panobbgo.heuristics.ClaudeHeuristic(strategy, elite_fraction=0.2, max_clusters=5, n_candidates=5, min_points=None, regularization=0.001)[source]#

Bases: Heuristic

Cluster-based adaptive search heuristic (written by Claude, hence the name).

Fits a Mixture of Gaussians to the top-performing evaluated points, then samples new candidates from the mixture. Mixture weights favor clusters with lower penalty values (better objective + feasibility).

Parameters:
  • strategy (StrategyBase) – The optimization strategy instance.

  • elite_fraction – Fraction of all results to consider “elite” (default 0.2).

  • max_clusters – Maximum number of clusters (default 5).

  • n_candidates – Number of points to emit per trigger (default 5).

  • min_points – Minimum total results before activating (default 2*dim+1).

  • regularization – Covariance regularization strength (default 1e-3).

  • strategy

  • name (str)

@type strategy: StrategyBase

on_new_results(results)[source]#

Accumulate results, rebuild clusters, sample new candidates.

on_start()[source]#

Reset state at start of optimization.

class panobbgo.heuristics.ConstraintGradient(strategy, step_size=0.01, descent_step=0.1, samples=1)[source]#

Bases: Heuristic

Constraint-specific heuristic that uses gradient estimation of constraint violation to guide the search towards feasibility.

Behavior: - If the current best point is infeasible (cv > 0):

  • Estimates the gradient of constraint violations using finite differences from history.

  • If cv_vec (vector of constraints) is available, it solves a Linear Programming (LP) subproblem to find a descent direction that reduces the maximum violation.

  • If only scalar cv is available, it uses the gradient of the sum of violations.

  • If the current best point is feasible (cv == 0): - Estimates the gradient of the objective function and constraints. - Solves an LP to minimize the objective while respecting linearized constraints.

  • Generates new points by taking steps in the calculated descent direction.

  • Active Sampling: If there are not enough neighbors to estimate the gradient, it generates perturbation points around the current best solution.

Parameters:
  • strategy – Reference to the strategy.

  • step_size (float) – Step size for finite difference gradient approximation (h).

  • descent_step (float) – Step size for moving in the descent direction (relative to box).

  • samples (int) – Number of points to generate along the direction (if > 1, uses scaling factors).

on_new_best(best)[source]#

React to a new best point. Try to improve it using gradient information.

on_new_results(results)[source]#

Called when new results are available. If we were waiting for samples to estimate gradient, check if we can proceed now.

class panobbgo.heuristics.ConstraintRepair(strategy, max_iter=20, tolerance=1e-06)[source]#

Bases: Heuristic

Heuristic that attempts to repair infeasible solutions by projecting them onto the feasible region.

It triggers when a new best point is found that is infeasible (cv > 0). It uses Scipy’s SLSQP optimizer to minimize the distance to the original point subject to the problem’s constraints.

Objective: min ||x - x_start||^2 Subject to: g(x) <= 0 (evaluated via problem.eval_constraints)

Parameters:
  • strategy – Reference to strategy.

  • max_iter (int) – Maximum iterations for the repair optimizer.

  • tolerance (float) – Feasibility tolerance.

on_new_best(best)[source]#

Check if the new best point needs repair.

class panobbgo.heuristics.DifferentialEvolution(strategy, CR=0.9, F=0.8, NP=20)[source]#

Bases: Heuristic

Asynchronous Differential Evolution (DE) heuristic.

It maintains a population of points. When a new result arrives, if it corresponds to a trial vector generated by DE, it competes with its target vector (parent) for survival in the population. The selection criterion uses the strategy’s constraint handler, making it effective for constrained optimization.

Parameters:
  • CR (float) – Crossover probability [0, 1]. Default 0.9.

  • F (float) – Differential weight [0, 2]. Default 0.8.

  • NP (int) – Population size. Default 20.

  • strategy (StrategyBase)

  • name (str)

@type strategy: StrategyBase

on_failed_evaluations(points)[source]#

Free the slots whose trial failed to evaluate, and keep them working.

A failed trial (the objective crashed) produces no result, so without this its slot keeps a pending entry forever and is never woken again. A failed initial point is redrawn; a failed trial counts as a lost one (the target stays) and the slot gets its next trial. The same rule as LSHADE.on_failed_evaluations.

on_new_results(results)[source]#

Process new results. If result is from our initialization or trial, update population.

on_start()[source]#
class panobbgo.heuristics.Extremal(strategy, diameter=0.1, prob=None)[source]#

Bases: Heuristic

This heuristic is specifically seeking for points at the border of the box and around 0. The @where parameter takes a list or tuple, which has values from 0 to 1, which indicate the probability for sampling from the minimum, zero, center and the maximum. default = ( 1, .2, .2, 1 )

Parameters:

@type strategy: StrategyBase

on_new_results(results)[source]#
on_restart(center, reason)[source]#

Respond to a restart event by flushing stale points.

on_start()[source]#
class panobbgo.heuristics.FeasibleSearch(strategy, radius=0.1, decay=0.95, samples=5)[source]#

Bases: Heuristic

Constraint-specific heuristic that targets feasible regions.

Behavior: - Listens for new best results. - If the current best result is infeasible (cv > 0), it generates candidate points

in an attempt to reduce constraint violation.

  • It uses a simple randomized local search around the current infeasible best, with adaptive step sizes (radius).

  • If a feasible point is known, it searches along the line segment between the infeasible best and the feasible best to find the feasibility boundary.

  • If the current best is feasible, this heuristic reduces its activity (emits fewer points or stops), as its primary goal is finding feasible regions.

Parameters:
  • strategy – Reference to the strategy.

  • radius (float) – Initial search radius (relative to box size).

  • decay (float) – Decay factor for radius when improvement is found.

  • samples (int) – Number of points to generate per event.

on_new_best(best)[source]#

React to a new best point found by the strategy. If it’s infeasible, we try to improve it (reduce CV).

on_new_results(results)[source]#

Listen to all results to find any feasible point, not just the best.

class panobbgo.heuristics.GaussianProcessHeuristic(strategy, acquisition_func=AcquisitionFunction.EI, kappa=1.96, xi=0.01, n_restarts=10, enable_eic=True)[source]#

Bases: Heuristic

Bayesian optimization heuristic using Gaussian Process surrogate models.

This heuristic builds a GP model from evaluated points and uses acquisition functions to select promising new points for evaluation. It responds to new results by updating the model and suggesting new points.

acquisition_func#

The acquisition function to use (EI, UCB, or PI)

kappa#

Exploration parameter for UCB acquisition function

xi#

Exploration parameter for EI and PI acquisition functions

n_restarts#

Number of random restarts for acquisition optimization

gp_model#

The fitted GaussianProcessRegressor model for the objective

gp_constraint#

The fitted GaussianProcessRegressor model for constraints (if EIC enabled)

X_train#

Training points (n_samples, n_features)

y_train#

Training target values (n_samples,) - used for gp_model

y_fx_train#

Raw objective values (n_samples,)

y_cv_train#

Raw constraint violation values (n_samples,)

Initialize the Gaussian Process heuristic.

Parameters:
  • strategy – The optimization strategy instance

  • acquisition_func – Acquisition function to use

  • kappa – Exploration param for UCB (default: 1.96, ~95% confidence)

  • xi – Exploration parameter for EI/PI (default: 0.01)

  • n_restarts – Number of random restarts for opt (default: 10)

  • enable_eic – Whether to use Expected Improvement with Constraints (default: True)

on_new_results(results)[source]#

Update GP model when new results are available.

Parameters:

results – List of Result objects

on_start()[source]#

Initialize the heuristic at the start of optimization.

class panobbgo.heuristics.JSO(strategy, NP_init: int | str = 'auto', NP_min: int = 4, H: int = 5, p_best_max: float = 0.25, p_best_min: float = 0.125, archive_factor: float = 1.0, warm_start: str | None = None, shared_pbest: bool = False, seed: int | None = None, name: str | None = None)[source]#

Bases: LSHADE

jSO: linear-p_best, weighted-mutation refinement of L-SHADE.

Parameters:
  • strategy – The owning StrategyBase.

  • NP_init – Initial population size, or "auto" for budget-adaptive sizing. Default "auto"; the literature default of 30 is the fallback when the budget is unknown. See LSHADE for the "auto" sizing formula and budget notes.

  • NP_min – Minimum population size after LPSR shrinking. Default 4.

  • H – History memory size. Default 5 (Brest et al.). Must be at least 2 so the anchor bin H − 1 is distinct from the learning bins [0, H − 2].

  • p_best_max – Start of the linear p_best schedule (reference code: p = p_best_max · (1 − 0.5 · progress)). Default 0.25. Must lie in (0, 1].

  • p_best_min – End of the linear p_best schedule. Default 0.125. Must satisfy 0 < p_best_min <= p_best_max.

  • archive_factor – Multiplier for the external archive size. Default 1.0. Setting it to 0 disables the archive.

  • warm_start – Optional archive-seeding mode; see LSHADE. Default None (cold start).

  • shared_pbest – Widen the pbest pool with the shared archive (planning/DESIGN_seams_2026-09-11.md §2.2): the pool becomes the live top-p_count union the best p_count foreign results (who not starting with this instance’s own tag) from the Archive analyzer, and pbest is drawn uniformly from that union with the instance’s own RNG. Without an Archive analyzer, or with none of its results foreign, the pool and the RNG draw are exactly today’s — no extra draw is spent probing for foreign points. Default False; like inject on CMAES, this is inert without a second arm feeding the archive.

  • seed – Optional seed for the per-instance RNG.

  • name – Override the heuristic’s display name.

Notes

  • All numeric arguments are validated; bad values raise ValueError.

  • Memory bins [0, H − 2] are initialized to (_INIT_M_F, _INIT_M_CR) = (0.3, 0.8) and updated as (mean_WL + old) / 2. Bin H − 1 is the anchor (_ANCHOR_M_F, _ANCHOR_M_CR) = (0.9, 0.9); the pointer cycles over all H bins and an update that lands on the anchor is dropped (reference code).

  • When the strategy budget is unknown, jSO degrades gracefully: the early-phase F_w factor and p_best = p_best_max; no F cap and no CR floor. This matches L-SHADE’s LPSR fallback.

Parameters:

@type strategy: StrategyBase

shared_pbest: bool#

widen the pbest pool with the best foreign results from the shared archive.

Type:

Shared-pbest seam (§2.2)

class panobbgo.heuristics.LBFGSB(strategy, max_starts: int | None = None, maxfun: int | None = None, epsilon: float | None = None, warm_start: bool = False, warm_start_sigma: float = 0.1, seed: int | None = None, name: str | None = None)[source]#

Bases: PipeBridgeHeuristic

Multi-start L-BFGS-B bound-constrained quasi-Newton local optimizer.

Parameters:
  • strategy – The owning StrategyBase.

  • max_starts – Maximum number of random-restart L-BFGS-B descents. None (default) means “restart until the strategy budget is exhausted” — the parent terminates the subprocess when the run ends. Must be a positive integer when set.

  • maxfun – Maximum function evaluations the underlying fmin_l_bfgs_b may spend on a single descent. None (default) uses scipy’s own default (15000); the strategy budget still caps total evaluations. A smaller value forces earlier restarts on functions where a single descent does not converge. Must be a positive integer when set.

  • epsilon – Finite-difference step size for the gradient approximation. None (default) uses scipy’s default (1e-8). Must be a positive finite float when set.

  • warm_start – When True, every restart after the first box-centre descent starts from a small Gaussian perturbation of the strategy’s best incumbent result instead of a fresh uniform-random point — the memetic “polish the best basin” recipe (see the module docstring). Falls back to a uniform-random draw until the strategy produces its first result. False (default) preserves the historical uniform-restart behaviour byte-for-byte.

  • warm_start_sigma – Standard deviation of the warm-start perturbation as a fraction of each dimension’s box range (default 0.1). Only consulted when warm_start=True. A small positive value turns the restarts into iterated local search / basin hopping around the incumbent; 0.0 polishes the exact incumbent every restart (degenerate once the incumbent is itself an L-BFGS-B local minimum). Must be a non-negative finite float.

  • seed – Optional seed for the per-instance restart RNG (controls the random restart points after the first, box-centre descent, and — under warm_start — the parent-side perturbation RNG).

  • name – Override the heuristic’s display name.

Notes

  • The first descent always starts from the box centre (deterministic, reproducible). Subsequent descents start from fresh uniform-random points in the box, or — under warm_start — from perturbations of the strategy’s best incumbent.

  • The heuristic spawns one dedicated subprocess; on_restart tears it down and relaunches it warm-started from the supplied restart centre (matching COBYQA), with a fresh worker seed for the later multi-start points.

  • Out-of-bounds proposals from the subprocess are projected onto the feasible box by panobbgo.lib.Problem.project() before being emitted; the value the subprocess sees is therefore the objective at the projected (feasible) point.

  • The subprocess uses the "spawn" start method to avoid the deadlocks that fork triggers in multi-threaded processes.

Parameters:

@type strategy: StrategyBase

on_new_best(best) → None[source]#

Track the strategy’s best incumbent for warm-started restarts.

A no-op unless warm_start is enabled; the parent-side _warm_start_x0() reads _best_x when the worker requests a restart point. Mirrors panobbgo.heuristics.nearby.Nearby.on_new_best().

on_restart(center, reason: str = '') → None[source]#

Relaunch the subprocess warm-started at center.

Mirrors panobbgo.heuristics.cobyqa.COBYQA.on_restart(): the first descent of the relaunched worker starts from center (clipped into the box) when one is supplied, falling back to the box centre otherwise. Subsequent descents resume random multi-start, from a fresh worker seed.

This handler runs on the event-bus thread, so it only records the request; produce() performs it (_bridge_respawn()) on the main loop’s thread. A worker that already finished (max_starts reached) is revived too.

static worker(pipe: Any, output: Any, x0_first: ndarray, bounds: list, lb: ndarray, ub: ndarray, seed: int | None, max_starts: int | None, maxfun: int | None, epsilon: float | None, warm_start: bool = False) → None[source]#

Subprocess entry point: run multi-start L-BFGS-B over the pipe.

When warm_start is set, restart points (after the first box-centre descent) are requested from the parent — a perturbation of the strategy’s best incumbent — instead of drawn from the local uniform RNG. The request is a single _X0_REQUEST sentinel over the same pipe used for f(x) round-trips; a closed pipe raises SystemExit so the worker shuts down cleanly on parent teardown.

class panobbgo.heuristics.LSHADE(strategy, NP_init: int | str = 'auto', NP_min: int = 4, H: int = 6, p_best: float = 0.11, p_best_end: float | None = None, archive_factor: float = 1.0, F_schedule: bool | str | None = None, warm_start: str | None = None, seed: int | None = None, name: str | None = None)[source]#

Bases: Heuristic

L-SHADE: linear-population-reduction SHADE adaptive DE.

Parameters:
  • strategy – The owning StrategyBase.

  • NP_init – Initial population size, or the string "auto" for budget-adaptive sizing. Default "auto"; the literature default of 30 is the fallback when the budget is unknown. A fixed population is mistuned by construction — the CEC-2014 paper’s 18 · d is far heavier than Panobbgo’s typical budget can support, and even the milder constant 30 costs ~0.10 AOCC at d=2 and ~0.05 at d=5 against the measured rule (planning/DISCOVERY_2026-09-09.md §17), so the default sizes itself from the strategy’s evaluation budget and the problem dimension via clip(round(3·dim · (budget / (500·dim))**0.25), max(NP_min, 6), 400) — the measured AOCC optimum on the MA-BBOB battery is ≈ 3·dim at the reference budget of 500·dim evaluations, with a mild (fourth-root) budget dependence (planning/DISCOVERY_2026-09-09.md §17): 6 at d=2, 15 at d=5, 30 at d=10, rising to 21 for d=5 at four times the budget. The coefficient 3 is the class attribute AUTO_DIM_COEF, so a subclass whose measured optimum is a bigger swarm can raise it — NLSHADE_LBC uses 4. Pass an explicit int to pin a fixed population. See _resolve_auto_np_init().

  • NP_min – Minimum population size after LPSR shrinking. Default 4 — required by current-to-pbest/1 (mutation needs at least four distinct individuals). Must satisfy NP_min <= NP_init.

  • H – History memory size — number of (M_F, M_CR) bins. Default 6 — the value used by both SHADE and L-SHADE. Larger values smooth memory updates but slow adaptation; smaller values track recent successes more tightly at the cost of more variance.

  • p_best – Greediness factor for current-to-pbest/1. Each trial picks its pbest uniformly from the top ceil(p_best · |population|) by fitness. Default 0.11 per Tanabe-Fukunaga §III-A. Must lie in (0, 1]. When p_best_end is set, this is the initial value of a linearly-annealed schedule (iLSHADE / jSO).

  • p_best_end – Optional terminal greediness for the iLSHADE (Brest et al. 2016) / jSO (Brest et al. 2017) adaptive schedule. When set, the effective p_best at evaluation count e (out of E = strategy.config.max_eval) is p_eff(e) = p_best − (p_best − p_best_end) · min(e/E, 1). The canonical jSO setting is p_best = 0.25, p_best_end = 0.125 — greediness halves as the population shrinks under LPSR so the late-search mutation pulls toward a narrower, more tightly-chosen pbest slice. Must lie in (0, 1] when set; None (the default) keeps p_best constant for byte-identical L-SHADE behaviour. Falls back to constant p_best whenever the strategy budget is unknown.

  • archive_factor – Multiplier for the external archive size; the archive is capped at ceil(archive_factor · NP_current). Default 1.0. Setting it to 0 disables the archive (r2 is then drawn only from the live population).

  • F_schedule – Optional asymmetric F-cap regime. Accepts one of the named regimes "off" / "jso" / "early" / "strict" (see the module docstring for the per-regime breakpoints and caps), or None (default — same as "off"). True / False are accepted as backwards-compatible synonyms for "jso" / "off". The constructor normalizes the value so F_schedule is None for the disabled regimes and a string regime name otherwise. Falls back to the unclamped behaviour when the strategy budget is unknown. jSO opts into "jso" by construction.

  • warm_start – Optional seeding of the initial population from the shared archive instead of uniform random points (planning/DESIGN_warm_start_2026-09-10.md §2). One of "archive" (the k best results in the run), "archive_diverse" (k well-separated good results) or "archive_leaf" (the best point of each of the k best Splitter leaves — k different basins); None (default) is the cold start, statement for statement the behaviour shipped before. Seeds are placed into the population directly, as evaluated results, so warm starting costs zero evaluations; any shortfall is filled by the cold random path, and the next good points seed the external archive. Needs points to exist: at t = 0 the archive is empty and the heuristic silently cold-starts. On a restart event the archive is used only when its best point lies outside the stagnated basin (the bounding box of the live population); otherwise the restart goes to the Restart analyzer’s center.

  • seed – Optional seed for the per-instance RNG. None (default) uses the module’s strategy-derived self.rng stream.

  • name – Override the heuristic’s display name.

Notes

  • All numeric arguments are validated; bad values raise ValueError.

  • Like every Panobbgo heuristic, all state is per-instance. Multiple LSHADE heuristics in one strategy run independently and never share memory bins.

  • LPSR scales the population by progress len(strategy.results) / strategy.config.max_eval. When the budget is unknown (no max_eval, zero, or non-numeric) the heuristic falls back to a constant population at NP_init.

Parameters:

@type strategy: StrategyBase

AUTO_DIM_COEF: float = 3.0#

Per-dimension coefficient of the NP_init="auto" rule, overridable per subclass: the measured optimum is not the same swarm size for every variant of the algorithm (see _AUTO_DIM_COEF and NLSHADE_LBC).

F_schedule: str | None#
H: int#
NP_init: int#
NP_min: int#
archive_factor: float#
on_failed_evaluations(points) → None[source]#

Free the slots whose trial failed to evaluate, and keep them working.

A failed trial produces no result, so without this its slot keeps a pending entry forever and is never woken again. A failed initial point is redrawn; a failed competitive trial counts as a lost one (the target stays) and the slot gets its next trial.

on_new_results(results) → None[source]#

Process incoming evaluations and dispatch follow-up trials.

on_restart(center, reason: str = '') → None[source]#

Drop in-flight state and reseed the population around center.

Mirrors the warm-restart pattern used by PSO and the IPOP/BIPOP CMA-ES variants: archive cleared, memory bins reset to 0.5, slots re-randomised in a small ball around center (or random in the box if center is None), and a fresh round of initial-random trials emitted.

With warm_start set the population is re-seeded from the shared archive instead — but only when the archive’s best point lies outside the stagnated basin, the bounding box of the live population (panobbgo.heuristics._warm_restart.restart_from_archive). Otherwise the archive would put the population straight back where it stagnated, and the restart goes to center as the cold path does.

on_start() → None[source]#

Allocate state and emit NP_init random initial trials.

With warm_start set and a non-empty archive the initial trials are replaced by seeds taken straight from the shared archive; with warm_start=None — or an archive that has nothing to give — this is the cold start, statement for statement as before.

p_best: float#
p_best_end: float | None#
warm_start: str | None#

Archive selector for _warm_start_population(), or None for the cold start. A string, deliberately not a callable: the trigger is warm_start_now().

warm_start_box: Any#

Region the next warm start is restricted to, or None for the whole archive. Written by panobbgo.strategies.blocks.StrategyBlockBandit._apply_pending_region() on the main thread just before a block opens, and cleared again right after — a one-shot hand-off from MetaAnalyst (planning/DESIGN_meta_level_2026-09-10.md §2). Anything archive_seed() accepts as box: a Box or a (dim, 2) bounds array.

warm_start_now() → bool[source]#

Re-seed the population from the shared archive on re-acquisition.

The direct-call hook of StrategyBlockBandit: an arm that is handed a fresh block with an empty queue drops its stale in-flight trials and restarts from the best points the portfolio has found, without spending an evaluation on any of them. Adapted state (the success-history memory, the LPSR population size) is deliberately kept — this is a re-seeding, not a restart.

class panobbgo.heuristics.LSHADE_EpSin(strategy, NP_init: int | str = 'auto', NP_min: int = 4, H: int = 6, p_best: float = 0.11, archive_factor: float = 1.0, mu_freq_init: float = 0.5, warm_start: str | None = None, seed: int | None = None, name: str | None = None)[source]#

Bases: LSHADE

LSHADE-EpSin: ensemble-of-sinusoids F adaptation on top of L-SHADE.

Parameters:
  • strategy – The owning StrategyBase.

  • NP_init – Initial population size, or "auto" for budget-adaptive sizing. Default "auto"; the literature default of 30 is the fallback when the budget is unknown. See LSHADE for the "auto" sizing formula and budget notes.

  • NP_min – Minimum population size after LPSR shrinking. Default 4.

  • H – History memory size (used by the second-half Cauchy-from-memory F sampling and the Normal-from-memory CR sampling at all times). Default 6 (inherited from LSHADE). Awad et al. report results across a range of H values; the L-SHADE default keeps EpSin in lock-step with its parent’s defaults.

  • p_best – Greediness factor for current-to-pbest/1. Default 0.11 — the L-SHADE default; EpSin inherits the current-to-pbest/1 mutation skeleton unchanged.

  • archive_factor – Multiplier for the external archive size. Default 1.0.

  • mu_freq_init – Initial mean frequency for the variable-freq sinusoid (Sinusoid 2). Default 0.5. Must lie in (0, 1].

  • warm_start – Optional archive-seeding mode; see LSHADE. Default None (cold start).

  • seed – Optional seed for the per-instance RNG.

  • name – Override the heuristic’s display name.

Notes

  • All numeric arguments are validated; bad values raise ValueError.

  • Like every Panobbgo heuristic, all state is per-instance.

  • F_schedule is intentionally opt-in. The sinusoidal envelope already provides a time-varying F magnitude; composing it with the jSO asymmetric F-cap (Brest 2017) is usually counter-productive in the first half. The default (F_schedule=None) reproduces the literature behaviour. Callers who want the cap can set F_schedule="jso" (or another named regime) explicitly — it is applied to both phases’ F then.

  • When the strategy budget is unknown (no max_eval, zero, or non-numeric), the phase split defaults to “sinusoidal” so the heuristic still produces a varied F distribution. The G_max estimate falls back to _GMAX_FALLBACK_FACTOR · NP_init.

Parameters:

@type strategy: StrategyBase

on_restart(center, reason: str = '') → None[source]#

Reseed the population and reset the ensemble bandit + frequency memory.

on_start() → None[source]#

Allocate state and reset the ensemble bandit + frequency memory.

class panobbgo.heuristics.LatinHypercube(strategy, div)[source]#

Bases: Heuristic

Partitions the search box into n x n x … x n cubes. Selects randomly in such a way, that there is only one cube in each dimension. Then, it randomly selects one point from inside such a cube.

e.g. with div=4 and dim=2:

+---+---+---+---+
| X |   |   |   |
+---+---+---+---+
|   |   |   | X |
+---+---+---+---+
|   | X |   |   |
+---+---+---+---+
|   |   | X |   |
+---+---+---+---+
Parameters:

div (-) – number of divisions, positive integer.

on_new_results(results)[source]#
on_start()[source]#
class panobbgo.heuristics.LocalPenaltySearch(strategy, method='L-BFGS-B', max_iter=50)[source]#

Bases: PipeBridgeHeuristic

Heuristic that runs a local search using Scipy’s optimizers (e.g. L-BFGS-B, Nelder-Mead) on the penalized objective function provided by the strategy’s constraint handler.

It runs in a separate process and communicates via Pipe, as a pull bridge (PipeBridgeHeuristic): the strategy asks for the next point with produce() and the whole round trip happens on the caller’s thread.

  1. produce receives an "eval" request from the worker and emits the point it carries.

  2. on_new_results stores the penalty value (it runs on the event-bus dispatcher thread, which must neither block nor do I/O).

  3. The next produce sends that value back and receives the next request.

Until 2026-09 steps 1 and 2 ran on a daemon “pump” thread and the event-bus thread respectively, so the output queue was empty whenever a scheduler looked at it and any competitor with a stocked queue starved this arm completely (F3 of planning/results/2026-09-10/invariants_findings.md).

Unlike L-BFGS-B and COBYQA, this worker is a server: it idles between searches, waiting for a "start" command, so _bridge_pending_request() reports whether a descent is actually running. The commands that start one arrive on event handlers (on_start(), on_new_best(), on_restart()) and are therefore recorded there and sent from produce() — only one thread may write to the pipe.

Parameters:

@type strategy: StrategyBase

on_new_best(best)[source]#
on_new_results(results)[source]#

Store the penalty value of our outstanding point.

Delegates to PipeBridgeHeuristic, which keeps the value in a queue until produce() can send it from the main thread.

on_restart(center, reason)[source]#

Reset the search around the new center.

Records the intent; _apply_pending_control() performs it on the main loop’s thread (this handler runs on the event bus, which may not touch the pipe or the output queue — the strategy may be draining it at that instant).

on_start()[source]#

Queue the first local search.

The starting point is drawn here, so this heuristic consumes exactly the same number of draws from its module RNG, at the same point in the stream, as it always did. Only the send is deferred to produce() — see _apply_pending_control().

property p1: Any#

The base class’s name for parent_conn.

produce(limit=None, timeout=None)[source]#

Flush any deferred control command, then do the round trip.

class panobbgo.heuristics.MetaAnalyst(strategy, *, trigger: Any = 'never', mode: str = 'scan', region: bool = False, region_arm: str | None = None, k: int | None = None, k_frac: float = 0.02, meta_frac: float = 0.05, refractory: int | None = None, refractory_frac: float = 0.05, n_leaves: int = 3, quality_weight: float = 0.5, min_leafs: int = 8, min_region_points: int = 4, tail_frac: float = 0.25, name: str | None = None)[source]#

Bases: Heuristic

Analyse the shared store once, at a chosen moment, and turn the analysis into points or into a region hand-off.

Parameters:
  • strategy (StrategyBase) – the owning strategy.

  • trigger – a Trigger, or "never" (default — the null control), or a float read as budget_fraction().

  • mode – "scan" (points from the leaf scan), "random" (the falsifier: uniform points over the whole box at the same moments) or "none" (emit nothing; for the pure region hand-off).

  • region – publish meta_region so the block scheduler moves an adapted arm into the chosen leaf at its next block open.

  • region_arm – name of the arm to hand the region to; None picks the arm that is furthest behind on its own best (the leader is left alone).

  • k – points per firing; None resolves k_frac * max_eval, floored at dim.

  • k_frac – the fraction behind k=None (design §4: 0.02).

  • meta_frac – hard cap on the share of the budget this module may ever emit (design §5).

  • refractory – evaluations between two firings; None resolves max(block_evals, refractory_frac * max_eval).

  • n_leaves – how many top-scoring leaves the k points are spread over — concentrated enough to establish a basin, spread enough not to feed the Splitter live-lock of §13.

  • quality_weight – w in the score; 0 is the pure volume-vs-count scan, 1 pure leaf quality.

  • min_leafs – refuse to fire with fewer leaves than this — on a handful of boxes volume-per-point is noise (design §5).

  • min_region_points – refuse a region hand-off unless the archive holds at least this many points inside the box, so the receiving arm is not handed an empty query after its queue was cleared.

  • tail_frac – refuse to fire in the last fraction of the budget.

  • strategy

  • name (str)

@type strategy: StrategyBase

DEFAULT_NAME = 'Meta'#

default name; sorts after CMAES / JSO / LSHADE, which is what keeps the arms’ registration order untouched (module docstring).

context() → MetaContext[source]#

The MetaContext the trigger is evaluated against.

firings: List[Dict[str, Any]]#

one record per firing, for the screen’s health block

on_new_results(results) → None[source]#

Advance the trace, ask the trigger, fire at most once per batch.

The very first statement is the null short-circuit: with trigger="never" this module reads nothing, writes nothing and draws nothing, so the run is bit-identical to one without it.

refractory() → int[source]#

Evaluations that must pass between two firings.

max(block_evals, refractory_frac*max_eval): never more often than the scheduler makes a decision, and never more often than 5 % of the budget.

refusals: Dict[str, int]#

firings refused by a precondition, by cause

requires_analyzers: Tuple[str, ...] = ('Splitter',)#

Reads Splitter boxes / subscribes to its events (installed on demand).

scan() → List[Tuple[float, Any]][source]#

Score every Splitter leaf, best first.

O(#leaves) floats plus one get_penalty_value per leaf — the whole point of a meta level is that this runs per firing, not per result batch.

class panobbgo.heuristics.NLSHADE_LBC(strategy, NP_init: int | str = 'auto', NP_min: int = 4, H: int | None = None, p_best: float = 0.2, p_best_end: float = 0.3, archive_factor: float = 1.0, k_rank: float = 4.0, p_F_init: float = <object object>, p_F_final: float = <object object>, p_CR_init: float = <object object>, p_CR_final: float = <object object>, m_lbc: float = <object object>, lbc_regime: str | None = None, warm_start: str | None = None, seed: int | None = None, name: str | None = None)[source]#

Bases: NLSHADE_RSP

NL-SHADE-LBC: linear bias change on the SHADE memory update.

Parameters:
  • strategy – The owning StrategyBase.

  • NP_init – Initial population size, or "auto" for budget-adaptive sizing (see LSHADE). Default "auto"; the literature default of 30 is the fallback when the budget is unknown.

  • NP_min – Minimum population size after non-linear reduction. Default 4.

  • H – History memory size. Default None → 20 · D.

  • p_best – pbest share at the start of the run. Default 0.2.

  • p_best_end – pbest share at the end of the run. Default 0.3.

  • archive_factor – Archive size per individual (N_A = ⌊factor · NP⌋, at least NP_min). Default 1.0; 0 disables it.

  • k_rank – Exponent of the rank weights exp(−k_rank · i / NP) for the population draw of r2. Default 4.

  • p_F_init – Initial exponent of the F Lehmer mean’s numerator (at progress r = 0). Default 3.5. Mutually exclusive with lbc_regime.

  • p_F_final – Final exponent of the F Lehmer mean’s numerator (at progress r = 1). Default 1.5. Mutually exclusive with lbc_regime.

  • p_CR_init – Initial exponent of the CR Lehmer mean’s numerator. Default 1.0. Mutually exclusive with lbc_regime.

  • p_CR_final – Final exponent of the CR Lehmer mean’s numerator. Default 1.5. Mutually exclusive with lbc_regime.

  • m_lbc – Spread between numerator and denominator exponents of the Lehmer mean. The denominator exponent is p − m_lbc. Default 1.5. Must be a finite float > 0. At p = 2, m = 1 the formula recovers the standard L-SHADE weighted Lehmer mean. Mutually exclusive with lbc_regime.

  • lbc_regime – Optional named LBC regime. One of "cec2022" (Stanovov et al. 2022 defaults — equivalent to passing no explicit LBC fields), "lshade" (recovers the standard L-SHADE Lehmer mean at p = 2, m = 1), "flat" (pure arithmetic mean — p = 1 throughout, default spread), or "aggressive" (strong bias throughout — p_F decays 5 → 3, p_CR grows 3 → 5, default spread). Mutually exclusive with the five individual LBC float kwargs above — passing both raises ValueError. See _LBC_REGIMES for the regime-to-tuple mapping. Default None (no preset; the individual float kwargs apply, all at their byte-identical CEC 2022 defaults).

  • warm_start – Optional archive-seeding mode; see LSHADE. Default None (cold start).

  • seed – Optional seed for the per-instance RNG.

  • name – Override the heuristic’s display name.

Notes

  • All numeric arguments are validated; bad values raise ValueError.

  • Like every Panobbgo heuristic, all state is per-instance.

  • When the strategy budget is unknown, the LBC schedule falls back to its initial exponents.

  • lbc_regime carries the normalized regime name (or None when no preset was active) so the self-improvement catalog’s categorical_choice rule can flip the bias regime as a single discrete bandit arm.

Parameters:

@type strategy: StrategyBase

AUTO_DIM_COEF: float = 4.0#

NL-SHADE-LBC wants a bigger swarm than the rest of the L-SHADE lineage: its measured AOCC optimum is 8 / 20 / 30 at d = 2 / 5 / 10 against jSO’s and L-SHADE’s 6 / 15 / 20-30, i.e. 4·dim rather than 3·dim (planning/DISCOVERY_2026-09-09.md §17, §20, §24). A 12-seed paired A/B of 4·dim against the shipped 3·dim "auto" rule gives +0.0523 AOCC [+0.0098, +0.0948], 10/12 seeds positive.

INIT_MEMORY: Tuple[float, float] = (0.5, 0.9)#

Initial (M_F, M_CR).

NO_SUCCESS_MEMORY: Tuple[float, float] = (0.5, 0.9)#

(M_F, M_CR) a bin is reset to after a generation without success.

class panobbgo.heuristics.NLSHADE_RSP(strategy, NP_init: int | str = 'auto', NP_min: int = 4, H: int | None = None, p_best: float = 0.2, p_best_end: float = 0.4, archive_factor: float = 2.1, k_rank: float = 1.0, warm_start: str | None = None, seed: int | None = None, name: str | None = None)[source]#

Bases: LSHADE

NL-SHADE-RSP: NLPSR, rank-based r2 pressure, adaptive archive use, mixed crossover.

Parameters:
  • strategy – The owning StrategyBase.

  • NP_init – Initial population size, or "auto" for budget-adaptive sizing (see LSHADE). Default "auto" — a measured project default; the paper uses 30 · D.

  • NP_min – Minimum population size after non-linear reduction. Default 4.

  • H – History memory size. Default None → 20 · D.

  • p_best – pbest share at the start of the run. Default 0.2.

  • p_best_end – pbest share at the end of the run. Default 0.4 (rising, as in the reference code).

  • archive_factor – Archive size per individual, N_A = ⌊factor · NP⌋ (at least NP_min). Default 2.1; 0 disables the archive.

  • k_rank – Exponent of the rank weights exp(−k_rank · i / NP) for the population draw of r2. Default 1; 0 is uniform.

  • warm_start – Optional archive-seeding mode; see LSHADE.

  • seed – Optional seed for the per-instance RNG.

  • name – Override the heuristic’s display name.

Notes

When the strategy budget is unknown, the population and archive stay at their initial sizes, p_best stays at its start value and the binomial crossover uses CR_b = 0 (the first-half value).

Parameters:

@type strategy: StrategyBase

INIT_MEMORY: Tuple[float, float] = (0.2, 0.2)#

Initial (M_F, M_CR).

NO_SUCCESS_MEMORY: Tuple[float, float] = (0.5, 0.5)#

(M_F, M_CR) a bin is reset to after a generation without success.

k_rank: float#
on_restart(center, reason: str = '') → None[source]#

Reset p_A and the crossover coin, then restart as L-SHADE.

on_start() → None[source]#

Reset p_A and the crossover coin, then start as L-SHADE.

class panobbgo.heuristics.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]#

Bases: Heuristic

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

on_new_best(best) → None[source]#

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

When quadratic is enabled and a local model can be fitted, the first emitted point is the trust-region Newton minimiser of that model (a curvature-aware step); the remaining points stay isotropic perturbations so exploration is preserved.

Parameters:

best – The new best Result.

on_new_results(results) → None[source]#

Accumulate recent (x, penalty-value) pairs for the quadratic fit.

A no-op unless quadratic is enabled, so quadratic=False keeps the classic heuristic free of any per-result bookkeeping.

on_new_sensitivity(importance: ndarray) → None[source]#

Called when the Sensitivity analyzer produces updated importance scores.

Parameters:

importance – Array of shape (dim,) with values in [0, 1]. Higher means more important. Used to scale perturbation per dimension.

on_restart(center: ndarray, reason: str) → None[source]#

Respond to a restart event by generating points around the new center.

Parameters:
  • center – New search center suggested by the Restart analyzer.

  • reason – Human-readable reason string for the restart.

class panobbgo.heuristics.NelderMead(strategy)[source]#

Bases: Heuristic

This heuristic is inspired by the Nelder Mead Method

Algorithm:

  • If there are enough result points available, it tries to find a subset of dim + 1 points, which are affinely independent (hence, span a simplex) and have the best (so far) function values, and are close (in the same Box).

  • Then, it applies the NM heuristic in a randomized fashion, i.e. it generates several promising points into the same direction as the implied search direction. See here.

The heuristic is reactive: it recomputes its base whenever the Splitter publishes a new best box and tops its output queue up on every result batch. It never sleeps or polls.

Parameters:

@type strategy: StrategyBase

gram_schmidt(dim, results, tol=0.0001)[source]#

Pick dim + 1 affinely independent Results to span a simplex, best first.

The results are sorted best first; the best one is the simplex’s origin, and each further result is accepted iff its offset p.x - first.x keeps a component above tol after Gram-Schmidt against the offsets accepted so far. Working on offsets (affine independence) rather than on the absolute positions makes the choice translation-invariant: collinear points such as (1, 0), (1, 1), (1, 2) never pass as a basis, wherever the origin lies. Returns None if there are not enough such points. The actual basis is not important, only the points for it are; they are used in nelder_mead().

nelder_mead(base, scale=3, offset=0)[source]#

Retuns a new randomized search point for the given set of results (base), which are linearly independent enough to form a orthonormal base, using the Nelder-Mead Method.

Optional Arguments:

  • scale: Used when sampling the new points via the rayleigh() method.

  • offset: This is subtracted from the sample factor; i.e. negative values account for the “contraction”.

nelder_mead_init(base)[source]#

Calculates the worst point and the centroid of the remaining points from the given base.

nelder_mead_sample(worst, centroid, scale=3, offset=0)[source]#

Generates a new randomized search point based on worst point and centroid.

on_new_best_box(best_box)[source]#

A new best box (from the Splitter) resets the search direction: the queue is flushed and refilled from the new base.

on_new_results(results)[source]#

Keep the queue topped up; the base only changes with the best box.

on_restart(center, reason)[source]#

Flush points and pause until a new best box is found.

requires_analyzers: Tuple[str, ...] = ('Splitter',)#

Reads Splitter boxes / subscribes to its events (installed on demand).

class panobbgo.heuristics.PSO(strategy, NP: int = 20, w: float = 0.7298437881283576, c1: float = 1.49618, c2: float = 1.49618, v_max_frac: float = 0.5, topology: str = 'gbest', k_neighbors: int = 2, w_end: float | None = None, stagnation_threshold: int | None = None, warm_start: str | None = None, seed: int | None = None, name: str | None = None)[source]#

Bases: Heuristic

Asynchronous Particle Swarm Optimization heuristic.

Parameters:
  • strategy – The owning StrategyBase.

  • NP – Swarm size (number of particles). Default 20 — large enough to avoid premature convergence on multimodal problems yet cheap enough that the per-iteration overhead is tiny next to a typical black-box evaluation cost.

  • w – Inertia weight (χ in the constriction formulation). Default 0.7298 — the canonical Clerc-Kennedy value that provably guarantees convergence with c1 = c2 = 1.49618. Also acts as the initial inertia of the linearly-decreasing schedule when w_end is provided.

  • c1 – Cognitive (personal-best attraction) coefficient. Default 1.49618 — Clerc-Kennedy.

  • c2 – Social (global-best attraction) coefficient. Default 1.49618 — Clerc-Kennedy.

  • v_max_frac – Maximum velocity per dimension as a fraction of the corresponding box range. Velocities are clamped to [-v_max_frac · range, +v_max_frac · range] to prevent the swarm from exploding outside the search box. Default 0.5 — a common conservative choice.

  • topology – Social-attraction topology (see module docstring). "gbest" (default) pulls every particle toward the single global best. "lbest" switches to a wrap-around ring of width 2 · k_neighbors + 1 and pulls toward the best pbest in that ring; this slows information diffusion and is empirically stronger on multimodal problems (Kennedy & Mendes, 2002). "vonneumann" arranges the swarm on a 2-D toroidal grid of shape R × C with R · C ≥ NP and R ≈ √NP so the grid is as square as possible, and pulls each particle toward the best pbest among its 4-connected N/S/E/W neighbours plus itself (size 5 on a full rectangular grid; size 4 or 3 on edge particles when NP does not factor into a perfect rectangle). Empirically a stable middle ground that wins on a broader range of problem classes than either pure ring or pure star (Kennedy & Mendes 2003; Mendes 2004). "random" connects each particle to itself plus k_neighbors informers drawn uniformly with replacement from the other particles, dropping duplicates so the actual neighbourhood size lies in [2, k_neighbors + 1]. The adjacency is sampled at on_start and re-sampled at on_restart from the heuristic’s RNG (Mendes 2004; Clerc 2007 / SPSO 2011 — Clerc reports K=3 as the standard default).

  • k_neighbors – Size knob for the neighbourhood. Under "lbest" it is the half-width of the ring — the neighbourhood spans 2 · k_neighbors + 1 particles including the centre — and the default 2 matches Kennedy & Mendes 2002 (neighbourhood size 5). Under "random" it is the number of random informers drawn per particle (in addition to self); after de-duplication the realised neighbourhood size lies in [2, k_neighbors + 1]. Must be a positive integer; k_neighbors >= NP // 2 under "lbest" makes the neighbourhood span the whole swarm and degenerates to "gbest". Ignored when topology in {"gbest", "vonneumann"}.

  • w_end – Final inertia weight for the linearly-decreasing (Shi-Eberhart 1998) schedule. When set, the inertia at evaluation count e (out of E = strategy.config.max_eval) is w_eff(e) = w − (w − w_end) · min(e / E, 1). When None (default) inertia is constant at w — the original Clerc-Kennedy behaviour. Common choice: w = 0.9, w_end = 0.4. Falls back to constant w whenever the strategy budget is unknown (no max_eval configured).

  • stagnation_threshold – Optional stochastic-K stagnation rebuild threshold (Clerc 2007 / SPSO 2011) for the random topology. When a positive integer, the random adjacency is re-sampled mid-run after stagnation_threshold consecutive incoming results land without lifting the global best. The Clerc / SPSO 2011 default is NP (one swarm-cycle’s worth of evaluations). None (default) preserves the static- between-restarts behaviour shipped 2026-05-29. Rejected with a ValueError for topology in {"gbest", "lbest", "vonneumann"} — the three geometric topologies are deterministic functions of NP and have no stochastic graph to rebuild, so the argument could only ever be inert there. Until 2026-09-11 it was accepted and silently ignored, which made a sweep over it on a default-topology swarm measure nothing (planning/DISCOVERY_2026-09-09.md §18).

  • warm_start – Optional seeding of the initial swarm from the shared archive instead of uniform random positions (planning/DESIGN_warm_start_2026-09-10.md §2). One of "archive", "archive_diverse" or "archive_leaf" — see archive_seed(); None (default) is the cold start, statement for statement the behaviour shipped before. Positions and personal bests come from the top-NP results at zero evaluation cost; velocities are 0.5·(x_π(i) − x_i) over a random derangement π, clipped to v_max, so the swarm starts moving between known good points instead of from a standstill. At t = 0 the archive is empty and the heuristic silently cold-starts. On a restart event the archive is used only when its best point lies outside the stagnated basin (the bounding box of the positions and evaluated personal bests); otherwise the restart goes to the Restart analyzer’s center.

  • seed – Optional seed for the per-instance RNG. None (default) uses the module’s strategy-derived self.rng stream.

  • name – Override the heuristic’s display name.

Notes

  • The constructor validates all numeric arguments and raises ValueError on bad inputs.

  • All particle bookkeeping (positions, velocities, personal bests, global best) lives in the heuristic instance — no shared global state, so multiple PSO heuristics in one strategy are independent.

  • The heuristic respects constraints via self.strategy.constraint_handler.is_better and get_penalty_value exactly like DifferentialEvolution.

Parameters:

@type strategy: StrategyBase

on_failed_evaluations(points) → None[source]#

A particle whose trial failed to evaluate moves on without it.

No result comes back for a failed evaluation, so without this the particle keeps a pending entry and never moves again. Its personal best is unchanged.

on_new_results(results) → None[source]#

Process incoming evaluation results and emit follow-up trials.

on_restart(center, reason: str = '') → None[source]#

Drop in-flight trials and reseed the swarm around center.

The behaviour mirrors the IPOP-style warm restart used by CMAES: the global memory is wiped, particles are scattered around the suggested center, and the next evaluation cycle behaves as if the heuristic had just started — except the strategy keeps its accumulated history. With warm_start set the swarm is re-seeded from the archive instead (_warm_start_swarm()) — but only when the archive’s best point lies outside the stagnated basin, the bounding box of the current positions and evaluated personal bests (panobbgo.heuristics._warm_restart.restart_from_archive). Otherwise the archive would put the swarm straight back where it stagnated, and the restart goes to center as the cold path does.

on_start() → None[source]#

Allocate state and emit the initial swarm of random positions.

With warm_start set and a non-empty archive the random swarm is replaced by seeds taken straight from the shared archive; with warm_start=None — or an archive that has nothing to give — this is the cold start, statement for statement as before.

warm_start: str | None#

Archive selector for _warm_start_swarm(), or None for the cold start. A string, deliberately not a callable: the trigger is warm_start_now().

warm_start_box: Any#

Region the next warm start is restricted to, or None for the whole archive — the one-shot hand-off panobbgo.strategies.blocks.StrategyBlockBandit._apply_pending_region() writes from MetaAnalyst. Anything archive_seed() accepts as box.

warm_start_now() → bool[source]#

Re-seed the swarm from the shared archive on re-acquisition.

The direct-call hook of StrategyBlockBandit; see panobbgo.core.Heuristic.warm_start_now(). Drops the stale in-flight trials and rebuilds the swarm around the portfolio’s best points, at zero evaluation cost. The informer graph and the inertia schedule are left alone — this is a re-seeding, not a restart.

class panobbgo.heuristics.QuadraticWlsModel(strategy)[source]#

Bases: HeuristicSubprocess

Fit a weighted quadratic model to the best box and propose its minimiser.

For each new best box the results in it are fitted by weighted least squares (weights rank_weights() of the distance to the box’s best point), and the minimiser of the fitted quadratic within the problem box becomes the next search point.

The fit runs in a worker subprocess and is pulled from the main loop’s thread, like the solver bridges (PipeBridgeHeuristic):

  • on_new_best_box() runs on the event-bus thread and only records a snapshot of the latest best box. It never touches the pipe, so a slow fit cannot stall the other handlers. Boxes that arrive before the next produce() coalesce: the latest one wins.

  • produce() (main thread) sends the recorded box to the worker and collects its answer. Under sync_evaluation it waits for the fit — fit_timeout is only a deadlock backstop for a wedged worker — so the emitted point is a function of the event sequence, not of machine speed. Otherwise it takes an answer only when one is ready and returns [] in the meantime.

At most one fit is outstanding. Every request carries an id and every reply echoes it, so a reply to an abandoned request (after the backstop fired) is recognised and dropped.

Parameters:

@type strategy: StrategyBase

property can_produce: bool#

A queued point, a recorded box to fit, or a fit on its way.

True while a fit is in flight even though an asynchronous produce() may still return [] (the reply is not ready yet) — the same convention as PipeBridgeHeuristic.

fit_timeout: float = 60.0#

Deadlock backstop for the synchronous wait in produce(), in seconds. Not a scheduling parameter: it only expires when the worker is wedged or slower than fit_timeout; the worker is then terminated and the arm retires for the rest of the run.

on_demand: bool = True#

Points are produced on the caller’s thread (see produce()).

on_new_best_box(best_box)[source]#

Record a snapshot of best_box for the next produce().

Runs on the event-bus thread: cheap, no pipe I/O. The arrays are copied here because the box keeps changing as results arrive.

produce(limit: int | None = None, timeout: float | None = None) → List[Any][source]#

Send the latest recorded box to the worker and hand out its answer.

Under sync_evaluation this waits for the fit (timeout, default fit_timeout, is a deadlock backstop only); otherwise it never blocks and returns [] while the fit is still running.

requires_analyzers: Tuple[str, ...] = ('Splitter',)#

Reads Splitter boxes / subscribes to its events (installed on demand).

static subprocess(pipe)[source]#

overwrite this pipe.recv() & pipe.send() loop and compute something in between.

class panobbgo.heuristics.Random(strategy, cap=None, name=None)[source]#

Bases: Heuristic

Generates uniformly random points inside the box of the current “best leaf” (see Splitter), or inside the whole problem box until the Splitter has published one.

The heuristic is reactive: it fills its output queue on start and tops it up whenever results arrive or the best leaf changes. It never sleeps or polls, so the sequence of points it produces is a pure function of its rng and the events it receives.

Parameters:

@type strategy: StrategyBase

on_new_best_box(best_box)[source]#
on_new_results(results)[source]#
on_new_split(box, children, dim)[source]#

Track the (possibly new) leaf around the best point.

on_restart(center, reason)[source]#

Reset the search area after a restart event.

Splitter.get_leaf only locates leaves around observed results and a restart proposes an unobserved center, so fall back to the Splitter’s root box (the whole search space) until the next split assigns a tighter leaf around the new incumbent.

on_start()[source]#
requires_analyzers: Tuple[str, ...] = ('Splitter',)#

Reads Splitter boxes / subscribes to its events (installed on demand).

class panobbgo.heuristics.RegionUCB(strategy, ucb_c=1.0, n_candidates=5, gauss_fraction=0.5, gauss_scale=0.25, name=None)[source]#

Bases: Heuristic

UCB1 allocation over Splitter leaves with in-leaf sampling.

Parameters:
  • strategy (StrategyBase) – The strategy instance (provides Splitter, constraint handler).

  • ucb_c (float) – Exploration weight in the UCB score (default 1.0).

  • n_candidates (int) – Points emitted per new_results event (default 5).

  • gauss_fraction (float) – Fraction of candidates drawn from a Gaussian around the leaf’s best point instead of uniformly (default 0.5).

  • gauss_scale (float) – Std-dev of that Gaussian, relative to the leaf’s ranges (default 0.25).

  • strategy

  • name (str)

@type strategy: StrategyBase

on_new_results(results)[source]#

Re-select a region and refill the output queue on every batch.

on_start()[source]#

Emit an initial design, so the bandit has something to react to.

Every other line of this class is driven by on_new_results, and the Splitter tree it allocates over does not exist until results arrive. Without a producer of its own the heuristic therefore emits nothing, ever: run alone it stalls the strategy at 0 evaluations and the run dies on the no-progress guard (measured: 0 of 200 on Rosenbrock d = 3, and 0 of 200 through the IOH harness — under the legacy Splitter as well, so this is the heuristic’s own defect, not the tree’s). Until now it was only ever benchmarked next to another arm, which hid it.

A uniform draw over the problem box is the cheapest opening that presupposes no tree, and it is the same one Random opens with. It uses this module’s own rng, so the master stream is untouched and the RNG-order contract (__init__ draws nothing) still holds.

requires_analyzers: Tuple[str, ...] = ('Splitter',)#

Reads Splitter boxes / subscribes to its events (installed on demand).

sample_in_leaf(leaf)[source]#

Draw n_candidates points inside the leaf’s box.

select_leaf(leafs)[source]#

Pick a leaf by UCB1 score; empty leaves win immediately (random tie-break among them).

class panobbgo.heuristics.Sobol(strategy: Any, n: int = 16, scramble: bool = True, seed: int | None = None, name: str | None = None)[source]#

Bases: Heuristic

Emit n Sobol’-sequence points scaled to the problem’s bounding box.

Sobol’ is a low-discrepancy quasi-random sequence: the first 2^k points cover the unit hypercube with much better uniformity than the same number of i.i.d. uniform samples. By default the sequence is scrambled (Owen-style) so that across reps we still get statistical independence — without that, every run would produce the same points and there would be no per-rep variance to average over.

Note: the quick-mode Rewarding_Diverse strategy ships scramble=False after a 2026-05-31 ledger-evidence-driven codification (three independent self-improvement loop accepts with bootstrap-CI lower bound > 0; see planning/done/SELF_IMPROVEMENT_LOOP.md §13). At n=16 in the 2-D quick-mode battery the deterministic Sobol’ grid is already optimally space-filling, and Owen scrambling adds variance the local heuristics then have to absorb — the per-rep “different points” benefit is dominated by the randomized harness’s per-rep instance translation / rotation, which already provides the statistical independence scramble normally supplies.

Parameters:
  • strategy – The owning StrategyBase.

  • n – Number of points to emit. Sobol’ uniformity is best at powers of two (2^k); the heuristic accepts any positive integer and warns when n is not a power of two. Default 16.

  • scramble – If True (default), apply Owen scrambling so different seeds produce statistically independent point sets while preserving the low-discrepancy property within each set.

  • seed – Optional seed for reproducibility. None (default) draws the sampler seed from the module’s strategy-derived self.rng stream, so the run is pinned by the strategy’s master seed.

  • name – Override the heuristic’s display name.

Notes

  • Heuristic is “one-shot”: after emitting n points it stops. That matches the role of an initial-design heuristic feeding a downstream local/model-based optimizer.

  • The output queue capacity is set to n so all points are enqueued at once; the strategy pulls them as evaluation budget allows.

  • Re-uses scipy.stats.qmc.Sobol(); no new dependency.

Parameters:

@type strategy: StrategyBase

on_start() → None[source]#

Generate and emit the full Sobol’ batch once.

class panobbgo.heuristics.TrustRegionQuadratic(strategy: Any, radius_init: float = 0.1, radius_min: float = 1e-07, radius_max: float = 0.5, fit_span: float = 3.0, first_start: str = 'center', failure_aware: bool = False, name: str | None = None)[source]#

Bases: Heuristic

Quadratic-model trust-region local search on the shared archive (see the module docstring).

Parameters:
  • strategy (StrategyBase) – The owning StrategyBase.

  • radius_init – Initial (and restart) trust radius, as a fraction of the box width per axis. Default 0.1 (Py-BOBYQA’s rhobeg with scaling_within_bounds).

  • radius_min – Radius below which the centre is declared converged and the arm restarts. Default 1e-7.

  • radius_max – Upper bound of the radius. Default 0.5.

  • fit_span – Only archive points within fit_span * radius (inf-norm) of the centre enter the model. Default 3.

  • first_start – Where the first centre is when the archive is empty: "center" of the box (default, like CMAES and COBYQA) or a uniform "random" point (like the Py-BOBYQA baseline). Restarts always draw a random point when the archive offers no non-tabu centre.

  • failure_aware – Default False. True: every failed point (any arm’s crash, timeout or non-finite value, and candidates the failure filter rejected) is remembered and never proposed again (without it a failed geometry point is re-proposed, because only finite results enter the archive), and a candidate in a poison zone of the strategy’s FailureModel is skipped: a poisoned full step shrinks the radius (once per model state) and the step at the smaller radius is tried, so the trust region contracts away from the zone towards its centre; poisoned geometry points are passed over (DISCOVERY §71).

  • name (str) – Override the heuristic’s name.

  • strategy

  • name

@type strategy: StrategyBase

ETA_BAD = 0.1#

Ratio-test thresholds and factors.

ETA_GOOD = 0.7#

Ratio-test thresholds and factors.

GROW = 2.0#
RANK_RTOL = 0.001#

Relative singular-value tolerance of the rank test in _fit().

SHRINK = 0.5#
property can_produce: bool#

a geometry point is always available.

Type:

Always, until stopped

n_poison_skips#

Candidates skipped because the failure model marks them (failure_aware).

n_steps#

Diagnostics.

n_tabu_catch#

Centres made tabu because a step from them improved into a tabu ball (_into_tabu()).

on_demand: bool = True#

True iff this heuristic produces points on demand, on the caller’s thread, rather than reactively topping its queue up from event handlers. The solver bridges (LBFGSB, COBYQA) set it: a sequential SciPy optimizer cannot queue a point ahead, because its next iterate is a function of f at the current one. A scheduler must call produce() — never get_points() — or such an arm is starved by any competitor that keeps a stocked queue (planning/DESIGN_pump_and_stall_2026-09-11.md §1).

on_failed_evaluations(points: List[Any]) → None[source]#

A failed step counts as a failed step; a failed geometry point is just dropped.

on_new_results(results: List[Any]) → None[source]#

Add every result (any arm’s) to the archive; run the ratio test on this arm’s steps.

produce(limit: int | None = None, timeout: float | None = None) → List[Point][source]#

Up to limit fresh points (one when limit is None), computed now from the archive.

class panobbgo.heuristics.WeightedAverage(strategy, k=0.1)[source]#

Bases: Heuristic

This strategy calculates the weighted average of all points in the box around the best point of the Splitter.

Parameters:

@type strategy: StrategyBase

check_dependencies(analyzers, heuristics)[source]#

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

By default, it returns true. Return false if there is a problem.

The arguments are the list of pre-initialized analyzers and heuristics.

on_new_best(best)[source]#
requires_analyzers: Tuple[str, ...] = ('Splitter',)#

Reads Splitter boxes / subscribes to its events (installed on demand).

class panobbgo.heuristics.Zero(strategy)[source]#

Bases: Heuristic

This heuristic only returns the 0 vector once.

Parameters:

@type strategy: StrategyBase

on_start()[source]#
panobbgo.heuristics.budget_fraction(f: float) → Trigger[source]#

Fire once, at f of the budget (see BudgetFraction).

panobbgo.heuristics.never() → Trigger[source]#

The null trigger (see Never).

panobbgo.heuristics.stagnation(window_frac: float = 0.1, tol: float = 1e-08) → Trigger[source]#

Fire on a flat run best over a budget-relative window (Stagnation).