00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkLBFGSOptimizer_h
00018 #define __itkLBFGSOptimizer_h
00019
00020 #include "itkSingleValuedNonLinearVnlOptimizer.h"
00021 #include "vnl/algo/vnl_lbfgs.h"
00022
00023 namespace itk
00024 {
00025
00031 class ITK_EXPORT LBFGSOptimizer :
00032 public SingleValuedNonLinearVnlOptimizer
00033 {
00034 public:
00036 typedef LBFGSOptimizer Self;
00037 typedef SingleValuedNonLinearVnlOptimizer Superclass;
00038 typedef SmartPointer<Self> Pointer;
00039 typedef SmartPointer<const Self> ConstPointer;
00040
00042 itkNewMacro(Self);
00043
00045 itkTypeMacro( LBFGSOptimizer, SingleValuedNonLinearVnlOptimizer );
00046
00048 typedef vnl_vector<double> InternalParametersType;
00049
00051 typedef vnl_lbfgs InternalOptimizerType;
00052
00054 vnl_lbfgs * GetOptimizer(void);
00055
00057 void StartOptimization( void );
00058
00060 virtual void SetCostFunction( SingleValuedCostFunction * costFunction );
00061
00065 virtual void SetTrace( bool flag );
00066 itkGetMacro( Trace, bool );
00067 itkBooleanMacro( Trace );
00069
00071 virtual void SetMaximumNumberOfFunctionEvaluations( unsigned int n );
00072 itkGetMacro( MaximumNumberOfFunctionEvaluations, unsigned int );
00074
00080 virtual void SetGradientConvergenceTolerance( double gtol );
00081 itkGetMacro( GradientConvergenceTolerance, double );
00083
00090 virtual void SetLineSearchAccuracy( double tol );
00091 itkGetMacro( LineSearchAccuracy, double );
00093
00098 virtual void SetDefaultStepLength( double stp );
00099 itkGetMacro( DefaultStepLength, double );
00101
00103 MeasureType GetValue();
00104
00105 protected:
00106 LBFGSOptimizer();
00107 virtual ~LBFGSOptimizer();
00108 void PrintSelf(std::ostream& os, Indent indent) const;
00109
00110 typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType;
00111
00112 private:
00113 LBFGSOptimizer(const Self&);
00114 void operator=(const Self&);
00115
00116 bool m_OptimizerInitialized;
00117 InternalOptimizerType * m_VnlOptimizer;
00118
00119 bool m_Trace;
00120 unsigned int m_MaximumNumberOfFunctionEvaluations;
00121 double m_GradientConvergenceTolerance;
00122 double m_LineSearchAccuracy;
00123 double m_DefaultStepLength;
00124
00125 };
00126
00127 }
00128
00129
00130
00131 #endif
00132
00133
00134
00135