Mantid
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Mantid::CurveFitting::AugmentedLagrangianOptimizer Class Reference

Implements the Augmented Lagrangian optimization method of Birgin & Martinez. More...

#include <AugmentedLagrangianOptimizer.h>

Public Types

using ObjFunction = boost::function< double(const size_t, const double *)>
 Function type. More...
 

Public Member Functions

 AugmentedLagrangianOptimizer ()=delete
 Disable default constructor. More...
 
 AugmentedLagrangianOptimizer (const AugmentedLagrangianOptimizer &)=delete
 Disable copy operator. More...
 
 AugmentedLagrangianOptimizer (const size_t nparams, const ObjFunction &objfunc)
 Constructor. More...
 
 AugmentedLagrangianOptimizer (const size_t nparams, const ObjFunction &objfunc, const Kernel::DblMatrix &equality, const Kernel::DblMatrix &inequality)
 Constructor with constraints. More...
 
void minimize (std::vector< double > &xv) const
 Perform the minimization. More...
 
size_t numEqualityConstraints () const
 
size_t numInequalityConstraints () const
 
size_t numParameters () const
 
AugmentedLagrangianOptimizeroperator= (const AugmentedLagrangianOptimizer &)=delete
 Disable assignment operator. More...
 
void setMaxIterations (const int maxIter)
 Override the maximum number of iterations (Default = 500) More...
 

Private Member Functions

void checkConstraints (const Kernel::DblMatrix &equality, const Kernel::DblMatrix &inequality)
 Sanity check for constraint inputs. More...
 
void unconstrainedOptimization (const std::vector< double > &lambda, const std::vector< double > &mu, const double rho, std::vector< double > &xcur) const
 Using gradient optimizer to perform limited optimization of current set. More...
 

Private Attributes

Kernel::DblMatrix m_eq
 Defines the equality constraints. More...
 
Kernel::DblMatrix m_ineq
 Defines the inequality constraints. More...
 
int m_maxIter
 Maximum number of iterations. More...
 
const size_t m_neq
 Number of equality constraints. More...
 
const size_t m_nineq
 Number of inequality constraints. More...
 
const size_t m_nparams
 Number of parameters under minimization. More...
 
ObjFunction m_userfunc
 User-defined function. More...
 

Friends

class UnconstrainedCostFunction
 

Detailed Description

Implements the Augmented Lagrangian optimization method of Birgin & Martinez.

See

E. G. Birgin and J. M. Martiinez, "Improving ultimate convergence of an augmented Lagrangian method,", Optimization Methods and Software vol. 23, no. 2, p. 177-195 (2008).

If the objective function is written as

\[ Cx = d \]

where \(x\) are the parameters, then the routine attempts to minimize

\[ \frac{1}{2}||Cx - d||^2 \]

where \( ||f|| \) denotes the 2nd-norm of \(f\). It possible to specify an optional set of constraints such that the function is minimized subject to

\[ Ax \geq 0 \]

and

\[ A_{eq} x = 0 \]

Definition at line 53 of file AugmentedLagrangianOptimizer.h.

Member Typedef Documentation

◆ ObjFunction

using Mantid::CurveFitting::AugmentedLagrangianOptimizer::ObjFunction = boost::function<double(const size_t, const double *)>

Function type.

Definition at line 57 of file AugmentedLagrangianOptimizer.h.

Constructor & Destructor Documentation

◆ AugmentedLagrangianOptimizer() [1/4]

Mantid::CurveFitting::AugmentedLagrangianOptimizer::AugmentedLagrangianOptimizer ( const size_t  nparams,
const ObjFunction objfunc 
)
inline

Constructor.

Parameters
nparamsThe number of parameters in the problem
objfuncAn object whose type has a member named eval with the following signature "double eval(const std::vector<double> &) const" to return the value of the objective function at a given pt

Definition at line 69 of file AugmentedLagrangianOptimizer.h.

◆ AugmentedLagrangianOptimizer() [2/4]

Mantid::CurveFitting::AugmentedLagrangianOptimizer::AugmentedLagrangianOptimizer ( const size_t  nparams,
const ObjFunction objfunc,
const Kernel::DblMatrix equality,
const Kernel::DblMatrix inequality 
)
inline

Constructor with constraints.

Parameters
nparamsThe number of parameters in the problem
objfuncAn object whose type has a member named eval with the following signature "double eval(const std::vector<double> &)" to return the value of the objective function at a given pt
equalityA matrix of coefficients, \(A_{eq}\) such that in the final solution \(A_{eq} x = 0\)
inequalityA matrix of coefficients, \(A\) such that in the final solution \(A_{eq} x\geq 0\)

Definition at line 85 of file AugmentedLagrangianOptimizer.h.

◆ AugmentedLagrangianOptimizer() [3/4]

Mantid::CurveFitting::AugmentedLagrangianOptimizer::AugmentedLagrangianOptimizer ( )
delete

Disable default constructor.

◆ AugmentedLagrangianOptimizer() [4/4]

Mantid::CurveFitting::AugmentedLagrangianOptimizer::AugmentedLagrangianOptimizer ( const AugmentedLagrangianOptimizer )
delete

Disable copy operator.

Member Function Documentation

◆ checkConstraints()

void Mantid::CurveFitting::AugmentedLagrangianOptimizer::checkConstraints ( const Kernel::DblMatrix equality,
const Kernel::DblMatrix inequality 
)
private

Sanity check for constraint inputs.

