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: 2009-06-24 12:02:51 $
00007   Version:   $Revision: 1.31 $
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 #include <string>
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 long );
00114 
00116   itkGetConstReferenceMacro( Value, double );
00117 
00119   itkGetConstReferenceMacro( StopCondition, StopConditionType );
00120   const std::string GetStopConditionDescription() const;
00122 
00124   itkGetConstReferenceMacro( Gradient, DerivativeType );
00125 
00126 protected:
00127   GradientDescentOptimizer();
00128   virtual ~GradientDescentOptimizer() {};
00129   void PrintSelf(std::ostream& os, Indent indent) const;
00130 
00131 
00132   // made protected so subclass can access
00133   DerivativeType                m_Gradient; 
00134   bool                          m_Maximize;
00135   double                        m_LearningRate;
00136 
00137 private:
00138   GradientDescentOptimizer(const Self&); //purposely not implemented
00139   void operator=(const Self&); //purposely not implemented
00140   
00141   bool                          m_Stop;
00142   double                        m_Value;
00143   StopConditionType             m_StopCondition;
00144   unsigned long                 m_NumberOfIterations;
00145   unsigned long                 m_CurrentIteration;
00146   OStringStream                 m_StopConditionDescription;
00147 };
00148 
00149 } // end namespace itk
00150 
00151 
00152 #endif
00153 

Generated at Mon Jul 12 2010 18:25:04 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000