ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkGradientDescentOptimizerv4.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 itkGradientDescentOptimizerv4_h
19 #define itkGradientDescentOptimizerv4_h
20 
22 
23 namespace itk
24 {
76 template<typename TInternalComputationValueType>
78 : public GradientDescentOptimizerBasev4Template<TInternalComputationValueType>
79 {
80 public:
86 
89 
91  itkNewMacro(Self);
92 
93 
95  typedef TInternalComputationValueType InternalComputationValueType;
96 
99 
106 
108  itkSetMacro(LearningRate, TInternalComputationValueType);
109 
111  itkGetConstReferenceMacro(LearningRate, TInternalComputationValueType);
112 
119  itkSetMacro(MaximumStepSizeInPhysicalUnits, TInternalComputationValueType);
120 
122  itkGetConstReferenceMacro(MaximumStepSizeInPhysicalUnits, TInternalComputationValueType);
123 
131  itkSetMacro(DoEstimateLearningRateAtEachIteration, bool);
132  itkGetConstReferenceMacro(DoEstimateLearningRateAtEachIteration, bool);
133  itkBooleanMacro(DoEstimateLearningRateAtEachIteration);
135 
143  itkSetMacro(DoEstimateLearningRateOnce, bool);
144  itkGetConstReferenceMacro(DoEstimateLearningRateOnce, bool);
145  itkBooleanMacro(DoEstimateLearningRateOnce);
147 
157  itkSetMacro(MinimumConvergenceValue, TInternalComputationValueType);
158 
167  itkSetMacro(ConvergenceWindowSize, SizeValueType);
168 
170  itkGetConstReferenceMacro( ConvergenceValue, TInternalComputationValueType);
171 
183  itkSetMacro(ReturnBestParametersAndValue, bool);
184  itkGetConstReferenceMacro(ReturnBestParametersAndValue, bool);
185  itkBooleanMacro(ReturnBestParametersAndValue);
187 
189  virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE;
190 
191  virtual void StopOptimization(void) ITK_OVERRIDE;
192 
193  virtual void ResumeOptimization() ITK_OVERRIDE;
194 
196  virtual void EstimateLearningRate();
197 
198 protected:
199 
202  virtual void AdvanceOneStep();
203 
205  virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE;
206  virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE;
208 
212  TInternalComputationValueType m_LearningRate;
213 
216 
219 
220  virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE;
221 
227  TInternalComputationValueType m_MinimumConvergenceValue;
228 
230  /* WindowConvergenceMonitoringFunction always returns output convergence value in 'TInternalComputationValueType' precision */
231  TInternalComputationValueType m_ConvergenceValue;
232 
236 
239 
246 
247 private:
248 
249  GradientDescentOptimizerv4Template( const Self & ) ITK_DELETE_FUNCTION;
250  void operator=( const Self& ) ITK_DELETE_FUNCTION;
251 };
252 
254 typedef GradientDescentOptimizerv4Template<double> GradientDescentOptimizerv4;
255 
256 } // end namespace itk
257 
258 #ifndef ITK_MANUAL_INSTANTIATION
259 #include "itkGradientDescentOptimizerv4.hxx"
260 #endif
261 
262 #endif
virtual void StartOptimization(bool doOnlyInitialization=false) override
Light weight base class for most itk classes.
virtual void ModifyGradientByLearningRateOverSubRange(const IndexRangeType &subrange) override
unsigned long SizeValueType
Definition: itkIntTypes.h:143
GradientDescentOptimizerBasev4Template< TInternalComputationValueType > Superclass
virtual void PrintSelf(std::ostream &os, Indent indent) const override
TInternalComputationValueType InternalComputationValueType
virtual void ModifyGradientByScalesOverSubRange(const IndexRangeType &subrange) override
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void ResumeOptimization() override
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType
virtual void StopOptimization(void) override