18#ifndef itkLBFGS2Optimizerv4_h
19#define itkLBFGS2Optimizerv4_h
22#include "ITKOptimizersv4Export.h"
43 LINESEARCH_DEFAULT = 0,
46 LINESEARCH_MORETHUENTE = 0,
57 LINESEARCH_BACKTRACKING_ARMIJO = 1,
60 LINESEARCH_BACKTRACKING = 2,
72 LINESEARCH_BACKTRACKING_WOLFE = 2,
84 LINESEARCH_BACKTRACKING_STRONG_WOLFE = 3,
88extern ITKOptimizersv4_EXPORT std::ostream &
164template <
typename TInternalComputationValueType>
174#if !defined(ITK_LEGACY_REMOVE)
176 static constexpr LineSearchMethodEnum LINESEARCH_DEFAULT = LineSearchMethodEnum::LINESEARCH_DEFAULT;
177 static constexpr LineSearchMethodEnum LINESEARCH_MORETHUENTE = LineSearchMethodEnum::LINESEARCH_MORETHUENTE;
179 LineSearchMethodEnum::LINESEARCH_BACKTRACKING_ARMIJO;
180 static constexpr LineSearchMethodEnum LINESEARCH_BACKTRACKING = LineSearchMethodEnum::LINESEARCH_BACKTRACKING;
182 LineSearchMethodEnum::LINESEARCH_BACKTRACKING_WOLFE;
184 LineSearchMethodEnum::LINESEARCH_BACKTRACKING_STRONG_WOLFE;
193 static_assert(std::is_same<TInternalComputationValueType, double>::value,
194 "LBFGS2Optimizerv4Template only supports double precision");
207 using typename Superclass::StopConditionReturnStringType;
304 return GetMaximumIterations();
309 SetMaximumIterations(
static_cast<int>(_arg));
486 itkSetMacro(EstimateScalesAtEachIteration,
bool);
487 itkGetConstReferenceMacro(EstimateScalesAtEachIteration,
bool);
488 itkBooleanMacro(EstimateScalesAtEachIteration);
536 class PrivateImplementationHolder;
537 lbfgs_parameter_t m_Parameters{};
539 bool m_EstimateScalesAtEachIteration{};
540 double m_CurrentStepSize{};
541 double m_CurrentParameterNorm{};
542 double m_CurrentGradientNorm{};
543 int m_CurrentNumberOfEvaluations{};
551 itkWarningMacro(
"Not supported. Please use LBFGS specific convergence methods.");
555 itkWarningMacro(
"Not supported. Please use LBFGS specific convergence methods.");
557 const PrecisionType &
560 itkWarningMacro(
"Not supported. Please use LBFGS specific convergence methods.");
569 itkWarningMacro(
"LBFGS2Optimizerv4Template does not implement single step advance");
579#ifndef ITK_MANUAL_INSTANTIATION
580# include "itkLBFGS2Optimizerv4.hxx"
Gradient descent optimizer.
Control indentation during Print() invocation.
Wrap of the libLBFGS[1] algorithm for use in ITKv4 registration framework. LibLBFGS is a translation ...
int GetHessianApproximationAccuracy() const
int GetDeltaConvergenceDistance() const
void SetMachinePrecisionTolerance(PrecisionType xtol)
void SetMaximumLineSearchStep(PrecisionType step)
PrecisionType GetWolfeCoefficient() const
~LBFGS2Optimizerv4Template() override
void SetDeltaConvergenceTolerance(PrecisionType tol)
int GetMaximumIterations() const
PrecisionType GetDeltaConvergenceTolerance() const
int GetOrthantwiseEnd() const
void StartOptimization(bool doOnlyInitialization=false) override
PrecisionType GetMaximumLineSearchStep() const
PrecisionType GetMachinePrecisionTolerance() const
void SetOrthantwiseStart(int start)
LineSearchMethodEnum GetLineSearch() const
PrecisionType GetMinimumLineSearchStep() const
int GetOrthantwiseStart() const
SizeValueType GetNumberOfIterations() const override
void SetHessianApproximationAccuracy(int m)
void SetLineSearchAccuracy(PrecisionType ftol)
void SetDeltaConvergenceDistance(int nPast)
void ResumeOptimization() override
typename Superclass::ParametersType ParametersType
PrecisionType GetLineSearchGradientAccuracy() const
void SetMinimumConvergenceValue(PrecisionType) override
void SetConvergenceWindowSize(SizeValueType) override
typename Superclass::MetricType MetricType
int GetMaximumLineSearchEvaluations() const
PrecisionType GetLineSearchAccuracy() const
void SetLineSearchGradientAccuracy(PrecisionType gtol)
void SetNumberOfIterations(const SizeValueType _arg) override
void AdvanceOneStep() override
typename Superclass::ScalesType ScalesType
const PrecisionType & GetConvergenceValue() const override
LBFGS2Optimizerv4Template()
void SetOrthantwiseEnd(int end)
virtual StopConditionReturnStringType GetStopConditionDescription() const override
PrecisionType GetSolutionAccuracy() const
void PrintSelf(std::ostream &os, Indent indent) const override
PrecisionType GetOrthantwiseCoefficient() const
static int UpdateProgressCallback(void *instance, const PrecisionType *x, const PrecisionType *g, const PrecisionType fx, const PrecisionType xnorm, const PrecisionType gnorm, const PrecisionType step, int n, int k, int ls)
void SetLineSearch(const LineSearchMethodEnum &linesearch)
void SetMaximumIterations(int maxIterations)
void SetSolutionAccuracy(PrecisionType epsilon)
void SetOrthantwiseCoefficient(PrecisionType orthant_c)
void SetMinimumLineSearchStep(PrecisionType step)
void SetWolfeCoefficient(PrecisionType wc)
PrecisionType EvaluateCost(const PrecisionType *x, PrecisionType *g, const int n, const PrecisionType step)
int UpdateProgress(const PrecisionType *x, const PrecisionType *g, const PrecisionType fx, const PrecisionType xnorm, const PrecisionType gnorm, const PrecisionType step, int n, int k, int ls)
void SetMaximumLineSearchEvaluations(int n)
static PrecisionType EvaluateCostCallback(void *instance, const PrecisionType *x, PrecisionType *g, const int n, const PrecisionType step)
Light weight base class for most itk classes.
std::string StopConditionReturnStringType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
ITKCommon_EXPORT std::ostream & operator<<(std::ostream &out, typename AnatomicalOrientation::CoordinateEnum value)
unsigned long SizeValueType