24#include <adolc/adolc.h>
25#include <adolc/adolc_sparse.h>
26#include <adolc/adouble.h>
27#include <coin/IpIpoptApplication.hpp>
28#include <coin/IpIpoptCalculatedQuantities.hpp>
29#include <coin/IpIpoptData.hpp>
30#include <coin/IpOrigIpoptNLP.hpp>
31#include <coin/IpSolveStatistics.hpp>
32#include <coin/IpTNLP.hpp>
33#include <coin/IpTNLPAdapter.hpp>
34#include <coin/IpTypes.hpp>
47 std::vector<double> bounds);
60 std::vector<double>* ptr_y)
const;
63 bool get_nlp_info(
int& n,
int& m,
int& nnz_jac_g,
int& nnz_h_lag,
64 IndexStyleEnum& index_style)
override;
67 bool get_bounds_info(
int n,
double* x_l,
double* x_u,
int m,
double* g_l,
68 double* g_u)
override;
72 double* z_L,
double* z_U,
int m,
bool init_lambda,
73 double* lambda)
override;
76 bool eval_f(
int n,
const double* x,
bool new_x,
double& obj_value)
override;
79 bool eval_grad_f(
int n,
const double* x,
bool new_x,
double* grad_f)
override;
82 bool eval_g(
int n,
const double* x,
bool new_x,
int m,
double* g)
override;
88 bool eval_jac_g(
int n,
const double* x,
bool new_x,
int m,
int nele_jac,
89 int* iRow,
int* jCol,
double* values)
override;
96 bool eval_h(
int n,
const double* x,
bool new_x,
double obj_factor,
int m,
97 const double* lambda,
bool new_lambda,
int nele_hess,
int* iRow,
98 int* jCol,
double* values)
override;
104 const double* z_L,
const double* z_U,
int m,
105 const double* g,
const double* lambda,
106 double obj_value,
const Ipopt::IpoptData* ip_data,
107 Ipopt::IpoptCalculatedQuantities* ip_cq)
override;
113 bool eval_obj(
int n,
const T* x, T* obj_value);
120 virtual void generate_tapes(
int n,
int m,
int* nnz_jac_g,
int* nnz_h_lag);
125 std::vector<std::pair<double, double>> ref_points_;
127 std::vector<double> bounds_;
129 std::vector<double> opt_x_;
131 std::vector<double> opt_y_;
133 size_t num_of_variables_ = 0;
135 size_t num_of_constraints_ = 0;
137 size_t nnz_jac_g_ = 0;
139 size_t nnz_h_lag_ = 0;
141 size_t num_of_points_ = 0;
143 std::map<std::pair<size_t, size_t>,
size_t> idx_map_;
145 void hessian_strcuture();
147 double weight_cos_included_angle_ = 0.0;
149 double weight_anchor_points_ = 0.0;
151 double weight_length_ = 0.0;
155 bool use_automatic_differentiation_ =
false;
161 std::vector<double> obj_lam_;
173 unsigned int* rind_g_;
174 unsigned int* cind_g_;
176 unsigned int* rind_L_;
177 unsigned int* cind_L_;
void set_automatic_differentiation_flag(const bool use_ad)
virtual ~CosThetaIpoptInterface()=default
bool eval_jac_g(int n, const double *x, bool new_x, int m, int nele_jac, int *iRow, int *jCol, double *values) override
Method to return: 1) The structure of the jacobian (if "values" is nullptr) 2) The values of the jaco...
bool eval_constraints(int n, const T *x, int m, T *g)
Template to compute contraints
bool eval_grad_f(int n, const double *x, bool new_x, double *grad_f) override
Method to return the gradient of the objective
bool get_bounds_info(int n, double *x_l, double *x_u, int m, double *g_l, double *g_u) override
Method to return the bounds for my problem
bool eval_f(int n, const double *x, bool new_x, double &obj_value) override
Method to return the objective value
bool eval_g(int n, const double *x, bool new_x, int m, double *g) override
Method to return the constraint residuals
void set_weight_length(const double weight_length)
virtual void generate_tapes(int n, int m, int *nnz_jac_g, int *nnz_h_lag)
Method to generate the required tapes
void finalize_solution(Ipopt::SolverReturn status, int n, const double *x, const double *z_L, const double *z_U, int m, const double *g, const double *lambda, double 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
bool eval_h(int n, const double *x, bool new_x, double obj_factor, int m, const double *lambda, bool new_lambda, int nele_hess, int *iRow, int *jCol, double *values) override
Method to return: 1) The structure of the hessian of the lagrangian (if "values" is nullptr) 2) The v...
bool eval_obj(int n, const T *x, T *obj_value)
Template to return the objective value
void set_weight_cos_included_angle(const double weight_cos_included_angle)
bool get_starting_point(int n, bool init_x, double *x, bool init_z, double *z_L, double *z_U, int m, bool init_lambda, double *lambda) override
Method to return the starting point for the algorithm
void get_optimization_results(std::vector< double > *ptr_x, std::vector< double > *ptr_y) const
void set_weight_anchor_points(const double weight_anchor_points)
bool get_nlp_info(int &n, int &m, int &nnz_jac_g, int &nnz_h_lag, IndexStyleEnum &index_style) override
Method to return some info about the nlp
Planning module main class.