ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkLBFGSOptimizer.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkLBFGSOptimizer_h
19#define itkLBFGSOptimizer_h
20
22#include "vnl/algo/vnl_lbfgs.h"
23#include "ITKOptimizersExport.h"
24#include <memory> // For unique_ptr.
25
26namespace itk
27{
75class ITKOptimizers_EXPORT LBFGSOptimizer : public SingleValuedNonLinearVnlOptimizer
76{
77public:
78 ITK_DISALLOW_COPY_AND_MOVE(LBFGSOptimizer);
79
85
87 itkNewMacro(Self);
88
90 itkOverrideGetNameOfClassMacro(LBFGSOptimizer);
91
93 using InternalParametersType = vnl_vector<double>;
94
96 using InternalOptimizerType = vnl_lbfgs;
97
99 vnl_lbfgs *
101
103 void
105
107 void
109
113 virtual void
114 SetTrace(bool flag);
115
116 itkGetMacro(Trace, bool);
117 itkBooleanMacro(Trace);
118
120 virtual void
122
123 itkGetMacro(MaximumNumberOfFunctionEvaluations, unsigned int);
124
130 virtual void
132
133 itkGetMacro(GradientConvergenceTolerance, double);
134
141 virtual void
143
144 itkGetMacro(LineSearchAccuracy, double);
145
150 virtual void
152
153 itkGetMacro(DefaultStepLength, double);
154
157 GetValue() const;
158
160 std::string
162
163protected:
165 ~LBFGSOptimizer() override;
166 void
167 PrintSelf(std::ostream & os, Indent indent) const override;
168
170
171private:
173 std::unique_ptr<InternalOptimizerType> m_VnlOptimizer;
174 mutable std::ostringstream m_StopConditionDescription{};
175
176 bool m_Trace{};
181};
182} // end namespace itk
183
184#endif
Control indentation during Print() invocation.
Definition itkIndent.h:50
void StartOptimization() override
void PrintSelf(std::ostream &os, Indent indent) const override
vnl_lbfgs * GetOptimizer()
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
std::ostringstream m_StopConditionDescription
virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n)
SmartPointer< const Self > ConstPointer
virtual void SetGradientConvergenceTolerance(double f)
MeasureType GetValue() const
virtual void SetDefaultStepLength(double f)
vnl_vector< double > InternalParametersType
unsigned int m_MaximumNumberOfFunctionEvaluations
SmartPointer< Self > Pointer
virtual void SetTrace(bool flag)
void SetCostFunction(SingleValuedCostFunction *costFunction) override
std::string GetStopConditionDescription() const override
SingleValuedNonLinearVnlOptimizer Superclass
std::unique_ptr< InternalOptimizerType > m_VnlOptimizer
virtual void SetLineSearchAccuracy(double f)
~LBFGSOptimizer() override
This class is a base for the CostFunctions returning a single value.
Implements transparent reference counting.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....