12 namespace problem_ns {
17 class Grasp :
public Ipopt::TNLP
21 std::vector<Force> result;
24 bool get_nlp_info(Ipopt::Index &n, Ipopt::Index &m,
25 Ipopt::Index &nnz_jac_g,
26 Ipopt::Index &nnz_h_lag,
27 IndexStyleEnum &index_style)
override;
30 bool get_bounds_info(Ipopt::Index n, Ipopt::Number *x_l,
31 Ipopt::Number *x_u, Ipopt::Index m,
32 Ipopt::Number *g_l, Ipopt::Number *g_u)
override;
35 bool get_starting_point(Ipopt::Index n,
bool init_x,
36 Ipopt::Number *x,
bool init_z,
37 Ipopt::Number *z_L, Ipopt::Number *z_U,
38 Ipopt::Index m,
bool init_lambda,
39 Ipopt::Number *lambda)
override;
42 bool eval_f(Ipopt::Index n,
const Ipopt::Number *x,
43 bool new_x, Ipopt::Number &obj_value)
override;
46 bool eval_grad_f(Ipopt::Index n,
const Ipopt::Number *x,
47 bool new_x, Ipopt::Number *grad_f)
override;
50 bool eval_g(Ipopt::Index n,
const Ipopt::Number *x,
51 bool new_x, Ipopt::Index m, Ipopt::Number *g)
override;
54 bool eval_jac_g(Ipopt::Index n,
const Ipopt::Number *x,
55 bool new_x, Ipopt::Index m, Ipopt::Index nele_jac,
56 Ipopt::Index *iRow, Ipopt::Index *jCol,
57 Ipopt::Number *values)
override;
60 bool eval_h(Ipopt::Index n,
const Ipopt::Number *x,
bool new_x,
61 Ipopt::Number obj_factor, Ipopt::Index m,
const Ipopt::Number *lambda,
62 bool new_lambda, Ipopt::Index nele_hess, Ipopt::Index *iRow,
63 Ipopt::Index *jCol, Ipopt::Number *values)
override
69 void finalize_solution(Ipopt::SolverReturn status,
70 Ipopt::Index n,
const Ipopt::Number *x,
71 const Ipopt::Number *z_L,
72 const Ipopt::Number *z_U, Ipopt::Index m,
73 const Ipopt::Number *g,
const Ipopt::Number *lambda,
74 Ipopt::Number obj_value,
const Ipopt::IpoptData *ip_data,
75 Ipopt::IpoptCalculatedQuantities *ip_cq)
override;
79 Grasp(
const Problem &problem_) : problem(problem_), result(2) { }
82 const std::vector<Force>& get_result()
const
101 const bool verbose=
true);
static std::vector< Force > solve(const Problem &problem, const bool verbose=true)
Definition: solver.cpp:118