4 #include <boost/property_tree/ptree.hpp>
12 namespace Optimization {
24 Optimizer(std::shared_ptr<muq::Modeling::ModPiece>
const& cost,
25 boost::property_tree::ptree
const& pt);
45 static std::shared_ptr<Optimizer>
Construct(std::shared_ptr<muq::Modeling::ModPiece>
const& cost,
46 boost::property_tree::ptree
const& options);
49 typedef std::function<std::shared_ptr<Optimizer>(std::shared_ptr<muq::Modeling::ModPiece>
const&, boost::property_tree::ptree)>
OptimizerConstructor;
96 virtual std::pair<Eigen::VectorXd, double>
Solve(std::vector<Eigen::VectorXd>
const& inputs) = 0;
102 static std::shared_ptr<CostFunction>
ConvertModPiece(std::shared_ptr<muq::Modeling::ModPiece>
const& modCost);
105 std::shared_ptr<CostFunction>
opt;
129 #define REGISTER_OPTIMIZER(OPTNAME, CLASSNAME) static auto optReg ##OPTNAME = muq::Optimization::Optimizer::GetOptimizerMap()->insert(std::make_pair(#OPTNAME, muq::Utilities::shared_factory<CLASSNAME>()));
Base class for MUQ's modelling envronment.
Solve an optimization problem.
virtual ~Optimizer()=default
Optimizer(std::shared_ptr< muq::Modeling::ModPiece > const &cost, boost::property_tree::ptree const &pt)
std::function< std::shared_ptr< Optimizer >std::shared_ptr< muq::Modeling::ModPiece > const &, boost::property_tree::ptree)> OptimizerConstructor
std::vector< std::shared_ptr< muq::Modeling::ModPiece > > ineqConstraints
Inequality constraints.
const double constraint_tol
Tolerance on the constraints.
std::shared_ptr< CostFunction > opt
The cost function that we are trying to minimize.
void ClearEqualityConstraint()
Clear all equality constraints.
virtual void AddInequalityConstraint(std::vector< std::shared_ptr< muq::Modeling::ModPiece >> const &ineq)
Add an inequality constraint to the optimization.
static std::shared_ptr< Optimizer > Construct(std::shared_ptr< muq::Modeling::ModPiece > const &cost, boost::property_tree::ptree const &options)
static std::shared_ptr< CostFunction > ConvertModPiece(std::shared_ptr< muq::Modeling::ModPiece > const &modCost)
virtual void AddEqualityConstraint(std::vector< std::shared_ptr< muq::Modeling::ModPiece >> const &eq)
Add an equality constraint to the optimization.
std::vector< std::shared_ptr< muq::Modeling::ModPiece > > eqConstraints
Equality constraints.
virtual void EvaluateImpl(muq::Modeling::ref_vector< boost::any > const &inputs) override
User-implemented function that determines the behavior of this muq::Modeling::WorkPiece.
virtual std::pair< Eigen::VectorXd, double > Solve(std::vector< Eigen::VectorXd > const &inputs)=0
Solve the optimization problem.
const unsigned int maxEvals
Maximum number of cost function evaluations.
std::map< std::string, OptimizerConstructor > OptimizerMap
void ClearInequalityConstraint()
Clear all inequality constraints.
const double ftol_rel
Relative and absolute tolerances on the cost function value and on the difference between successive ...
static void ListMethods(std::string prefix="")
static std::shared_ptr< OptimizerMap > GetOptimizerMap()
std::vector< std::reference_wrapper< const T > > ref_vector
A vector of references to something ...