Skip to main content

CoEvolutionaryAlgorithm

Trait CoEvolutionaryAlgorithm 

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

Source

type Params: Clone + Debug + Send + Sync

Static parameters for a run (inner strategy params plus any coupling configuration).

Source

type State: Clone + Debug + Send

Generation-to-generation joint state.

Required Methods§

Source

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

Source

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.

Source

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

Implementors§

Source§

impl<B, SA, SB, F> CoEvolutionaryAlgorithm<B> for CompetitiveCoEA<B, SA, SB, F>
where B: Backend, SA: Strategy<B, Genome = Tensor<B, 2>>, SB: Strategy<B, Genome = Tensor<B, 2>>, F: CoupledFitness<B>,

Source§

type Params = CompetitiveCoEAParams<<SA as Strategy<B>>::Params, <SB as Strategy<B>>::Params>

Source§

type State = CoEAState<<SA as Strategy<B>>::State, <SB as Strategy<B>>::State>

Source§

impl<B, SA, SB, F> CoEvolutionaryAlgorithm<B> for CooperativeCoEA<B, SA, SB, F>
where B: Backend, SA: Strategy<B, Genome = Tensor<B, 2>>, SB: Strategy<B, Genome = Tensor<B, 2>>, F: CoupledFitness<B>,

Source§

type Params = CooperativeCoEAParams<<SA as Strategy<B>>::Params, <SB as Strategy<B>>::Params>

Source§

type State = CooperativeState<<SA as Strategy<B>>::State, <SB as Strategy<B>>::State, B>