Class UnconMinTrustRegionBFGS_F64
java.lang.Object
org.ddogleg.optimization.GaussNewtonBase_F64<ConfigTrustRegion,HM>
org.ddogleg.optimization.trustregion.TrustRegionBase_F64<DMatrixRMaj,HessianBFGS>
org.ddogleg.optimization.trustregion.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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ddogleg.optimization.trustregion.TrustRegionBase_F64
TrustRegionBase_F64.ParameterUpdate<S extends DMatrix>
Nested classes/interfaces inherited from class org.ddogleg.optimization.GaussNewtonBase_F64
GaussNewtonBase_F64.Mode
-
Field Summary
Fields inherited from class org.ddogleg.optimization.trustregion.TrustRegionBase_F64
gradientNorm, parameterUpdate, tmp_p
Fields inherited from class org.ddogleg.optimization.GaussNewtonBase_F64
config, ftest_val, fx, gradient, gtest_val, hessian, hessianScaling, mode, p, sameStateAsCost, totalFullSteps, totalSelectSteps, verbose, verboseLevel, x, x_next
-
Constructor Summary
ConstructorDescriptionUnconMinTrustRegionBFGS_F64
(TrustRegionBase_F64.ParameterUpdate<DMatrixRMaj> parameterUpdate, HessianBFGS hessian) -
Method Summary
Modifier and TypeMethodDescriptionprotected double
cost
(DMatrixRMaj x) Computes the function's value at xprotected void
functionGradientHessian
(DMatrixRMaj x, boolean sameStateAsCost, DMatrixRMaj gradient, HessianBFGS hessian) Computes the gradient and Hessian at 'x'.double
Returns the value of the objective function being evaluated at the current parameters value.double[]
After each iteration this function can be called to get the current best set of parameters.void
initialize
(double[] initial, double ftol, double gtol) Specify the initial set of parameters from which to start from.void
initialize
(double[] initial, int numberOfParameters, double minimumFunctionValue) Override parent to initialize matricesboolean
Indicates if iteration stopped due to convergence or not.boolean
True if the parameter(s) being optimized have been updatedvoid
setFunction
(FunctionNtoS function, FunctionNtoN gradient, double minFunctionValue) Specifies the function being optimized.protected boolean
wolfeCondition
(DMatrixRMaj s, DMatrixRMaj y, DMatrixRMaj g_k) Indicates if there's sufficient decrease and curvature.Methods inherited from class org.ddogleg.optimization.trustregion.TrustRegionBase_F64
acceptNewState, checkConvergenceFTest, computeStep, configure, considerCandidate, getConfig, setVerbose, solveCauchyStepLength, updateDerivates
Methods inherited from class org.ddogleg.optimization.GaussNewtonBase_F64
applyHessianScaling, checkConvergenceGTest, computeHessianScaling, computeHessianScaling, computePredictedReduction, initialize, iterate, mode, undoHessianScalingOnParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.ddogleg.optimization.IterativeOptimization
iterate, setVerbose
-
Field Details
-
f_prev
protected double f_prev
-
-
Constructor Details
-
UnconMinTrustRegionBFGS_F64
public UnconMinTrustRegionBFGS_F64(TrustRegionBase_F64.ParameterUpdate<DMatrixRMaj> parameterUpdate, HessianBFGS hessian)
-
-
Method Details
-
setFunction
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 interfaceUnconstrainedMinimization
- Parameters:
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
Specify the initial set of parameters from which to start from. Call afterUnconstrainedMinimization.setFunction(org.ddogleg.optimization.functions.FunctionNtoS, org.ddogleg.optimization.functions.FunctionNtoN, double)
has been called.- Specified by:
initialize
in interfaceUnconstrainedMinimization
- Parameters:
initial
- Initial parameters or guess.ftol
- Relative convergence test based on function value. 0 disables test. 0 ≤ ftol<
1, Try 1e-12gtol
- 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- Overrides:
initialize
in classTrustRegionBase_F64<DMatrixRMaj,
HessianBFGS> - Parameters:
initial
- Initial parameter statenumberOfParameters
- Number many parameters are being optimized.minimumFunctionValue
- The minimum possible value that the function can output
-
cost
Description copied from class:TrustRegionBase_F64
Computes the function's value at x- Specified by:
cost
in classTrustRegionBase_F64<DMatrixRMaj,
HessianBFGS> - Parameters:
x
- parameters- Returns:
- 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 classGaussNewtonBase_F64<ConfigTrustRegion,
HessianBFGS> sameStateAsCost
- (Input) If true then when the cost (or residuals) was last called it had the same value of xgradient
- (Input) xhessian
- (Output) hessian
-
wolfeCondition
Indicates if there's sufficient decrease and curvature. If the Wolfe condition is meet then the Hessian will be positive definite.- Parameters:
s
- change in state (new - old)y
- change in gradient (new - old)g_k
- Gradient at step k.- Returns:
-
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 interfaceUnconstrainedMinimization
-
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 interfaceUnconstrainedMinimization
- Returns:
- 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 interfaceIterativeOptimization
- Returns:
- 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 interfaceIterativeOptimization
- Returns:
- True if iteration stopped because it converged.
-