pub enum DeVariant {
Rand1Bin,
Best1Bin,
CurrentToBest1Bin,
Rand2Bin,
Rand1Exp,
}Expand description
Mutation + crossover variant for differential evolution.
§Convergence caveats
Not every variant converges to machine precision on every landscape
within the same budget. On unimodal landscapes like Sphere,
Best1Bin and
CurrentToBest1Bin tend to
converge prematurely: the population collapses around the
current best before the differential search has fully explored, and
the per-generation variance F · (x_{r2} − x_{r3}) shrinks to zero.
Classical DE literature documents this as the core trade-off of
best-biased variants. The crate’s integration tests therefore only
require strong reduction from the random baseline for those
variants, not optimality — see
algorithms::de::tests::all_variants_converge_on_sphere_d10 for the
per-variant tolerance choice.
Variants§
Rand1Bin
x_{r1} + F · (x_{r2} − x_{r3}), binomial crossover. Balanced
exploration / exploitation; reaches machine precision on Sphere
within a few hundred generations.
Best1Bin
x_{best} + F · (x_{r2} − x_{r3}), binomial crossover.
Strong exploitation — the mutation base is always the current
best, so the population concentrates quickly. Prone to
premature convergence on landscapes where the current best
is far from the global optimum; on Sphere-D10 with 500 gens this
variant stalls around best_fitness ≈ 1 while Rand1Bin reaches
< 1e-20.
CurrentToBest1Bin
x_i + F · (x_{best} − x_i) + F · (x_{r1} − x_{r2}), binomial.
Hybrid of the current individual and the best-so-far. Still
prone to premature convergence because the
F · (x_{best} − x_i) term dominates once the population is
near the best. Useful on multimodal landscapes where pure-best
variants get stuck in local basins, less useful on Sphere.
Rand2Bin
x_{r1} + F · (x_{r2} − x_{r3}) + F · (x_{r4} − x_{r5}),
binomial. Higher variance than Rand1Bin thanks to two
difference vectors; converges on Sphere but more slowly.
Rand1Exp
x_{r1} + F · (x_{r2} − x_{r3}), exponential crossover.
Identical mutation to Rand1Bin, different crossover mask shape.
Performance comparable to Rand1Bin in practice.
Trait Implementations§
impl Copy for DeVariant
impl Eq for DeVariant
impl StructuralPartialEq for DeVariant
Auto Trait Implementations§
impl Freeze for DeVariant
impl RefUnwindSafe for DeVariant
impl Send for DeVariant
impl Sync for DeVariant
impl Unpin for DeVariant
impl UnsafeUnpin for DeVariant
impl UnwindSafe for DeVariant
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more