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-modeRewarding_Diversestrategy shipsscramble=Falseafter a 2026-05-31 ledger-evidence-driven codification — atn=16in the 2-D battery the deterministic Sobol’ grid is optimally space-filling. Seeplanning/SELF_IMPROVEMENT_LOG.md“CodifySobol.scramble=FalseinRewarding_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_boxhandler only records the latest box (boxes arriving between two pulls coalesce), andproduce()sends it to the worker on the scheduler’s thread. Undersync_evaluationthe 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_bwith 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 solvesRosenbrock_5Dat a 200-eval budget, where every default Panobbgo strategy scores0.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_restartwarm-starts the next descent at the Restart analyzer’s centre. Subprocess-backed (the solver is synchronous; the pipe round-tripsf(x)),cap=1— an on-demand arm built onPipeBridgeHeuristic: it produces its next point when the scheduler asks, on the scheduler’s thread, so it is reproducible undersync_evaluationand cannot be starved by a competitor with a stocked queue. Opt-in: add it to a strategy withstrategy.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 + 1points 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 aroundscipy.optimize.minimize(method="COBYQA")(scipy 1.14+), an on-demandPipeBridgeHeuristiclikeLBFGSB. 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 keepsqworkers busy. Opt-in (planning/DISCOVERY_2026-09-09.md§66; specsRoundRobin_TRQandBlocks_warm_CMAES_JSO_TRQinmake_trust_region_strategies(), withRoundRobin_COBYQA,RoundRobin_TRQ_r05, the arm atradius_init=0.5(§69.5), and the failure-region candidatesRoundRobin_TRQ_aware(failure_aware=True) andRoundRobin_TRQ_fa(that plus theFailureModelfilter, §71); on the expensive track the opt-intrqmeasure 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 sharedwhotag 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 toc_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 atmax(1, λ // 4)injected points per generation. DefaultFalse; 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
FandCRper-trial via per-bin Cauchy / Normal memories that update each generation by the weighted Lehmer mean of successful triples; uses thecurrent-to-pbest/1mutation with an external archive of replaced parents. The population shrinks linearly fromNP_initdown toNP_min(default 4) over the strategy’s evaluation budget — broad exploration early, focused exploitation late.NP_initdefaults 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·dimfor 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 basicDE/rand/1/binon multimodal benchmarks; opt-in (strategy.add(...)).JSO: jSO (Brest, Maučec & Bošković, CEC 2017 winner) — direct subclass of
LSHADEthat 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-dependentF_wfactor —0.7·Fearly,0.8·Fmid,1.2·Flate), a linear ``p_best`` schedule that decreases from0.25to0.125over the budget (as in the authors’ reference code; the paper’s formula rises), withpbest ≠target in the first half, Cauchy-F clamping that limits sampledFvalues to0.7whileprogress < 0.6, and CR floors (CR ≥ 0.7whileprogress < 0.25,≥ 0.6while< 0.5). The history memory usesM_F = 0.3/M_CR = 0.8initial 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 as0.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 thecurrent-to-pbest-w/1pbest pool from the live top-p_countalone to that pool’s union with the bestp_countforeign results (whonot starting with this instance’s own tag) drawn from the sharedArchiveanalyzer, withpbestthen drawn uniformly over the union using jSO’s own RNG; without anArchiveanalyzer, 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. DefaultFalse; like CMA-ES’sinject, it is inert without a second arm feeding the archive. Opt-in: add it to a strategy withstrategy.add(...).NLSHADE_RSP: NL-SHADE-RSP (Stanovov, Akhmedova & Semenkin, CEC 2021 winner) — direct subclass of
LSHADEfollowing 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 ofr2(weightsexp(−i/NP);r1is uniform), an archive of2.1·NPused forr2with an adaptive probabilityp_Alearned from the archive’s vs. the population’s success, a per-generation choice between binomial and exponential crossover with the sampledCRhanded out sorted by fitness (binomial usesCR_b = 0, then2(r − 0.5)), apbestshare rising0.2 → 0.4,H = 20·Dmemory bins initialised at0.2with 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 withstrategy.add(...).NLSHADE_LBC: NL-SHADE-LBC (Stanovov, Akhmedova & Semenkin, CEC 2022 winner) — direct subclass of
NLSHADE_RSPthat 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 orderplinearly scheduled across budget progress —p_F(r) = (1 − r)·p_F_init + r·p_F_final(defaults3.5 → 1.5) andp_CR(r) = (1 − r)·p_CR_init + r·p_CR_final(defaults1.0 → 1.5). The spreadmis held constant at the literature default1.5; atp = 2, m = 1the formula recovers the standard L-SHADE weighted Lehmer mean. The constructor’slbc_regimekwarg (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 pressureexp(−4i/NP)onr2, fixed archive probability0.5, archive1.0·NPwith fitness-probed replacement,pbestshare0.2 → 0.3, binomial crossover only (fitness-sortedCR), out-of-bounds trials regenerated up to 100 times before the midpoint repair,H = 20·Dbins atM_F = 0.5/M_CR = 0.9. Opt-in: add it to a strategy withstrategy.add(...).LSHADE_EpSin: LSHADE-EpSin (Awad, Ali & Suganthan, CEC 2016) — direct subclass of
LSHADEthat replaces the SHADE Cauchy-from-memoryFsampling 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 adaptiveCauchy(μ_freq, 0.1)clamped to(0, 1]and pairs it with an increasing envelopeg/G_maxand a+πphase shift. Each trial picks one of the two sinusoids with probabilityp_supdated each generation from a Laplace-smoothed Sinusoid-1 success rate;μ_frequpdates 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.CRis always sampled from the SHADE Normal-from-memory bin (unchanged in both phases). The sinusoidal envelope already provides a time-varyingFmagnitude, 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 adaptFvia the SHADE Cauchy memory; EpSin’s deterministic-amplitude sinusoid is algorithmically distinct. Opt-in: add it to a strategy withstrategy.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
topologyargument: the default fully-connected"gbest"(Kennedy-Eberhart 1995), the wrap-around ring"lbest"of width2·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 plusk_neighborsrandom informers re-sampled aton_startandon_restart, plus an optionalstagnation_thresholdfor the stochastic-K mid-run rebuild that re-samples the graph when the swarm fails to lift its global best forNconsecutive 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. Optionalw_endenables the Shi–Eberhart (1998) linearly-decreasing inertia schedule (off by default; constantwreproduces the prior behaviour).RegionUCB: UCB1 allocation over the leaves of the
Splitterbox 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_csets the exploration weight. Emits an initial design fromon_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:
HeuristicCovariance 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
Restartanalyzer, the heuristic implements either:IPOP-CMA-ES (
restart_mode="ipop", default): each restart multiplies the population size byipop_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’sq, 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 explicitpopsizeis never raised. The raised λ is capped by the budget so the run keeps at leastMIN_GENERATIONSgenerations (λ ≤ 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); setTruefor 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 (seequorum).quorum (str) – When a generation may close before all its results are in (DISCOVERY §64).
"dispatched"(default): atmin_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 λ (StrategyRoundRobinasks for 10 points: an IPOP- or BIPOP-grown λ, or an explicitpopsize> 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 repairedx) is converted to the oldest open generation’s coordinates and Mahalanobis-clipped toc_y(_clip_injected()); it never counts toward that generation’s quorum, never gets a negative weight underactive_skip_repairedand 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 lateycarries about−Δm/σ), which shortensp_σ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 mostmax(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_droppedcount 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
restartevent. DefaultTrue.Falserestores the pre-2026-09 behaviour: one CMA-ES run for the whole budget unless theRestartanalyzer 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, ason_start()uses). Restarts coming from therestartevent always use the analyzer’s centre.tolx (float) – Termination when all components of
σ·sqrt(diag C)andσ·p_cfall belowtolx · σ0. Default 1e-11 (pycmacma.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 to20 + ⌈120n/λ⌉;0disables the test.conditioncov (float) – Termination when
cond(C)exceeds this. Default 1e14 (pycmatolconditioncov).noeffectaxis (bool) – Enable the
NoEffectAxiscriterion (defaultTrue).noeffectcoord (bool) – Enable the
NoEffectCoordcriterion (defaultTrue).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 ismax(10·λ, stagnation_frac · max_eval)evaluations; the criterion fires when the best value seen has not improved by more thanstagnation_rel_tol(relative) over that window.max_evalis 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 abovesigma_max_frac · rangein every coordinate forsigma_divergence_gensconsecutive generations. This is the panobbgo analogue of pycma’stolupsigma“creeping behaviour” stop. A diverged run has no basin worth keeping, so its restart always re-centres on the best point seen, whateverrestart_fromsays.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", seearchive_seed()— or the CMA-ES-only"archive_cov", which additionally seedsCwith 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. Att = 0the 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 constantcof\[α = \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.
kis the number of seeds actually fitted. See_seed_covariance()for why the denominator counts the free parameters of the estimate rather thann.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
2nseed floor that"archive_cov"uses to every warm-start mode. DefaultFalse. 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 movesmandσ.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 nominal1e-6·rangefloor every number before 2026-09-14 was measured with. A floatf ∈ (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 most1 − fof 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/Cacross the warm start instead of resetting them to the identity (§49.4). DefaultFalse— the reset every warm-start mode has always done. With it on the hand-off movesmandσonly: the relocation without the reset. Mutually exclusive withwarm_start="archive_cov", which by definition overwritesCwith 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 coordinatesy = (x_f - m) / σand its Mahalanobis norm‖diag(1/D) Bᵀ y‖is clipped toc_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 ism + σ·y_clipped, not the original point. At mostmax(1, λ // 4)injected points are kept per generation, the best by penalty. DefaultFalse. 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
whotag 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 thecmaeslibrary that Optuna’sCmaEsSamplerruns — redraw the offspring from N(m, σ²C) up to10·ntimes 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_clipinpanobbgo.harness_baselines). Every draw comes fromrng, 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’sCmaEsSamplerwithoutx0."random": a uniform point of the box, drawn fromrng— what the harness’sBaseline_Optuna_CmaEsdoes (it passes a uniform randomx0) and what pycma does in our adapter. Restarts are governed byrestart_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. DefaultTruesince 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 theactive_skip_repairedguard); every CMA-ES trajectory changed with that switch.Falseis the positive-only update every number before §60 was measured with.Truefollows 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 tomin(α_μ⁻, α_μeff⁻, α_posdef⁻)in absolute sum (eq. 50–53), the negative weights rescaled byn / ‖C^{-1/2} y‖²(eq. 46), and the decay factor1 + c₁δ(h_σ) − c₁ − c_μ Σ w_jof eq. (47).c₁,c_μandμ_effare 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 ofpanobbgo.analyzers.failure_modelrejected) is never among the recombined parents, even when more than λ − μ of a generation failed; it keeps its last rank (and withactiveits 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):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;
injected foreign points never receive a negative weight.
Default
True;Falseturns 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 defaultBoundTransformruns 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 forboundary(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: onellipsoid_fhs_crash(optimum on the boundary)3fired on healthy runs and cost precision (1e-6 -> 42 on one d5 run);10never 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 fortolfun). 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’sCmaEsSamplerpassesn_max_resampling = 10 · ntocmaes.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_fromconstructor argument.
- SUPPORTED_WARM_START = ('archive', 'archive_diverse', 'archive_leaf', 'archive_cov')#
the shared selectors of
WARM_START_MODESplus 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_regime: str#
Current BIPOP regime (
"large"or"small").In IPOP mode this stays at
"large".
- 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_fractionof 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
Restartanalyzer when stagnation is detected, and by_self_restart_now()when one of the heuristic’s own termination criteria fires (then center comes fromrestart_frominstead of the analyzer). Dispatches to the IPOP or BIPOP sub-routine according torestart_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_factorand 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.
- warm_start: str | None#
Archive selector for
_warm_start_distribution(), orNonefor the cold start. A string, deliberately not a callable: the trigger iswarm_start_now().
- warm_start_box: Any#
Region the next warm start is restricted to, or
Nonefor the whole archive. Written bypanobbgo.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 fromMetaAnalyst(planning/DESIGN_meta_level_2026-09-10.md§2). Anythingarchive_seed()accepts asbox: aBoxor 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; seepanobbgo.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
Falseand 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:
PipeBridgeHeuristicCOBYQA: 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 uses0.1 · max(box_width). Withscale=TrueSciPy applies the value in the scaled space[-1, 1]^d(capped at 1), so the default first steps movemin(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 thaninitial_tr_radius.maxfev – Maximum number of function evaluations the underlying
scipy.optimize.minimizemay consume. WhenNone(default) the strategy’s evaluation budget is the only cap; the subprocess is terminated when the strategy stops.maxfevis 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 ofWARM_START_MODES("archive"): at thestartevent, if the shared archive already holds results (a resumed run, or results booked withpreload_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 thatforktriggers in multi-threaded processes.
- Parameters:
strategy (StrategyBase)
name (str)
@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. WhencenterisNonewe 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()), orNonefor the box centre.
- class panobbgo.heuristics.Center(strategy)[source]#
Bases:
HeuristicThis heuristic checks the point in the center of the box.
- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- class panobbgo.heuristics.ClaudeHeuristic(strategy, elite_fraction=0.2, max_clusters=5, n_candidates=5, min_points=None, regularization=0.001)[source]#
Bases:
HeuristicCluster-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
- class panobbgo.heuristics.ConstraintGradient(strategy, step_size=0.01, descent_step=0.1, samples=1)[source]#
Bases:
HeuristicConstraint-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).
- class panobbgo.heuristics.ConstraintRepair(strategy, max_iter=20, tolerance=1e-06)[source]#
Bases:
HeuristicHeuristic 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:
- class panobbgo.heuristics.DifferentialEvolution(strategy, CR=0.9, F=0.8, NP=20)[source]#
Bases:
HeuristicAsynchronous 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.
- class panobbgo.heuristics.Extremal(strategy, diameter=0.1, prob=None)[source]#
Bases:
HeuristicThis 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:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- class panobbgo.heuristics.FeasibleSearch(strategy, radius=0.1, decay=0.95, samples=5)[source]#
Bases:
HeuristicConstraint-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:
- class panobbgo.heuristics.GaussianProcessHeuristic(strategy, acquisition_func=AcquisitionFunction.EI, kappa=1.96, xi=0.01, n_restarts=10, enable_eic=True)[source]#
Bases:
HeuristicBayesian 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)
- 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:
LSHADEjSO: 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 of30is the fallback when the budget is unknown. SeeLSHADEfor 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 least2so the anchor binH − 1is distinct from the learning bins[0, H − 2].p_best_max – Start of the linear
p_bestschedule (reference code:p = p_best_max · (1 − 0.5 · progress)). Default0.25. Must lie in(0, 1].p_best_min – End of the linear
p_bestschedule. Default0.125. Must satisfy0 < p_best_min <= p_best_max.archive_factor – Multiplier for the external archive size. Default
1.0. Setting it to0disables the archive.warm_start – Optional archive-seeding mode; see
LSHADE. DefaultNone(cold start).shared_pbest – Widen the
pbestpool with the shared archive (planning/DESIGN_seams_2026-09-11.md§2.2): the pool becomes the live top-p_countunion the bestp_countforeign results (whonot starting with this instance’s own tag) from theArchiveanalyzer, andpbestis drawn uniformly from that union with the instance’s own RNG. Without anArchiveanalyzer, 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. DefaultFalse; likeinjectonCMAES, 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. BinH − 1is the anchor(_ANCHOR_M_F, _ANCHOR_M_CR) = (0.9, 0.9); the pointer cycles over allHbins 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_wfactor andp_best = p_best_max; no F cap and no CR floor. This matches L-SHADE’s LPSR fallback.
- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
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:
PipeBridgeHeuristicMulti-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_bmay 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 whenwarm_start=True. A small positive value turns the restarts into iterated local search / basin hopping around the incumbent;0.0polishes 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_restarttears it down and relaunches it warm-started from the supplied restart centre (matchingCOBYQA), 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 thatforktriggers in multi-threaded processes.
- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- on_new_best(best) None[source]#
Track the strategy’s best incumbent for warm-started restarts.
A no-op unless
warm_startis enabled; the parent-side_warm_start_x0()reads_best_xwhen the worker requests a restart point. Mirrorspanobbgo.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 fromcenter(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_startsreached) 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_startis 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_REQUESTsentinel over the same pipe used forf(x)round-trips; a closed pipe raisesSystemExitso 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:
HeuristicL-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 of30is the fallback when the budget is unknown. A fixed population is mistuned by construction — the CEC-2014 paper’s18 · dis far heavier than Panobbgo’s typical budget can support, and even the milder constant30costs ~0.10 AOCC atd=2and ~0.05 atd=5against 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 viaclip(round(3·dim · (budget / (500·dim))**0.25), max(NP_min, 6), 400)— the measured AOCC optimum on the MA-BBOB battery is≈ 3·dimat the reference budget of500·dimevaluations, with a mild (fourth-root) budget dependence (planning/DISCOVERY_2026-09-09.md§17): 6 atd=2, 15 atd=5, 30 atd=10, rising to 21 ford=5at four times the budget. The coefficient3is the class attributeAUTO_DIM_COEF, so a subclass whose measured optimum is a bigger swarm can raise it —NLSHADE_LBCuses4. Pass an explicitintto pin a fixed population. See_resolve_auto_np_init().NP_min – Minimum population size after LPSR shrinking. Default
4— required bycurrent-to-pbest/1(mutation needs at least four distinct individuals). Must satisfyNP_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 itspbestuniformly from the topceil(p_best · |population|)by fitness. Default0.11per Tanabe-Fukunaga §III-A. Must lie in(0, 1]. Whenp_best_endis 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_bestat evaluation counte(out ofE = strategy.config.max_eval) isp_eff(e) = p_best − (p_best − p_best_end) · min(e/E, 1). The canonical jSO setting isp_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-chosenpbestslice. Must lie in(0, 1]when set;None(the default) keepsp_bestconstant for byte-identical L-SHADE behaviour. Falls back to constantp_bestwhenever the strategy budget is unknown.archive_factor – Multiplier for the external archive size; the archive is capped at
ceil(archive_factor · NP_current). Default1.0. Setting it to0disables the archive (r2is 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), orNone(default — same as"off").True/Falseare accepted as backwards-compatible synonyms for"jso"/"off". The constructor normalizes the value soF_scheduleisNonefor 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: att = 0the archive is empty and the heuristic silently cold-starts. On arestartevent 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’scenter.seed – Optional seed for the per-instance RNG.
None(default) uses the module’s strategy-derivedself.rngstream.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
LSHADEheuristics 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 (nomax_eval, zero, or non-numeric) the heuristic falls back to a constant population atNP_init.
- Parameters:
strategy (StrategyBase)
name (str)
@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_COEFandNLSHADE_LBC).
- 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_restart(center, reason: str = '') None[source]#
Drop in-flight state and reseed the population around
center.Mirrors the warm-restart pattern used by
PSOand the IPOP/BIPOP CMA-ES variants: archive cleared, memory bins reset to 0.5, slots re-randomised in a small ball aroundcenter(or random in the box ifcenterisNone), and a fresh round of initial-random trials emitted.With
warm_startset 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 tocenteras the cold path does.
- on_start() None[source]#
Allocate state and emit
NP_initrandom initial trials.With
warm_startset and a non-empty archive the initial trials are replaced by seeds taken straight from the shared archive; withwarm_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_population(), orNonefor the cold start. A string, deliberately not a callable: the trigger iswarm_start_now().
- warm_start_box: Any#
Region the next warm start is restricted to, or
Nonefor the whole archive. Written bypanobbgo.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 fromMetaAnalyst(planning/DESIGN_meta_level_2026-09-10.md§2). Anythingarchive_seed()accepts asbox: aBoxor 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:
LSHADELSHADE-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 of30is the fallback when the budget is unknown. SeeLSHADEfor 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
Fsampling and the Normal-from-memoryCRsampling at all times). Default6(inherited fromLSHADE). Awad et al. report results across a range ofHvalues; the L-SHADE default keeps EpSin in lock-step with its parent’s defaults.p_best – Greediness factor for
current-to-pbest/1. Default0.11— the L-SHADE default; EpSin inherits thecurrent-to-pbest/1mutation 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. DefaultNone(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
Fmagnitude; 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 setF_schedule="jso"(or another named regime) explicitly — it is applied to both phases’Fthen.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 variedFdistribution. TheG_maxestimate falls back to_GMAX_FALLBACK_FACTOR · NP_init.
- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- class panobbgo.heuristics.LatinHypercube(strategy, div)[source]#
Bases:
HeuristicPartitions 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.
- class panobbgo.heuristics.LocalPenaltySearch(strategy, method='L-BFGS-B', max_iter=50)[source]#
Bases:
PipeBridgeHeuristicHeuristic 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 withproduce()and the whole round trip happens on the caller’s thread.producereceives an"eval"request from the worker and emits the point it carries.on_new_resultsstores the penalty value (it runs on the event-bus dispatcher thread, which must neither block nor do I/O).The next
producesends 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 fromproduce()— only one thread may write to the pipe.- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- on_new_results(results)[source]#
Store the penalty value of our outstanding point.
Delegates to
PipeBridgeHeuristic, which keeps the value in a queue untilproduce()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).
- 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:
HeuristicAnalyse 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 asbudget_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_regionso 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;
Nonepicks the arm that is furthest behind on its own best (the leader is left alone).k – points per firing;
Noneresolvesk_frac * max_eval, floored atdim.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;
Noneresolvesmax(block_evals, refractory_frac * max_eval).n_leaves – how many top-scoring leaves the
kpoints are spread over — concentrated enough to establish a basin, spread enough not to feed theSplitterlive-lock of §13.quality_weight –
win the score;0is the pure volume-vs-count scan,1pure 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).
- 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.
- 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_RSPNL-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 (seeLSHADE). Default"auto"; the literature default of30is 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 –
pbestshare at the start of the run. Default0.2.p_best_end –
pbestshare at the end of the run. Default0.3.archive_factor – Archive size per individual (
N_A = ⌊factor · NP⌋, at leastNP_min). Default1.0;0disables it.k_rank – Exponent of the rank weights
exp(−k_rank · i / NP)for the population draw ofr2. Default4.p_F_init – Initial exponent of the F Lehmer mean’s numerator (at progress
r = 0). Default3.5. Mutually exclusive withlbc_regime.p_F_final – Final exponent of the F Lehmer mean’s numerator (at progress
r = 1). Default1.5. Mutually exclusive withlbc_regime.p_CR_init – Initial exponent of the CR Lehmer mean’s numerator. Default
1.0. Mutually exclusive withlbc_regime.p_CR_final – Final exponent of the CR Lehmer mean’s numerator. Default
1.5. Mutually exclusive withlbc_regime.m_lbc – Spread between numerator and denominator exponents of the Lehmer mean. The denominator exponent is
p − m_lbc. Default1.5. Must be a finite float> 0. Atp = 2, m = 1the formula recovers the standard L-SHADE weighted Lehmer mean. Mutually exclusive withlbc_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 atp = 2, m = 1),"flat"(pure arithmetic mean —p = 1throughout, default spread), or"aggressive"(strong bias throughout —p_Fdecays5 → 3,p_CRgrows3 → 5, default spread). Mutually exclusive with the five individual LBC float kwargs above — passing both raisesValueError. See_LBC_REGIMESfor the regime-to-tuple mapping. DefaultNone(no preset; the individual float kwargs apply, all at their byte-identical CEC 2022 defaults).warm_start – Optional archive-seeding mode; see
LSHADE. DefaultNone(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_regimecarries the normalized regime name (orNonewhen no preset was active) so the self-improvement catalog’scategorical_choicerule can flip the bias regime as a single discrete bandit arm.
- Parameters:
strategy (StrategyBase)
name (str)
@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·dimrather than3·dim(planning/DISCOVERY_2026-09-09.md§17, §20, §24). A 12-seed paired A/B of4·dimagainst the shipped3·dim"auto"rule gives +0.0523 AOCC [+0.0098, +0.0948], 10/12 seeds positive.
- 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:
LSHADENL-SHADE-RSP: NLPSR, rank-based
r2pressure, adaptive archive use, mixed crossover.- Parameters:
strategy – The owning
StrategyBase.NP_init – Initial population size, or
"auto"for budget-adaptive sizing (seeLSHADE). Default"auto"— a measured project default; the paper uses30 · D.NP_min – Minimum population size after non-linear reduction. Default
4.H – History memory size. Default
None→20 · D.p_best –
pbestshare at the start of the run. Default0.2.p_best_end –
pbestshare at the end of the run. Default0.4(rising, as in the reference code).archive_factor – Archive size per individual,
N_A = ⌊factor · NP⌋(at leastNP_min). Default2.1;0disables the archive.k_rank – Exponent of the rank weights
exp(−k_rank · i / NP)for the population draw ofr2. Default1;0is 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_beststays at its start value and the binomial crossover usesCR_b = 0(the first-half value).- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- NO_SUCCESS_MEMORY: Tuple[float, float] = (0.5, 0.5)#
(M_F, M_CR)a bin is reset to after a generation without success.
- 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:
HeuristicGenerates new points based on a cheap, fast algorithm.
For each new best point, generates
newmany nearby points by applying a random perturbation of magnituderadius(relative to dimension ranges).When a
Sensitivityanalyzer is active and has produced importance scores, the perturbation along each dimension is scaled proportionally to that dimension’s importance score. This focuses the local search on dimensions that have the greatest impact on the objective, making it significantly more efficient in high-dimensional problems.Arguments:
axes:one: perturb only one randomly chosen axisall: perturb all axes simultaneously
new: number of new points to generate per best update (default: 1)radius: perturbation size as a fraction of the dimension’s range (default: 0.01)sensitivity_scale: when sensitivity data is available, scale perturbations by dimension importance raised to this power (default: 1.0). Higher values focus more aggressively on important dimensions; 0.0 disables sensitivity scaling.quadratic: whenTrue, keep a rolling buffer of recent evaluated(x, f(x))pairs and, on each new best, emit the trust-region Newton minimiser of a locally-fitted quadratic model as the first refinement point (a curvature-aware step; see the module docstring). The remainingnew - 1points stay isotropic perturbations.False(default) is byte-for-byte the classic behaviour — no buffer, no model.quadratic_trust: trust-region radius for the quadratic step, as a multiple ofradiusin per-axis box-normalised units (default: 2.0). Only consulted whenquadratic=True.quadratic_min_r2: minimum weightedR²the local quadratic model must achieve to be trusted (default: 0.8). Below it the step is skipped and the point falls back to an isotropic perturbation — this is what keeps the curvature step from over-exploiting on multimodal landscapes whose neighbourhood straddles several basins. Only consulted whenquadratic=True.quadratic_weight_sigma: bandwidth of the Gaussian distance kernel that localises the quadratic fit, as a fraction of the median neighbour distance (default: 0.35). Smaller focuses the model more tightly on the immediate neighbourhood of the incumbent (a better local model of a curved valley, but noisier if pushed too small); larger approaches an unweighted fit over the whole buffer. Only consulted whenquadratic=True. Seefit_quadratic_step().quadratic_hessian_rank: coupling rank of the local Hessian model (default:"auto")."auto"fits a diagonal-plus-low-rank quadratic in the weighted-PCA basis and selects the coupling rank per fit by BIC, which recovers the coordinate coupling of a curved (Rosenbrock) valley from a thin local cloud that a ridge-regularised full quadratic shrinks to zero — while still keeping the full model on an isotropic neighbourhood. A non-negativeintpins the rank (0= diagonal in the PCA basis;≥ dim= full quadratic);Noneselects the legacy full quadratic fitted in the raw axis basis."auto"keeps the legacy full quadratic atdim ≤ 2(byte-identical to the previous behaviour on the 2-D battery), engaging the coupling model only atdim ≥ 3where a thin cloud under-determines the cross terms. Only consulted whenquadratic=True. Seefit_quadratic_step().
- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- on_new_best(best) None[source]#
React to a new best result by generating nearby candidate points.
When
quadraticis 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
quadraticis enabled, soquadratic=Falsekeeps the classic heuristic free of any per-result bookkeeping.
- class panobbgo.heuristics.NelderMead(strategy)[source]#
Bases:
HeuristicThis heuristic is inspired by the Nelder Mead Method
Algorithm:
If there are enough result points available, it tries to find a subset of
dim + 1points, which are affinely independent (hence, span a simplex) and have the best (so far) function values, and are close (in the sameBox).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
Splitterpublishes a new best box and tops its output queue up on every result batch. It never sleeps or polls.- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- gram_schmidt(dim, results, tol=0.0001)[source]#
Pick
dim + 1affinely independentResultsto 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.xkeeps a component abovetolafter 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. ReturnsNoneif there are not enough such points. The actual basis is not important, only the points for it are; they are used innelder_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 therayleigh()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.
- 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:
HeuristicAsynchronous 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). Default0.7298— the canonical Clerc-Kennedy value that provably guarantees convergence withc1 = c2 = 1.49618. Also acts as the initial inertia of the linearly-decreasing schedule whenw_endis 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. Default0.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 width2 · k_neighbors + 1and pulls toward the bestpbestin 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 shapeR × CwithR · C ≥ NPandR ≈ √NPso the grid is as square as possible, and pulls each particle toward the bestpbestamong its 4-connected N/S/E/W neighbours plus itself (size 5 on a full rectangular grid; size 4 or 3 on edge particles whenNPdoes 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 plusk_neighborsinformers 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 aton_startand re-sampled aton_restartfrom the heuristic’s RNG (Mendes 2004; Clerc 2007 / SPSO 2011 — Clerc reportsK=3as the standard default).k_neighbors – Size knob for the neighbourhood. Under
"lbest"it is the half-width of the ring — the neighbourhood spans2 · k_neighbors + 1particles including the centre — and the default2matches 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 // 2under"lbest"makes the neighbourhood span the whole swarm and degenerates to"gbest". Ignored whentopology 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 ofE = strategy.config.max_eval) isw_eff(e) = w − (w − w_end) · min(e / E, 1). WhenNone(default) inertia is constant atw— the original Clerc-Kennedy behaviour. Common choice:w = 0.9,w_end = 0.4. Falls back to constantwwhenever the strategy budget is unknown (nomax_evalconfigured).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_thresholdconsecutive incoming results land without lifting the global best. The Clerc / SPSO 2011 default isNP(one swarm-cycle’s worth of evaluations).None(default) preserves the static- between-restarts behaviour shipped 2026-05-29. Rejected with aValueErrorfortopology in {"gbest", "lbest", "vonneumann"}— the three geometric topologies are deterministic functions ofNPand 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"— seearchive_seed();None(default) is the cold start, statement for statement the behaviour shipped before. Positions and personal bests come from the top-NPresults at zero evaluation cost; velocities are0.5·(x_π(i) − x_i)over a random derangementπ, clipped tov_max, so the swarm starts moving between known good points instead of from a standstill. Att = 0the archive is empty and the heuristic silently cold-starts. On arestartevent 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’scenter.seed – Optional seed for the per-instance RNG.
None(default) uses the module’s strategy-derivedself.rngstream.name – Override the heuristic’s display name.
Notes
The constructor validates all numeric arguments and raises
ValueErroron 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_betterandget_penalty_valueexactly likeDifferentialEvolution.
- Parameters:
strategy (StrategyBase)
name (str)
@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. Withwarm_startset 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 tocenteras the cold path does.
- on_start() None[source]#
Allocate state and emit the initial swarm of random positions.
With
warm_startset and a non-empty archive the random swarm is replaced by seeds taken straight from the shared archive; withwarm_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(), orNonefor the cold start. A string, deliberately not a callable: the trigger iswarm_start_now().
- warm_start_box: Any#
Region the next warm start is restricted to, or
Nonefor the whole archive — the one-shot hand-offpanobbgo.strategies.blocks.StrategyBlockBandit._apply_pending_region()writes fromMetaAnalyst. Anythingarchive_seed()accepts asbox.
- warm_start_now() bool[source]#
Re-seed the swarm from the shared archive on re-acquisition.
The direct-call hook of
StrategyBlockBandit; seepanobbgo.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:
HeuristicSubprocessFit 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 nextproduce()coalesce: the latest one wins.produce()(main thread) sends the recorded box to the worker and collects its answer. Undersync_evaluationit waits for the fit —fit_timeoutis 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:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- property can_produce: bool#
A queued point, a recorded box to fit, or a fit on its way.
Truewhile a fit is in flight even though an asynchronousproduce()may still return[](the reply is not ready yet) — the same convention asPipeBridgeHeuristic.
- 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 thanfit_timeout; the worker is then terminated and the arm retires for the rest of the run.
- on_new_best_box(best_box)[source]#
Record a snapshot of
best_boxfor the nextproduce().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_evaluationthis waits for the fit (timeout, defaultfit_timeout, is a deadlock backstop only); otherwise it never blocks and returns[]while the fit is still running.
- class panobbgo.heuristics.Random(strategy, cap=None, name=None)[source]#
Bases:
HeuristicGenerates 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
startand 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 itsrngand the events it receives.- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- on_restart(center, reason)[source]#
Reset the search area after a restart event.
Splitter.get_leafonly locates leaves around observed results and a restart proposes an unobservedcenter, 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.
- class panobbgo.heuristics.RegionUCB(strategy, ucb_c=1.0, n_candidates=5, gauss_fraction=0.5, gauss_scale=0.25, name=None)[source]#
Bases:
HeuristicUCB1 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_resultsevent (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_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 theSplittertree 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
Randomopens with. It uses this module’s ownrng, so the master stream is untouched and the RNG-order contract (__init__draws nothing) still holds.
- class panobbgo.heuristics.Sobol(strategy: Any, n: int = 16, scramble: bool = True, seed: int | None = None, name: str | None = None)[source]#
Bases:
HeuristicEmit
nSobol’-sequence points scaled to the problem’s bounding box.Sobol’ is a low-discrepancy quasi-random sequence: the first
2^kpoints 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_Diversestrategy shipsscramble=Falseafter a 2026-05-31 ledger-evidence-driven codification (three independent self-improvement loop accepts with bootstrap-CI lower bound > 0; seeplanning/done/SELF_IMPROVEMENT_LOOP.md§13). Atn=16in 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 whennis not a power of two. Default16.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-derivedself.rngstream, 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
npoints 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
nso all points are enqueued at once; the strategy pulls them as evaluation budget allows.Re-uses
scipy.stats.qmc.Sobol(); no new dependency.
- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- 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:
HeuristicQuadratic-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’srhobegwithscaling_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. Default3.first_start – Where the first centre is when the archive is empty:
"center"of the box (default, likeCMAESandCOBYQA) 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’sFailureModelis 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#
- 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#
Trueiff 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 offat the current one. A scheduler must callproduce()— neverget_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.
- class panobbgo.heuristics.WeightedAverage(strategy, k=0.1)[source]#
Bases:
HeuristicThis strategy calculates the weighted average of all points in the box around the best point of the
Splitter.- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase
- class panobbgo.heuristics.Zero(strategy)[source]#
Bases:
HeuristicThis heuristic only returns the 0 vector once.
- Parameters:
strategy (StrategyBase)
name (str)
@type strategy: StrategyBase