33 #ifndef DART_OPTIMIZER_IPOPT_IPOPTSOLVER_HPP_
34 #define DART_OPTIMIZER_IPOPT_IPOPTSOLVER_HPP_
39 #if IPOPT_VERSION_GE(3, 13, 0)
40 # include <IpIpoptApplication.hpp>
41 # include <IpTNLP.hpp>
43 # include <coin/IpIpoptApplication.hpp>
44 # include <coin/IpTNLP.hpp>
63 explicit IpoptSolver(std::shared_ptr<Problem> _problem);
69 bool solve()
override;
72 std::string
getType()
const override;
75 std::shared_ptr<Solver>
clone()
const override;
81 Ipopt::SmartPtr<const Ipopt::IpoptApplication>
getApplication()
const;
87 const Ipopt::SmartPtr<Ipopt::IpoptApplication>& _app);
90 Ipopt::SmartPtr<Ipopt::TNLP>
mNlp;
110 Ipopt::Index& nnz_jac_g,
111 Ipopt::Index& nnz_h_lag,
112 Ipopt::TNLP::IndexStyleEnum& index_style)
override;
121 Ipopt::Number* g_u)
override;
133 Ipopt::Number* lambda)
override;
138 const Ipopt::Number* _x,
140 Ipopt::Number& _obj_value)
override;
145 const Ipopt::Number* _x,
147 Ipopt::Number* _grad_f)
override;
152 const Ipopt::Number* _x,
155 Ipopt::Number* _g)
override;
162 const Ipopt::Number* _x,
165 Ipopt::Index _nele_jac,
168 Ipopt::Number* _values)
override;
177 const Ipopt::Number* _x,
179 Ipopt::Number _obj_factor,
181 const Ipopt::Number* _lambda,
183 Ipopt::Index _nele_hess,
186 Ipopt::Number* _values)
override;
191 Ipopt::SolverReturn _status,
193 const Ipopt::Number* _x,
194 const Ipopt::Number* _z_L,
195 const Ipopt::Number* _z_U,
197 const Ipopt::Number* _g,
198 const Ipopt::Number* _lambda,
199 Ipopt::Number _obj_value,
200 const Ipopt::IpoptData* _ip_data,
201 Ipopt::IpoptCalculatedQuantities* _ip_cq)
override;
class DartTNLP
Definition: IpoptSolver.hpp:98
bool get_starting_point(Ipopt::Index n, bool init_x, Ipopt::Number *x, bool init_z, Ipopt::Number *z_L, Ipopt::Number *z_U, Ipopt::Index m, bool init_lambda, Ipopt::Number *lambda) override
Method to return the starting point for the algorithm.
Definition: IpoptSolver.cpp:238
void finalize_solution(Ipopt::SolverReturn _status, Ipopt::Index _n, const Ipopt::Number *_x, const Ipopt::Number *_z_L, const Ipopt::Number *_z_U, Ipopt::Index _m, const Ipopt::Number *_g, const Ipopt::Number *_lambda, Ipopt::Number _obj_value, const Ipopt::IpoptData *_ip_data, Ipopt::IpoptCalculatedQuantities *_ip_cq) override
This method is called when the algorithm is complete so the TNLP can store/write the solution.
Definition: IpoptSolver.cpp:447
bool eval_grad_f(Ipopt::Index _n, const Ipopt::Number *_x, bool _new_x, Ipopt::Number *_grad_f) override
Method to return the gradient of the objective.
Definition: IpoptSolver.cpp:297
bool get_nlp_info(Ipopt::Index &n, Ipopt::Index &m, Ipopt::Index &nnz_jac_g, Ipopt::Index &nnz_h_lag, Ipopt::TNLP::IndexStyleEnum &index_style) override
Method to return some info about the nlp.
Definition: IpoptSolver.cpp:163
virtual ~DartTNLP()
Definition: IpoptSolver.cpp:157
IpoptSolver * mSolver
DART optimization problem.
Definition: IpoptSolver.hpp:208
Eigen::VectorXd mObjGradient
Objective gradient.
Definition: IpoptSolver.hpp:214
bool get_bounds_info(Ipopt::Index n, Ipopt::Number *x_l, Ipopt::Number *x_u, Ipopt::Index m, Ipopt::Number *g_l, Ipopt::Number *g_u) override
Method to return the bounds for my problem.
Definition: IpoptSolver.cpp:191
bool eval_h(Ipopt::Index _n, const Ipopt::Number *_x, bool _new_x, Ipopt::Number _obj_factor, Ipopt::Index _m, const Ipopt::Number *_lambda, bool _new_lambda, Ipopt::Index _nele_hess, Ipopt::Index *_iRow, Ipopt::Index *_jCol, Ipopt::Number *_values) override
Method to return: 1) The structure of the hessian of the lagrangian (if "values" is nullptr) 2) The v...
Definition: IpoptSolver.cpp:416
Eigen::MatrixXd mObjHessian
Objective Hessian.
Definition: IpoptSolver.hpp:217
bool eval_f(Ipopt::Index _n, const Ipopt::Number *_x, bool _new_x, Ipopt::Number &_obj_value) override
Method to return the objective value.
Definition: IpoptSolver.cpp:280
bool eval_jac_g(Ipopt::Index _n, const Ipopt::Number *_x, bool _new_x, Ipopt::Index _m, Ipopt::Index _nele_jac, Ipopt::Index *_iRow, Ipopt::Index *_jCol, Ipopt::Number *_values) override
Method to return: 1) The structure of the jacobian (if "values" is nullptr) 2) The values of the jaco...
Definition: IpoptSolver.cpp:355
Ipopt::Number mObjValue
Objective value.
Definition: IpoptSolver.hpp:211
bool eval_g(Ipopt::Index _n, const Ipopt::Number *_x, bool _new_x, Ipopt::Index _m, Ipopt::Number *_g) override
Method to return the constraint residuals.
Definition: IpoptSolver.cpp:313
DartTNLP(IpoptSolver *_solver)
Definition: IpoptSolver.cpp:151
class IpoptSolver
Definition: IpoptSolver.hpp:57
std::shared_ptr< Solver > clone() const override
Create an identical clone of this Solver.
Definition: IpoptSolver.cpp:120
Ipopt::SmartPtr< Ipopt::IpoptApplication > mIpoptApp
Main application class for making calls to Ipopt.
Definition: IpoptSolver.hpp:93
const Ipopt::SmartPtr< Ipopt::IpoptApplication > & getApplication()
Get the application interface for this IpoptSolver.
Definition: IpoptSolver.cpp:129
IpoptSolver(const Solver::Properties &_properties=Solver::Properties())
Default constructor.
Definition: IpoptSolver.cpp:45
std::string getType() const override
Get the type (implementation) of this Solver.
Definition: IpoptSolver.cpp:114
bool solve() override
Solve optimization problem.
Definition: IpoptSolver.cpp:76
virtual ~IpoptSolver()
Destructor.
Definition: IpoptSolver.cpp:70
Ipopt::SmartPtr< Ipopt::TNLP > mNlp
IPOPT nonlinear programming problem.
Definition: IpoptSolver.hpp:90
Abstract class that provides a common interface for different Solvers.
Definition: Solver.hpp:53
Definition: BulletCollisionDetector.cpp:65
The Solver::Properties class contains Solver parameters that are common to all Solver types.
Definition: Solver.hpp:60