pub struct BatState<B: Backend> { /* private fields */ }Expand description
Generation state for BatAlgorithm.
Implementations§
Source§impl<B: Backend> BatState<B>
impl<B: Backend> BatState<B>
Sourcepub fn try_new(
positions: Tensor<B, 2>,
velocities: Tensor<B, 2>,
loudness: Vec<f32>,
pulse_rate: Vec<f32>,
fitness: Vec<f32>,
best_genome: Option<Tensor<B, 2>>,
best_fitness: f32,
generation: usize,
pending_accept: Vec<bool>,
) -> Result<Self, ConfigError>
pub fn try_new( positions: Tensor<B, 2>, velocities: Tensor<B, 2>, loudness: Vec<f32>, pulse_rate: Vec<f32>, fitness: Vec<f32>, best_genome: Option<Tensor<B, 2>>, best_fitness: f32, generation: usize, pending_accept: Vec<bool>, ) -> Result<Self, ConfigError>
Assembles a bat-swarm state, checking the per-bat caches match pop.
§Errors
Returns a ConfigError if positions has zero rows or if any of
loudness / pulse_rate / fitness / pending_accept is non-empty
with a length other than pop_size.
Sourcepub fn velocities(&self) -> &Tensor<B, 2>
pub fn velocities(&self) -> &Tensor<B, 2>
Current velocities, shape (pop_size, D).
Sourcepub fn pulse_rate(&self) -> &[f32]
pub fn pulse_rate(&self) -> &[f32]
Per-bat pulse rate, pop_size long.
Sourcepub fn fitness(&self) -> &[f32]
pub fn fitness(&self) -> &[f32]
Host-side fitness cache (empty at bootstrap, else pop_size long).
Sourcepub fn best_genome(&self) -> Option<&Tensor<B, 2>>
pub fn best_genome(&self) -> Option<&Tensor<B, 2>>
Best-so-far genome, or None before the first tell.
Sourcepub fn best_fitness(&self) -> f32
pub fn best_fitness(&self) -> f32
Best-so-far (canonical, maximise) fitness.
Sourcepub fn generation(&self) -> usize
pub fn generation(&self) -> usize
Generation counter.
Sourcepub fn pending_accept(&self) -> &[bool]
pub fn pending_accept(&self) -> &[bool]
Per-candidate accept decisions recorded by ask (empty at bootstrap,
else pop_size long).
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for BatState<B>where
<B as BackendTypes>::FloatTensorPrimitive: Freeze,
<B as BackendTypes>::QuantizedTensorPrimitive: Freeze,
impl<B> RefUnwindSafe for BatState<B>where
<B as BackendTypes>::FloatTensorPrimitive: RefUnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: RefUnwindSafe,
impl<B> Send for BatState<B>
impl<B> Sync for BatState<B>
impl<B> Unpin for BatState<B>where
<B as BackendTypes>::FloatTensorPrimitive: Unpin,
<B as BackendTypes>::QuantizedTensorPrimitive: Unpin,
impl<B> UnsafeUnpin for BatState<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::QuantizedTensorPrimitive: UnsafeUnpin,
impl<B> UnwindSafe for BatState<B>where
<B as BackendTypes>::FloatTensorPrimitive: UnwindSafe,
<B as BackendTypes>::QuantizedTensorPrimitive: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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