pub struct GBestSearcher<TUnit, TFit, TMover>{ /* private fields */ }Expand description
Global-best PSO searcher.
Implementations§
Source§impl<TUnit, TFit, TMover> GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> GBestSearcher<TUnit, TFit, TMover>
Sourcepub fn new(fit_calc: TFit, mover: TMover) -> Self
pub fn new(fit_calc: TFit, mover: TMover) -> Self
RNG is OS-seeded; call Searcher::reseed for determinism.
Trait Implementations§
Source§impl<TUnit, TFit, TMover> Clone for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Clone for GBestSearcher<TUnit, TFit, TMover>
Source§fn clone(&self) -> GBestSearcher<TUnit, TFit, TMover>
fn clone(&self) -> GBestSearcher<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 GBestSearcher<TUnit, TFit, TMover>where
TFit: FitCalc<T = TUnit, TContext = TContext>,
TMover: ParticleMover<TUnit = TUnit, TCommon = Best<TUnit>, TContext = TContext>,
TUnit: Unit,
TContext: Copy,
impl<TUnit, TFit, TMover, TContext> Contextful for GBestSearcher<TUnit, TFit, TMover>where
TFit: FitCalc<T = TUnit, TContext = TContext>,
TMover: ParticleMover<TUnit = TUnit, TCommon = Best<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.Source§impl<TUnit, TFit, TMover> Debug for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Debug for GBestSearcher<TUnit, TFit, TMover>
Source§impl<TUnit, TFit, TMover, TContext> Searcher for GBestSearcher<TUnit, TFit, TMover>where
TFit: FitCalc<T = TUnit, TContext = TContext>,
TMover: ParticleMover<TUnit = TUnit, TCommon = Best<TUnit>, TContext = TContext>,
TUnit: Unit,
TContext: Copy,
impl<TUnit, TFit, TMover, TContext> Searcher for GBestSearcher<TUnit, TFit, TMover>where
TFit: FitCalc<T = TUnit, TContext = TContext>,
TMover: ParticleMover<TUnit = TUnit, TCommon = Best<TUnit>, TContext = TContext>,
TUnit: Unit,
TContext: Copy,
Source§fn init(&mut self, particles: &mut Group<Self::TUnit>)
fn init(&mut self, particles: &mut Group<Self::TUnit>)
Initial fitness pass + per-particle state seed.
Source§fn next(&mut self, particles: &mut Group<Self::TUnit>) -> &Best<TUnit>
fn next(&mut self, particles: &mut Group<Self::TUnit>) -> &Best<TUnit>
Advance the swarm one step; return the swarm-wide best so far.
Source§fn nested<TInit>(
self,
max_iteration: usize,
particle_init: TInit,
) -> NestedMover<<Self::TUnit as SetTo>::TTarget, Self::TUnit, Self, TInit>
fn nested<TInit>( self, max_iteration: usize, particle_init: TInit, ) -> NestedMover<<Self::TUnit as SetTo>::TTarget, Self::TUnit, Self, TInit>
Wrap this searcher in a
NestedMover.Source§fn iter<'a>(
&'a mut self,
max_iteration: usize,
group: &'a mut Group<Self::TUnit>,
evolution: Option<&'a mut Evolution<Self::TUnit>>,
) -> SearcherIter<'a, Self::TUnit, Self> ⓘwhere
Self: Sized,
fn iter<'a>(
&'a mut self,
max_iteration: usize,
group: &'a mut Group<Self::TUnit>,
evolution: Option<&'a mut Evolution<Self::TUnit>>,
) -> SearcherIter<'a, Self::TUnit, Self> ⓘwhere
Self: Sized,
Drive the searcher as an
Iterator<Item = Best<TUnit>> for
max_iteration steps; optionally record each step’s Group
snapshot into evolution.Auto Trait Implementations§
impl<TUnit, TFit, TMover> Freeze for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> RefUnwindSafe for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Send for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Sync for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> Unpin for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> UnsafeUnpin for GBestSearcher<TUnit, TFit, TMover>
impl<TUnit, TFit, TMover> UnwindSafe for GBestSearcher<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