pub struct NelderMead<P, F> { /* private fields */ }
Expand description

Nelder-Mead method

The Nelder-Mead method a heuristic search method for nonlinear optimization problems which does not require derivatives.

The method is based on simplices which consist of n+1 vertices for an optimization problem with n dimensions. The function to be optimized is evaluated at all vertices. Based on these cost function values the behaviour of the cost function is extrapolated in order to find the next point to be evaluated.

The following actions are possible:

  1. Reflection (Parameter alpha, defaults to 1, configurable via with_alpha)
  2. Expansion (Parameter gamma, defaults to 2, configurable via with_gamma)
  3. Contraction inside or outside (Parameter rho, defaults to 0.5, configurable via with_rho)
  4. Shrink (Parameter sigma, defaults to 0.5, configurable via with_sigma)

Requirements on the optimization problem

The optimization problem is required to implement CostFunction.

References

https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method

http://www.scholarpedia.org/article/Nelder-Mead_algorithm#Simplex_transformation_algorithm

Implementations

Construct a new instance of NelderMead

Takes a vector of parameter vectors. The number of parameter vectors must be n + 1 where n is the number of optimization parameters.

Example
let nm: NelderMead<Vec<f64>, f64> = NelderMead::new(vec_of_parameters);

Set sample standard deviation tolerance

Must be non-negative and defaults to EPSILON.

Example
let nm: NelderMead<Vec<f64>, f64> =
    NelderMead::new(vec_of_parameters).with_sd_tolerance(1e-6)?;

Set alpha parameter for reflection

Must be larger than 0 and defaults to 1.

Example
let nm: NelderMead<Vec<f64>, f64> =
    NelderMead::new(vec_of_parameters).with_alpha(0.9)?;

Set gamma for expansion

Must be larger than 1 and defaults to 2.

Example
let nm: NelderMead<Vec<f64>, f64> =
    NelderMead::new(vec_of_parameters).with_gamma(1.9)?;

Set rho for contraction

Must be in (0, 0.5] and defaults to 0.5.

Example
let nm: NelderMead<Vec<f64>, f64> =
    NelderMead::new(vec_of_parameters).with_rho(0.4)?;

Set sigma for shrinking

Must be in (0, 1] and defaults to 0.5.

Example
let nm: NelderMead<Vec<f64>, f64> =
    NelderMead::new(vec_of_parameters).with_sigma(0.4)?;

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Deserialize this value from the given Serde deserializer. Read more

Serialize this value into the given Serde serializer. Read more

Name of the solver. Mainly used in Observers.

Initializes the algorithm. Read more

Computes a single iteration of the algorithm and has access to the optimization problem definition and the internal state of the solver. Returns an updated state and optionally a KV which holds key-value pairs used in Observers. Read more

Used to implement stopping criteria, in particular criteria which are not covered by (terminate_internal. Read more

Checks whether basic termination reasons apply. Read more

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 resulting type after obtaining ownership.

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

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.