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: 2010-05-12 19:38:30 $
00007   Version:   $Revision: 1.11 $
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 
00104   virtual void SetTrace( bool flag );
00105   itkGetMacro( Trace, bool );
00106   itkBooleanMacro( Trace );
00108 
00110   virtual void SetLowerBound( const BoundValueType & value );
00111   virtual const BoundValueType & GetLowerBound();
00113 
00115   virtual void SetUpperBound( const BoundValueType & value );
00116   virtual const BoundValueType & GetUpperBound();
00118 
00125   virtual void SetBoundSelection( const BoundSelectionType & select );
00126   virtual const BoundSelectionType & GetBoundSelection();
00128 
00135   virtual void SetCostFunctionConvergenceFactor( double );
00136   itkGetMacro( CostFunctionConvergenceFactor, double );
00138 
00143   virtual void SetProjectedGradientTolerance( double );
00144   itkGetMacro( ProjectedGradientTolerance, double );
00146 
00148   virtual void SetMaximumNumberOfIterations( unsigned int );
00149   itkGetMacro( MaximumNumberOfIterations, unsigned int );
00151 
00153   virtual void SetMaximumNumberOfEvaluations( unsigned int );
00154   itkGetMacro( MaximumNumberOfEvaluations, unsigned int );
00156 
00158   virtual void SetMaximumNumberOfCorrections( unsigned int );
00159   itkGetMacro( MaximumNumberOfCorrections, unsigned int );
00161 
00163   void SetScales( const ScalesType & )
00164     {
00165     itkExceptionMacro( << "This optimizer does not support scales." );
00166     }
00167 
00169   itkGetConstReferenceMacro( CurrentIteration, unsigned int );
00170 
00172   MeasureType GetValue() const;
00173 
00176   itkGetConstReferenceMacro( InfinityNormOfProjectedGradient, double );
00177 
00179   const std::string GetStopConditionDescription() const;
00180 
00181 protected:
00182   LBFGSBOptimizer();
00183   virtual ~LBFGSBOptimizer();
00184   void PrintSelf(std::ostream& os, Indent indent) const;
00185 
00186   typedef Superclass::CostFunctionAdaptorType   CostFunctionAdaptorType;
00187 
00188 private:
00189   LBFGSBOptimizer(const Self&); //purposely not implemented
00190   void operator=(const Self&); //purposely not implemented
00191 
00192   // give the helper access to member variables, to update iteration
00193   // counts, etc.
00194   friend class LBFGSBOptimizerHelper;
00195 
00196   bool                     m_Trace;
00197   bool                     m_OptimizerInitialized;
00198   InternalOptimizerType  * m_VnlOptimizer;
00199   mutable OStringStream    m_StopConditionDescription;
00200   BoundValueType           m_LowerBound;
00201   BoundValueType           m_UpperBound;
00202   BoundSelectionType       m_BoundSelection;
00203 
00204   double                   m_CostFunctionConvergenceFactor;
00205   double                   m_ProjectedGradientTolerance;
00206   unsigned int             m_MaximumNumberOfIterations;
00207   unsigned int             m_MaximumNumberOfEvaluations;
00208   unsigned int             m_MaximumNumberOfCorrections;
00209 
00210   unsigned int             m_CurrentIteration;
00211   double                   m_InfinityNormOfProjectedGradient;
00212 
00213 };
00214 
00215 } // end namespace itk
00216 
00217 #endif
00218 

Generated at Mon Jul 12 2010 19:02:46 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000