3#include <IpIpoptCalculatedQuantities.hpp>
13 mvec null{
nullptr, 0};
21 mvec null{
nullptr, 0};
28 Index &nnz_h_lag, IndexStyleEnum &index_style) {
38 index_style = TNLP::C_STYLE;
46 mvec{x_u, n} = C.upperbound;
49 mvec{g_u, m} = D.upperbound;
55 Index m,
bool init_lambda,
67 mvec{z_L, n}.setZero();
71 mvec{z_U, n}.setZero();
77 mvec{lambda, m}.setZero();
89 [[maybe_unused]]
bool new_x,
Number *grad_f) {
101 [[maybe_unused]]
bool new_x,
Index m,
105 throw std::logic_error(
"Missing required function: eval_jac_g");
106 if (values ==
nullptr)
116 [[maybe_unused]]
bool new_lambda,
Index nele_hess,
119 throw std::logic_error(
"Missing required function: eval_hess_L");
121 if (values ==
nullptr) {
128 mvec{values, nele_hess});
132 mmat H{values, n, n};
133 for (
Index c = 0; c < n; ++c)
134 for (
Index r = c + 1; r < n; ++r)
145 const Ipopt::IpoptData *ip_data,
146 Ipopt::IpoptCalculatedQuantities *ip_cq) {
164 for (
Index c = 0; c < n; ++c) {
167 for (
Index i = inner_start; i < inner_end; ++i) {
179 for (
Index c = 0; c < n; ++c) {
180 for (
Index r = 0; r < m; ++r) {
IpoptAdapter(const Problem &problem)
static void set_sparsity(Index n, Index m, Index nele, Index *iRow, Index *jCol, const Sparsity &sp)
bool eval_g(Index n, const Number *x, bool new_x, Index m, Number *g) override
bool eval_grad_f(Index n, const Number *x, bool new_x, Number *grad_f) override
bool eval_h(Index n, const Number *x, bool new_x, Number obj_factor, Index m, const Number *lambda, bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values) override
bool get_starting_point(Index n, bool init_x, Number *x, bool init_z, Number *z_L, Number *z_U, Index m, bool init_lambda, Number *lambda) override
bool get_bounds_info(Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u) override
vec initial_guess_bounds_multipliers_l
struct alpaqa::IpoptAdapter::Results results
struct alpaqa::IpoptAdapter::Sparsity sparsity_J
bool eval_f(Index n, const Number *x, bool new_x, Number &obj_value) override
bool get_nlp_info(Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, IndexStyleEnum &index_style) override
bool eval_jac_g(Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values) override
Ipopt::SolverReturn status
vec initial_guess_multipliers
vec initial_guess_bounds_multipliers_u
void finalize_solution(Ipopt::SolverReturn status, Index n, const Number *x, const Number *z_L, const Number *z_U, Index m, const Number *g, const Number *lambda, Number obj_value, const Ipopt::IpoptData *ip_data, Ipopt::IpoptCalculatedQuantities *ip_cq) override
struct alpaqa::IpoptAdapter::Sparsity sparsity_H
bool provides_eval_hess_L() const
Returns true if the problem provides an implementation of eval_hess_L.
const Box & get_box_D() const
[Optional] Get the rectangular constraint set of the general constraint function, .
bool provides_eval_jac_g() const
Returns true if the problem provides an implementation of eval_jac_g.
length_t get_n() const
[Required] Number of decision variables.
length_t get_m() const
[Required] Number of constraints.
void eval_hess_L(crvec x, crvec y, real_t scale, rindexvec inner_idx, rindexvec outer_ptr, rvec H_values) const
[Optional] Function that evaluates the Hessian of the Lagrangian as a sparse matrix,
void eval_grad_f(crvec x, rvec grad_fx) const
[Required] Function that evaluates the gradient of the cost,
real_t eval_f(crvec x) const
[Required] Function that evaluates the cost,
void eval_g(crvec x, rvec gx) const
[Required] Function that evaluates the constraints,
length_t get_jac_g_num_nonzeros() const
[Optional] Function that gets the number of nonzeros of the sparse Jacobian of the constraints.
const Box & get_box_C() const
[Optional] Get the rectangular constraint set of the decision variables, .
void eval_jac_g(crvec x, rindexvec inner_idx, rindexvec outer_ptr, rvec J_values) const
[Optional] Function that evaluates the Jacobian of the constraints as a sparse matrix,
length_t get_hess_L_num_nonzeros() const
[Optional] Function that gets the number of nonzeros of the sparse Hessian of the Lagrangian.
typename Conf::length_t length_t
typename Conf::cmvec cmvec