Constrained optimization
Compare solvers on problems with box bounds, a linear sum constraint, or a nonlinear ball constraint.
L-BFGS-B
Basin is compared with lbfgsb 0.1.1, which wraps Stephen Becker's C translation of L-BFGS-B 3.0. This case scales the reference's extended Rosenbrock driver to 20,000 variables:
Every coordinate starts at 3. Lower bounds alternate between 1 and , starting with 1, and every upper bound is 100. The all-ones vector attains on the box faces. Both implementations use Vec<f64>, fused analytic objective and gradient evaluations, and ten curvature pairs.
Both stop when the projected-gradient infinity norm reaches . The signed relative-reduction tolerance is zero (factr = 0), so a nonpositive reduction can also stop a run. Both use a Moré–Thuente line search with sufficient-decrease coefficient , curvature coefficient 0.9, relative bracket tolerance 0.1, and at most 20 evaluations per search. Safety limits are 2,000 iterations and 10,000 objective calls, checked at accepted iteration boundaries.
Returned solutions and evaluation counts
basin: ProjectedGradientTolerance. Independent accuracy check passed. Returned (1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, …), objective 1.075e-17. 43 iterations; 50 objective and 50 gradient calls (fused); bound violation 0.000e+0; projected-gradient norm 7.120e-9.
lbfgsb (C): ProjectedGradientTolerance. Independent accuracy check passed. Returned (1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, …), objective 1.075e-17. 43 iterations; 50 objective and 50 gradient calls (fused); bound violation 0.000e+0; projected-gradient norm 7.120e-9.
The curves sample initialization and accepted iterates, followed by an endpoint that includes solver teardown. Independent checks recompute the objective and projected gradient, require an objective gap at most , and check returned and trial bound violations against . They check objective accuracy and stationarity, rather than coordinate accuracy along this ill-conditioned valley. The problem size gives both implementations at least 20 ms per solve on the measurement machine, including with intermediate trace recording disabled.
SLSQP
SLSQP minimizes the same coupled quadratic with , subject to the nonlinear constraint
The unique optimum again has every coordinate equal to , with . This case uses the same starting-point formula as COBYLA, analytic objective gradients, and an analytic constraint Jacobian. Normalizing the constraint by keeps its scale independent of dimension.
Basin is compared with slsqp 1.0.2, a Rust translation of NLopt, and native NLopt. Basin uses Kraft's composite accuracy test at . The references use an absolute function-change tolerance of , with their other optional objective and step tolerances disabled. Basin has a 200-iteration safety cap; the references have a 200-objective-evaluation cap. The objective curve uses a constraint-violation tolerance of .
Each point is one trial. Zero is on the baseline; the shaded band meets the feasibility tolerance.
Returned solutions and evaluation counts
basin: SolverFailed. Independent accuracy check passed. Returned (0.750000, 0.750000, 0.750000, 0.750000, 0.750000, 0.750000, …), objective 6.250e+0. Violation 9.826e-9; 36 gradient calls; 69 objective and 69 constraint calls (vector callbacks).
slsqp: RoundoffLimited. Independent accuracy check passed. Returned (0.750000, 0.750000, 0.750000, 0.750000, 0.750000, 0.750000, …), objective 6.250e+0. Violation 0.000e+0; 69 gradient calls; 118 objective and 118 constraint calls (scalar nonlinear callbacks; native bounds excluded).
nlopt: RoundoffLimited. Independent accuracy check passed. Returned (0.750000, 0.750000, 0.750000, 0.750000, 0.750000, 0.750000, …), objective 6.250e+0. Violation 1.998e-15; 69 gradient calls; 118 objective and 118 constraint calls (scalar nonlinear callbacks; native bounds excluded).
Termination statuses and independent accuracy and feasibility checks are reported in the run details. Passing an independent solution check does not mean that the solver reported convergence. The main curve records best feasible trials, which can differ from the returned point.
COBYLA
The constrained fixture minimizes a coupled quadratic,
with , , and . The unique optimum has every coordinate equal to and . The deterministic start is .
Basin's PRIMA implementation is compared with cobyla 1.0.4, derived from NLopt, and native NLopt 2.9.1 through the nlopt 0.8.1 Rust bindings. All three use an initial radius of , a final radius of about , a 10,000-objective-call budget, and disabled optional objective-change stops. The references use native bounds and a zero tolerance for the sum constraint. Objective trials enter the main curve only when their maximum constraint violation is at most .
The NLopt variant modifies Powell's original implementation with explicit bound handling, trust-region increases, and deterministic simplex perturbations. Basin follows modern PRIMA, so matched budgets and radii do not imply identical trajectories.
Each point is one trial. Zero is on the baseline; the shaded band meets the feasibility tolerance.
Returned solutions and evaluation counts
basin: SolverConverged. Independent accuracy check passed. Returned (0.750000, 0.750000, 0.750000, 0.750000, 0.750000, 0.750000, …), objective 1.875e+0. Violation 1.340e-8; 1332 objective and 1332 constraint calls (vector callbacks, including bounds).
nlopt: XtolReached. Independent accuracy check passed. Returned (0.750000, 0.750000, 0.750000, 0.750000, 0.750000, 0.750000, …), objective 1.875e+0. Violation 1.208e-13; 2512 objective and 2512 constraint calls (scalar nonlinear callbacks; native bounds excluded).
cobyla: XtolReached. Independent accuracy check passed. Returned (0.750000, 0.750000, 0.750000, 0.750000, 0.750000, 0.750000, …), objective 1.875e+0. Violation 1.208e-13; 2512 objective and 2512 constraint calls (scalar nonlinear callbacks; native bounds excluded).
Read the violation plot alongside objective progress: an infeasible trial with a lower objective is not a better constrained solution. Small negative objective gaps permitted by the feasibility tolerance appear at the display floor.
Constraint counts use different callback units. Basin records vector callbacks including bounds, while both references record scalar nonlinear callbacks and exclude native bounds.