Architecture Overview#

This section describes Panobbgo’s architecture, explaining how the components fit together and interact during optimization.

High-Level Design#

Panobbgo follows an event-driven, modular architecture where independent components communicate through an EventBus. This design enables:

  • Extensibility: Add new heuristics or analyzers without modifying existing code

  • Composability: Mix and match components to create custom optimization strategies

  • Decoupling: Components don’t depend directly on each other

  • Parallelism: Events processed asynchronously in separate threads

Data Flow Diagram#

┌─────────────────────────────────────────────────────────────┐
│                         Strategy                            │
│  ┌─────────────┐      ┌──────────────┐     ┌─────────────┐│
│  │  Heuristic  │─────▶│ Point Queue  │────▶│  Evaluator  ││
│  │ (generates) │      │              │     │             ││
│  └─────────────┘      └──────────────┘     └──────┬──────┘│
│         ▲                                          │      │
│         │                                          │      │
│         │                                          ▼      │
│  ┌──────┴──────┐       ┌──────────────┐    ┌──────────┐  │
│  │  Analyzer   │◀──────│  EventBus    │◀───│ Results  │  │
│  │ (processes) │       │ (publishes)  │    │ Database │  │
│  └─────────────┘       └──────────────┘    └──────────┘  │
└─────────────────────────────────────────────────────────────┘

Core Components#

StrategyBase#

StrategyBase is the main orchestrator that:

  • Manages the optimization loop

  • Coordinates heuristics, analyzers, and evaluators

  • Tracks budget (number of evaluations)

  • Manages parallel evaluation of objective functions

Key methods:

  • __init__(problem, **kwargs): Initialize with problem definition

  • add(Heuristic, **kwargs): Register a heuristic

  • add_analyzer(Analyzer, **kwargs): Register an analyzer

  • start(): Run the optimization loop

  • execute(): Abstract method to get next points (implemented by subclasses)

Properties:

  • best: Current best result

  • results: The results database

  • heuristics: List of registered heuristics

  • analyzers: List of registered analyzers

Results Database#

Results stores all evaluated points in a pandas DataFrame.

Structure:

The DataFrame uses MultiIndex columns:

  • \((x_0, x_1, \ldots, x_{n-1})\): Coordinate values

  • \(fx\): Objective function value

  • \((cv_0, cv_1, \ldots, cv_{m-1})\): Individual constraint violations

  • \(cv\): Total constraint violation (L2 norm)

  • \(who\): Name of heuristic that generated this point

  • \(error\): Estimated error margin

Methods:

  • add_results(new_results): Add new results and publish new_results event

  • __len__(): Number of evaluations performed

EventBus#

EventBus implements the publisher-subscriber pattern.

How it works:

  1. Modules define methods named on_<event_name>(self, **kwargs)

  2. EventBus automatically discovers these methods via introspection

  3. When an event is published, one delivery per subscriber is appended to a single FIFO

  4. One dispatcher thread calls the handlers serially, in subscription order

Common events:

Event

Published By

Common Subscribers

start

Strategy

All modules (initialization)

new_results

Results

Analyzers (Best, Splitter, Sensitivity, Restart)

new_best

Best analyzer

Heuristics (NelderMead, Nearby)

new_min

Best analyzer

UI, statistics collectors

new_split

Splitter analyzer

Heuristics (Random)

new_sensitivity

Sensitivity analyzer

Heuristics (Nearby — scales perturbations by dimension importance)

restart

Restart analyzer

Heuristics (reset and re-explore)

finished

Strategy

All modules (cleanup)

Module Base Classes#

Module is the abstract parent for Heuristic and Analyzer.

Lifecycle:

  1. __init__(strategy, **kwargs): Construction with parameter storage

  2. __start__(): Called before optimization begins

  3. Event handlers: on_<event>() methods invoked during optimization

  4. __stop__(): Called when optimization terminates

Properties:

  • strategy: Reference to the strategy

  • config: Configuration object

  • eventbus: EventBus instance

  • problem: Problem definition

  • results: Results database

  • logger: Logger for this module

Heuristics (Point Generators)#

Heuristic extends Module to generate candidate points.

Architecture#

Each heuristic maintains:

  • Output queue: FIFO queue with configurable capacity (default: 20)

  • Active state: Whether it’s still generating points

  • Performance score: Tracked by StrategyRewarding for adaptive selection

Key methods:

  • emit(x) or emit([x1, x2, ...]): queue coordinate vectors (numpy arrays; they are projected into the box and wrapped in a Point)

  • get_points(limit): Drain up to limit points from queue

  • active: Property indicating if heuristic has more points

