pub struct ElitistReinserter<G, F, E> where
    G: Genotype,
    F: Fitness,
    E: FitnessFunction<G, F>, 
{ /* private fields */ }
Expand description

The ElitistReinserter combines the best individuals from the offspring and the old population. When there are more individuals in the offspring than necessary, either because the offspring is larger than the population size or a replace ratio smaller then 1.0 is specified, only those individuals with the best fitness are taken over into the new population.

The reinserter can be configured by the replace_ratio field. The replace ratio is the fraction of the population size that is replaced by individuals from the offspring. The remaining spots are filled with individuals from the old population.

A replace ratio of 1.0 means that the new population is fist filled with individuals from the offspring. If the offspring does not contain enough individuals then the new population is filled up with individuals from the old population. If the offspring contains more individuals than the size of the population then the individuals are chosen uniformly at random.

Implementations

Constructs a new instance of the ElitistReinserter.

Returns true if the offspring should take precedence over better performing individuals from the old population.

Sets whether the offspring should have precedence over better performing individuals from the old population.

Returns the replace_ratio of this ElitistReinserter.

Set the replace_ratio of this ElitistReinserter to the given value. The value must be between 0 and 1.0 (inclusive).

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The name of the operator used for display purposes. The name should make clear to the user of the simulation which implementation of which kind of operator is being performed. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Combines the given offspring with the current population to create the population of the next generation. Read more

Can be used for multi-objective optimization

Can be used for single-objective optimization

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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

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.