Class NelderMead

java.lang.Object
com.quantfinlib.optimization.NelderMead

public final class NelderMead extends Object
Derivative-free minimisation by the Nelder-Mead simplex method with the standard coefficients (reflection 1, expansion 2, contraction 1/2, shrink 1/2), following Lagarias, Reeds, Wright and Wright, "Convergence properties of the Nelder-Mead simplex method in low dimensions", SIAM J. Optim. 9 (1998) 112-147.

Nelder-Mead can stall on a non-stationary point, so minimize(ToDoubleFunction, double[], double, double, int) restarts from the best vertex with a fresh simplex until a restart no longer improves the objective by more than the tolerance. It is meant for smooth problems in a handful of unconstrained variables (likelihoods after a reparameterisation that maps the admissible region onto R^k). An objective value of NaN or +Infinity is treated as "worse than any finite value", which lets the objective reject inadmissible points.

  • Method Details

    • minimize

      public static NelderMead.Result minimize(ToDoubleFunction<double[]> f, double[] start, double step, double tol, int maxEvals)
      Minimises f from start.
      Parameters:
      f - objective; NaN or +Infinity marks an inadmissible point
      start - starting point (length k ≥ 1), must give a finite value
      step - initial simplex edge in every coordinate, > 0
      tol - convergence tolerance on the spread of simplex values, relative to 1 + |f|, and on the restart gain
      maxEvals - evaluation budget
      Throws:
      IllegalArgumentException - if f(start) is not finite
      IllegalStateException - if the budget runs out before convergence