Typical pattern:

class MyHeuristic(Heuristic):
    def on_start(self):
        # Generate initial points
        for i in range(10):
            x = self.problem.random_point(rng=self.rng)
            self.emit(x)

    def on_new_best(self, best):
        # React to improvements
        x_new = best.x + 0.1 * self.rng.standard_normal(self.problem.dim)
        x_new = self.problem.project(x_new)
        self.emit(x_new)

Implemented Heuristics#

Initialization:

  • Center: Returns center of bounding box

  • Zero: Returns zero vector

Space-filling:

  • LatinHypercube: Stratified sampling with parameter div

  • Sobol: Low-discrepancy Sobol’ quasi-random sequence with parameter n (powers of two preferred); Owen-scrambled by default so different reps see independent point sets

  • Extremal: Samples from box boundaries

  • Random: Uniform sampling in best leaf box

Local refinement:

  • Nearby: Perturbations around best; sensitivity-aware when Sensitivity is active — scales perturbations along each dimension proportionally to its importance score

  • WeightedAverage: Averages points in best region

Model-based (surrogate):

  • QuadraticWlsModel: Weighted least-squares quadratic surrogate

  • GaussianProcessHeuristic: Gaussian Process surrogate with EI / UCB / PI acquisition functions (scikit-learn backend). Supports constrained Expected Improvement (EIC) when the problem has active constraint violations. Gold standard for expensive black-box optimization — builds an accurate probabilistic model and queries it via the acquisition function.

  • ClaudeHeuristic: Mixture of Gaussians over elite points (cluster-based adaptive search)

Classical optimizers:

  • NelderMead: Randomized simplex method

  • LBFGSB: Multi-start, bound-constrained quasi-Newton (L-BFGS-B) local optimizer in a subprocess. The only gradient-based arm (finite-difference gradients); restarts from fresh random points across the budget and warm-starts at the Restart analyzer’s centre. Excels on smooth ill-conditioned valleys (Rosenbrock) where a single dedicated descent reaches the optimum in a fraction of a population method’s budget.

  • COBYQA: Powell-family derivative-free trust-region local optimizer (Ragonneau-Zhang 2023) — curvature-aware quadratic-model refinement in a subprocess.

