ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkGradientDescentOptimizerv4_h 00019 #define __itkGradientDescentOptimizerv4_h 00020 00021 #include "itkGradientDescentOptimizerBasev4.h" 00022 #include "itkOptimizerParameterScalesEstimator.h" 00023 #include "itkWindowConvergenceMonitoringFunction.h" 00024 00025 namespace itk 00026 { 00079 class ITK_EXPORT GradientDescentOptimizerv4 00080 : public GradientDescentOptimizerBasev4 00081 { 00082 public: 00084 typedef GradientDescentOptimizerv4 Self; 00085 typedef GradientDescentOptimizerBasev4 Superclass; 00086 typedef SmartPointer< Self > Pointer; 00087 typedef SmartPointer< const Self > ConstPointer; 00088 00090 itkTypeMacro(GradientDescentOptimizerv4, GradientDescentOptimizerBasev4); 00091 00093 itkNewMacro(Self); 00094 00096 typedef Superclass::DerivativeType DerivativeType; 00097 00099 typedef Superclass::MeasureType MeasureType; 00100 typedef Superclass::InternalComputationValueType InternalComputationValueType; 00101 00103 typedef itk::Function::WindowConvergenceMonitoringFunction<double> 00104 ConvergenceMonitoringType; 00105 00107 itkSetMacro(LearningRate, InternalComputationValueType); 00108 00110 itkGetConstReferenceMacro(LearningRate, InternalComputationValueType); 00111 00118 itkSetMacro(MaximumStepSizeInPhysicalUnits, InternalComputationValueType); 00119 00129 itkSetObjectMacro(ScalesEstimator, OptimizerParameterScalesEstimator); 00130 00135 itkSetMacro(DoEstimateScales, bool); 00136 itkGetConstReferenceMacro(DoEstimateScales, bool); 00137 itkBooleanMacro(DoEstimateScales); 00139 00147 itkSetMacro(DoEstimateLearningRateAtEachIteration, bool); 00148 itkGetConstReferenceMacro(DoEstimateLearningRateAtEachIteration, bool); 00149 itkBooleanMacro(DoEstimateLearningRateAtEachIteration); 00151 00159 itkSetMacro(DoEstimateLearningRateOnce, bool); 00160 itkGetConstReferenceMacro(DoEstimateLearningRateOnce, bool); 00161 itkBooleanMacro(DoEstimateLearningRateOnce); 00163 00173 itkSetMacro(MinimumConvergenceValue, InternalComputationValueType); 00174 00183 itkSetMacro(ConvergenceWindowSize, SizeValueType); 00184 00186 virtual void StartOptimization(); 00187 00190 virtual void ResumeOptimization(); 00191 00192 protected: 00193 00196 virtual void AdvanceOneStep(void); 00197 00199 virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ); 00200 virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ); 00202 00206 InternalComputationValueType m_LearningRate; 00207 00211 InternalComputationValueType m_MaximumStepSizeInPhysicalUnits; 00212 00214 virtual void EstimateLearningRate(); 00215 00217 GradientDescentOptimizerv4(); 00218 00220 virtual ~GradientDescentOptimizerv4(); 00221 00222 virtual void PrintSelf( std::ostream & os, Indent indent ) const; 00223 00224 OptimizerParameterScalesEstimator::Pointer m_ScalesEstimator; 00225 00231 InternalComputationValueType m_MinimumConvergenceValue; 00232 00237 SizeValueType m_ConvergenceWindowSize; 00238 00240 ConvergenceMonitoringType::Pointer m_ConvergenceMonitoring; 00241 00242 private: 00246 bool m_DoEstimateScales; 00247 00251 bool m_DoEstimateLearningRateAtEachIteration; 00252 00256 bool m_DoEstimateLearningRateOnce; 00257 00258 GradientDescentOptimizerv4( const Self & ); //purposely not implemented 00259 void operator=( const Self& ); //purposely not implemented 00260 }; 00261 00262 } // end namespace itk 00263 00264 #endif 00265