Struct metaheuristics_nature::utility::Context[][src]

#[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

Get lower bound.

Get upper bound.

Get dimension (number of variables).

Get population number.

Get fitness from individual i.

Set the index to best.

Set the fitness and variables to best.

Assign the index from best.

Assign the index from source.

Find the best, and set it globally.

Check the bounds of the index s with the value v.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.