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§
fn get_performance(&self) -> f64
Sourcefn update_position(&mut self, position: &Vec<T>) -> Option<Vec<T>>
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
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.
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.