Skip to main content

Module optimize

Module optimize 

Source
Expand description

Optimization: one-variable searches and the Nelder–Mead simplex.

Structs§

Minimum
The result of nelder_mead: the best point found, its value, the number of simplex moves made and whether the tolerance was met.
NelderMead
Options for nelder_mead.

Functions§

brent
Minimizes f on [a, b] by Brent’s method: parabolic interpolation through the three best points when it lands inside the bracket and shrinks it, golden-section steps otherwise (Brent, Algorithms for Minimization without Derivatives, 1973, ch. 5). Stops when the bracket is within tol (relative, plus a tiny absolute floor) of the best point, and returns (x, f(x), evaluations). Near a minimum f is flat to second order, so x is only determined to about √ε relative, and tol below that is raised to it.
golden_section
Minimizes a unimodal f on [a, b] by golden-section search, to the width of 1e-15 relative to b.
minimize
Minimizes f on the open interval (lo, hi): a scan of 64 equal cells picks the best interior grid point, then golden-section search runs between its neighbours to full precision.
nelder_mead
Minimizes f from the start point x0 by the Nelder–Mead simplex method, with the standard moves: reflection 1, expansion 2, contraction 1/2 (outside or inside) and shrink 1/2 toward the best vertex (Nelder and Mead, 1965; Lagarias et al., 1998).