ITK  4.6.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 
24 namespace itk
25 {
34 {
35 public:
41 
43  itkNewMacro(Self);
44 
47 
49  typedef vnl_vector< double > InternalParametersType;
50 
52  typedef vnl_lbfgs InternalOptimizerType;
53 
55  vnl_lbfgs * GetOptimizer(void);
56 
58  virtual void StartOptimization(void) ITK_OVERRIDE;
59 
61  virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE;
62 
66  virtual void SetTrace(bool flag);
67 
68  itkGetMacro(Trace, bool);
69  itkBooleanMacro(Trace);
70 
72  virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n);
73 
74  itkGetMacro(MaximumNumberOfFunctionEvaluations, unsigned int);
75 
81  virtual void SetGradientConvergenceTolerance(double gtol);
82 
83  itkGetMacro(GradientConvergenceTolerance, double);
84 
91  virtual void SetLineSearchAccuracy(double tol);
92 
93  itkGetMacro(LineSearchAccuracy, double);
94 
99  virtual void SetDefaultStepLength(double stp);
100 
101  itkGetMacro(DefaultStepLength, double);
102 
104  MeasureType GetValue() const;
105 
107  virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE;
108 
109 protected:
110  LBFGSOptimizer();
111  virtual ~LBFGSOptimizer();
112  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
113 
115 
116 private:
117  LBFGSOptimizer(const Self &); //purposely not implemented
118  void operator=(const Self &); //purposely not implemented
119 
122  mutable std::ostringstream m_StopConditionDescription;
123 
124  bool m_Trace;
129 };
130 } // end namespace itk
131 
132 #endif
InternalOptimizerType * m_VnlOptimizer
virtual void StartOptimization(void) ITK_OVERRIDE
vnl_vector< double > InternalParametersType
virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
virtual void SetLineSearchAccuracy(double tol)
vnl_lbfgs InternalOptimizerType
virtual void SetGradientConvergenceTolerance(double gtol)
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE
SmartPointer< const Self > ConstPointer
std::ostringstream m_StopConditionDescription
This class is a base for the Optimization methods that optimize a single valued function.
virtual void SetDefaultStepLength(double stp)
vnl_lbfgs * GetOptimizer(void)
MeasureType GetValue() const
Wrap of the vnl_lbfgs algorithm.
unsigned int m_MaximumNumberOfFunctionEvaluations
virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n)
SmartPointer< Self > Pointer
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
virtual void SetTrace(bool flag)
SingleValuedNonLinearVnlOptimizer Superclass