/*=========================================================================
Program: vv http://www.creatis.insa-lyon.fr/rio/vv
- Authors belong to:
+ Authors belong to:
- University of LYON http://www.universite-lyon.fr/
- - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - Léon Bérard cancer center http://www.centreleonberard.fr
- CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
This software is distributed WITHOUT ANY WARRANTY; without even
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
-
-/*=========================================================================
-
- Program: Insight Segmentation & Registration Toolkit
- Module: $RCSfile: clitkLBFGSBOptimizer.h,v $
- Language: C++
- Date: $Date: 2010/06/14 17:32:07 $
- Version: $Revision: 1.1 $
-
- Copyright (c) Insight Software Consortium. All rights reserved.
- See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notices for more information.
-
-=========================================================================*/
+===========================================================================**/
#ifndef __clitkLBFGSBOptimizer_h
#define __clitkLBFGSBOptimizer_h
-
#include "itkSingleValuedNonLinearVnlOptimizer.h"
+#include "clitkCommon.h"
+
namespace clitk
{
*
* References:
*
- * [1] R. H. Byrd, P. Lu and J. Nocedal.
- * A Limited Memory Algorithm for Bound Constrained Optimization, (1995),
- * SIAM Journal on Scientific and Statistical Computing ,
- * 16, 5, pp. 1190-1208.
+ * [1] R. H. Byrd, P. Lu and J. Nocedal.
+ * A Limited Memory Algorithm for Bound Constrained Optimization, (1995),
+ * SIAM Journal on Scientific and Statistical Computing ,
+ * 16, 5, pp. 1190-1208.
*
- * [2] C. Zhu, R. H. Byrd and J. Nocedal.
- * L-BFGS-B: Algorithm 778: L-BFGS-B, FORTRAN routines for large scale
- * bound constrained optimization (1997),
- * ACM Transactions on Mathematical Software,
- * Vol 23, Num. 4, pp. 550 - 560.
+ * [2] C. Zhu, R. H. Byrd and J. Nocedal.
+ * L-BFGS-B: Algorithm 778: L-BFGS-B, FORTRAN routines for large scale
+ * bound constrained optimization (1997),
+ * ACM Transactions on Mathematical Software,
+ * Vol 23, Num. 4, pp. 550 - 560.
*
* \ingroup Numerics Optimizers
*/
-class ITK_EXPORT LBFGSBOptimizer :
- public itk::SingleValuedNonLinearVnlOptimizer
+class ITK_EXPORT LBFGSBOptimizer :
+ public itk::SingleValuedNonLinearVnlOptimizer
{
public:
/** Standard "Self" typedef. */
typedef itk::SingleValuedNonLinearVnlOptimizer Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
-
+
/** Method for creation through the object factory. */
itkNewMacro(Self);
itkTypeMacro( LBFGSBOptimizer, SingleValuedNonLinearVnlOptimizer );
/** BoundValue type.
- * Use for defining the lower and upper bounds on the variables.
+ * Use for defining the lower and upper bounds on the variables.
*/
typedef itk::Array<double> BoundValueType;
/** BoundSelection type
- * Use for defining the boundary condition for each variables.
+ * Use for defining the boundary condition for each variables.
*/
typedef itk::Array<long> BoundSelectionType;
/** Start optimization with an initial value. */
- void StartOptimization( void );
+ virtual void StartOptimization( void ) ITK_OVERRIDE;
/** Plug in a Cost Function into the optimizer */
- virtual void SetCostFunction( itk::SingleValuedCostFunction * costFunction );
+ virtual void SetCostFunction( itk::SingleValuedCostFunction * costFunction ) ITK_OVERRIDE;
/** Set the lower bound value for each variable. */
virtual void SetLowerBound( const BoundValueType & value );
/** Set/Get the CostFunctionConvergenceFactor. Algorithm terminates
* when the reduction in cost function is less than factor * epsmcj
* where epsmch is the machine precision.
- * Typical values for factor: 1e+12 for low accuracy;
+ * Typical values for factor: 1e+12 for low accuracy;
* 1e+7 for moderate accuracy and 1e+1 for extremely high accuracy.
*/
virtual void SetCostFunctionConvergenceFactor( double );
itkGetMacro( MaximumNumberOfCorrections, unsigned int );
/** This optimizer does not support scaling of the derivatives. */
- void SetScales( const ScalesType & ) {
+ void SetScales( const ScalesType & )
+ {
itkExceptionMacro( << "This optimizer does not support scales." );
- }
+ }
/** Get the current iteration number. */
itkGetConstReferenceMacro( CurrentIteration, unsigned int );
* function. */
itkGetConstReferenceMacro( InfinityNormOfProjectedGradient, double );
+ /** Get the reason for termination */
+ virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE;
+
protected:
LBFGSBOptimizer();
virtual ~LBFGSBOptimizer();
- void PrintSelf(std::ostream& os, itk::Indent indent) const;
+ void PrintSelf(std::ostream& os, itk::Indent indent) const ITK_OVERRIDE;
typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType;
bool m_OptimizerInitialized;
InternalOptimizerType * m_VnlOptimizer;
-
+ mutable std::ostringstream m_StopConditionDescription;
BoundValueType m_LowerBound;
BoundValueType m_UpperBound;
BoundSelectionType m_BoundSelection;