Parameters
equalityA matrix of equality constraints \(A_{eq}\)(the number of columns must match number of parameters) where \(A_{eq} x = 0\)
inequalityA matrix of inequality constraints (the number of columns must match number of parameters where \(A_{eq} x \geq 0\)

Definition at line 352 of file AugmentedLagrangianOptimizer.cpp.

References ncols, Mantid::Kernel::Matrix< T >::numCols(), numEqualityConstraints(), numInequalityConstraints(), and numParameters().

◆ minimize()

void Mantid::CurveFitting::AugmentedLagrangianOptimizer::minimize ( std::vector< double > &  xv) const

Perform the minimization.

Perform the minimization using the Augmented Lagrangian routine.

Parameters
xvThe starting parameter values. They will get updated with the values as the routine progresses

Definition at line 130 of file AugmentedLagrangianOptimizer.cpp.

References fabs, Mantid::CurveFitting::FTolReached, lambda, m_eq, m_ineq, m_maxIter, m_userfunc, numEqualityConstraints(), numInequalityConstraints(), numParameters(), rho, Mantid::CurveFitting::Success, unconstrainedOptimization(), and Mantid::CurveFitting::XTolReached.

Referenced by Mantid::CurveFitting::Functions::ComptonScatteringCountRate::iterationStarting().

◆ numEqualityConstraints()

size_t Mantid::CurveFitting::AugmentedLagrangianOptimizer::numEqualityConstraints ( ) const
inline
Returns
The number of equality constraints

Definition at line 104 of file AugmentedLagrangianOptimizer.h.

Referenced by checkConstraints(), and minimize().

◆ numInequalityConstraints()

size_t Mantid::CurveFitting::AugmentedLagrangianOptimizer::numInequalityConstraints ( ) const
inline
Returns
The number of inequality constraints

Definition at line 106 of file AugmentedLagrangianOptimizer.h.

Referenced by checkConstraints(), and minimize().

◆ numParameters()

size_t Mantid::CurveFitting::AugmentedLagrangianOptimizer::numParameters ( ) const
inline
Returns
The number of parameters under minimization

Definition at line 102 of file AugmentedLagrangianOptimizer.h.

Referenced by checkConstraints(), minimize(), and unconstrainedOptimization().

◆ operator=()

AugmentedLagrangianOptimizer & Mantid::CurveFitting::AugmentedLagrangianOptimizer::operator= ( const AugmentedLagrangianOptimizer )
delete

Disable assignment operator.

◆ setMaxIterations()

void Mantid::CurveFitting::AugmentedLagrangianOptimizer::setMaxIterations ( const int  maxIter)
inline

Override the maximum number of iterations (Default = 500)

Parameters
maxIterMaximum value for the main minimizer loop

Definition at line 112 of file AugmentedLagrangianOptimizer.h.

◆ unconstrainedOptimization()

void Mantid::CurveFitting::AugmentedLagrangianOptimizer::unconstrainedOptimization ( const std::vector< double > &  lambda,
const std::vector< double > &  mu,
const double  rho,
std::vector< double > &  xcur 
) const
private

Using gradient optimizer to perform limited optimization of current set.

Parameters
lambda
mu
rho
xcurThe starting parameters for the limited unconstrained optimization. They will be updated as it proceeds

Definition at line 290 of file AugmentedLagrangianOptimizer.cpp.

References Mantid::Geometry::d, lambda, m_eq, m_ineq, m_userfunc, numParameters(), rho, tmp, and Mantid::Geometry::x.

Referenced by minimize().

Friends And Related Function Documentation

◆ UnconstrainedCostFunction

friend class UnconstrainedCostFunction
friend

Definition at line 118 of file AugmentedLagrangianOptimizer.h.

Member Data Documentation

◆ m_eq

Kernel::DblMatrix Mantid::CurveFitting::AugmentedLagrangianOptimizer::m_eq
private

Defines the equality constraints.

Definition at line 135 of file AugmentedLagrangianOptimizer.h.

Referenced by minimize(), and unconstrainedOptimization().

◆ m_ineq

Kernel::DblMatrix Mantid::CurveFitting::AugmentedLagrangianOptimizer::m_ineq
private

Defines the inequality constraints.

Definition at line 139 of file AugmentedLagrangianOptimizer.h.

Referenced by minimize(), and unconstrainedOptimization().

◆ m_maxIter

int Mantid::CurveFitting::AugmentedLagrangianOptimizer::m_maxIter
private

Maximum number of iterations.

Definition at line 141 of file AugmentedLagrangianOptimizer.h.

Referenced by minimize().

◆ m_neq

const size_t Mantid::CurveFitting::AugmentedLagrangianOptimizer::m_neq
private

Number of equality constraints.

Definition at line 133 of file AugmentedLagrangianOptimizer.h.

◆ m_nineq

const size_t Mantid::CurveFitting::AugmentedLagrangianOptimizer::m_nineq
private

Number of inequality constraints.

Definition at line 137 of file AugmentedLagrangianOptimizer.h.

◆ m_nparams

const size_t Mantid::CurveFitting::AugmentedLagrangianOptimizer::m_nparams
private

Number of parameters under minimization.

Definition at line 131 of file AugmentedLagrangianOptimizer.h.

◆ m_userfunc

ObjFunction Mantid::CurveFitting::AugmentedLagrangianOptimizer::m_userfunc
private

User-defined function.

Definition at line 129 of file AugmentedLagrangianOptimizer.h.

Referenced by minimize(), and unconstrainedOptimization().


The documentation for this class was generated from the following files: