pub enum APF<F, R> where
    F: Float + SampleUniform,
    R: Rng
{ Metropolis, Custom { f: fn(diff: F, t: F, uni: &Uniform<F>, rng: &mut R) -> bool, }, }
Expand description

Acceptance probability function

Variants

Metropolis

Metropolis criterion:

$ P(\Delta f, t) = \begin{cases} 1, & if \; \Delta f \leqslant 0; \\ \min(e^{- \Delta f / t}, 1), & if \; \Delta f \gt 0 \end{cases} $

Custom

Fields

f: fn(diff: F, t: F, uni: &Uniform<F>, rng: &mut R) -> bool

Custom function

Custom: choose your own!

Implementations

Choose whether to accept the point

Arguments:

  • diff — Difference in the objective;
  • t — Temperature;
  • uni – Uniform[0, 1] distribution;
  • rng — Random number generator.

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 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.