Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __itkGradientDescentOptimizer2_h
00016 #define __itkGradientDescentOptimizer2_h
00017
00018 #include "itkScaledSingleValuedNonLinearOptimizer.h"
00019
00020 namespace itk
00021 {
00022
00049 class GradientDescentOptimizer2 :
00050 public ScaledSingleValuedNonLinearOptimizer
00051 {
00052 public:
00054 typedef GradientDescentOptimizer2 Self;
00055 typedef ScaledSingleValuedNonLinearOptimizer Superclass;
00056 typedef SmartPointer<Self> Pointer;
00057 typedef SmartPointer<const Self> ConstPointer;
00058
00060 itkNewMacro(Self);
00061
00063 itkTypeMacro( GradientDescentOptimizer2, ScaledSingleValuedNonLinearOptimizer );
00064
00066 typedef Superclass::MeasureType MeasureType;
00067 typedef Superclass::ParametersType ParametersType;
00068 typedef Superclass::DerivativeType DerivativeType;
00069 typedef Superclass::CostFunctionType CostFunctionType;
00070 typedef Superclass::ScalesType ScalesType;
00071 typedef Superclass::ScaledCostFunctionType ScaledCostFunctionType;
00072 typedef Superclass::ScaledCostFunctionPointer ScaledCostFunctionPointer;
00073
00077 typedef enum {
00078 MaximumNumberOfIterations,
00079 MetricError,
00080 MinimumStepSize } StopConditionType;
00081
00083 virtual void AdvanceOneStep( void );
00084
00086 virtual void StartOptimization( void );
00087
00090 virtual void ResumeOptimization( void );
00091
00093 virtual void MetricErrorResponse( ExceptionObject & err );
00094
00097 virtual void StopOptimization( void );
00098
00100 itkSetMacro( LearningRate, double );
00101
00103 itkGetConstReferenceMacro( LearningRate, double);
00104
00106 itkSetMacro( NumberOfIterations, unsigned long );
00107
00109 itkGetConstReferenceMacro( NumberOfIterations, unsigned long );
00110
00112 itkGetConstMacro( CurrentIteration, unsigned int );
00113
00115 itkGetConstReferenceMacro( Value, double );
00116
00118 itkGetConstReferenceMacro( StopCondition, StopConditionType );
00119
00121 itkGetConstReferenceMacro( Gradient, DerivativeType );
00122
00123
00124 protected:
00125 GradientDescentOptimizer2();
00126 virtual ~GradientDescentOptimizer2() {};
00127 void PrintSelf(std::ostream& os, Indent indent) const;
00128
00129
00130 DerivativeType m_Gradient;
00131 double m_LearningRate;
00132 StopConditionType m_StopCondition;
00133
00134 private:
00135 GradientDescentOptimizer2(const Self&);
00136 void operator=(const Self&);
00137
00138 bool m_Stop;
00139 double m_Value;
00140
00141 unsigned long m_NumberOfIterations;
00142 unsigned long m_CurrentIteration;
00143
00144
00145
00146 };
00147
00148 }
00149
00150
00151 #endif
00152
00153
00154