Skip to main content

nelder_mead_minimize

Function nelder_mead_minimize 

Source
pub fn nelder_mead_minimize<F>(
    f: F,
    x0: &[f64],
    bounds: Option<&[(f64, f64)]>,
    config: &NelderMeadConfig,
) -> Result<NelderMeadResult, FittingError>
where F: FnMut(&[f64]) -> Result<f64, FittingError>,
Expand description

Minimize a scalar objective with optional per-coordinate box bounds.

  • f must be non-panicking; it may return Err to signal an infeasible point (the NM logic treats the vertex as +∞ and contracts away from it).
  • x0 is the initial point. An initial simplex of n+1 vertices is built by perturbing each coordinate in turn.
  • bounds, if present, must have the same length as x0. Each pair is (lower, upper); use f64::NEG_INFINITY / f64::INFINITY to disable.

§Panics

Does not panic on infeasible objective values. Panics only if x0 is empty or bounds.len() != x0.len().