3#include <IpIpoptCalculatedQuantities.hpp>
12 mvec null{
nullptr, 0};
19 mvec null{
nullptr, 0};
26 Index &nnz_h_lag, IndexStyleEnum &index_style) {
36 index_style = TNLP::C_STYLE;
44 mvec{x_u, n} = C.upperbound;
47 mvec{g_u, m} = D.upperbound;
53 Index m,
bool init_lambda,
65 mvec{z_L, n}.setZero();
69 mvec{z_U, n}.setZero();
75 mvec{lambda, m}.setZero();
87 [[maybe_unused]]
bool new_x,
Number *grad_f) {
99 [[maybe_unused]]
bool new_x,
Index m,
103 throw std::logic_error(
"Missing required function: eval_jac_g");
104 if (values ==
nullptr)
114 [[maybe_unused]]
bool new_lambda,
Index nele_hess,
117 throw std::logic_error(
"Missing required function: eval_hess_L");
119 if (values ==
nullptr) {
126 mvec{values, nele_hess});
130 mmat H{values, n, n};
131 for (
Index c = 0; c < n; ++c)
132 for (
Index r = c + 1; r < n; ++r)
143 const Ipopt::IpoptData *ip_data,
144 Ipopt::IpoptCalculatedQuantities *ip_cq) {
162 for (
Index c = 0; c < n; ++c) {
165 for (
Index i = inner_start; i < inner_end; ++i) {
177 for (
Index c = 0; c < n; ++c) {
178 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 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 Hessian of the Lagrangian.
typename Conf::length_t length_t
typename Conf::cmvec cmvec