ITK  5.4.0
Insight Toolkit
itkLBFGSBOptimizerv4.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 itkLBFGSBOptimizerv4_h
19#define itkLBFGSBOptimizerv4_h
20
22#include "vnl/algo/vnl_lbfgsb.h"
23#include "ITKOptimizersv4Export.h"
24
25namespace itk
26{
27/* Necessary forward declaration */
37// Forward reference because of private implementation
38class ITK_FORWARD_EXPORT LBFGSBOptimizerHelperv4;
39
67class ITKOptimizersv4_EXPORT LBFGSBOptimizerv4 : public LBFGSOptimizerBasev4<vnl_lbfgsb>
68{
69public:
70 ITK_DISALLOW_COPY_AND_MOVE(LBFGSBOptimizerv4);
71
77
78 using MetricType = Superclass::MetricType;
79 using ParametersType = Superclass::ParametersType;
80 using ScalesType = Superclass::ScalesType;
81
83 itkNewMacro(Self);
84
86 itkOverrideGetNameOfClassMacro(LBFGSBOptimizerv4);
87
89 {
90 UNBOUNDED = 0,
91 LOWERBOUNDED = 1,
92 BOTHBOUNDED = 2,
93 UPPERBOUNDED = 3
94 };
95
100
105
107 void
109
113 {
114 return m_InitialPosition;
115 }
116
118 void
119 StartOptimization(bool doOnlyInitialization = false) override;
120
122 void
123 SetMetric(MetricType * metric) override;
124
126 void
128
129 itkGetConstReferenceMacro(LowerBound, BoundValueType);
130
132 void
134
135 itkGetConstReferenceMacro(UpperBound, BoundValueType);
136
143 void
145
146 itkGetConstReferenceMacro(BoundSelection, BoundSelectionType);
147
154 virtual void
156
157 itkGetConstMacro(CostFunctionConvergenceFactor, double);
158
160 virtual void
162
163 itkGetConstMacro(MaximumNumberOfCorrections, unsigned int);
164
166 void
167 SetScales(const ScalesType &) override;
168
171 itkGetConstReferenceMacro(InfinityNormOfProjectedGradient, double);
172
174 bool
175 CanUseScales() const override
176 {
177 return false;
178 }
179
180protected:
183 void
184 PrintSelf(std::ostream & os, Indent indent) const override;
185
186 using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
187
190
192
193private:
194 unsigned int m_MaximumNumberOfCorrections{ 5 };
195
196 ParametersType m_InitialPosition{};
197 BoundValueType m_LowerBound{};
198 BoundValueType m_UpperBound{};
199 BoundSelectionType m_BoundSelection{};
200};
201} // end namespace itk
202#endif
Wrapper helper around vnl_lbfgsb.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Limited memory Broyden Fletcher Goldfarb Shannon minimization with simple bounds.
void SetMetric(MetricType *metric) override
void SetBoundSelection(const BoundSelectionType &value)
void SetUpperBound(const BoundValueType &value)
ParametersType & GetInitialPosition()
virtual void SetCostFunctionConvergenceFactor(double)
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
void PrintSelf(std::ostream &os, Indent indent) const override
virtual void SetMaximumNumberOfCorrections(unsigned int)
~LBFGSBOptimizerv4() override
void SetLowerBound(const BoundValueType &value)
void SetInitialPosition(const ParametersType &param)
void StartOptimization(bool doOnlyInitialization=false) override
Superclass::ScalesType ScalesType
Superclass::MetricType MetricType
void SetScales(const ScalesType &) override
Superclass::ParametersType ParametersType
bool CanUseScales() const override
Abstract base for vnl lbfgs algorithm optimizers in ITKv4 registration framework.
Light weight base class for most itk classes.
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
class ITK_FORWARD_EXPORT LBFGSBOptimizerHelperv4