1 #ifndef NLOPTOPTIMIZATION_H_
2 #define NLOPTOPTIMIZATION_H_
4 #include <boost/property_tree/ptree.hpp>
12 namespace Optimization {
17 NLoptOptimizer(std::shared_ptr<muq::Modeling::ModPiece>
const& cost,
18 boost::property_tree::ptree
const& pt);
22 virtual std::pair<Eigen::VectorXd, double>
Solve(std::vector<Eigen::VectorXd>
const& inputs)
override;
34 static double Cost(
unsigned int n,
virtual void EvaluateImpl(muq::Modeling::ref_vector< boost::any > const &inputs) override
Override the evaluate impl method (solve the optimization problem)
const nlopt_algorithm algorithm
The algorithm used to solve the problem.
static double Cost(unsigned int n, const double *x, double *grad, void *f_data)
Evaluate either the cost function or a constraint.
static void Constraint(unsigned int m, double *result, unsigned int n, const double *x, double *grad, void *f_data)
virtual ~NLoptOptimizer()=default
NLoptOptimizer(std::shared_ptr< muq::Modeling::ModPiece > const &cost, boost::property_tree::ptree const &pt)
virtual std::pair< Eigen::VectorXd, double > Solve(std::vector< Eigen::VectorXd > const &inputs) override
Solve the optimization problem.
nlopt_algorithm NLOptAlgorithm(std::string const &alg) const
Get the NLOPT algorithm we are using.
const bool minimize
True: minimize the cost function, False: maximize the cost function.
Solve an optimization problem.
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...