Mantid
|
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 |
AugmentedLagrangianOptimizer & | operator= (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 |
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.
using Mantid::CurveFitting::AugmentedLagrangianOptimizer::ObjFunction = boost::function<double(const size_t, const double *)> |
Function type.
Definition at line 57 of file AugmentedLagrangianOptimizer.h.
|
inline |
Constructor.
nparams | The number of parameters in the problem |
objfunc | An 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.
|
inline |
Constructor with constraints.
nparams | The number of parameters in the problem |
objfunc | An 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 |
equality | A matrix of coefficients, \(A_{eq}\) such that in the final solution \(A_{eq} x = 0\) |
inequality | A matrix of coefficients, \(A\) such that in the final solution \(A_{eq} x\geq 0\) |
Definition at line 85 of file AugmentedLagrangianOptimizer.h.
|
delete |
Disable default constructor.
|
delete |
Disable copy operator.
|
private |
Sanity check for constraint inputs.
equality | A matrix of equality constraints \(A_{eq}\)(the number of columns must match number of parameters) where \(A_{eq} x = 0\) |
inequality | A 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().
void Mantid::CurveFitting::AugmentedLagrangianOptimizer::minimize | ( | std::vector< double > & | xv | ) | const |
Perform the minimization.
Perform the minimization using the Augmented Lagrangian routine.
xv | The 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().
|
inline |
Definition at line 104 of file AugmentedLagrangianOptimizer.h.
Referenced by checkConstraints(), and minimize().
|
inline |
Definition at line 106 of file AugmentedLagrangianOptimizer.h.
Referenced by checkConstraints(), and minimize().
|
inline |
Definition at line 102 of file AugmentedLagrangianOptimizer.h.
Referenced by checkConstraints(), minimize(), and unconstrainedOptimization().
|
delete |
Disable assignment operator.
|
inline |
Override the maximum number of iterations (Default = 500)
maxIter | Maximum value for the main minimizer loop |
Definition at line 112 of file AugmentedLagrangianOptimizer.h.
|
private |
Using gradient optimizer to perform limited optimization of current set.
lambda | |
mu | |
rho | |
xcur | The 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().
|
friend |
Definition at line 118 of file AugmentedLagrangianOptimizer.h.
|
private |
Defines the equality constraints.
Definition at line 135 of file AugmentedLagrangianOptimizer.h.
Referenced by minimize(), and unconstrainedOptimization().
|
private |
Defines the inequality constraints.
Definition at line 139 of file AugmentedLagrangianOptimizer.h.
Referenced by minimize(), and unconstrainedOptimization().
|
private |
Maximum number of iterations.
Definition at line 141 of file AugmentedLagrangianOptimizer.h.
Referenced by minimize().
|
private |
Number of equality constraints.
Definition at line 133 of file AugmentedLagrangianOptimizer.h.
|
private |
Number of inequality constraints.
Definition at line 137 of file AugmentedLagrangianOptimizer.h.
|
private |
Number of parameters under minimization.
Definition at line 131 of file AugmentedLagrangianOptimizer.h.
|
private |
User-defined function.
Definition at line 129 of file AugmentedLagrangianOptimizer.h.
Referenced by minimize(), and unconstrainedOptimization().