13. Benchmark Evaluation and Reproducibility
tools/bench (crate name nlopt4r-bench) is the in-repo benchmark driver, and tools/nlopt-reference provides comparison runs against the crates.io nlopt wrapper. This chapter records the protocol, metric definitions and published measurements.
13.1 Run protocol
- suites:
smoke(sphere, Rosenbrock, Booth, Rastrigin, linear fit, coupled QP),smooth(analytic, non-global, unconstrained catalog entries) andglobal(multimodal and nonsmooth groups); - dimension: 1–128, bounded by each formula’s minimum dimension; fixed-dimension problems keep their declared dimension;
- budget:
budget_per_dimension × actual dimensionobjective calls; - starting points: generated by a run-local SplitMix64 stream; population algorithms receive explicit seeds;
- target value: reference value + \(10^{-6}(1+|\text{reference}|)\); a hit requires box feasibility and constraint violation \(\le10^{-8}\);
- local solvers use exact chain-rule gradients for analytic entries and central differences for the rest, with each probe counted in the same budget;
- recorded fields: seed, dimension, budget, derivative mode, termination or error, best point and value, improvement history and platform metadata.
13.2 Metrics
The expected running time (ERT) to first hit is
- failed runs enter the numerator with their actual consumption;
- with zero successes the ERT is infinite (summary output null);
- time ERT uses the corresponding hit times and full run times;
- summaries group by budget, target, transform and noise configuration, and metadata is emitted with each group.
13.3 Affine-transform instances
Optional switches --shift, --rotate and --instance-seed generate paired comparison instances:
- the shift \(s\) samples uniformly in the central 60% of each coordinate’s original interval;
- the rotation \(Q\) comes from a Gaussian QR factorization with a sign correction and determinant +1;
- reference and target values stay the same;
- the JSON record carries generator version, seed, switches, shift vector and rotation matrix; with the switches off these fields record
null.
The outer box and solver starting points stay in place; the transform acts on the objective landscape.
13.4 Observation noise
The main driver supports independent identically distributed additive noise
with a Gaussian (Box–Muller), Uniform (\(U[-\sqrt3,\sqrt3]\)) or Laplace (scale \(1/\sqrt2\)) distribution. Noise applies after the transform; reference values, constraints and targets stay the same.
Records separate three metric classes:
best_*and first-hit: noise-free feasible best visits;observed_best: the smallest noisy observation and its true value;recommendation: true-value score of the point the solver actually returns (or of the error-recovery point).
Noisy runs disable objective-value stopping, and the remaining stopping rules stay in force.
13.5 Measured baseline
The data below are historical measurements at the source revisions recorded in docs/BENCHMARK_RESULTS.md: seeds 0–29, Rust 1.99.1, Linux/x86_64, Intel Core i7-12700H, default algorithm parameters. Cell format is “hits/30; ERT (objective calls)”. They are not portable wall-time or current-revision claims.
smoke suite, dimension 2, budget 4000:
| Problem | BFGS | L-BFGS | DE | PSO |
|---|---|---|---|---|
| Sphere | 30/30; 3.00 | 30/30; 3.00 | 30/30; 1420.67 | 30/30; 1343.23 |
| Rosenbrock | 30/30; 62.87 | 30/30; 39.30 | 30/30; 2232.73 | 24/30; 3879.67 |
| Booth | 30/30; 13.07 | 30/30; 10.53 | 30/30; 1744.53 | 30/30; 1773.03 |
| Rastrigin | 0/30 | 0/30 | 29/30; 3534.10 | 30/30; 2513.23 |
| Linear fit | 30/30; 9.00 | 30/30; 10.20 | 30/30; 1517.37 | 30/30; 1448.27 |
| Coupled QP | 30/30; 11.70 | 30/30; 7.27 | 30/30; 1320.60 | 30/30; 1173.60 |
global suite, requested dimension 4 (fixed-dimension problems keep dimension 2):
| Problem | Dimension/budget | DE | PSO |
|---|---|---|---|
| Ackley | 4 / 8000 | 2/30 | 30/30; 5067.03 |
| Alpine | 4 / 8000 | 0/30 | 30/30; 4891.83 |
| Easom | 2 / 4000 | 30/30; 1722.60 | 30/30; 1499.43 |
| Griewank | 4 / 8000 | 0/30 | 0/30 |
| Himmelblau | 2 / 4000 | 30/30; 2977.20 | 30/30; 1942.23 |
| Levy | 4 / 8000 | 30/30; 4402.57 | 30/30; 2351.37 |
| Qing | 4 / 8000 | 0/30 | 30/30; 3096.20 |
| Rastrigin | 4 / 8000 | 0/30 | 7/30; 31449.29 |
| Schwefel-222 | 4 / 8000 | 1/30 | 30/30; 5193.03 |
Native L-BFGS comparison (same ChaCha8 starting points, unbounded domain, history 10):
| Problem | Dimension/budget | Native NLopt | nlopt4r |
|---|---|---|---|
| Sphere | 2 / 4000 | 30/30; 3.00 | 30/30; 3.00 |
| Rosenbrock | 2 / 4000 | 30/30; 37.83 | 30/30; 43.30 |
| Sphere | 20 / 40000 | 30/30; 3.00 | 30/30; 3.00 |
| Rosenbrock | 20 / 40000 | 25/30; 166.52 | 25/30; 195.80 |
Five of the 20-dimensional Rosenbrock Rust runs report explicit errors from strong-Wolfe search exhaustion at seeds 1, 5, 9, 15 and 16; all records stay in the ERT.
The shift/rotate pairing experiment (instance seed 42, dimension 2, budget 4000, 2160 records) shows: the external pattern search on shifted sphere, coupled QP and Rastrigin moves from a single hit to 96, 85–93 calls or a miss; Rastrigin’s DE/PSO hit counts vary with orientation; sphere keeps its results under rotation. These records describe one instance seed’s observations.
The noise pairing experiment (instance seed 42, noise seed 17, 2520 records) shows: at \(\sigma=10^{-6}\), visit hits and recommendation hits stay close; at \(\sigma=0.01\), Gaussian gives 118 visit hits and 0 recommendation hits over 360 runs, Uniform gives 208 visit hits and 5 recommendation hits, and Laplace gives 80 visit hits and 0 recommendation hits.
13.6 Coverage and validation
Historical baseline at the recorded benchmark revision:
- 118 workspace tests passed: 90 solver integration tests, 3 unit tests, 1 doctest, 10 native comparisons and 14 tool tests;
- line coverage 90.05% (3331/3699), function coverage 93.91% (262/279), region coverage 88.34%;
- 13 Criterion kernel smoke checks passed;
- an allocation regression checks workspace scale at dimensions 512 and 2048.
Current 1.0.1 counts are 90 solver integration tests, 3 unit tests, 16 doctests, 10 native comparisons and 28 benchmark-tool tests; the extension example has no tests. Coverage figures come from cargo llvm-cov. Branch coverage was not instrumented, so no branch-coverage percentage is claimed.
Software interface
- benchmark commands, options and summaries: see chapter 22.
- transform and noise field definitions: see
docs/BENCHMARKS.mdin the repository. - full record files:
tools/bench/results/*.jsonl.gz. - published API reference for the benchmarked entries: https://docs.rs/nlopt4r/1.0.1/nlopt4r/.
References
- N. Hansen, A. Auger, R. Ros, O. Mersmann, T. Tušar, D. Brockhoff, “COCO: A Platform for Comparing Continuous Optimizers in a Black-Box Setting,” Optimization Methods and Software 36 (2021).
- R. Storn, K. Price (1997); J. Kennedy, R. Eberhart (1995), see chapter 9.