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).
13 lines
408 B
Rust
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>;
|
|
}
|