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