ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkLBFGSOptimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 itkLBFGSOptimizer_h
19 #define itkLBFGSOptimizer_h
20 
22 #include "vnl/algo/vnl_lbfgs.h"
23 #include "ITKOptimizersExport.h"
24 
25 namespace itk
26 {
85 class ITKOptimizers_EXPORT LBFGSOptimizer:
87 {
88 public:
94 
96  itkNewMacro(Self);
97 
100 
102  typedef vnl_vector< double > InternalParametersType;
103 
105  typedef vnl_lbfgs InternalOptimizerType;
106 
108  vnl_lbfgs * GetOptimizer();
109 
111  virtual void StartOptimization(void) ITK_OVERRIDE;
112 
114  virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE;
115 
119  virtual void SetTrace(bool flag);
120 
121  itkGetMacro(Trace, bool);
122  itkBooleanMacro(Trace);
123 
125  virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n);
126 
127  itkGetMacro(MaximumNumberOfFunctionEvaluations, unsigned int);
128 
134  virtual void SetGradientConvergenceTolerance(double gtol);
135 
136  itkGetMacro(GradientConvergenceTolerance, double);
137 
144  virtual void SetLineSearchAccuracy(double tol);
145 
146  itkGetMacro(LineSearchAccuracy, double);
147 
152  virtual void SetDefaultStepLength(double stp);
153 
154  itkGetMacro(DefaultStepLength, double);
155 
157  MeasureType GetValue() const;
158 
160  virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE;
161 
162 protected:
163  LBFGSOptimizer();
164  virtual ~LBFGSOptimizer() ITK_OVERRIDE;
165  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
166 
168 
169 private:
170  ITK_DISALLOW_COPY_AND_ASSIGN(LBFGSOptimizer);
171 
172  bool m_OptimizerInitialized;
173  InternalOptimizerType * m_VnlOptimizer;
174  mutable std::ostringstream m_StopConditionDescription;
175 
176  bool m_Trace;
177  unsigned int m_MaximumNumberOfFunctionEvaluations;
178  double m_GradientConvergenceTolerance;
179  double m_LineSearchAccuracy;
180  double m_DefaultStepLength;
181 };
182 } // end namespace itk
183 
184 #endif
vnl_vector< double > InternalParametersType
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
SmartPointer< const Self > ConstPointer
This class is a base for the Optimization methods that optimize a single valued function.
Wrap of the vnl_lbfgs algorithm for use in ITKv4 registration framework. The vnl_lbfgs is a wrapper f...
SmartPointer< Self > Pointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
SingleValuedNonLinearVnlOptimizer Superclass