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: 2007-03-22 21:39:37 $
00007   Version:   $Revision: 1.30 $
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     {
00068     MaximumNumberOfIterations,
00069     MetricError
00070     } StopConditionType;
00071 
00073   itkGetConstReferenceMacro( Maximize, bool );
00074   itkSetMacro( Maximize, bool );
00075   itkBooleanMacro( Maximize );
00076   bool GetMinimize( ) const
00077     { return !m_Maximize; }
00078   void SetMinimize(bool v)
00079     { this->SetMaximize(!v); }
00080   void MinimizeOn()
00081     { this->MaximizeOff(); }
00082   void MinimizeOff()
00083     { this->MaximizeOn(); }
00085 
00087   virtual void AdvanceOneStep( void );
00088 
00090   void    StartOptimization( void );
00091 
00094   void    ResumeOptimization( void );
00095 
00098   void    StopOptimization( void );
00099 
00101   itkSetMacro( LearningRate, double );
00102 
00104   itkGetConstReferenceMacro( LearningRate, double);
00105 
00107   itkSetMacro( NumberOfIterations, unsigned long );
00108 
00110   itkGetConstReferenceMacro( NumberOfIterations, unsigned long );
00111 
00113   itkGetConstMacro( CurrentIteration, unsigned int );
00114 
00116   itkGetConstReferenceMacro( Value, double );
00117 
00119   itkGetConstReferenceMacro( StopCondition, StopConditionType );
00120 
00122   itkGetConstReferenceMacro( Gradient, DerivativeType );
00123 
00124 
00125 protected:
00126   GradientDescentOptimizer();
00127   virtual ~GradientDescentOptimizer() {};
00128   void PrintSelf(std::ostream& os, Indent indent) const;
00129 
00130 
00131   // made protected so subclass can access
00132   DerivativeType                m_Gradient; 
00133   bool                          m_Maximize;
00134   double                        m_LearningRate;
00135 
00136 private:
00137   GradientDescentOptimizer(const Self&); //purposely not implemented
00138   void operator=(const Self&); //purposely not implemented
00139   
00140   bool                          m_Stop;
00141   double                        m_Value;
00142   StopConditionType             m_StopCondition;
00143   unsigned long                 m_NumberOfIterations;
00144   unsigned long                 m_CurrentIteration;
00145 
00146 };
00147 
00148 } // end namespace itk
00149 
00150 
00151 #endif
00152 

Generated at Mon Apr 14 12:33:30 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000