[−][src]Struct pso::swarm_config::SwarmConfig
Configuration for Swarms of Particles
- Defines the physical behavior of particles
- Defines the number of particles in each swarm
- Defines how a swarm uses information from other swarms
Examples
use pso::swarm_config::SwarmConfig; // Start with a default configuration let mut sc = SwarmConfig::new(); // Tell the swarm to collaborate with others every 25 iterations and weight the global minimum with a coefficient of 0.6 sc.synergic_behavior(0.6, 25); // Define other motion coefficients sc.motion_coefficients(0.7, 0.9, 0.45); // Set the number of particles in the swarm sc.num_particles(256); println!("{}", sc);
Fields
global_behavior: GlobalBehavior
transient_behavior: TransientBehavior
wall_bounce_factor: f64
local_motion: f64
tribal_motion: f64
momentum: f64
num_particles: usize
Implementations
impl SwarmConfig
[src]
pub fn new() -> Self
[src]
pub fn synergic_behavior(
&mut self,
global_motion_coefficient: f64,
collaboration_periodicity: usize
)
[src]
&mut self,
global_motion_coefficient: f64,
collaboration_periodicity: usize
)
Set the particles in the swarm to use the global minimum to calculate their velocity each iteration
Arguments
global_motion_coefficient
: How heavily weighted is the global minimum in the velocity calculationcollaboration_periodicity
: How often does the swarm update its global minimum from the other swarms
pub fn solitary_behavior(&mut self)
[src]
Set the swarm to ignore the global minimum and only use its own internal minimum (this is default behavior)
pub fn set_transient_behavior(&mut self, transient_behavior: TransientBehavior)
[src]
Apply a custom transient behavior to the swarm configuration
pub fn wall_bounce(&mut self, wall_bounce_factor: f64)
[src]
Set the wall bounce factor. This value is multiplied by a particles velocity when it goes out of bounds.
pub fn motion_coefficients(
&mut self,
local_motion: f64,
tribal_motion: f64,
momentum: f64
)
[src]
&mut self,
local_motion: f64,
tribal_motion: f64,
momentum: f64
)
Set the motion coefficients. These describe how heavily certain parts of each particles velocity are weighted
Arguments
local_motion
: How important is the particles best known location in the search spacetribal_motion
: How important is the swarms best known location in the search spacemomentum
: How much of the particles current velocity is used to calculate its next velocity
pub fn num_particles(&mut self, num_particles: usize)
[src]
The number of particles in the swarm. Powers of 2 are recommended
Trait Implementations
impl Clone for SwarmConfig
[src]
fn clone(&self) -> SwarmConfig
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SwarmConfig
[src]
impl Display for SwarmConfig
[src]
Auto Trait Implementations
impl RefUnwindSafe for SwarmConfig
impl Send for SwarmConfig
impl Sync for SwarmConfig
impl Unpin for SwarmConfig
impl UnwindSafe for SwarmConfig
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,