18 #ifndef itkRegularStepGradientDescentBaseOptimizer_h
19 #define itkRegularStepGradientDescentBaseOptimizer_h
23 #include "ITKOptimizersExport.h"
54 GradientMagnitudeTolerance = 1,
56 ImageNotAvailable = 3,
57 CostFunctionError = 4,
58 MaximumNumberOfIterations = 5,
63 itkSetMacro(Maximize,
bool);
64 itkGetConstReferenceMacro(Maximize,
bool);
65 itkBooleanMacro(Maximize);
67 {
return !m_Maximize; }
69 { this->SetMaximize(!v); }
71 { SetMaximize(
false); }
73 { SetMaximize(
true); }
77 void StartOptimization()
override;
81 void ResumeOptimization();
85 void StopOptimization();
88 itkSetMacro(MaximumStepLength,
double);
89 itkSetMacro(MinimumStepLength,
double);
90 itkSetMacro(RelaxationFactor,
double);
92 itkSetMacro(GradientMagnitudeTolerance,
double);
93 itkGetConstReferenceMacro(CurrentStepLength,
double);
94 itkGetConstReferenceMacro(MaximumStepLength,
double);
95 itkGetConstReferenceMacro(MinimumStepLength,
double);
96 itkGetConstReferenceMacro(RelaxationFactor,
double);
98 itkGetConstReferenceMacro(GradientMagnitudeTolerance,
double);
99 itkGetConstMacro(CurrentIteration,
unsigned int);
100 itkGetConstReferenceMacro(StopCondition, StopConditionType);
101 itkGetConstReferenceMacro(Value, MeasureType);
102 itkGetConstReferenceMacro(Gradient, DerivativeType);
106 const std::string GetStopConditionDescription()
const override;
111 void PrintSelf(std::ostream & os,
Indent indent)
const override;
116 virtual void AdvanceOneStep();
125 const DerivativeType &)
130 ex.
SetDescription(
"This method MUST be overloaded in derived classes");
Light weight base class for most itk classes.
double m_MinimumStepLength
virtual void SetDescription(const std::string &s)
virtual void SetLocation(const std::string &s)
unsigned long SizeValueType
Implement a gradient descent optimizer.
This class is a base for the Optimization methods that optimize a single valued function.
std::ostringstream m_StopConditionDescription
SizeValueType m_NumberOfIterations
double m_CurrentStepLength
double m_RelaxationFactor
StopConditionType m_StopCondition
DerivativeType m_PreviousGradient
double m_MaximumStepLength
Standard exception handling object.
virtual void StepAlongGradient(double, const DerivativeType &)
double m_GradientMagnitudeTolerance
Control indentation during Print() invocation.
SizeValueType m_CurrentIteration
DerivativeType m_Gradient