Population-based (global search):

  • CMAES: Covariance Matrix Adaptation Evolution Strategy with IPOP and BIPOP restart support. The gold standard for derivative-free optimization of continuous functions. Maintains a multivariate Gaussian search distribution N(m, σ²C) and adapts both the step size σ and covariance matrix C online. Invariant under order-preserving objective transformations and orthogonal search-space transformations; excels on ill-conditioned and ridge-following problems such as Rosenbrock. Implemented in pure NumPy with asynchronous generation tracking that is compatible with panobbgo’s threaded evaluation model.

    When paired with the Restart analyzer, the heuristic supports two restart schemes selected by restart_mode:

    • "ipop" — IPOP-CMA-ES (Increasing Population CMA-ES; Auger & Hansen, CEC 2005): each restart multiplies the population size λ → ipop_factor · λ (default 2.0), resets the covariance to identity, and moves the search mean to a new diverse center. Good for moderately multimodal problems.

    • "bipop" — BIPOP-CMA-ES (Hansen, GECCO 2009): alternates between two restart regimes — a large regime with geometric population growth (λ_l = 2^k · λ_default) and a small regime with a small population and a random small step size (σ_s = σ_default · 10^(-2·U[0,1])). After each restart, the regime that has consumed fewer cumulative evaluations is selected next, balancing exploitation (large regime fits the local geometry) with exploration (small regime probes diverse regions cheaply). This is the BBOB-2009 winning algorithm and the de-facto gold standard for highly multimodal problems with limited evaluation budget.

    Both schemes preserve the accumulated result history; only the CMA-ES distribution state is reset.

  • DifferentialEvolution: Differential Evolution mutation/crossover/selection operators (DE/rand/1/bin with fixed F = 0.8 and CR = 0.9) run against the accumulated result database. Excels on multimodal landscapes such as Rastrigin and Schwefel where purely local methods get trapped.

  • LSHADE: Linear-population-reduction Success-History Adaptive Differential Evolution (Tanabe & Fukunaga, CEC 2014 winner). Adapts F and CR per-trial via per-bin Cauchy / Normal memories that update each generation by the weighted Lehmer mean of successful triples; uses the current-to-pbest/1 mutation (Zhang & Sanderson 2009) with an external archive of replaced parents. The population shrinks linearly from NP_init (default "auto", budget-adaptive) down to NP_min (default 4) over the strategy’s evaluation budget — broad exploration early, focused exploitation late. Strictly stronger than the basic DE on multimodal benchmarks; opt-in (strategy.add(...)). Also supports IPOP-style warm restarts via Restart.

  • JSO: jSO refinement of L-SHADE (Brest, Maučec & Bošković, CEC 2017 winner). Direct subclass of LSHADE that adds three literature-best refinements: a weighted current-to-pbest-w/1 mutation (the pbest direction is re-weighted by a phase-dependent F_w factor — 0.7·F early, 0.8·F mid, 1.2·F late); a linear p_best schedule (0.25 → 0.125); and Cauchy-F clamping that limits sampled F to 0.7 while progress < 0.6; CR floors (CR ≥ 0.7 while progress < 0.25, ≥ 0.6 while < 0.5). The p_best schedule and the rest follow the authors’ reference code where it differs from the paper text (the paper’s p formula rises 0.125 → 0.25, the code’s falls). The history memory uses M_F = 0.3 / M_CR = 0.8 initial values, averages each update with the old value (M ← (mean_WL + M) / 2, from iL-SHADE) and reserves the last bin (H − 1) as an anchor sampled as 0.9 / 0.9. Inherits L-SHADE’s asynchronous pipeline (per-slot pending dict, generation-by-count book-keeping, archive trimming, LPSR shrinking, warm restart) unchanged. Add L-SHADE and jSO side by side and a bandit strategy picks whichever DE-family variant wins on the current battery.

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

  • NLSHADE_LBC: NL-SHADE-LBC (Stanovov, Akhmedova & Semenkin, CEC 2022 winner), a subclass of NLSHADE_RSP with Linear Bias Change in the success-history memory update: the F / CR Lehmer-mean order p is linearly scheduled across budget progress (p_F: 3.5 → 1.5, p_CR: 1.0 → 1.5) with spread m_lbc = 1.5; at p = 2, m = 1 the formula recovers the standard weighted Lehmer mean. Otherwise per the paper: rank pressure exp(−4i/NP) on r2, fixed p_A = 0.5, archive 1.0·NP with fitness-probed replacement, pbest share 0.2 → 0.3, binomial crossover only (sorted CR), out-of-bounds trials regenerated up to 100 times before the midpoint repair, H = 20·D bins at M_F = 0.5 / M_CR = 0.9. Deviations: NP_init="auto" with coefficient 4 (measured) and the asynchronous generation model.

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

  • PSO: Asynchronous Particle Swarm Optimization with the canonical Clerc–Kennedy (2002) constriction-coefficient parameters (w = χ ≈ 0.7298, c1 = c2 ≈ 1.49618). Each particle carries a position, a velocity, and a memory of its personal best; on every step the velocity is pulled toward the personal best and toward the swarm best the particle is allowed to see with random per-component weights. Three swarm topologies select that visible attractor: "gbest" (default) — every particle sees the single global best; "lbest" — a wrap-around ring of width 2·k_neighbors + 1 (Kennedy & Mendes 2002), trading slower information diffusion for stronger multimodal exploration; "vonneumann" — a 4-connected 2-D toroidal grid (Kennedy & Mendes 2003; Mendes 2004) that sits between the two, widely cited as a stable middle ground that wins on a broader range of problem classes; or "random" — a stochastic informer graph (Mendes 2004; Clerc 2007 / SPSO 2011) where each particle is connected to itself plus k_neighbors random informers re-sampled at on_start and on_restart, a structure-free middle ground whose diffusion speed depends on the realised graph. Under topology="random", an optional stagnation_threshold (Clerc 2007 / SPSO 2011 stochastic-K) re-samples the informer graph mid-run when the swarm fails to lift its global best for stagnation_threshold consecutive incoming results — a finer-grained stagnation rebuild than restart-gated re-sampling alone (under the Restart analyzer restarts are rare, so a bad realised graph can otherwise stay locked in for hundreds of iterations). stagnation_threshold=None (default) preserves the static-between-restarts behaviour. An opt-in w_end argument enables the Shi–Eberhart (1998) linearly-decreasing inertia schedule paced by the strategy’s evaluation budget; the default constant w reproduces the original Clerc-Kennedy behaviour. PSO’s momentum and social dynamics are markedly different from CMA-ES (covariance re-sampling) and DE (recombination of three random members) — fast contraction once a basin is found, while inertia retains the prior search direction. Velocities are clamped to a configurable fraction of each box dimension to prevent the swarm from exploding outside the search box. Supports IPOP-style warm restarts via the Restart analyzer: on a restart event the swarm is scattered around the suggested center and the global memory is wiped while the strategy keeps its accumulated result history. With warm_start set the swarm re-seeds from the shared archive instead, but only when the archive’s best point lies outside the stagnated basin (the bounding box of the swarm’s positions and evaluated personal bests); otherwise it restarts around the center like a cold swarm.

