forge-core
A deterministic metaheuristic optimization substrate in Rust. forge is
to optimization what surtgis-core is to raster data: a shared engine that
several tools in the ecosystem consume rather than an application in itself.
Every optimizer speaks one interface — the [Problem] trait — minimizes by
convention, counts objective evaluations as its budget, rejects non-finite
candidates, and is reproducible for a given seed (the portfolio's
certified-determinism seal).
What sets it apart
Generic Rust optimization crates exist (argmin, optirustic). forge's
value is not to reimplement them but to provide:
- Geoscientific global optimizers the generic libraries omit — DDS and SCE-UA — central to hydrological calibration.
- Certified determinism via one seedable RNG ([
Rng]). - One unified [
Problem] trait for the whole ecosystem.
The DDS and SCE-UA implementations are migrated from rainflow-core, where
they were validated against airGR (GR4J calibration NSE 0.7956 vs 0.7957).
Quick start
use ;
use Sphere;
let problem = new;
let report = default.optimize;
assert!;
Maximization (e.g. NSE/KGE in rainflow) wraps the problem so the minimizing core stays the single convention:
use ;
use ;
// Maximize a concave bump peaking at x = 2.
let p = Maximize;
let report = default.optimize;
assert!;
assert!;
Robust restarts via independent islands (deterministic with or without the
rayon feature):
use ;
use Rastrigin;
let problem = new;
let report = ensemble;
assert!;
Multi-objective optimization with NSGA-II returns a Pareto front:
use ;
use multi_func;
// Schaffer N.1: minimize x² and (x−2)²; Pareto-optimal x ∈ [0, 2].
let sch = multi_func;
let front = default.optimize;
assert!;