Struct metaheuristics_nature::utility::Context
source · [−]#[non_exhaustive]pub struct Context<F: ObjFunc> {
pub rng: Rng,
pub best: Array1<f64>,
pub best_f: F::Fitness,
pub pool: Array2<f64>,
pub fitness: Vec<F::Fitness>,
pub adaptive: f64,
pub gen: u64,
pub func: F,
}
Expand description
The base class of algorithms.
This type provides a shared dataset if you want to implement a new method.
Please see Algorithm
for the implementation.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.rng: Rng
Random number generator.
best: Array1<f64>
The best variables.
best_f: F::Fitness
Best fitness.
pool: Array2<f64>
Current variables of all individuals.
fitness: Vec<F::Fitness>
Current fitness of all individuals.
adaptive: f64
Adaptive factor.
gen: u64
Generation.
func: F
The objective function.
Implementations
Set the fitness and variables to best.
Assign the index from best.
Assign the index from source.