pub trait CoEvolutionaryAlgorithm<B: Backend>: Send + Sync {
type Params: Clone + Debug + Send + Sync;
type State: Clone + Debug + Send;
// Required methods
fn init(
&self,
params: &Self::Params,
rng: &mut dyn Rng,
device: &<B as BackendTypes>::Device,
) -> Self::State;
fn step(
&self,
params: &Self::Params,
state: Self::State,
rng: &mut dyn Rng,
device: &<B as BackendTypes>::Device,
) -> (Self::State, CoEAMetrics);
fn metrics(&self, state: &Self::State) -> CoEAMetrics;
}Expand description
A co-evolutionary algorithm driving two populations under simultaneous updates.
The analogue of Strategy for the coupled
case: init builds the joint state and step
advances one simultaneous-update generation (both populations ask → one
CoupledFitness evaluation → both tell). Implementors hold their inner
strategies and a CoupledFitness by value and carry no PRNG state — all
randomness flows through the explicit rng argument, per the crate’s
host-RNG convention.
v1 ships CompetitiveCoEA and CooperativeCoEA; Stackelberg
(alternating) turn order is deferred.
Required Associated Types§
Required Methods§
Sourcefn init(
&self,
params: &Self::Params,
rng: &mut dyn Rng,
device: &<B as BackendTypes>::Device,
) -> Self::State
fn init( &self, params: &Self::Params, rng: &mut dyn Rng, device: &<B as BackendTypes>::Device, ) -> Self::State
Build the initial joint state (initializes both inner strategies).
Sourcefn step(
&self,
params: &Self::Params,
state: Self::State,
rng: &mut dyn Rng,
device: &<B as BackendTypes>::Device,
) -> (Self::State, CoEAMetrics)
fn step( &self, params: &Self::Params, state: Self::State, rng: &mut dyn Rng, device: &<B as BackendTypes>::Device, ) -> (Self::State, CoEAMetrics)
Advance one simultaneous-update generation, returning the next state
and this generation’s CoEAMetrics.
Sourcefn metrics(&self, state: &Self::State) -> CoEAMetrics
fn metrics(&self, state: &Self::State) -> CoEAMetrics
Snapshot the current metrics without advancing a generation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".