SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.optimization.unconstrained
Class NelderMead

java.lang.Object
  extended by com.numericalmethod.suanshu.optimization.unconstrained.NelderMead
All Implemented Interfaces:
Minimizer, UnconstrainedMinimizer

public class NelderMead
extends java.lang.Object
implements UnconstrainedMinimizer

The Nelder–Mead method is a nonlinear optimization technique, which is well-defined for twice differentiable and unimodal problems. However, the Nelder–Mead technique is only a heuristic, since it can converge to non-stationary points on problems that can be solved by alternative methods.

The Nelder–Mead method starts with a simplex, and then uses operations reflection, expansion, contraction, and reduction, to search for the minimum/maximum point.

The Nelder–Mead algorithm does not always converge even for smooth problems. In practice, however, the performance is generally good.

Note that one dimensional optimization by Nelder-Mead is unreliable.

See Also:
Wikipedia: Nelder–Mead method

Nested Class Summary
static interface NelderMead.BuildSimplex
          The Nelder–Mead algorithm requires an initial simplex to start the search.
 
Field Summary
 double alpha
          the reflection coefficient
 double gamma
          the expansion coefficient
 double rho
          the contraction coefficient
 double sigma
          the shrink/reduction coefficient
 
Constructor Summary
NelderMead()
          Construct a NelderMead instance to minimize an objective function with the default control parameters.
NelderMead(double alpha, double gamma, double rho, double sigma)
          Construct a NelderMead instance to minimize/maximize f with the control parameters.
 
Method Summary
 double minimum()
          Get the minimum found.
 double[] search(double[] initial)
          Perform a Nelder-Mead search from one initial guess.
 double[] search(int maxIterations, double[]... simplex)
          Perform a Nelder-Mead search from an initial simplex.
 double[] search(int maxIterations, double[] initial)
          Perform a Nelder-Mead search from one initial guess.
 Vector search(int maxIterations, Vector... simplex)
          Perform a Nelder-Mead search from an initial simplex.
 Vector search(int maxIterations, Vector initial, NelderMead.BuildSimplex simplex)
          Perform a Nelder-Mead search from one initial guess.
 void solve(RealScalarFunction f, double tol)
           
 void solve(UnconstrainedProblem problem, double tol)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alpha

public final double alpha
the reflection coefficient


gamma

public final double gamma
the expansion coefficient


rho

public final double rho
the contraction coefficient


sigma

public final double sigma
the shrink/reduction coefficient

Constructor Detail

NelderMead

public NelderMead(double alpha,
                  double gamma,
                  double rho,
                  double sigma)
Construct a NelderMead instance to minimize/maximize f with the control parameters.

Parameters:
alpha - the reflection coefficient
gamma - the shrink/reduction coefficient
rho - the contraction coefficient
sigma - the shrink/reduction coefficient

NelderMead

public NelderMead()
Construct a NelderMead instance to minimize an objective function with the default control parameters.

Method Detail

solve

public void solve(UnconstrainedProblem problem,
                  double tol)
Specified by:
solve in interface UnconstrainedMinimizer

solve

public void solve(RealScalarFunction f,
                  double tol)
Specified by:
solve in interface UnconstrainedMinimizer

minimum

public double minimum()
Description copied from interface: Minimizer
Get the minimum found.

This is especially useful for an objective function that takes a long time to compute.

Specified by:
minimum in interface Minimizer
Returns:
the minimum found

search

public double[] search(int maxIterations,
                       double[]... simplex)
Perform a Nelder-Mead search from an initial simplex.

Parameters:
maxIterations - the maximum number of iterations
simplex - initial guesses for the optimizer. The guess points should form a simplex.
Returns:
the optimal point

search

public Vector search(int maxIterations,
                     Vector initial,
                     NelderMead.BuildSimplex simplex)
Perform a Nelder-Mead search from one initial guess.

Parameters:
maxIterations - the maximum number of iterations
initial - an initial guess of the optimizer
simplex - specify the way to build a simplex from an initial point
Returns:
the optimal point

search

public double[] search(int maxIterations,
                       double[] initial)
Perform a Nelder-Mead search from one initial guess.

Parameters:
maxIterations - the maximum number of iterations
initial - an initial guess of the optimizer
Returns:
the optimal point

search

public double[] search(double[] initial)
Perform a Nelder-Mead search from one initial guess.

Parameters:
initial - an initial guess of the optimizer
Returns:
the optimal point

search

public Vector search(int maxIterations,
                     Vector... simplex)
Perform a Nelder-Mead search from an initial simplex.

Specified by:
search in interface Minimizer
Parameters:
maxIterations - the maximum number of iterations, e.g., 500
simplex - initial guesses for the optimizer; The guess points should form a simplex.
Returns:
the optimal point

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.