Expand description
Framework: traits, state shapes, the iteration driver, and the convergence and execution controls. The slot taxonomy is:
problem: what the user implements about their objective:CostFunction,Gradient,MiniBatchGradient(finite-sum, for mini-batch SGD),Residual/Jacobian(least squares), andHessian(second order). Future: operators (matrix-free).numdiff: finite-difference derivative synthesis and analytic checks.DerivativeCheckerchecks gradients and Jacobians with optional bounds and directional probes. TheFiniteDiffwrapper addsGradient/Jacobian/Hessianto a problem that only exposes function values.constraint: constraint markers carried on the problem (tenet 4 inCONTRIBUTING.md):BoxConstraints,LinearInequalityConstraints,LinearEqualityConstraints, andNonlinearInequalityConstraints. The standalone aggregatorsLinearConstraintsandNonlinearConstraintssupply the full forms for LINCOA and COBYLA, respectively; COBYLA consumes the latter throughFoldedConstraints.barrier: theLogBarrieradapter that rewrites a linearly-constrained problem as the unconstrained log-barrier objective consumed by theBarrierMethod.state: what a solver carries between iterations:Statefor the minimum,GradientState/SimplexStatewhen a solver carries richer info that convergence checks can read.solver: theSolvertrait every concrete solver implements. Lifecycle isinitonce, then repeatednext_iter, with an optionalterminatehook.convergence: shared fixed slots for solver-owned optional checks. Enabled checks require only their minimum state and backend capabilities.run_control: execution budgets, targets, stalls, and application hooks.termination: stopping reasons and the deprecated Basin 1.x criterion facility, scheduled for removal in Basin 2.0.observer: read-only side-effect hooks fired around the loop (Observe+ObserverMode).checkpoint: solver-aware snapshots for exact continuation. State-only warm-start files remain an observer concern.executor: the driver:Executor/Stepper/run_loop_with_control, plus the cooperativeCancellationToken. The canonical iteration ordering is documented on theexecutormodule.inner: the composition adapter:InnerExecutorwrapsrun_loop_with_controlfor outer solvers that drive an inner solver per outer iteration. SeeCONTRIBUTING.md“Solver composition” for the contracts.math: the small shared math layer (ScaledAdd,NormSquared, …) that backend-generic solvers depend on. Per tenet 5, this stays honest: only ops every backend can implement well live here. LA-heavy ops will live in a separate tier when the first solver wants them.
Modules§
- augmented_
lagrangian - Augmented-Lagrangian adapter for linear equality constraints.
- barrier
- Log-barrier adapter for linear inequality constraints.
- checkpoint
- Solver-aware checkpoints for exact continuation.
- constraint
- Constraint markers carried on the problem (tenet 4 in
CONTRIBUTING.md).BoxConstraints(interval bounds, consumed by projection-based solvers),LinearInequalityConstraints(A x ≤ b, consumed by the log-barrier method),LinearEqualityConstraints(A x = b, consumed by the augmented-Lagrangian method), andNonlinearInequalityConstraints(c(x) ≤ 0for an arbitrary vector-valuedc, consumed by COBYLA). - convergence
- Solver-owned convergence settings with compile-time backend capabilities.
- executor
- Iteration driver. The high-level entry point is
Executor;Stepperexposes one-iteration-at-a-time control, andrun_loop_with_controlis the borrowed-problem variant used by composed solvers. - inner
- Composition adapter: drive an inner solver from inside an outer
solver’s
next_iter. - least_
squares - Robust objectives for nonlinear least squares.
- math
- Math abstraction the solvers depend on.
- numdiff
- Finite-difference derivative synthesis and analytic derivative checks.
- observer
- Read-only side effects fired around the iteration loop.
- problem
- Problem traits the user implements about their objective. Solvers
bind on whichever subset they need (e.g. gradient descent requires
CostFunctionandGradient; Nelder-Mead only needsCostFunction). - rng
- Seedable, wasm-safe RNG used by stochastic solvers.
- run_
control - Execution budgets and application stopping conditions.
- solver
- The
Solvertrait every concrete solver implements. See the trait contract for the lifecycle (initonce, then repeatednext_iter, with an optionalterminatehook) and theexecutormodule for the canonical iteration ordering. - state
- Solver state shapes.
- termination
- Stopping reasons and the deprecated Basin 1.x criterion facility.