ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkLBFGSBOptimizer.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 __itkLBFGSBOptimizer_h
19 #define __itkLBFGSBOptimizer_h
20 
21 #include "itkIntTypes.h"
23 
24 namespace itk
25 {
26 /* Necessary forward declaration see below for definition */
35 
64 {
65 public:
71 
73  itkNewMacro(Self);
74 
77 
82 
87 
89  typedef vnl_vector< double > InternalBoundValueType;
90 
92  typedef vnl_vector< long > InternalBoundSelectionType;
93 
96 
98  virtual void StartOptimization(void) ITK_OVERRIDE;
99 
101  virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE;
102 
106  virtual void SetTrace(bool flag);
107 
108  itkGetMacro(Trace, bool);
109  itkBooleanMacro(Trace);
110 
112  virtual void SetLowerBound(const BoundValueType & value);
113  itkGetConstReferenceMacro(LowerBound,BoundValueType);
115 
117  virtual void SetUpperBound(const BoundValueType & value);
118  itkGetConstReferenceMacro(UpperBound,BoundValueType);
120 
127  virtual void SetBoundSelection(const BoundSelectionType & select);
128  itkGetConstReferenceMacro(BoundSelection,BoundSelectionType);
130 
137  virtual void SetCostFunctionConvergenceFactor(double);
138 
139  itkGetMacro(CostFunctionConvergenceFactor, double);
140 
145  virtual void SetProjectedGradientTolerance(double);
146 
147  itkGetMacro(ProjectedGradientTolerance, double);
148 
150  virtual void SetMaximumNumberOfIterations(unsigned int);
151 
152  itkGetMacro(MaximumNumberOfIterations, unsigned int);
153 
155  virtual void SetMaximumNumberOfEvaluations(unsigned int);
156 
157  itkGetMacro(MaximumNumberOfEvaluations, unsigned int);
158 
160  virtual void SetMaximumNumberOfCorrections(unsigned int);
161 
162  itkGetMacro(MaximumNumberOfCorrections, unsigned int);
163 
165  void SetScales(const ScalesType &)
166  {
167  itkExceptionMacro(<< "This optimizer does not support scales.");
168  }
169 
171  itkGetConstReferenceMacro(CurrentIteration, unsigned int);
172 
174  MeasureType GetValue() const;
175 
178  itkGetConstReferenceMacro(InfinityNormOfProjectedGradient, double);
179 
181  virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE;
182 
183 protected:
184  LBFGSBOptimizer();
185  virtual ~LBFGSBOptimizer();
186  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
187 
189 
190 private:
191  LBFGSBOptimizer(const Self &); //purposely not implemented
192  void operator=(const Self &); //purposely not implemented
193 
194  // give the helper access to member variables, to update iteration
195  // counts, etc.
196  friend class LBFGSBOptimizerHelper;
197 
198  bool m_Trace;
205  unsigned int m_CurrentIteration;
207 
212 };
213 } // end namespace itk
214 
215 #endif
virtual void SetMaximumNumberOfCorrections(unsigned int)
vnl_vector< long > InternalBoundSelectionType
This class is a base for the CostFunctions returning a single value.
Light weight base class for most itk classes.
vnl_vector< double > InternalBoundValueType
BoundSelectionType m_BoundSelection
virtual void SetProjectedGradientTolerance(double)
virtual void SetMaximumNumberOfIterations(unsigned int)
Array< long > BoundSelectionType
virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE
virtual void SetUpperBound(const BoundValueType &value)
virtual void SetLowerBound(const BoundValueType &value)
virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
Superclass::CostFunctionAdaptorType CostFunctionAdaptorType
virtual void SetCostFunctionConvergenceFactor(double)
virtual void SetMaximumNumberOfEvaluations(unsigned int)
BoundValueType m_UpperBound
Superclass::ScalesType ScalesType
Limited memory Broyden Fletcher Goldfarb Shannon minimization with simple bounds. ...
Array< double > BoundValueType
This class is a base for the Optimization methods that optimize a single valued function.
virtual void StartOptimization(void) ITK_OVERRIDE
BoundValueType m_LowerBound
SmartPointer< Self > Pointer
unsigned int m_MaximumNumberOfIterations
SingleValuedNonLinearVnlOptimizer Superclass
LBFGSBOptimizerHelper InternalOptimizerType
virtual void SetTrace(bool flag)
virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE
Control indentation during Print() invocation.
Definition: itkIndent.h:49
unsigned int m_CurrentIteration
virtual void SetBoundSelection(const BoundSelectionType &select)
MeasureType GetValue() const
void SetScales(const ScalesType &)
SmartPointer< const Self > ConstPointer
Wrapper helper around vnl_lbfgsb.
unsigned int m_MaximumNumberOfCorrections
unsigned int m_MaximumNumberOfEvaluations
InternalOptimizerType * m_VnlOptimizer