# Class QuasiNewtonBFGS

java.lang.Object
org.ddogleg.optimization.quasinewton.QuasiNewtonBFGS

```public class QuasiNewtonBFGS
extends Object```

Quasi-Newton nonlinear optimization using BFGS update on the approximate inverse Hessian with a line search. The function and its gradient is required. If no gradient is available then a numerical gradient will be used. The line search must meet the Wolfe or strong Wolfe condition. This technique is automatically scale invariant and no scale matrix is required. In most situations super-linear convergence can be expected. Based on the description provided in [1].

The inverse Hessian update requires only a rank-2 making it efficient. Stability requires that the line search maintain the Wolfe or strong Wolfe condition or else the inverse Hessian matrix can stop being symmetric positive definite.

[1] Jorge Nocedal, Stephen J. Wright, "Numerical Optimization" 2nd Ed, 2006 Springer

• ## Constructor Summary

Constructors
Constructor Description
`QuasiNewtonBFGS​(LineSearch lineSearch)`
Configures the search.
• ## Method Summary

Modifier and Type Method Description
`double` `getFuncMinValue()`
`double` `getFx()`
`LineSearch` `getLineSearch()`
`double[]` `getParameters()`
`void` `initialize​(double[] initial)`
`boolean` `isConverged()`
True if the line search converged to a solution
`boolean` `isUpdatedParameters()`
`boolean` `iterate()`
Perform one iteration in the optimization.
`void` ```setConvergence​(double ftol, double gtol)```
Specify convergence tolerances
`void` ```setFunction​(GradientLineFunction function, double funcMinValue)```
Specify the function being optimized
`void` `setInitialHInv​(DMatrixRMaj Hinverse)`
Manually specify the initial inverse hessian approximation.
`void` ```setVerbose​(@Nullable PrintStream out, int level)```

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ## Constructor Details

• ### QuasiNewtonBFGS

public QuasiNewtonBFGS​(LineSearch lineSearch)
Configures the search.
Parameters:
`lineSearch` - Line search that selects a solution that meets the Wolfe condition.
• ## Method Details

• ### setFunction

public void setFunction​(GradientLineFunction function, double funcMinValue)
Specify the function being optimized
Parameters:
`function` - Function to optimize
`funcMinValue` - Minimum possible function value. E.g. 0 for least squares.
• ### setConvergence

public void setConvergence​(double ftol, double gtol)
Specify convergence tolerances
Parameters:
`ftol` - Relative error tolerance for function value 0 `<=` ftol `<=` 1
`gtol` - Absolute convergence based on gradient norm 0 `<=` gtol
• ### setInitialHInv

public void setInitialHInv​(DMatrixRMaj Hinverse)
Manually specify the initial inverse hessian approximation.
Parameters:
`Hinverse` - Initial hessian approximation
• ### initialize

public void initialize​(double[] initial)
• ### getParameters

public double[] getParameters()
• ### iterate

public boolean iterate()
Perform one iteration in the optimization.
Returns:
true if the optimization has stopped.
• ### isConverged

public boolean isConverged()
True if the line search converged to a solution
• ### getFx

public double getFx()
• ### isUpdatedParameters

public boolean isUpdatedParameters()
• ### setVerbose

public void setVerbose​(@Nullable @Nullable PrintStream out, int level)
• ### getLineSearch

public LineSearch getLineSearch()
• ### getFuncMinValue

public double getFuncMinValue()