Class UnconMinTrustRegionBFGS_F64

All Implemented Interfaces:
Serializable, IterativeOptimization, UnconstrainedMinimization

public class UnconMinTrustRegionBFGS_F64
extends TrustRegionBase_F64<DMatrixRMaj,​HessianBFGS>
implements UnconstrainedMinimization
Implementations of TrustRegionUpdateCauchy_F64 for UnconstrainedMinimization. The hessian is approximated using the BFGS method. This method exhibits poor convergence, probably due to the Hessian being estimated poorly at times.
See Also:
Serialized Form
  • Field Details

    • f_prev

      protected double f_prev
  • Constructor Details

  • Method Details

    • setFunction

      public void setFunction​(FunctionNtoS function, FunctionNtoN gradient, double minFunctionValue)
      Description copied from interface: UnconstrainedMinimization
      Specifies the function being optimized. A numerical Jacobian will be computed if null is passed in.
      Specified by:
      setFunction in interface UnconstrainedMinimization
      function - Function being optimized.
      gradient - Partial derivative for each input in the function. If null a numerical gradient will be computed.
      minFunctionValue - Minimum possible value that 'function' can have. E.g. for least squares problems this value should be set to zero.
    • initialize

      public void initialize​(double[] initial, double ftol, double gtol)
      Description copied from interface: UnconstrainedMinimization
      Specified by:
      initialize in interface UnconstrainedMinimization
      initial - Initial parameters or guess.
      ftol - Relative convergence test based on function value. 0 disables test. 0 ≤ ftol < 1, Try 1e-12
      gtol - Absolute convergence test based on gradient. 0 disables test. 0 ≤ gtol. Try 1e-12
    • initialize

      public void initialize​(double[] initial, int numberOfParameters, double minimumFunctionValue)
      Override parent to initialize matrices
      initialize in class TrustRegionBase_F64<DMatrixRMaj,​HessianBFGS>
      initial - Initial parameter state
      numberOfParameters - Number many parameters are being optimized.
      minimumFunctionValue - The minimum possible value that the function can output
    • cost

      protected double cost​(DMatrixRMaj x)
      Description copied from class: TrustRegionBase_F64
      Computes the function's value at x
      Specified by:
      cost in class TrustRegionBase_F64<DMatrixRMaj,​HessianBFGS>
      x - parameters
      function value
    • functionGradientHessian

      protected void functionGradientHessian​(DMatrixRMaj x, boolean sameStateAsCost, DMatrixRMaj gradient, HessianBFGS hessian)
      Description copied from class: GaussNewtonBase_F64
      Computes the gradient and Hessian at 'x'. If sameStateAsCost is true then it can be assumed that 'x' has not changed since the cost was last computed.
      Specified by:
      functionGradientHessian in class GaussNewtonBase_F64<ConfigTrustRegion,​HessianBFGS>
      sameStateAsCost - (Input) If true then when the cost (or residuals) was last called it had the same value of x
      gradient - (Input) x
      hessian - (Output) hessian
    • wolfeCondition

      protected boolean wolfeCondition​(DMatrixRMaj s, DMatrixRMaj y, DMatrixRMaj g_k)
      Indicates if there's sufficient decrease and curvature. If the Wolfe condition is meet then the Hessian will be positive definite.
      s - change in state (new - old)
      y - change in gradient (new - old)
      g_k - Gradient at step k.
    • getParameters

      public double[] getParameters()
      Description copied from interface: UnconstrainedMinimization
      After each iteration this function can be called to get the current best set of parameters.
      Specified by:
      getParameters in interface UnconstrainedMinimization
    • getFunctionValue

      public double getFunctionValue()
      Description copied from interface: UnconstrainedMinimization
      Returns the value of the objective function being evaluated at the current parameters value. If not supported then an exception is thrown.
      Specified by:
      getFunctionValue in interface UnconstrainedMinimization
      Objective function's value.
    • isUpdated

      public boolean isUpdated()
      Description copied from interface: IterativeOptimization
      True if the parameter(s) being optimized have been updated
      Specified by:
      isUpdated in interface IterativeOptimization
      True if parameters have been updated
    • isConverged

      public boolean isConverged()
      Description copied from interface: IterativeOptimization
      Indicates if iteration stopped due to convergence or not.
      Specified by:
      isConverged in interface IterativeOptimization
      True if iteration stopped because it converged.