## org.apache.commons.math3.optim.nonlinear.scalar.noderiv
Class NelderMeadSimplex

    java.lang.Object
      org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex
          org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex

All Implemented Interfaces:
  OptimizationData

    public class NelderMeadSimplex

extends AbstractSimplex

This class implements the Nelder-Mead simplex algorithm.

Since:
  3.0
Version:
  $Id: NelderMeadSimplex.java 1364392 2012-07-22 18:27:12Z tn $

Field Summary
`private static double` `DEFAULT_GAMMA` Default value for `gamma`: 0.5.
`private static double` `DEFAULT_KHI` Default value for `khi`: 2.0.
`private static double` `DEFAULT_RHO` Default value for `rho`: 1.0.
`private static double` `DEFAULT_SIGMA` Default value for `sigma`: 0.5.
`private double` `gamma` Contraction coefficient.
`private double` `khi` Expansion coefficient.
`private double` `rho` Reflection coefficient.
`private double` `sigma` Shrinkage coefficient.

Constructor Summary
`NelderMeadSimplex(double[] steps)` Build a Nelder-Mead simplex with default coefficients.
`NelderMeadSimplex(double[][] referenceSimplex)` Build a Nelder-Mead simplex with default coefficients.
`NelderMeadSimplex(double[][] referenceSimplex, double rho, double khi, double gamma, double sigma)` Build a Nelder-Mead simplex with specified coefficients.
`NelderMeadSimplex(double[] steps, double rho, double khi, double gamma, double sigma)` Build a Nelder-Mead simplex with specified coefficients.
`NelderMeadSimplex(int n)` Build a Nelder-Mead simplex with default coefficients.
`NelderMeadSimplex(int n, double sideLength)` Build a Nelder-Mead simplex with default coefficients.
`NelderMeadSimplex(int n, double rho, double khi, double gamma, double sigma)` Build a Nelder-Mead simplex with specified coefficients.
`NelderMeadSimplex(int n, double sideLength, double rho, double khi, double gamma, double sigma)` Build a Nelder-Mead simplex with specified coefficients.

Method Summary
`void` `iterate(MultivariateFunction evaluationFunction, Comparator<PointValuePair> comparator)` Compute the next simplex of the algorithm.

Methods inherited from class org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex
`build, evaluate, getDimension, getPoint, getPoints, getSize, replaceWorstPoint, setPoint, setPoints`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_RHO

    private static final double DEFAULT_RHO

  Default value for `rho`: 1.0.

  See Also:
    Constant Field Values

### DEFAULT_KHI

    private static final double DEFAULT_KHI

  Default value for `khi`: 2.0.

  See Also:
    Constant Field Values

### DEFAULT_GAMMA

    private static final double DEFAULT_GAMMA

  Default value for `gamma`: 0.5.

  See Also:
    Constant Field Values

### DEFAULT_SIGMA

    private static final double DEFAULT_SIGMA

  Default value for `sigma`: 0.5.

  See Also:
    Constant Field Values

### rho

    private final double rho

  Reflection coefficient.

### khi

    private final double khi

  Expansion coefficient.

### gamma

    private final double gamma

  Contraction coefficient.

### sigma

    private final double sigma

  Shrinkage coefficient.

Constructor Detail

### NelderMeadSimplex

    public NelderMeadSimplex(int n)

  Build a Nelder-Mead simplex with default coefficients. The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 for both gamma and sigma.

  Parameters:
    `n` - Dimension of the simplex.

### NelderMeadSimplex

    public NelderMeadSimplex(int n,
                             double sideLength)

  Build a Nelder-Mead simplex with default coefficients. The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 for both gamma and sigma.

  Parameters:
    `n` - Dimension of the simplex.
    `sideLength` - Length of the sides of the default (hypercube) simplex. See `AbstractSimplex.AbstractSimplex(int,double)`.

### NelderMeadSimplex

    public NelderMeadSimplex(int n,
                             double sideLength,
                             double rho,
                             double khi,
                             double gamma,
                             double sigma)

  Build a Nelder-Mead simplex with specified coefficients.

  Parameters:
    `n` - Dimension of the simplex. See `AbstractSimplex.AbstractSimplex(int,double)`.
    `sideLength` - Length of the sides of the default (hypercube) simplex. See `AbstractSimplex.AbstractSimplex(int,double)`.
    `rho` - Reflection coefficient.
    `khi` - Expansion coefficient.
    `gamma` - Contraction coefficient.
    `sigma` - Shrinkage coefficient.

### NelderMeadSimplex

    public NelderMeadSimplex(int n,
                             double rho,
                             double khi,
                             double gamma,
                             double sigma)

  Build a Nelder-Mead simplex with specified coefficients.

  Parameters:
    `n` - Dimension of the simplex. See `AbstractSimplex.AbstractSimplex(int)`.
    `rho` - Reflection coefficient.
    `khi` - Expansion coefficient.
    `gamma` - Contraction coefficient.
    `sigma` - Shrinkage coefficient.

### NelderMeadSimplex

    public NelderMeadSimplex(double[] steps)

  Build a Nelder-Mead simplex with default coefficients. The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 for both gamma and sigma.

  Parameters:
    `steps` - Steps along the canonical axes representing box edges. They may be negative but not zero. See

### NelderMeadSimplex

    public NelderMeadSimplex(double[] steps,
                             double rho,
                             double khi,
                             double gamma,
                             double sigma)

  Build a Nelder-Mead simplex with specified coefficients.

  Parameters:
    `steps` - Steps along the canonical axes representing box edges. They may be negative but not zero. See `AbstractSimplex.AbstractSimplex(double[])`.
    `rho` - Reflection coefficient.
    `khi` - Expansion coefficient.
    `gamma` - Contraction coefficient.
    `sigma` - Shrinkage coefficient.
  Throws:
    `IllegalArgumentException` - if one of the steps is zero.

### NelderMeadSimplex

    public NelderMeadSimplex(double[][] referenceSimplex)

  Build a Nelder-Mead simplex with default coefficients. The default coefficients are 1.0 for rho, 2.0 for khi and 0.5 for both gamma and sigma.

  Parameters:
    `referenceSimplex` - Reference simplex. See `AbstractSimplex.AbstractSimplex(double[][])`.

### NelderMeadSimplex

    public NelderMeadSimplex(double[][] referenceSimplex,
                             double rho,
                             double khi,
                             double gamma,
                             double sigma)

  Build a Nelder-Mead simplex with specified coefficients.

  Parameters:
    `referenceSimplex` - Reference simplex. See `AbstractSimplex.AbstractSimplex(double[][])`.
    `rho` - Reflection coefficient.
    `khi` - Expansion coefficient.
    `gamma` - Contraction coefficient.
    `sigma` - Shrinkage coefficient.
  Throws:
    `NotStrictlyPositiveException` - if the reference simplex does not contain at least one point.
    `DimensionMismatchException` - if there is a dimension mismatch in the reference simplex.

Method Detail

### iterate

    public void iterate(MultivariateFunction evaluationFunction,
                        Comparator<PointValuePair> comparator)

  Compute the next simplex of the algorithm.

  Specified by:
    `iterate` in class `AbstractSimplex`
  Parameters:
    `evaluationFunction` - Evaluation function.
    `comparator` - Comparator to use to sort simplex vertices from best to worst.

Copyright (c) 2003-2013 Apache Software Foundation