ITK  4.9.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>
47 : public GradientDescentOptimizerv4Template<TInternalComputationValueType>
48 {
49 public:
55 
58 
60  itkNewMacro(Self);
61 
62 
64  typedef TInternalComputationValueType InternalComputationValueType;
65 
68 
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  virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE;
104 
106  virtual void EstimateLearningRate() ITK_OVERRIDE;
107 
109  double GetCurrentStepLength() const;
110 
111 protected:
112 
115  virtual void AdvanceOneStep(void) ITK_OVERRIDE;
116 
118  virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE;
119  virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE;
121 
127  TInternalComputationValueType m_RelaxationFactor;
128 
131 
134 
135  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
136 
138  TInternalComputationValueType m_MinimumStepLength;
139 
141  TInternalComputationValueType m_GradientMagnitudeTolerance;
142 
145 
146 private:
147  RegularStepGradientDescentOptimizerv4( const Self & ) ITK_DELETE_FUNCTION;
148  void operator=( const Self& ) ITK_DELETE_FUNCTION;
149 };
150 
151 } // end namespace itk
152 
153 #ifndef ITK_MANUAL_INSTANTIATION
154 #include "itkRegularStepGradientDescentOptimizerv4.hxx"
155 #endif
156 
157 #endif
Light weight base class for most itk classes.
virtual void EstimateLearningRate() override
virtual void PrintSelf(std::ostream &os, Indent indent) const override
GradientDescentOptimizerv4Template< TInternalComputationValueType > Superclass
virtual void ModifyGradientByLearningRateOverSubRange(const IndexRangeType &subrange) override
Perform more precise accumulation of floating point numbers.
virtual void ModifyGradientByScalesOverSubRange(const IndexRangeType &subrange) override
CompensatedSummation< InternalComputationValueType > CompensatedSummationType
virtual void StartOptimization(bool doOnlyInitialization=false) override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void AdvanceOneStep(void) override
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType