Skip to main content

Module strategy

Module strategy 

Source
Expand description

Central Strategy trait and the EvolutionaryHarness adapter.

§The ask / tell contract

A Strategy exposes three methods that together drive one generation:

  1. init — build the initial state (sampling the population, initializing σ, generation counter, etc).
  2. ask — propose the next population as a genome container.
  3. tell — consume that population together with its fitness and produce the next state plus a metrics snapshot.

All three methods take the RNG explicitly so the harness owns all stochasticity; strategies carry no internal PRNG state.

§Fitness convention

The fitness tensor passed to tell is the raw objective value. Strategies in this crate minimize it: the StrategyMetrics::best_fitness field is the smallest value observed so far, and the harness reports reward = -best_fitness so the benchmark harness’s “higher = better” convention still holds.

§The harness adapter

EvolutionaryHarness glues a strategy to any BatchFitnessFn and implements BenchEnv, so the benchmark evaluator drives it just like an RL environment.

Structs§

EvolutionaryHarness
Wraps a Strategy into a BenchEnv so the benchmark harness can drive it.
StrategyMetrics
Per-generation summary reported by Strategy::tell.

Traits§

Strategy
Central evolutionary-strategy abstraction.