9#include "MantidKernel/DllConfig.h"
57 : m_nparams(nparams), m_neq(0), m_nineq(0), m_objfunc(objfunc), m_constraintNorms() {}
74 : m_nparams(nparams), m_neq(equality.numRows()), m_nineq(inequality.numRows()), m_objfunc(objfunc),
76 initializeConstraints(equality, inequality);
96 std::vector<double> minimize(
const std::vector<double> &x0)
const;
104 inline double fvalue(
const std::vector<double> &x)
const {
return m_objfunc.eval(
x); }
106 void fprime(std::vector<double> &grad,
const std::vector<double> &x)
const;
108 void evaluateConstraints(std::vector<double> &constrValues,
const std::vector<double> &x)
const;
121 virtual double eval(
const std::vector<double> &x)
const = 0;
126 double eval(
const std::vector<double> &x)
const override {
return func.eval(
x); }
139 double eval(
const std::vector<double> &x)
const {
return m_funcHolder->eval(
x); }
virtual double eval(const std::vector< double > &x) const =0
virtual ~BaseHolder()=default
double eval(const std::vector< double > &x) const override
T func
The actual function supplied by the user.
TypeHolder(const T &func)
Non-templated wrapper for objective function object to allow it to be stored without templating the c...
FunctionWrapper(const T &func)
Construct.
double eval(const std::vector< double > &x) const
Calls user supplied function.
std::unique_ptr< BaseHolder > m_funcHolder
Templated holder.
Minimize an objective function using the SLSQP optimization subroutine originally implemented by Diet...
SLSQPMinimizer()=delete
Disable default constructor.
const size_t m_nineq
Number of inequality constraints.
SLSQPMinimizer & operator=(const SLSQPMinimizer &)=delete
Disable assignment operator.
const size_t m_neq
Number of equality constraints.
size_t numInequalityConstraints() const
size_t numParameters() const
size_t numEqualityConstraints() const
SLSQPMinimizer(const size_t nparams, const T &objfunc)
Constructor.
FunctionWrapper m_objfunc
User-defined function.
SLSQPMinimizer(const size_t nparams, const T &objfunc, const DblMatrix &equality, const DblMatrix &inequality)
Constructor with constraints.
const size_t m_nparams
Number of parameters under minimization.
SLSQPMinimizer(const SLSQPMinimizer &)=delete
Disable copy operator.
double fvalue(const std::vector< double > &x) const
Compute the value of the objective function.
std::vector< double > m_constraintNorms
Holder for constraint normals.
Helper class which provides the Collimation Length for SANS instruments.