Struct differential_evolution::Settings [] [src]

pub struct Settings<F, R> where F: Fn(&[f32]) -> f32, R: Rng {
    pub min_max_pos: Vec<(f32, f32)>,
    pub cr_min_max: (f32, f32),
    pub cr_change_probability: f32,
    pub f_min_max: (f32, f32),
    pub f_change_probability: f32,
    pub pop_size: usize,
    pub rng: R,
    pub cost_function: F,
}

Holds all settings for the self adaptive differential evolution algorithm.

Fields

The population is initialized with uniform random for each dimension between the tuple's size. Beware that this is only the initial state, the DE will search outside of this initial search space.

Minimum and maximum value for cr, the crossover control parameter. a good value is (0, 1) so cr is randomly choosen between in the full range of usable CR's from [0, 1).

Probability to change the cr value of an individual. Tests with 0.05, 0.1, 0.2 and 0.3 did not show any significant different results. So 0.1 seems to be a reasonable choice.

Minimum and maximum value for f, the amplification factor of the difference vector. DE is more sensitive to F than it is to CR. In literature, F is rarely greater than 1. If F=0, the evolution degenerates to a crossover but no mutation, so a reasonable choise for f_min_max seems to be (0.1, 1.0).

Probability to change the f value of an individual. See cr_change_probability, 0.1 is a reasonable choice.

Number of individuals for the DE. In many benchmarks, a size of 100 is used. The choice somewhat depends on the difficulty and the dimensionality of the problem to solve. Reasonable choices seem between 20 and 200.

Random number generator used to generate mutations. If the fitness function is fairly fast, the random number generator should be very fast as well. Since it is not necessary to use a cryptographic secure RNG, the best (fastest) choice is to use rand::weak_rng().

The cost function to minimize. This takes an &[f32] and returns the calculated cost for this position as f32. This should be fast to evaluate, and always produce the same result for the same input.

Methods

impl<F> Settings<F, XorShiftRng> where F: Fn(&[f32]) -> f32
[src]

Creates default settings for the differential evolution. It uses the default parameters as defined in the paper "Self-Adapting Control Parameters in Differential Evolution: A Comparative Study on Numerical Benchmark Problems", with a population size of 100. It also uses This uses rand::weak_rng() for the fastest random number generator available.

For most problems this should be a fairly good parameter set.