Skip to main content

Crate bobyqa

Crate bobyqa 

Source
Expand description

A pure-Rust, dependency-free port of M. J. D. Powell’s BOBYQA (Bound Optimization BY Quadratic Approximation) — a derivative-free, box-constrained local optimizer, ported from PRIMA’s modern Fortran.

Trajectory-parity-tested bit-exact against PRIMA (natively and on wasm32-wasip1).

Three invariants hold across every call:

  • Feasibility — every point at which the objective is evaluated lies within [lower, upper].
  • Determinism — no global mutable state, no RNG, no I/O, no threads; identical inputs give identical outputs on a given target.
  • Zero-alloc warm pathBobyqa::new is the sole heap-allocation site; a built Bobyqa then runs Bobyqa::minimize with no further allocation.

Structs§

Bobyqa
A reusable BOBYQA solver: holds every buffer the algorithm needs, built once per problem size and driven across many Bobyqa::minimize calls.
Config
Tuning knobs for Bobyqa. No Default: npt’s default (2n + 1) needs n — use Config::new and struct-update syntax for overrides.
Outcome
The result of one Bobyqa::minimize call.

Enums§

Status
Why the solver stopped (or why construction failed).

Functions§

bobyqa
One-shot convenience over Bobyqa: infers n from x.len(), builds a throwaway solver, and runs a single minimisation. Allocates per call — hot loops re-solving many problems of one size should build a Bobyqa once and reuse it.