Constraint-focused:

  • FeasibleSearch: Beta(2,1)-biased line search between the last feasible and last infeasible point; efficiently locates the constraint boundary.

  • ConstraintGradient: Approximate constraint gradient via finite-differences; perturbs the best infeasible point in the direction that most reduces constraint violation.

  • LocalPenaltySearch: Local search with an adaptive penalty function to steer towards feasibility while minimising the objective.

  • ConstraintRepair: Repairs infeasible points by projecting them back into the feasible region using nearest-feasible-point logic.

Analyzers (Result Processors)#

Analyzer extends Module to process results and maintain derived information.

Architecture#

Analyzers typically:

  • Subscribe to new_results event

  • Maintain internal state (Pareto front, spatial decomposition, statistics)

  • Publish derived events to trigger heuristics or other analyzers

Implemented Analyzers#

Best Tracker

Best maintains:

  • Best feasible point (\(CV(x) = 0\), minimum \(f(x)\))

  • Best infeasible point (minimum \(CV(x)\))

  • Pareto front of \((f(x), CV(x))\) pairs

Events published:

  • new_best: New best point (considering constraints)

  • new_min: New minimum \(f(x)\) among feasible points

  • new_cv: New minimum \(CV(x)\)

  • new_pareto: Pareto front updated

Splitter

Splitter manages hierarchical box decomposition. Best and Convergence are installed by every strategy; the Splitter only when a module declares that it reads it, via the class attribute requires_analyzers = ("Splitter",) (Random, NelderMead, QuadraticWlsModel, WeightedAverage, RegionUCB, MetaAnalyst) or, for heuristics whose need depends on arguments, by overriding required_analyzers() (every heuristic with a warm_start does). A custom module that calls strategy.analyzer("Splitter") must declare it too.

  • Maintains tree of boxes splitting the search space

  • Splits boxes when they contain sufficient points — the threshold is derived from a target leaf population (leaf_size, min_leaf_size, max_leaves), so the resolution scales with the evaluation budget; split_rule / cut_rule choose the cut, and legacy=True restores the pre-2026-09-10 fixed-resolution tree

  • Identifies “best leaf box” containing current best point

See Splitter Resolution in Usage Guide for the knobs and the measured effect on the consumers that read the tree.

Events published:

  • new_split: A box was split into children

Sensitivity

Sensitivity estimates per-dimension importance from evaluation history using rank correlation. Publishes new_sensitivity events that heuristics can use to focus search on the most influential dimensions.

Events published:

  • new_sensitivity: Importance scores for each dimension (array in [0, 1])

Restart

Restart detects search stagnation (no improvement in patience evaluations) and publishes restart events with a suggested new center point. Enables multi-start optimization without losing accumulated results.

Events published:

  • restart: New center point and reason string

Strategies (Orchestration)#

Strategy subclasses implement the execute() method to determine which points to evaluate next.

StrategyRoundRobin#

StrategyRoundRobin cycles through heuristics in fixed order:

def execute(self):
    points = []
    for h in self.heuristics:
        points.extend(h.get_points(batch_size))
    return points

Characteristics:

  • Predictable, deterministic

  • No adaptation to problem

  • Good baseline for comparison

StrategyRewarding#

StrategyRewarding implements multi-armed bandit:

def execute(self):
    points = []
    # Calculate selection probabilities based on performance
    for h in self.heuristics:
        prob = (h.performance + smooth) / (total_performance + smooth * |H|)
        nb_points = round(target * prob)
        points.extend(h.get_points(nb_points))
    return points

Characteristics:

  • Adaptive: learns which heuristics work

  • Probabilistic: maintains exploration

  • Reward function: \(R(x) = 1 - e^{-(f_{best} - f(x))}\)

  • Discount factor: causes old successes to fade

StrategyUCB#

StrategyUCB extends the multi-armed bandit with an Upper Confidence Bound selection rule (UCB1 / UCB-tuned variant):

