pub struct SearcherCore<TUnit, TFit, TMover>{
pub fit_calc: TFit,
pub mover: TMover,
pub swarm_best: Best<TUnit>,
pub master_rng: SmallRng,
pub particle_rngs: Vec<SmallRng>,
}Expand description
Shared bookkeeping for Searcher impls.
Holds the fitness function, mover, master + per-particle RNGs, and
the reduced swarm best. Topology-specific state (niche partition,
neighbour graph, pbest snapshot) lives on each searcher alongside a
SearcherCore field.
Fields§
§fit_calc: TFitFitness function.
mover: TMoverMover.
swarm_best: Best<TUnit>Reduced from particle pbests. For gbest this is the social attractor; for lbest / niched it’s reporting only.
master_rng: SmallRngSource for the per-particle RNGs.
particle_rngs: Vec<SmallRng>One RNG per particle, sized lazily.
Implementations§
Source§impl<TUnit, TFit, TMover> SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> SearcherCore<TUnit, TFit, TMover>
Trait Implementations§
Source§impl<TUnit, TFit, TMover> Clone for SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Clone for SearcherCore<TUnit, TFit, TMover>
Source§fn clone(&self) -> SearcherCore<TUnit, TFit, TMover>
fn clone(&self) -> SearcherCore<TUnit, TFit, TMover>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<TUnit, TFit, TMover, TContext> Contextful for SearcherCore<TUnit, TFit, TMover>where
TFit: FitCalc<T = TUnit, TContext = TContext>,
TMover: ParticleMover<TUnit = TUnit, TContext = TContext>,
TUnit: Unit,
TContext: Copy,
impl<TUnit, TFit, TMover, TContext> Contextful for SearcherCore<TUnit, TFit, TMover>where
TFit: FitCalc<T = TUnit, TContext = TContext>,
TMover: ParticleMover<TUnit = TUnit, TContext = TContext>,
TUnit: Unit,
TContext: Copy,
Source§fn set_context(&mut self, context: Self::TContext)
fn set_context(&mut self, context: Self::TContext)
Replace the current context. Defaults to a no-op; override when the
impl actually reads
TContext.Source§fn set_iteration(&mut self, iteration: usize, max_iteration: usize)
fn set_iteration(&mut self, iteration: usize, max_iteration: usize)
iteration is 1-based; the init (fitness-only) pass runs before
any call. Override for iteration-dependent schedules.Auto Trait Implementations§
impl<TUnit, TFit, TMover> Freeze for SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> RefUnwindSafe for SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Send for SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Sync for SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Unpin for SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> UnsafeUnpin for SearcherCore<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> UnwindSafe for SearcherCore<TUnit, TFit, TMover>
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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