Package org.ddogleg.optimization.wrap
Class QuasiNewtonBFGS_to_UnconstrainedMinimization
java.lang.Object
org.ddogleg.optimization.wrap.QuasiNewtonBFGS_to_UnconstrainedMinimization
- All Implemented Interfaces:
Serializable
,IterativeOptimization
,UnconstrainedMinimization
public class QuasiNewtonBFGS_to_UnconstrainedMinimization
extends Object
implements UnconstrainedMinimization
Wrapper around
QuasiNewtonBFGS
for UnconstrainedMinimization
. For a description of what
the line parameters mean see LineSearchMore94
.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
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.boolean
Indicates if iteration stopped due to convergence or not.boolean
True if the parameter(s) being optimized have been updatedboolean
iterate()
Updates the search.void
setFunction
(FunctionNtoS function, FunctionNtoN gradient, double minFunctionValue) Specifies the function being optimized.void
setVerbose
(@Nullable PrintStream verbose, int level) If set to a non-null output then extra information will be printed to the specified stream.
-
Constructor Details
-
QuasiNewtonBFGS_to_UnconstrainedMinimization
-
-
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
-
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
-
iterate
Description copied from interface:IterativeOptimization
Updates the search. If the search has terminated true is returned. After the search has terminated invoke
IterativeOptimization.isConverged()
to see if a solution has been converged to or if it stopped for some other reason.NOTE: The optimization parameters might not be modified after iterate() is called. An internal book keeping step might have been done. To see if parameters have changed call
IterativeOptimization.isUpdated()
.- Specified by:
iterate
in interfaceIterativeOptimization
- Returns:
- true if it has converged or that no more progress can be made.
- Throws:
OptimizationException
-
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.
-
setVerbose
Description copied from interface:IterativeOptimization
If set to a non-null output then extra information will be printed to the specified stream.- Specified by:
setVerbose
in interfaceIterativeOptimization
- Parameters:
verbose
- Stream that is printed to. Set to null to disablelevel
- (Future use) Parameter which can be used to specify level of verbose output. Set to zero for now.
-
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
-