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 engine is maximise-native: the fitness tensor passed to tell is a canonical value where higher is better, and strategies maximise it directly. The StrategyMetrics::best_fitness field is the largest value observed in a generation; StrategyMetrics::best_fitness_ever is a rolling maximum. Strategies are sense-unaware — they never see an ObjectiveSense. Cost objectives (e.g. the benchmark landscapes) are negated into canonical space at exactly one chokepoint, EvolutionaryHarness, which also maps metrics back to the objective’s declared sense for reporting.

§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.