Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkGradientDescentOptimizer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkGradientDescentOptimizer.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/11/04 20:40:41 $
00007   Version:   $Revision: 1.29 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkGradientDescentOptimizer_h
00018 #define __itkGradientDescentOptimizer_h
00019 
00020 #include "itkSingleValuedNonLinearOptimizer.h"
00021 
00022 namespace itk
00023 {
00024   
00048 class ITK_EXPORT GradientDescentOptimizer : 
00049     public SingleValuedNonLinearOptimizer
00050 {
00051 public:
00053   typedef GradientDescentOptimizer          Self;
00054   typedef SingleValuedNonLinearOptimizer    Superclass;
00055   typedef SmartPointer<Self>                Pointer;
00056   typedef SmartPointer<const Self>          ConstPointer;
00057 
00059   itkNewMacro(Self);
00060 
00062   itkTypeMacro( GradientDescentOptimizer, SingleValuedNonLinearOptimizer );
00063 
00064 
00066   typedef enum {
00067     MaximumNumberOfIterations,
00068     MetricError
00069   } StopConditionType;
00070 
00072   itkGetConstReferenceMacro( Maximize, bool );
00073   itkSetMacro( Maximize, bool );
00074   itkBooleanMacro( Maximize );
00075   bool GetMinimize( ) const
00076   { return !m_Maximize; }
00077   void SetMinimize(bool v)
00078   { this->SetMaximize(!v); }
00079   void MinimizeOn()
00080   { this->MaximizeOff(); }
00081   void MinimizeOff()
00082   { this->MaximizeOn(); }
00084 
00086   virtual void AdvanceOneStep( void );
00087 
00089   void    StartOptimization( void );
00090 
00093   void    ResumeOptimization( void );
00094 
00097   void    StopOptimization( void );
00098 
00100   itkSetMacro( LearningRate, double );
00101 
00103   itkGetConstReferenceMacro( LearningRate, double);
00104 
00106   itkSetMacro( NumberOfIterations, unsigned long );
00107 
00109   itkGetConstReferenceMacro( NumberOfIterations, unsigned long );
00110 
00112   itkGetConstMacro( CurrentIteration, unsigned int );
00113 
00115   itkGetConstReferenceMacro( Value, double );
00116 
00118   itkGetConstReferenceMacro( StopCondition, StopConditionType );
00119 
00121   itkGetConstReferenceMacro( Gradient, DerivativeType );
00122 
00123 
00124 protected:
00125   GradientDescentOptimizer();
00126   virtual ~GradientDescentOptimizer() {};
00127   void PrintSelf(std::ostream& os, Indent indent) const;
00128 
00129 
00130   // made protected so subclass can access
00131   DerivativeType                m_Gradient; 
00132   bool                          m_Maximize;
00133   double                        m_LearningRate;
00134 
00135 private:
00136   GradientDescentOptimizer(const Self&); //purposely not implemented
00137   void operator=(const Self&); //purposely not implemented
00138   
00139   bool                          m_Stop;
00140   double                        m_Value;
00141   StopConditionType             m_StopCondition;
00142   unsigned long                 m_NumberOfIterations;
00143   unsigned long                 m_CurrentIteration;
00144 
00145 
00146 
00147 };
00148 
00149 } // end namespace itk
00150 
00151 
00152 #endif
00153 
00154 
00155 
00156 

Generated at Mon Mar 12 00:29:08 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000