ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkRegularStepGradientDescentOptimizerv4.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkRegularStepGradientDescentOptimizerv4_h
19 #define itkRegularStepGradientDescentOptimizerv4_h
20 
23 
24 namespace itk
25 {
45 template<typename TInternalComputationValueType>
46 class ITK_TEMPLATE_EXPORT RegularStepGradientDescentOptimizerv4
47 : public GradientDescentOptimizerv4Template<TInternalComputationValueType>
48 {
49 public:
55 
58 
60  itkNewMacro(Self);
61 
62 
64  typedef TInternalComputationValueType InternalComputationValueType;
65 
67  typedef typename Superclass::DerivativeType DerivativeType;
68 
71  typedef typename Superclass::IndexRangeType IndexRangeType;
72  typedef typename Superclass::ScalesType ScalesType;
73  typedef typename Superclass::ParametersType ParametersType;
74  typedef typename Superclass::StopConditionType StopConditionType;
75 
78 
88  itkSetMacro(MinimumStepLength, TInternalComputationValueType);
89  itkGetConstReferenceMacro(MinimumStepLength, TInternalComputationValueType);
91 
93  itkSetMacro(RelaxationFactor, TInternalComputationValueType);
94  itkGetConstReferenceMacro(RelaxationFactor, TInternalComputationValueType);
96 
98  itkSetMacro(GradientMagnitudeTolerance, TInternalComputationValueType);
99  itkGetConstReferenceMacro(GradientMagnitudeTolerance, TInternalComputationValueType);
101 
103  itkSetMacro(CurrentLearningRateRelaxation, MeasureType);
104  itkGetConstReferenceMacro(CurrentLearningRateRelaxation, MeasureType);
106 
108  virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE;
109 
111  virtual void EstimateLearningRate() ITK_OVERRIDE;
112 
114  double GetCurrentStepLength() const;
115 
116 protected:
117 
120  virtual void AdvanceOneStep(void) ITK_OVERRIDE;
121 
123  virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE;
124  virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE;
126 
127 
130 
132  virtual ~RegularStepGradientDescentOptimizerv4() ITK_OVERRIDE;
133 
134  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
135 
136 
137 private:
138  ITK_DISALLOW_COPY_AND_ASSIGN(RegularStepGradientDescentOptimizerv4);
139 
140  TInternalComputationValueType m_RelaxationFactor;
141 
142  TInternalComputationValueType m_MinimumStepLength;
143 
144  TInternalComputationValueType m_GradientMagnitudeTolerance;
145 
146  MeasureType m_CurrentLearningRateRelaxation;
147 };
148 
149 } // end namespace itk
150 
151 #ifndef ITK_MANUAL_INSTANTIATION
152 #include "itkRegularStepGradientDescentOptimizerv4.hxx"
153 #endif
154 
155 #endif
Light weight base class for most itk classes.
GradientDescentOptimizerv4Template< TInternalComputationValueType > Superclass
Perform more precise accumulation of floating point numbers.
CompensatedSummation< InternalComputationValueType > CompensatedSummationType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType