ITK  4.5.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 
24 
25 namespace itk
26 {
83 template<typename TInternalComputationValueType>
85 : public GradientDescentOptimizerBasev4Template<TInternalComputationValueType>
86 {
87 public:
93 
96 
98  itkNewMacro(Self);
99 
100 
102  typedef TInternalComputationValueType InternalComputationValueType;
103 
106 
113 
117 
119  itkSetMacro(LearningRate, TInternalComputationValueType);
120 
122  itkGetConstReferenceMacro(LearningRate, TInternalComputationValueType);
123 
130  itkSetMacro(MaximumStepSizeInPhysicalUnits, TInternalComputationValueType);
131 
133  itkGetConstReferenceMacro(MaximumStepSizeInPhysicalUnits, TInternalComputationValueType);
134 
145 
150  itkSetMacro(DoEstimateScales, bool);
151  itkGetConstReferenceMacro(DoEstimateScales, bool);
152  itkBooleanMacro(DoEstimateScales);
154 
162  itkSetMacro(DoEstimateLearningRateAtEachIteration, bool);
163  itkGetConstReferenceMacro(DoEstimateLearningRateAtEachIteration, bool);
164  itkBooleanMacro(DoEstimateLearningRateAtEachIteration);
166 
174  itkSetMacro(DoEstimateLearningRateOnce, bool);
175  itkGetConstReferenceMacro(DoEstimateLearningRateOnce, bool);
176  itkBooleanMacro(DoEstimateLearningRateOnce);
178 
188  itkSetMacro(MinimumConvergenceValue, TInternalComputationValueType);
189 
198  itkSetMacro(ConvergenceWindowSize, SizeValueType);
199 
201  itkGetConstReferenceMacro( ConvergenceValue, TInternalComputationValueType);
202 
214  itkSetMacro(ReturnBestParametersAndValue, bool);
215  itkGetConstReferenceMacro(ReturnBestParametersAndValue, bool);
216  itkBooleanMacro(ReturnBestParametersAndValue);
218 
220  virtual void StartOptimization( bool doOnlyInitialization = false );
221 
222  virtual void StopOptimization(void);
223 
224  virtual void ResumeOptimization();
225 
227  virtual void EstimateLearningRate();
228 
229 protected:
230 
233  virtual void AdvanceOneStep(void);
234 
236  virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange );
237  virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange );
239 
243  TInternalComputationValueType m_LearningRate;
244 
248  TInternalComputationValueType m_MaximumStepSizeInPhysicalUnits;
249 
252 
255 
256  virtual void PrintSelf( std::ostream & os, Indent indent ) const;
257 
259 
265  TInternalComputationValueType m_MinimumConvergenceValue;
266 
272 
274  /* WindowConvergenceMonitoringFunction always returns output convergence value in 'TInternalComputationValueType' precision */
275  TInternalComputationValueType m_ConvergenceValue;
276 
279 
283 
286 
287 private:
292 
297 
302 
303  GradientDescentOptimizerv4Template( const Self & ); //purposely not implemented
304  void operator=( const Self& ); //purposely not implemented
305 };
306 
309 
310 } // end namespace itk
311 
312 #ifndef ITK_MANUAL_INSTANTIATION
313 #include "itkGradientDescentOptimizerv4.hxx"
314 #endif
315 
316 #endif
virtual void ModifyGradientByScalesOverSubRange(const IndexRangeType &subrange)
Light weight base class for most itk classes.
virtual void PrintSelf(std::ostream &os, Indent indent) const
itk::Function::WindowConvergenceMonitoringFunction< TInternalComputationValueType > ConvergenceMonitoringType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
GradientDescentOptimizerBasev4Template< TInternalComputationValueType > Superclass
OptimizerParameterScalesEstimatorTemplate is the base class offering a empty method of estimating the...
ConvergenceMonitoringType::Pointer m_ConvergenceMonitoring
Class which monitors convergence during the course of optimization.
GradientDescentOptimizerv4Template< double > GradientDescentOptimizerv4
TInternalComputationValueType InternalComputationValueType
OptimizerParameterScalesEstimatorTemplate< TInternalComputationValueType >::Pointer m_ScalesEstimator
TInternalComputationValueType m_MaximumStepSizeInPhysicalUnits
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void ModifyGradientByLearningRateOverSubRange(const IndexRangeType &subrange)
virtual void StartOptimization(bool doOnlyInitialization=false)
ThreadedIndexedContainerPartitioner::IndexRangeType IndexRangeType