itkGradientDescentOptimizer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkGradientDescentOptimizer_h
00018 #define __itkGradientDescentOptimizer_h
00019
00020 #include "itkSingleValuedNonLinearOptimizer.h"
00021
00022 namespace itk
00023 {
00024
00048 class ITK_EXPORT GradientDescentOptimizer :
00049 public SingleValuedNonLinearOptimizer
00050 {
00051 public:
00053 typedef GradientDescentOptimizer Self;
00054 typedef SingleValuedNonLinearOptimizer Superclass;
00055 typedef SmartPointer<Self> Pointer;
00056 typedef SmartPointer<const Self> ConstPointer;
00057
00059 itkNewMacro(Self);
00060
00062 itkTypeMacro( GradientDescentOptimizer, SingleValuedNonLinearOptimizer );
00063
00064
00066 typedef enum
00067 {
00068 MaximumNumberOfIterations,
00069 MetricError
00070 } StopConditionType;
00071
00073 itkGetConstReferenceMacro( Maximize, bool );
00074 itkSetMacro( Maximize, bool );
00075 itkBooleanMacro( Maximize );
00076 bool GetMinimize( ) const
00077 { return !m_Maximize; }
00078 void SetMinimize(bool v)
00079 { this->SetMaximize(!v); }
00080 void MinimizeOn()
00081 { this->MaximizeOff(); }
00082 void MinimizeOff()
00083 { this->MaximizeOn(); }
00085
00087 virtual void AdvanceOneStep( void );
00088
00090 void StartOptimization( void );
00091
00094 void ResumeOptimization( void );
00095
00098 void StopOptimization( void );
00099
00101 itkSetMacro( LearningRate, double );
00102
00104 itkGetConstReferenceMacro( LearningRate, double);
00105
00107 itkSetMacro( NumberOfIterations, unsigned long );
00108
00110 itkGetConstReferenceMacro( NumberOfIterations, unsigned long );
00111
00113 itkGetConstMacro( CurrentIteration, unsigned int );
00114
00116 itkGetConstReferenceMacro( Value, double );
00117
00119 itkGetConstReferenceMacro( StopCondition, StopConditionType );
00120
00122 itkGetConstReferenceMacro( Gradient, DerivativeType );
00123
00124
00125 protected:
00126 GradientDescentOptimizer();
00127 virtual ~GradientDescentOptimizer() {};
00128 void PrintSelf(std::ostream& os, Indent indent) const;
00129
00130
00131
00132 DerivativeType m_Gradient;
00133 bool m_Maximize;
00134 double m_LearningRate;
00135
00136 private:
00137 GradientDescentOptimizer(const Self&);
00138 void operator=(const Self&);
00139
00140 bool m_Stop;
00141 double m_Value;
00142 StopConditionType m_StopCondition;
00143 unsigned long m_NumberOfIterations;
00144 unsigned long m_CurrentIteration;
00145
00146 };
00147
00148 }
00149
00150
00151 #endif
00152