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");
135 void operator=(
const Self &);
Light weight base class for most itk classes.
double m_MinimumStepLength
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.
std::ostringstream m_StopConditionDescription
SizeValueType m_NumberOfIterations
double m_CurrentStepLength
unsigned long SizeValueType
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
SmartPointer< const Self > ConstPointer
DerivativeType m_Gradient
RegularStepGradientDescentBaseOptimizer Self