\[\text{score}(h) = \bar{r}_h + C \sqrt{\frac{\ln N}{n_h}}\]

where \(\bar{r}_h\) is the average reward, \(N\) is total selections, \(n_h\) is selections of heuristic \(h\), and \(C\) is an exploration constant. UCB provides a principled exploration–exploitation trade-off with theoretical regret bounds.

StrategyThompsonSampling#

StrategyThompsonSampling uses Thompson Sampling (Beta– Bernoulli bandit) to select heuristics. Each heuristic maintains a Beta posterior \(\text{Beta}(\alpha_h, \beta_h)\) over its success probability. At each step, an arm is selected by drawing a sample from each posterior and picking the largest.

Advantages: Naturally balances exploration and exploitation; often outperforms UCB in practice.

StrategyLinUCB#

StrategyLinUCB implements a contextual bandit using disjoint linear UCB models. Each heuristic has its own linear reward model:

\[\hat{r}_h(s) = \theta_h^\top s + \alpha \sqrt{s^\top A_h^{-1} s}\]

where \(s\) is a feature vector capturing budget progress, recent success rate, and a bias term. LinUCB adapts selection to the current optimization context, not just historical averages.

StrategyPhased#

StrategyPhased divides the evaluation budget into phases. Each phase can use a different sub-strategy or heuristic portfolio. The phase transitions are triggered by evaluation count, enabling a two-stage approach (e.g., initial exploration followed by focused exploitation).

Typical usage: Phase 1 = LatinHypercube global exploration → Phase 2 = GP-guided exploitation.

Execution Flow#

Initialization Phase#

  1. User creates Strategy with Problem:

    strategy = StrategyRewarding(problem, max_evaluations=1000)
    
  2. User registers heuristics and analyzers:

    strategy.add(LatinHypercube, div=5)
    strategy.add(Random)
    strategy.add_analyzer(Best)
    strategy.add_analyzer(Splitter)
    
  3. User calls strategy.start()

Startup#

  1. Strategy initializes the evaluation environment

  2. Strategy calls __start__() on all modules

  3. EventBus publishes start event

  4. Modules initialize (e.g., LatinHypercube generates initial grid)

Main Loop#

While budget remaining:

  1. Generate points:

    points = strategy.execute()  # Get points from heuristics
    
  2. Evaluate in parallel:

    # Send points to evaluation environment
    results = strategy._evaluate(points)
    
  3. Store results:

    results_db.add_results(results)
    
  4. Publish event:

    eventbus.publish("new_results", results=results)
    
  5. Analyzers process:

    • Best checks for improvements → publishes new_best if found

    • Splitter updates box tree → publishes new_split if box split

  6. Heuristics react:

    • NelderMead starts simplex on new_best

    • Random updates sampling region on new_split

  7. Check termination:

    if len(results_db) >= max_evaluations:
        break
    

Termination#

  1. EventBus publishes finished event

  2. Modules call __stop__() for cleanup

  3. Strategy returns best result

Threading Model#

Event Handling#

Events are delivered serially by one dispatcher thread:

  • Non-blocking: publishing returns immediately; the event is queued

  • Ordered: handlers run one after the other, in the order the events were published

  • Handlers must return promptly — a module reacts to events, it never loops, sleeps or waits inside a handler. Subprocess bridges such as LBFGSB obey this by storing the result in their handler and doing the pipe round trip in produce(), on the strategy’s own thread — no private thread is involved

  • Fire-and-forget: a handler’s return value, if any, is passed to emit

Because no two handlers ever run at the same time, module state needs no locking. The sequence of handler calls is a pure function of the sequence of publish calls, which is what makes a seeded run reproducible: wait_idle() blocks until every queued event (and the events those handlers published) has been handled, and the synchronous evaluation mode (config.sync_evaluation) waits for that before every draw of new points.

Randomness: every module owns a numpy.random.Generator (self.rng) derived from the strategy’s master seed and the module’s name (spawn_rng()), so adding or removing one module does not change another’s stream; modules never touch the global numpy.random state.

Parallel Evaluation#

Function evaluations can run in parallel using different engines:

  • Threaded (Default): Evaluations run in a local thread pool. Suitable for lightweight functions or when running on a single machine.

  • Dask Distributed: Connects to a Dask cluster for large-scale distributed evaluation. All Dask-specific code lives in panobbgo.dask_evaluation and is imported lazily — install the optional extra (pip install panobbgo[dask] or uv sync --extra dask) to use it.

