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,VerbosePrint
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns 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.voidinitialize(double[] initial, double ftol, double gtol) Specify the initial set of parameters from which to start from.booleanIndicates if iteration stopped due to convergence or not.booleanTrue if the parameter(s) being optimized have been updatedbooleaniterate()Updates the search.voidsetFunction(FunctionNtoS function, FunctionNtoN gradient, double minFunctionValue) Specifies the function being optimized.voidsetVerbose(@Nullable PrintStream verbose, int level) If set to a non-null output then extra information will be printed to the specified stream.voidsetVerbose(@Nullable PrintStream out, @Nullable Set<String> configuration) 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:UnconstrainedMinimizationSpecifies the function being optimized. A numerical Jacobian will be computed if null is passed in.- Specified by:
setFunctionin 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:UnconstrainedMinimizationSpecify 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:
initializein 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:UnconstrainedMinimizationAfter each iteration this function can be called to get the current best set of parameters.- Specified by:
getParametersin interfaceUnconstrainedMinimization
-
iterate
Description copied from interface:IterativeOptimizationUpdates 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 bookkeeping step might have been done. To see if parameters have changed call
IterativeOptimization.isUpdated().- Specified by:
iteratein 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:IterativeOptimizationIndicates if iteration stopped due to convergence or not.- Specified by:
isConvergedin interfaceIterativeOptimization- Returns:
- True if iteration stopped because it converged.
-
setVerbose
Description copied from interface:IterativeOptimizationIf set to a non-null output then extra information will be printed to the specified stream.- Specified by:
setVerbosein 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:UnconstrainedMinimizationReturns the value of the objective function being evaluated at the current parameters value. If not supported then an exception is thrown.- Specified by:
getFunctionValuein interfaceUnconstrainedMinimization- Returns:
- Objective function's value.
-
isUpdated
public boolean isUpdated()Description copied from interface:IterativeOptimizationTrue if the parameter(s) being optimized have been updated- Specified by:
isUpdatedin interfaceIterativeOptimization- Returns:
- True if parameters have been updated
-
setVerbose
public void setVerbose(@Nullable @Nullable PrintStream out, @Nullable @Nullable Set<String> configuration) Description copied from interface:VerbosePrintIf set to a non-null output then extra information will be printed to the specified stream.- Specified by:
setVerbosein interfaceVerbosePrint- Parameters:
out- Stream that is printed to. Set to null to disableconfiguration- (Future use) Set which specifies flags that can be used to turn on and off different output
-