Skip to main content

nmbrs_runtime/optimize/
mod.rs

1// Copyright 2024-2026 Jonathan Shook
2// SPDX-License-Identifier: Apache-2.0
3
4//! SRD-86 — the optimizer seam on the runtime side.
5//!
6//! The **contract** (the [`Optimizer`](crate::optimize::Optimizer) /
7//! [`Objective`](crate::optimize::Objective) traits, the search-space
8//! types, the registry) lives in [`contract`](crate::optimize::contract) —
9//! defined in the core with no
10//! dependency on any optimizer-algorithm crate. Algorithm crates (e.g.
11//! `nmbrs-optimizers`) register implementations via `inventory` and are
12//! discovered through [`contract::by_name`](crate::optimize::contract::by_name) /
13//! [`contract::describe`](crate::optimize::contract::describe) at link
14//! time; the core never names them.
15//!
16//! The live optimizer integration is owned by the **executor** (`crate::executor`):
17//! `dispatch_optimization` builds the search space from a phase's `for_each`
18//! comprehension and drives the chosen optimizer, actuating each axis by its
19//! changeover class —
20//!
21//! - **Coordinate / Fixture** → phase-rerun: the adaptive loop runs the phase
22//!   once per proposed coordinate (`CoordEval::Enumerated` looks a discrete
23//!   coordinate up in the grid; `CoordEval::Synthesized` binds a sampled
24//!   continuous coordinate);
25//! - **Control** → the in-phase servoing daemon
26//!   ([`servo`](crate::optimize::servo)), `tokio::join!`'d with
27//!   one continuous phase, live-retargeting the SRD-23 control per setting;
28//! - **mixed** → the hybrid (`run_hybrid_search`): coordinate axes form the outer
29//!   rerun grid, control axes servo interior to each cell.
30//!
31//! Settling a windowed objective per evaluation is
32//! [`settle`](crate::optimize::settle), driven by the cadence-pulse
33//! [`phase_pulse`](crate::optimize::phase_pulse) callback. This module proper is the contract
34//! re-export surface over those submodules.
35
36pub mod contract;
37pub mod phase_pulse;
38pub mod servo;
39pub mod settle;
40
41pub use contract::{
42    Axis, AxisImpact, AxisKind, AxisValue, Budget, Changeover, Coord, CoordinateSource,
43    FeedbackSource, LexSource, Objective, Observation, Optimizer, OptimizerInfo, OptimizerParams,
44    OptimizerRegistration, PullOnly, PullSource, Report, SearchSpace, StopReason, SweepOptimizer,
45    by_name, describe, registered_names,
46};