#include <IpStdInterfaceTNLP.hpp>
The standard C interface is exposed to the user as a single C function that is given problem dimension, starting points, and pointers for functions that evaluate objective function etc.
Public Member Functions | |
Constructors/Destructors | |
StdInterfaceTNLP (Index n_var, const Number *x_L, const Number *x_U, Index n_con, const Number *g_L, const Number *g_U, Index nele_jac, Index nele_hess, Index index_style, const Number *start_x, const Number *start_lam, const Number *start_z_L, const Number *start_z_U, Eval_F_CB eval_f, Eval_G_CB eval_g, Eval_Grad_F_CB eval_grad_f, Eval_Jac_G_CB eval_jac_g, Eval_H_CB eval_h, Number *x_sol, Number *z_L_sol, Number *z_U_sol, Number *g_sol, Number *lam_sol, Number *obj_sol, UserDataPtr user_data) | |
Constructor, given dimensions of problem, function pointers for evaluation callback functions, and starting points. | |
virtual | ~StdInterfaceTNLP () |
Default destructor. | |
methods to gather information about the NLP. These methods are | |
virtual bool | get_nlp_info (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, IndexStyleEnum &index_style) |
returns dimensions of the nlp. | |
virtual bool | get_bounds_info (Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u) |
returns bounds of the nlp. | |
virtual 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) |
provides a starting point for the nlp variables. | |
virtual bool | eval_f (Index n, const Number *x, bool new_x, Number &obj_value) |
evaluates the objective value for the nlp. | |
virtual bool | eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f) |
evaluates the gradient of the objective for the nlp. | |
virtual bool | eval_g (Index n, const Number *x, bool new_x, Index m, Number *g) |
evaluates the constraint residuals for the nlp. | |
virtual bool | eval_jac_g (Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values) |
specifies the jacobian structure (if values is NULL) and evaluates the jacobian values (if values is not NULL) for the nlp. | |
virtual 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) |
specifies the structure of the hessian of the lagrangian (if values is NULL) and evaluates the values (if values is not NULL). | |
Solution Methods | |
virtual 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) |
This method is called when the algorithm is complete so the TNLP can store/write the solution. |
StdInterfaceTNLP | ( | Index | n_var, | |
const Number * | x_L, | |||
const Number * | x_U, | |||
Index | n_con, | |||
const Number * | g_L, | |||
const Number * | g_U, | |||
Index | nele_jac, | |||
Index | nele_hess, | |||
Index | index_style, | |||
const Number * | start_x, | |||
const Number * | start_lam, | |||
const Number * | start_z_L, | |||
const Number * | start_z_U, | |||
Eval_F_CB | eval_f, | |||
Eval_G_CB | eval_g, | |||
Eval_Grad_F_CB | eval_grad_f, | |||
Eval_Jac_G_CB | eval_jac_g, | |||
Eval_H_CB | eval_h, | |||
Number * | x_sol, | |||
Number * | z_L_sol, | |||
Number * | z_U_sol, | |||
Number * | g_sol, | |||
Number * | lam_sol, | |||
Number * | obj_sol, | |||
UserDataPtr | user_data | |||
) |
Constructor, given dimensions of problem, function pointers for evaluation callback functions, and starting points.
Note that the constrctor does not make a copy of any of the Number arrays, i.e. it is up to the called to keep them around.
References ASSERT_EXCEPTION.
~StdInterfaceTNLP | ( | ) | [virtual] |
Default destructor.
bool get_nlp_info | ( | Index & | n, | |
Index & | m, | |||
Index & | nnz_jac_g, | |||
Index & | nnz_h_lag, | |||
IndexStyleEnum & | index_style | |||
) | [virtual] |
returns dimensions of the nlp.
Overloaded from TNLP
Implements TNLP.
References TNLP::C_STYLE, and TNLP::FORTRAN_STYLE.
bool get_bounds_info | ( | Index | n, | |
Number * | x_l, | |||
Number * | x_u, | |||
Index | m, | |||
Number * | g_l, | |||
Number * | g_u | |||
) | [virtual] |
returns bounds of the nlp.
Overloaded from TNLP
Implements TNLP.
References DBG_ASSERT, and fkinkryx::i.
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 | |||
) | [virtual] |
provides a starting point for the nlp variables.
Overloaded from TNLP
Implements TNLP.
References DBG_ASSERT, and fkinkryx::i.
evaluates the objective value for the nlp.
Overloaded from TNLP
Implements TNLP.
References DBG_ASSERT.
evaluates the gradient of the objective for the nlp.
Overloaded from TNLP
Implements TNLP.
References DBG_ASSERT.
evaluates the constraint residuals for the nlp.
Overloaded from TNLP
Implements TNLP.
References DBG_ASSERT.
bool eval_jac_g | ( | Index | n, | |
const Number * | x, | |||
bool | new_x, | |||
Index | m, | |||
Index | nele_jac, | |||
Index * | iRow, | |||
Index * | jCol, | |||
Number * | values | |||
) | [virtual] |
specifies the jacobian structure (if values is NULL) and evaluates the jacobian values (if values is not NULL) for the nlp.
Overloaded from TNLP
Implements TNLP.
References DBG_ASSERT.
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 | |||
) | [virtual] |
specifies the structure of the hessian of the lagrangian (if values is NULL) and evaluates the values (if values is not NULL).
Overloaded from TNLP
Reimplemented from TNLP.
References DBG_ASSERT, and fkinkryx::i.
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 | |||
) | [virtual] |
This method is called when the algorithm is complete so the TNLP can store/write the solution.
Implements TNLP.
References Ipopt::IpBlasDcopy().