Skip to main content

CoEvolutionaryHarness

Struct CoEvolutionaryHarness 

Source
pub struct CoEvolutionaryHarness<B, C>{ /* private fields */ }
Expand description

Wraps a CoEvolutionaryAlgorithm into a BenchEnv.

Like EvolutionaryHarness, the harness is lazily initialized: reset materializes the joint state on the configured device, and each step runs one generation. The reward exposed to the benchmark harness is the canonical binding_fitness = min(best_a, best_b) (canonical maximise, no negation): the weaker population — the lower canonical fitness — is the binding constraint, and a higher binding value is better. The per-population best_fitness_{a,b} / mean_fitness_{a,b} in CoEAMetrics are reported in the objective’s natural sense (ADR 0023); only binding_fitness stays canonical.

Per-generation metrics are emitted through tracing with structured per-population fields. (A dual-population PopulationObserver channel — the single-population PopulationSnapshot cannot carry both populations — is deferred to a follow-up.)

§Determinism

Determinism follows the same backend-RNG caveats documented on EvolutionaryHarness: run one harness per process, or pin EvaluatorConfig::num_threads = Some(1), for bit-reproducible runs.

Implementations§

Source§

impl<B, C> CoEvolutionaryHarness<B, C>

Source

pub fn new( algorithm: C, params: C::Params, seed: u64, device: B::Device, max_generations: usize, ) -> Result<Self, ConfigError>
where C::Params: Validate,

Build a new harness from an algorithm, its params, a seed, a device, and a generation budget.

The caller-supplied params are validated up front — this is the co-evolutionary harness consumption chokepoint (ADR 0026).

The harness is lazily initialized — the first reset call materializes the joint state on device.

§Errors

Returns a ConfigError when params fails Validate::validate, naming the offending field and violated invariant.

Source

pub fn latest_metrics(&self) -> Option<&CoEAMetrics>

The most recent generation’s metrics, if any.

Source

pub fn generation(&self) -> usize

Number of completed generations.

Source

pub fn reset(&mut self)

Reset to a fresh joint state, re-seeding the RNG.

Infallible; the BenchEnv impl wraps this in Ok(()).

Source

pub fn step(&mut self, _action: ()) -> BenchStep<()>

Run one simultaneous-update generation.

Infallible; the BenchEnv impl wraps the result in Ok(...).

§Panics

Panics if reset has not been called first.

Trait Implementations§

Source§

impl<B, C> BenchEnv for CoEvolutionaryHarness<B, C>

Source§

type Observation = ()

The observation type the environment produces on each step.
Source§

type Action = ()

The action type the environment accepts on each step.
Source§

fn reset(&mut self) -> Result<Self::Observation, BenchError>

Reset the environment to an initial state and return the first observation. Read more
Source§

fn step( &mut self, action: Self::Action, ) -> Result<BenchStep<Self::Observation>, BenchError>

Apply action and advance the environment by one step. Read more
Source§

impl<B, C> Debug for CoEvolutionaryHarness<B, C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Adaptor<()> for T

Source§

fn adapt(&self)

Adapt the type to be passed to a metric.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoComptime for T

Source§

fn comptime(self) -> Self

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more