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 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()