edu.rit.numeric

## Class MDMinimizationDownhillSimplex

- java.lang.Object
- edu.rit.numeric.MDMinimizationDownhillSimplex

public class MDMinimizationDownhillSimplexextends Object

Class MDMinimizationDownhillSimplex finds a minimum of a multidimensional function using the downhill simplex method of Nelder and Mead. The function has*N*inputs and is represented by an object that implements interface MDFunction. The`minimize()`method finds a (local) minimum in the function. The input to the`minimize()`method is an*N*-dimensional*simplex,*namely a group of*N*+1 points in*N*dimensions, each point different from all the others. Typically, one point of the simplex is an initial guess for the solution, and the other points of the simplex are perturbations of the initial guess. The`minimize()`method evaluates the function at each point of the simplex and moves the simplex through*N*-dimensional space to minimize the smallest function value of any point in the simplex, stopping when the relative difference between the smallest and largest function values of any points in the simplex falls below a tolerance. The output from the`minimize()`method is the final simplex, with the smallest-function-value point at position 0. The inputs to and outputs from the`minimize()`method are stored in the fields of an instance of class MDMinimizationDownhillSimplex.

### Field Summary

Fields Modifier and Type Field and Description `boolean`

**debug**Debug flag.`double[]`

**f**Function values of the simplex points.`MDFunction`

**fcn**The multidimensional function to be minimized.`int`

**N**The number of function arguments.`double`

**tol**Tolerance.`double[][]`

**x**The simplex.

### Constructor Summary

Constructors Constructor and Description **MDMinimizationDownhillSimplex**(MDFunction theFunction)Construct a new multidimensional minimization object for the given function.

### Method Summary

Methods Modifier and Type Method and Description `void`

**minimize**()Minimize the multidimensional function.`void`

**setSimplex**(double[] x, double delta)Set the simplex to the given point plus the same perturbation along each dimension.`void`

**setSimplex**(double[] x, double[] delta)Set the simplex to the given point plus a different perturbation along each dimension.

### Field Detail

#### fcn

public final MDFunction fcn

The multidimensional function to be minimized.

#### N

public final int N

The number of function arguments.

#### x

public final double[][] x

The simplex. This is an*N*+1-element array of*N*-element points. On input to the`minimize()`method,`x`contains a simplex with an initial estimate of the solution. On output from the`minimize()`method,`x`contains the final simplex, and`x[0]`contains the solution, namely the simplex point with the smallest function value.

#### f

public final double[] f

Function values of the simplex points. An*N*+1-element array. On output from the`minimize()`method,`f[i]`contains the function value for simplex point`x[i]`, 0 ≤`i`≤*N*−1. In particular,`f[0]`contains the minimized function value for the solution.

#### tol

public double tol

Tolerance. An input to the`minimize()`method. Must be > 0. Termination occurs when the relative difference between the smallest and largest function values of points in the simplex is less than the tolerance. The default tolerance is 1×10^{−6}.

#### debug

public boolean debug

Debug flag. An input to the`minimize()`method. If true, the`subclassDebug()`method is called at the beginning of every iteration. The default setting is false.

### Constructor Detail

#### MDMinimizationDownhillSimplex

public MDMinimizationDownhillSimplex(MDFunction theFunction)

Construct a new multidimensional minimization object for the given function. Field`fcn`is set to`theFunction`. Field`N`is set by calling the function's`argumentLength()`method. Field`x`, the simplex, is allocated with the proper size; all simplex points are initially 0. Field`f`, the function values, is allocated with the proper size.- Parameters:
`theFunction`

- Multidimensional function to be minimized.- Throws:
`NullPointerException`

- (unchecked exception) Thrown if`theFunction`is null.

### Method Detail

#### setSimplex

public void setSimplex(double[] x, double delta)

Set the simplex to the given point plus the same perturbation along each dimension. The field`x[0]`is set to`x`; the field`x[1]`is set to`x`with`delta`added to element 0; the field`x[2]`is set to`x`with`delta`added to element 1; and so on.- Parameters:
`x`

- Simplex point. Must be an*N*-element array.`delta`

- Perturbation along every dimension. Must be nonzero.

#### setSimplex

public void setSimplex(double[] x, double[] delta)

Set the simplex to the given point plus a different perturbation along each dimension. The field`x[0]`is set to`x`; the field`x[1]`is set to`x`with`delta[0]`added to element 0; the field`x[2]`is set to`x`with`delta[1]`added to element 1; and so on.- Parameters:
`x`

- Simplex point. Must be an*N*-element array.`delta`

- Perturbations along each dimension. All must be nonzero.

#### minimize

public void minimize()

Minimize the multidimensional function. On input, the field`x`must be filled in with an initial simplex, and the field`tol`must be set to the desired tolerance. On output, the field`x`contains the solution. For further information, see the documentation for each field.- Throws:
`IllegalArgumentException`

- (unchecked exception) Thrown if`tol`≤ 0.`TooManyIterationsException`

- (unchecked exception) Thrown if too many function evaluations (5,000) occurred without finding a minimum.

**SCaVis 2.0 © jWork.ORG**