bool get_bounds_info(Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u) override { g_l[0] = -2; g_u[0] = -2; return true; }
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 { for (Index i = 0; i < n; i++) { x[i] = 0; } return true; }
bool eval_f(Index n, const Number *x, bool new_x, Number &obj_value) override { obj_value = std::abs(x[0] * x[0] - 5); return true; }
bool eval_grad_f(Index n, const Number *x, bool new_x, Number *grad_f) override { grad_f[0] = 2 * x[0]; return true; }
bool eval_g(Index n, const Number *x, bool new_x, Index m, Number *g) override { g[0] = x[0] * x[0]; return true; }
bool eval_jac_g(Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values) override { if (values == nullptr) { iRow[0] = 0; jCol[0] = 0; } else { values[0] = 2 * x[0]; } return true; }
void finalize_solution(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 IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq) override { } };
int main(int argv, char **argc) { SmartPtr mynlp = new Dummy_NLP(); SmartPtr app = IpoptApplicationFactory(); app->Options()->SetNumericValue("tol", 3.82e-6); app->Options()->SetStringValue("mu_strategy", "adaptive"); app->Options()->SetStringValue("output_file", "ipopt.out"); ApplicationReturnStatus status; status = app->Initialize(); if (status != Solve_Succeeded) { std::cout