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: 2009-06-24 12:02:52 $
00007   Version:   $Revision: 1.9 $
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 
00171   const std::string GetStopConditionDescription() const;
00172 
00173 protected:
00174   LBFGSBOptimizer();
00175   virtual ~LBFGSBOptimizer();
00176   void PrintSelf(std::ostream& os, Indent indent) const;
00177 
00178   typedef Superclass::CostFunctionAdaptorType   CostFunctionAdaptorType;
00179 
00180 private:
00181   LBFGSBOptimizer(const Self&); //purposely not implemented
00182   void operator=(const Self&); //purposely not implemented
00183 
00184   // give the helper access to member variables, to update iteration
00185   // counts, etc.
00186   friend class LBFGSBOptimizerHelper;
00187 
00188   bool                     m_OptimizerInitialized;
00189   InternalOptimizerType  * m_VnlOptimizer;
00190   mutable OStringStream    m_StopConditionDescription;
00191   BoundValueType           m_LowerBound;
00192   BoundValueType           m_UpperBound;
00193   BoundSelectionType       m_BoundSelection;
00194 
00195   double                   m_CostFunctionConvergenceFactor;
00196   double                   m_ProjectedGradientTolerance;
00197   unsigned int             m_MaximumNumberOfIterations;
00198   unsigned int             m_MaximumNumberOfEvaluations;
00199   unsigned int             m_MaximumNumberOfCorrections;
00200 
00201   unsigned int             m_CurrentIteration;
00202   MeasureType              m_Value;
00203   double                   m_InfinityNormOfProjectedGradient;
00204 
00205 };
00206 
00207 } // end namespace itk
00208 
00209 #endif
00210 

Generated at Tue Sep 15 03:50:36 2009 for ITK by doxygen 1.5.8 written by Dimitri van Heesch, © 1997-2000