ITK  5.2.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  * http://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 
25 namespace itk
26 {
27 /* Necessary forward declaration */
37 // Forward reference because of private implementation
38 class ITK_FORWARD_EXPORT LBFGSBOptimizerHelperv4;
39 
67 class ITKOptimizersv4_EXPORT LBFGSBOptimizerv4 : public LBFGSOptimizerBasev4<vnl_lbfgsb>
68 {
69 public:
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  itkTypeMacro(LBFGSBOptimizerv4, Superclass);
87 
89  {
90  UNBOUNDED = 0,
91  LOWERBOUNDED = 1,
92  BOTHBOUNDED = 2,
93  UPPERBOUNDED = 3
94  };
95 
100 
105 
107  void
108  SetInitialPosition(const ParametersType & param);
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
127  SetLowerBound(const BoundValueType & value);
128 
129  itkGetConstReferenceMacro(LowerBound, BoundValueType);
130 
132  void
133  SetUpperBound(const BoundValueType & value);
134 
135  itkGetConstReferenceMacro(UpperBound, BoundValueType);
136 
143  void
144  SetBoundSelection(const BoundSelectionType & value);
145 
146  itkGetConstReferenceMacro(BoundSelection, BoundSelectionType);
147 
154  virtual void
155  SetCostFunctionConvergenceFactor(double);
156 
157  itkGetConstMacro(CostFunctionConvergenceFactor, double);
158 
160  virtual void
161  SetMaximumNumberOfCorrections(unsigned int);
162 
163  itkGetConstMacro(MaximumNumberOfCorrections, unsigned int);
164 
166  void
167  SetScales(const ScalesType &) override;
168 
171  itkGetConstReferenceMacro(InfinityNormOfProjectedGradient, double);
172 
173 protected:
175  ~LBFGSBOptimizerv4() override;
176  void
177  PrintSelf(std::ostream & os, Indent indent) const override;
178 
179  using CostFunctionAdaptorType = Superclass::CostFunctionAdaptorType;
180 
183 
185 
186 private:
187  unsigned int m_MaximumNumberOfCorrections{ 5 };
188 
193 };
194 } // end namespace itk
195 #endif
itk::LBFGSBOptimizerv4
Limited memory Broyden Fletcher Goldfarb Shannon minimization with simple bounds.
Definition: itkLBFGSBOptimizerv4.h:67
itk::LBFGSBOptimizerv4::m_UpperBound
BoundValueType m_UpperBound
Definition: itkLBFGSBOptimizerv4.h:191
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::LBFGSBOptimizerv4::m_LowerBound
BoundValueType m_LowerBound
Definition: itkLBFGSBOptimizerv4.h:190
itk::LBFGSBOptimizerv4::MetricType
Superclass::MetricType MetricType
Definition: itkLBFGSBOptimizerv4.h:78
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LBFGSBOptimizerv4::CostFunctionAdaptorType
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
Definition: itkLBFGSBOptimizerv4.h:179
itk::LBFGSBOptimizerv4::ScalesType
Superclass::ScalesType ScalesType
Definition: itkLBFGSBOptimizerv4.h:80
itk::LBFGSBOptimizerv4::BoundSelectionValues
BoundSelectionValues
Definition: itkLBFGSBOptimizerv4.h:88
LBFGSBOptimizerHelperv4
Wrapper helper around vnl_lbfgsb.
itk::LBFGSBOptimizerv4::ParametersType
Superclass::ParametersType ParametersType
Definition: itkLBFGSBOptimizerv4.h:79
itk::LBFGSBOptimizerHelperv4
class ITK_FORWARD_EXPORT LBFGSBOptimizerHelperv4
Definition: itkLBFGSBOptimizerv4.h:38
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::LBFGSBOptimizerv4::GetInitialPosition
ParametersType & GetInitialPosition()
Definition: itkLBFGSBOptimizerv4.h:112
itk::LBFGSBOptimizerv4::m_BoundSelection
BoundSelectionType m_BoundSelection
Definition: itkLBFGSBOptimizerv4.h:192
itk::Array< double >
itkLBFGSOptimizerBasev4.h
itk::LBFGSBOptimizerv4::m_InitialPosition
ParametersType m_InitialPosition
Definition: itkLBFGSBOptimizerv4.h:189
itk::LBFGSOptimizerBasev4
Abstract base for vnl lbfgs algorithm optimizers in ITKv4 registration framework.
Definition: itkLBFGSOptimizerBasev4.h:76