Dask setup (optional):

# Start local cluster with 4 workers
dask scheduler &
dask worker localhost:8786 --nworkers 4 &

Configuration#

The evaluation and Dask settings are read from config.yaml in the working directory only; ~/.panobbgo/config.ini has no section for them.

evaluation:
  method: threaded  # or 'processes' or 'dask'
  timeout: 60       # optional per-call limit in seconds (see below)
dask:               # top level, not under 'evaluation'
  cluster_type: remote   # 'local' (default) starts a LocalCluster
  remote:
    scheduler_address: tcp://localhost:8786
  local:                 # used when cluster_type is 'local'
    n_workers: 2
    threads_per_worker: 1

processes evaluates in a pool of spawned worker processes (panobbgo.local_pool): the problem must be picklable, and the script needs an if __name__ == "__main__": guard (Scripts That Start Worker Processes: the __main__ Guard). Each worker evaluates its own copy of the problem, so state the problem object accumulates while evaluating (evaluation counters, traces, caches, loggers) lives in the workers and is not visible on the caller’s object. A worker that crashes fails only its own evaluation, which still counts against max_eval.

evaluation.timeout (seconds, default unset = no limit) is a per-call limit that applies to every evaluation in every backend and is enforced where the evaluation runs. The clock starts when the call starts — time spent queued never counts. An evaluation past the limit becomes a regular result with fx = NaN and cv = inf (infeasible; the violations are unknown, so cv_vec is None and the frame’s cv_vec columns are NaN), marked Result.timed_out and in the ("timed_out", 0) column of the results frame; it is recorded, charged once against max_eval and published through new_results like any result, so heuristics see a bad point and every ranking puts it last.

  • processes: exactly the worker process running that call is killed (a fresh one replaces it); every other in-flight evaluation keeps running.

  • dask: the task on the dask worker runs the objective in a child process (panobbgo.timeout_call.call_with_timeout()) and kills that child when the call runs too long, so a hung objective never holds its worker. The problem must be serializable and importable in a fresh interpreter on the worker (checked once before the first task). Each call evaluates a fresh copy of the problem, so state it accumulates while evaluating does not carry over between calls — e.g. a NoisyProblem with resample=True draws the same noise on every re-evaluation (a warning says so). Without a timeout the objective runs in the worker itself, as before.

  • threaded: a thread cannot be killed — a timed-out call is abandoned: it keeps running in the background and its result is discarded; abandoned threads are counted and warned about. Use processes or dask for objectives that can hang. With evaluation.sync, a timeout routes each batch through the thread pool, harvested in submission order.

An objective that raises is still a failed evaluation (no result, failed_evaluations event).

Long evaluations and the deadlock backstop. Evaluations may take hours and run remotely; the main loop then sits idle, waiting, and that is not a stall. Any outstanding evaluation counts as progress for as long as it takes: a running thread, a process task that has started or is queued for live workers, and any outstanding dask future — the client cannot reliably tell queued from running, so every one is treated as “waiting”. One evaluation’s run time is limited only by the opt-in evaluation.timeout. core.deadlock_seconds (default 600) is an error backstop for a bug and fires only when there is nothing to wait for: no evaluation outstanding anywhere, yet the run reports itself alive (a heuristic claims a point it never gives, an event handler never returns, queued evaluations have no live worker) and nothing has changed for that long. Tripping it is logged at ERROR level and ends the run. Waiting is not silent either: while evaluations are outstanding and none finishes, a WARNING every deadlock_seconds reports how many are outstanding, how long ago the oldest started (or was submitted) and the evaluation.timeout setting; for dask it also warns when the cluster reports zero workers.

The heuristic queue size can be set in either file (YAML heuristic: capacity: 20, or in config.ini):

[heuristic]
capacity = 20      # Heuristic queue size

Extension Points#

To extend Panobbgo:

  1. Add a heuristic: Subclass Heuristic

  2. Add an analyzer: Subclass Analyzer

  3. Add a strategy: Subclass StrategyBase

  4. Define a problem: Subclass Problem

  5. Create custom events: Publish with eventbus.publish(event_name, **kwargs)

See Extending Panobbgo for detailed examples.

Design Principles#

The architecture follows these principles:

Modularity

Components are independent and interchangeable

Event-driven

Loose coupling through EventBus

Composability

Mix and match heuristics, analyzers, strategies

Extensibility

Add new components without modifying existing code

Parallelism

Designed for distributed evaluation from the start

Transparency

All events and data flows are observable and logged