pub struct PsoConfig {
pub pop_size: usize,
pub genome_dim: usize,
pub bounds: (f32, f32),
pub inertia: f32,
pub c1: f32,
pub c2: f32,
pub v_max: f32,
pub variant: PsoVariant,
}Expand description
Static configuration for a ParticleSwarm run.
Fields§
§pop_size: usizeNumber of particles in the swarm.
genome_dim: usizeGenome (position) dimensionality.
bounds: (f32, f32)Search-space bounds for initialization and position clamping.
inertia: f32Inertia weight (only used by PsoVariant::Inertia).
c1: f32Cognitive coefficient (personal-best pull).
c2: f32Social coefficient (global-best pull).
v_max: f32Per-dimension velocity clamp. Classical PSO literature recommends ~half the search-space extent.
variant: PsoVariantVariant.
Implementations§
Source§impl PsoConfig
impl PsoConfig
Sourcepub fn default_for(pop_size: usize, genome_dim: usize) -> Self
pub fn default_for(pop_size: usize, genome_dim: usize) -> Self
Default configuration matching Shi & Eberhart’s canonical settings
(ω = 0.7298, c1 = c2 = 1.49618) — the constriction-equivalent
values so Inertia and Constriction variants agree in behaviour
under the same default.
Sourcepub fn constriction_chi(&self) -> f32
pub fn constriction_chi(&self) -> f32
Constriction factor χ = 2 / |2 − φ − √(φ² − 4φ)|.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PsoConfig
impl RefUnwindSafe for PsoConfig
impl Send for PsoConfig
impl Sync for PsoConfig
impl Unpin for PsoConfig
impl UnsafeUnpin for PsoConfig
impl UnwindSafe for PsoConfig
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> 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