00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLBFGSBOptimizer_h
00018 #define __itkLBFGSBOptimizer_h
00019
00020 #include "itkSingleValuedNonLinearOptimizer.h"
00021 #include <string>
00022
00023 namespace itk
00024 {
00025
00051 class ITK_EXPORT LBFGSBOptimizer :
00052 public SingleValuedNonLinearOptimizer
00053 {
00054 public:
00056 typedef LBFGSBOptimizer Self;
00057 typedef SingleValuedNonLinearOptimizer Superclass;
00058 typedef SmartPointer<Self> Pointer;
00059 typedef SmartPointer<const Self> ConstPointer;
00060
00062 itkNewMacro(Self);
00063
00065 itkTypeMacro( LBFGSBOptimizer, SingleValuedNonLinearOptimizer );
00066
00070 typedef Array<double> BoundValueType;
00071
00075 typedef Array<long> BoundSelectionType;
00076
00078 void StartOptimization( void );
00079
00081 typedef SingleValuedCostFunction CostFunctionType;
00082 typedef CostFunctionType::Pointer CostFunctionPointer;
00083 typedef CostFunctionType::MeasureType MeasureType;
00084
00086 virtual void SetLowerBound( const BoundValueType & value );
00087 virtual const BoundValueType & GetLowerBound();
00089
00091 virtual void SetUpperBound( const BoundValueType & value );
00092 virtual const BoundValueType & GetUpperBound();
00094
00101 virtual void SetBoundSelection( const BoundSelectionType & select );
00102 virtual const BoundSelectionType & GetBoundSelection();
00104
00111 itkSetMacro( CostFunctionConvergenceFactor, double );
00112 itkGetMacro( CostFunctionConvergenceFactor, double );
00114
00119 itkSetMacro( ProjectedGradientTolerance, double );
00120 itkGetMacro( ProjectedGradientTolerance, double );
00122
00124 itkSetMacro( MaximumNumberOfIterations, unsigned int );
00125 itkGetMacro( MaximumNumberOfIterations, unsigned int );
00127
00129 itkSetMacro( MaximumNumberOfEvaluations, unsigned int );
00130 itkGetMacro( MaximumNumberOfEvaluations, unsigned int );
00132
00134 itkSetMacro( MaximumNumberOfCorrections, unsigned int );
00135 itkGetMacro( MaximumNumberOfCorrections, unsigned int );
00137
00139 void SetScales( const ScalesType & )
00140 {
00141 itkExceptionMacro( << "This optimizer does not support scales." );
00142 }
00143
00145 itkGetConstReferenceMacro( CurrentIteration, unsigned int );
00146
00148 itkGetConstReferenceMacro( Value, MeasureType );
00149
00152 itkGetConstReferenceMacro( InfinityNormOfProjectedGradient, double );
00153
00154 protected:
00155 LBFGSBOptimizer();
00156 virtual ~LBFGSBOptimizer();
00157 void PrintSelf(std::ostream& os, Indent indent) const;
00158
00159
00160 private:
00161 LBFGSBOptimizer(const Self&);
00162 void operator=(const Self&);
00163
00164 BoundValueType m_LowerBound;
00165 BoundValueType m_UpperBound;
00166 BoundSelectionType m_BoundSelection;
00167
00168 double m_CostFunctionConvergenceFactor;
00169 double m_ProjectedGradientTolerance;
00170 unsigned int m_MaximumNumberOfIterations;
00171 unsigned int m_MaximumNumberOfEvaluations;
00172 unsigned int m_MaximumNumberOfCorrections;
00173
00174 unsigned int m_CurrentIteration;
00175 MeasureType m_Value;
00176 double m_InfinityNormOfProjectedGradient;
00177
00178 };
00179
00180 }
00181
00182 #endif
00183