Struct pso_rs::model::Model [−][src]
pub struct Model { pub config: Config, pub flat_dim: usize, pub population: Population, pub population_f_scores: Vec<f64>, pub x_best: Particle, pub f_best: f64, // some fields omitted }
Expand description
Model struct
It takes in a Config
instance and fn
pointer to an objective function and defines a run
method for running Particle Swarm Optimization.
Fields
config: Config
flat_dim: usize
population: Population
population_f_scores: Vec<f64>
x_best: Particle
f_best: f64
Implementations
pub fn new(
config: Config,
obj_f: fn(p: &Particle, flat_dim: usize, dim: &Vec<usize>) -> f64
) -> Model
Computes the value of the objective function for each particle and updates best found
Returns the objective function values for all particles
Uses the rayon crate for parallel computation
Returns the best found objective function value
Returns the best found minimizer
Auto Trait Implementations
impl RefUnwindSafe for Model
impl UnwindSafe for Model