Documentation

Basin is a numerical optimization library for Rust. It follows the overall shape of argmin: a generic executor loop drives a solver over a state, calling into the problem traits you implement (CostFunction, Gradient, and friends).

Alpha. The public API is still iterating and breaking changes are expected. Pin a version and read the changelog before upgrading.

How the pieces fit

  • Problem — what you implement. A CostFunction (and a Gradient, if your solver needs one) describing the objective. Constraints such as box bounds live here too, not on the solver.
  • Solver — the algorithm. Gradient descent, Nelder–Mead, L-BFGS, Levenberg–Marquardt, CMA-ES, and more.
  • State — the iterate(s) a solver carries: a single point (BasicState), a simplex (BasicSimplexState), a population, and so on.
  • Executor — the driver that runs a solver to termination and hands back an OptimizationResult.
  • Termination — pluggable stopping criteria (gradient/parameter/cost tolerances, iteration and time budgets) configured uniformly across solvers.
  • Observers — read-only hooks fired around the loop (observe_init / observe_iter / observe_final) for logging, progress reporting, or recording a trajectory. Sibling to termination: observers watch, criteria decide.

Where to go next

  • Getting started: install Basin and run your first solve.
  • Solvers: the catalogue of solvers and which backends they need.

You can also watch solvers converge interactively in the visualizer, or browse the full API on docs.rs.