18 #ifndef itkRegularStepGradientDescentBaseOptimizer_h
19 #define itkRegularStepGradientDescentBaseOptimizer_h
23 #include "ITKOptimizersExport.h"
52 GradientMagnitudeTolerance = 1,
54 ImageNotAvailable = 3,
55 CostFunctionError = 4,
56 MaximumNumberOfIterations = 5,
61 itkSetMacro(Maximize,
bool);
62 itkGetConstReferenceMacro(Maximize,
bool);
63 itkBooleanMacro(Maximize);
65 {
return !m_Maximize; }
67 { this->SetMaximize(!v); }
69 { SetMaximize(
false); }
71 { SetMaximize(
true); }
75 virtual void StartOptimization(
void) ITK_OVERRIDE;
79 void ResumeOptimization();
83 void StopOptimization();
86 itkSetMacro(MaximumStepLength,
double);
87 itkSetMacro(MinimumStepLength,
double);
88 itkSetMacro(RelaxationFactor,
double);
90 itkSetMacro(GradientMagnitudeTolerance,
double);
91 itkGetConstReferenceMacro(CurrentStepLength,
double);
92 itkGetConstReferenceMacro(MaximumStepLength,
double);
93 itkGetConstReferenceMacro(MinimumStepLength,
double);
94 itkGetConstReferenceMacro(RelaxationFactor,
double);
95 itkGetConstReferenceMacro(NumberOfIterations, SizeValueType);
96 itkGetConstReferenceMacro(GradientMagnitudeTolerance,
double);
97 itkGetConstMacro(CurrentIteration,
unsigned int);
98 itkGetConstReferenceMacro(StopCondition, StopConditionType);
99 itkGetConstReferenceMacro(Value, MeasureType);
100 itkGetConstReferenceMacro(Gradient, DerivativeType);
104 virtual const std::
string GetStopConditionDescription() const ITK_OVERRIDE;
108 virtual ~RegularStepGradientDescentBaseOptimizer() {}
109 virtual void PrintSelf(std::ostream & os,
Indent indent)
const ITK_OVERRIDE;
114 virtual void AdvanceOneStep();
123 const DerivativeType &)
128 ex.
SetDescription(
"This method MUST be overloaded in derived classes");
134 void operator=(const Self &) ITK_DELETE_FUNCTION;
137 DerivativeType m_Gradient;
138 DerivativeType m_PreviousGradient;
143 double m_GradientMagnitudeTolerance;
144 double m_MaximumStepLength;
145 double m_MinimumStepLength;
146 double m_CurrentStepLength;
147 double m_RelaxationFactor;
151 std::ostringstream m_StopConditionDescription;
Light weight base class for most itk classes.
virtual void SetDescription(const std::string &s)
SingleValuedNonLinearOptimizer Superclass
SmartPointer< Self > Pointer
virtual void SetLocation(const std::string &s)
Implement a gradient descent optimizer.
This class is a base for the Optimization methods that optimize a single valued function.
unsigned long SizeValueType
Standard exception handling object.
virtual void StepAlongGradient(double, const DerivativeType &)
Control indentation during Print() invocation.
SmartPointer< const Self > ConstPointer
RegularStepGradientDescentBaseOptimizer Self