PsoParticle

Trait PsoParticle 

Source
pub trait PsoParticle<T> {
    // Required methods
    fn get_performance(&self) -> f64;
    fn update_position(&mut self, position: &Vec<T>) -> Option<Vec<T>>;
    fn init(position: Vec<T>) -> Self;
}

Required Methods§

Source

fn get_performance(&self) -> f64

Source

fn update_position(&mut self, position: &Vec<T>) -> Option<Vec<T>>

Here return value represents the status of the new position. The lib does not care about the actual problem space, but only whether the node is outside of it. But it will ask you to input a limit when initialize the nodes in order to make random particles.

None if the node is not outside of it, and Some(Vec) otherwise. And here your return value represents the valid position.

You have to process the node position yourself, this lib does not support it.

Tips: you are not forced to save the position, since the node will always save that.

Source

fn init(position: Vec<T>) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§