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

itkLBFGSBOptimizer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLBFGSBOptimizer.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007-11-13 14:56:49 $
00007   Version:   $Revision: 1.8 $
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 __itkLBFGSBOptimizer_h
00018 #define __itkLBFGSBOptimizer_h
00019 
00020 #include "itkSingleValuedNonLinearVnlOptimizer.h"
00021 
00022 namespace itk
00023 {
00024 
00031 class ITK_EXPORT LBFGSBOptimizerHelper;
00032 
00033 
00059 class ITK_EXPORT LBFGSBOptimizer : 
00060     public SingleValuedNonLinearVnlOptimizer
00061 {
00062 public:
00064   typedef LBFGSBOptimizer                     Self;
00065   typedef SingleValuedNonLinearVnlOptimizer   Superclass;
00066   typedef SmartPointer<Self>                  Pointer;
00067   typedef SmartPointer<const Self>            ConstPointer;
00068 
00070   itkNewMacro(Self);
00071 
00073   itkTypeMacro( LBFGSBOptimizer, SingleValuedNonLinearVnlOptimizer );
00074 
00078   typedef Array<double>             BoundValueType;
00079 
00083   typedef Array<long>                BoundSelectionType;
00084 
00086   typedef vnl_vector<double>    InternalBoundValueType;
00087 
00089   typedef vnl_vector<long>      InternalBoundSelectionType;
00090 
00092   typedef LBFGSBOptimizerHelper InternalOptimizerType;
00093 
00094 
00096   void StartOptimization( void );
00097 
00099   virtual void SetCostFunction( SingleValuedCostFunction * costFunction );
00100 
00102   virtual void SetLowerBound( const BoundValueType & value );
00103   virtual const BoundValueType & GetLowerBound();
00105 
00107   virtual void SetUpperBound( const BoundValueType & value );
00108   virtual const BoundValueType & GetUpperBound();
00110 
00117   virtual void SetBoundSelection( const BoundSelectionType & select );
00118   virtual const BoundSelectionType & GetBoundSelection();
00120 
00127   virtual void SetCostFunctionConvergenceFactor( double );
00128   itkGetMacro( CostFunctionConvergenceFactor, double );
00130 
00135   virtual void SetProjectedGradientTolerance( double );
00136   itkGetMacro( ProjectedGradientTolerance, double );
00138 
00140   virtual void SetMaximumNumberOfIterations( unsigned int );
00141   itkGetMacro( MaximumNumberOfIterations, unsigned int );
00143 
00145   virtual void SetMaximumNumberOfEvaluations( unsigned int );
00146   itkGetMacro( MaximumNumberOfEvaluations, unsigned int );
00148 
00150   virtual void SetMaximumNumberOfCorrections( unsigned int );
00151   itkGetMacro( MaximumNumberOfCorrections, unsigned int );
00153 
00155   void SetScales( const ScalesType & )
00156     {
00157     itkExceptionMacro( << "This optimizer does not support scales." );
00158     }
00159 
00161   itkGetConstReferenceMacro( CurrentIteration, unsigned int );
00162 
00164   itkGetConstReferenceMacro( Value, MeasureType );
00165 
00168   itkGetConstReferenceMacro( InfinityNormOfProjectedGradient, double );
00169 
00170 protected:
00171   LBFGSBOptimizer();
00172   virtual ~LBFGSBOptimizer();
00173   void PrintSelf(std::ostream& os, Indent indent) const;
00174 
00175   typedef Superclass::CostFunctionAdaptorType   CostFunctionAdaptorType;
00176 
00177 private:
00178   LBFGSBOptimizer(const Self&); //purposely not implemented
00179   void operator=(const Self&); //purposely not implemented
00180 
00181   // give the helper access to member variables, to update iteration
00182   // counts, etc.
00183   friend class LBFGSBOptimizerHelper;
00184 
00185   bool                     m_OptimizerInitialized;
00186   InternalOptimizerType  * m_VnlOptimizer;
00187 
00188   BoundValueType           m_LowerBound;
00189   BoundValueType           m_UpperBound;
00190   BoundSelectionType       m_BoundSelection;
00191 
00192   double                   m_CostFunctionConvergenceFactor;
00193   double                   m_ProjectedGradientTolerance;
00194   unsigned int             m_MaximumNumberOfIterations;
00195   unsigned int             m_MaximumNumberOfEvaluations;
00196   unsigned int             m_MaximumNumberOfCorrections;
00197 
00198   unsigned int             m_CurrentIteration;
00199   MeasureType              m_Value;
00200   double                   m_InfinityNormOfProjectedGradient;
00201 
00202 };
00203 
00204 } // end namespace itk
00205 
00206 #endif
00207 

Generated at Thu May 28 10:40:05 2009 for ITK by doxygen 1.5.5 written by Dimitri van Heesch, © 1997-2000