# Class MultivariateMinimum

java.lang.Object
jebl.math.MultivariateMinimum

Direct Known Subclasses:
  `OrthogonalSearch`

public abstract class MultivariateMinimum extends Object
abstract base class for minimisation of a multivariate function

Author:
  Korbinian Strimmer

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static interface`
`MultivariateMinimum.Factory`
A factory interface for MultivariateMinimums (because they aren't statefree)

## Field Summary

Fields
Modifier and Type
Field
Description
`int`
`maxFun`
maxFun is the maximum number of calls to fun allowed.
`int`
`numFun`
total number of function evaluations necessary
`int`
`numFuncStops`
numFuncStops is the number of consecutive positive evaluations of the stop criterion based on function evaluation necessary to cause the abortion of the optimization (default is 4)

## Constructor Summary

Constructors
Constructor
Description
`MultivariateMinimum()`

## Method Summary

Modifier and Type
Method
Description
`static final void`
`copy(double[] target, double[] source)`
Copy source vector into target vector
`double`
`findMinimum(MultivariateFunction f, double[] xvec)`
Find minimum close to vector x
`double`
`findMinimum(MultivariateFunction f, double[] xvec, int fxFracDigits, int xFracDigits)`
Find minimum close to vector x (desired fractional digits for each parameter is specified)
`double`
`findMinimum(MultivariateFunction f, double[] xvec, int fxFracDigits, int xFracDigits, MinimiserMonitor monitor)`
Find minimum close to vector x (desired fractional digits for each parameter is specified)
`abstract void`
`optimize(MultivariateFunction f, double[] xvec, double tolfx, double tolx)`
The actual optimization routine (needs to be implemented in a subclass of MultivariateMinimum).
`void`
`optimize(MultivariateFunction f, double[] xvec, double tolfx, double tolx, MinimiserMonitor monitor)`
The actual optimization routine It finds a minimum close to vector x when the absolute tolerance for each parameter is specified.
`boolean`
`stopCondition(double fx, double[] x, double tolfx, double tolx, boolean firstCall)`
Checks whether optimization should stop

### Methods inherited from class Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### numFun

public int numFun
total number of function evaluations necessary

### maxFun

public int maxFun
maxFun is the maximum number of calls to fun allowed. the default value of 0 indicates no limit on the number of calls.

### numFuncStops

public int numFuncStops
numFuncStops is the number of consecutive positive evaluations of the stop criterion based on function evaluation necessary to cause the abortion of the optimization (default is 4)

## Constructor Details

### MultivariateMinimum

public MultivariateMinimum()

## Method Details

### findMinimum

public double findMinimum(MultivariateFunction f, double[] xvec)
Find minimum close to vector x

Parameters:
  `f` - multivariate function
  `xvec` - initial guesses for the minimum (contains the location of the minimum on return)
Returns:
  minimal function value

### findMinimum

public double findMinimum(MultivariateFunction f, double[] xvec, int fxFracDigits, int xFracDigits)
Find minimum close to vector x (desired fractional digits for each parameter is specified)

Parameters:
  `f` - multivariate function
  `xvec` - initial guesses for the minimum (contains the location of the minimum on return)
  `fxFracDigits` - desired fractional digits in the function value
  `xFracDigits` - desired fractional digits in parameters x
Returns:
  minimal function value

### findMinimum

public double findMinimum(MultivariateFunction f, double[] xvec, int fxFracDigits, int xFracDigits, MinimiserMonitor monitor)
Find minimum close to vector x (desired fractional digits for each parameter is specified)

Parameters:
  `f` - multivariate function
  `xvec` - initial guesses for the minimum (contains the location of the minimum on return)
  `fxFracDigits` - desired fractional digits in the function value
  `xFracDigits` - desired fractional digits in parameters x
Returns:
  minimal function value

### optimize

public abstract void optimize(MultivariateFunction f, double[] xvec, double tolfx, double tolx)
The actual optimization routine (needs to be implemented in a subclass of MultivariateMinimum). It finds a minimum close to vector x when the absolute tolerance for each parameter is specified.

Parameters:
  `f` - multivariate function
  `xvec` - initial guesses for the minimum (contains the location of the minimum on return)
  `tolfx` - absolute tolerance of function value
  `tolx` - absolute tolerance of each parameter

### optimize

public void optimize(MultivariateFunction f, double[] xvec, double tolfx, double tolx, MinimiserMonitor monitor)
The actual optimization routine It finds a minimum close to vector x when the absolute tolerance for each parameter is specified.

Parameters:
  `f` - multivariate function
  `xvec` - initial guesses for the minimum (contains the location of the minimum on return)
  `tolfx` - absolute tolerance of function value
  `tolx` - absolute tolerance of each parameter
  `monitor` - A monitor object that receives information about the minimising process (for display purposes) note: The default implementation just calls the optimize function with out the Monitor!

### stopCondition

public boolean stopCondition(double fx, double[] x, double tolfx, double tolx, boolean firstCall)
Checks whether optimization should stop

Parameters:
  `fx` - current function value
  `x` - current values of function parameters
  `tolfx` - absolute tolerance of function value
  `tolx` - absolute tolerance of each parameter
  `firstCall` - needs to be set to true when this routine is first called otherwise it should be set to false
Returns:
  true if either x and its previous value are sufficiently similar or if fx and its previous values are sufficiently similar (test on function value has to be succesful numFuncStops consecutive times)

### copy

public static final void copy(double[] target, double[] source)
Copy source vector into target vector

Parameters:
  `target` - parameter array
  `source` - parameter array