Files
heuropt/src/traits/initializer.rs
T
swaits 60e52a031c feat(traits): add Initializer, Variation, and Optimizer traits
The three operator-level traits the algorithms consume, plus the single
trait users implement to add a new optimizer (`Optimizer<P>`). All take
`&mut Rng` directly rather than being generic over the RNG (spec §7.8).
2026-05-04 19:18:01 -06:00

13 lines
408 B
Rust

//! Trait for sampling initial decisions.
use crate::core::rng::Rng;
/// Generates initial decisions for a population.
///
/// Implementations should return exactly `size` decisions; if that is
/// impossible, panic with a clear message in v1.
pub trait Initializer<D> {
/// Produce `size` initial decisions using the supplied RNG.
fn initialize(&mut self, size: usize, rng: &mut Rng) -> Vec<D>;
}