Skip to main content

VariationGenerator

Trait VariationGenerator 

Source
pub trait VariationGenerator: Send + Sync {
    // Required methods
    fn next(
        &mut self,
        baseline: &ConfigSnapshot,
        visited: &HashSet<Variation>,
    ) -> Option<Variation>;
    fn name(&self) -> &'static str;
}
Expand description

A strategy for generating parameter variations one at a time.

Each call to VariationGenerator::next must produce a variation that changes exactly one parameter from the baseline. The caller is responsible for tracking visited variations and passing them to next.

Implementations hold mutable state (position cursor, RNG seed) and must be both Send and Sync so that [ExperimentEngine] can be used with tokio::spawn. The engine loop accesses the generator exclusively via &mut self, so no concurrent access occurs in practice.

Required Methods§

Source

fn next( &mut self, baseline: &ConfigSnapshot, visited: &HashSet<Variation>, ) -> Option<Variation>

Produce the next untested variation, or None if the space is exhausted.

baseline is the current best-known configuration snapshot. visited is the set of all variations already tested in this run.

Source

fn name(&self) -> &'static str

Strategy name for logging and metrics.

Implementors§