Ipopt
3.12.12
|
Implementation of a TNLP for the Standard C interface. More...
#include <IpStdInterfaceTNLP.hpp>
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, Intermediate_CB intermediate_cb, Number *x_sol, Number *z_L_sol, Number *z_U_sol, Number *g_sol, Number *lam_sol, Number *obj_sol, UserDataPtr user_data, Number obj_scaling=1, const Number *x_scaling=NULL, const Number *g_scaling=NULL) | |
Constructor, given dimensions of problem, function pointers for evaluation callback functions, and starting points. More... | |
virtual | ~StdInterfaceTNLP () |
Default destructor. More... | |
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. More... | |
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. More... | |
virtual bool | get_scaling_parameters (Number &obj_scaling, bool &use_x_scaling, Index n, Number *x_scaling, bool &use_g_scaling, Index m, Number *g_scaling) |
returns scaling parameters (if nlp_scaling_method is selected as user-scaling). More... | |
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. More... | |
virtual bool | eval_f (Index n, const Number *x, bool new_x, Number &obj_value) |
evaluates the objective value for the nlp. More... | |
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. More... | |
virtual bool | eval_g (Index n, const Number *x, bool new_x, Index m, Number *g) |
evaluates the constraint residuals for the nlp. More... | |
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. More... | |
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). More... | |
virtual bool | intermediate_callback (AlgorithmMode mode, Index iter, Number obj_value, Number inf_pr, Number inf_du, Number mu, Number d_norm, Number regularization_size, Number alpha_du, Number alpha_pr, Index ls_trials, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq) |
Intermediate Callback method for the user. More... | |
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, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq) |
This method is called when the algorithm is complete so the TNLP can store/write the solution. More... | |
![]() | |
DECLARE_STD_EXCEPTION (INVALID_TNLP) | |
TNLP () | |
virtual | ~TNLP () |
Default destructor. More... | |
virtual void | finalize_metadata (Index n, const StringMetaDataMapType &var_string_md, const IntegerMetaDataMapType &var_integer_md, const NumericMetaDataMapType &var_numeric_md, Index m, const StringMetaDataMapType &con_string_md, const IntegerMetaDataMapType &con_integer_md, const NumericMetaDataMapType &con_numeric_md) |
This method is called just before finalize_solution. More... | |
virtual Index | get_number_of_nonlinear_variables () |
virtual bool | get_list_of_nonlinear_variables (Index num_nonlin_vars, Index *pos_nonlin_vars) |
virtual bool | get_var_con_metadata (Index n, StringMetaDataMapType &var_string_md, IntegerMetaDataMapType &var_integer_md, NumericMetaDataMapType &var_numeric_md, Index m, StringMetaDataMapType &con_string_md, IntegerMetaDataMapType &con_integer_md, NumericMetaDataMapType &con_numeric_md) |
overload this method to return any meta data for the variables and the constraints More... | |
virtual bool | get_variables_linearity (Index n, LinearityType *var_types) |
overload this method to return the variables linearity (TNLP::LINEAR or TNLP::NON_LINEAR). More... | |
virtual bool | get_constraints_linearity (Index m, LinearityType *const_types) |
overload this method to return the constraint linearity. More... | |
virtual bool | get_warm_start_iterate (IteratesVector &warm_start_iterate) |
overload this method to provide an Ipopt iterate (already in the form Ipopt requires it internally) for a warm start. More... | |
![]() | |
ReferencedObject () | |
virtual | ~ReferencedObject () |
Index | ReferenceCount () const |
void | AddRef (const Referencer *referencer) const |
void | ReleaseRef (const Referencer *referencer) const |
Private Member Functions | |
void | apply_new_x (bool new_x, Index n, const Number *x) |
Internal function to update the internal and ampl state if the x value changes. More... | |
Default Compiler Generated Methods | |
(Hidden to avoid implicit creation/calling). These methods are not implemented and we do not want the compiler to implement them for us, so we declare them private and do not define them. This ensures that they will not be implicitly created/called. | |
StdInterfaceTNLP () | |
Default Constructor. More... | |
StdInterfaceTNLP (const StdInterfaceTNLP &) | |
Copy Constructor. More... | |
void | operator= (const StdInterfaceTNLP &) |
Overloaded Equals Operator. More... | |
Private Attributes | |
SmartPtr< const Journalist > | jnlst_ |
Journlist. More... | |
Number * | non_const_x_ |
A non-const copy of x - this is kept up-to-date in apply_new_x. More... | |
Number * | x_sol_ |
Pointers to the user provided vectors for solution. More... | |
Number * | z_L_sol_ |
Number * | z_U_sol_ |
Number * | g_sol_ |
Number * | lambda_sol_ |
Number * | obj_sol_ |
Information about the problem | |
const Index | n_var_ |
Number of variables. More... | |
const Index | n_con_ |
Number of constraints. More... | |
const Number * | x_L_ |
Pointer to Number array containing lower bounds for variables. More... | |
const Number * | x_U_ |
Pointer to Number array containing upper bounds for variables. More... | |
const Number * | g_L_ |
Pointer to Number array containing lower bounds for constraints. More... | |
const Number * | g_U_ |
Pointer to Number array containing upper bounds for constraints. More... | |
const Index | nele_jac_ |
Number of non-zero elements in the constraint Jacobian. More... | |
const Index | nele_hess_ |
Number of non-zero elements in the Hessian. More... | |
const Index | index_style_ |
Starting value of the iRow and jCol parameters for matrices. More... | |
const Number * | start_x_ |
Pointer to Number array containing starting point for variables. More... | |
const Number * | start_lam_ |
Poitner to Number array containing starting values for constraint multipliers. More... | |
const Number * | start_z_L_ |
Pointer to Number array containing starting values for lower bound multipliers. More... | |
const Number * | start_z_U_ |
Pointer to Number array containing starting values for upper bound multipliers. More... | |
Eval_F_CB | eval_f_ |
Pointer to callback function evaluating value of objective function. More... | |
Eval_G_CB | eval_g_ |
Pointer to callback function evaluating value of constraints. More... | |
Eval_Grad_F_CB | eval_grad_f_ |
Pointer to callback function evaluating gradient of objective function. More... | |
Eval_Jac_G_CB | eval_jac_g_ |
Pointer to callback function evaluating Jacobian of constraints. More... | |
Eval_H_CB | eval_h_ |
Pointer to callback function evaluating Hessian of Lagrangian. More... | |
Intermediate_CB | intermediate_cb_ |
Pointer to intermediate callback function giving control to user. More... | |
UserDataPtr | user_data_ |
Pointer to user data. More... | |
Number | obj_scaling_ |
Objective scaling factor. More... | |
const Number * | x_scaling_ |
Scaling factors for variables (if not NULL) More... | |
const Number * | g_scaling_ |
Scaling factors for constraints (if not NULL) More... | |
Additional Inherited Members | |
![]() | |
enum | LinearityType { LINEAR, NON_LINEAR } |
Type of the constraints. More... | |
enum | IndexStyleEnum { C_STYLE =0, FORTRAN_STYLE =1 } |
overload this method to return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian. More... | |
typedef std::map< std::string, std::vector< std::string > > | StringMetaDataMapType |
typedef std::map< std::string, std::vector< Index > > | IntegerMetaDataMapType |
typedef std::map< std::string, std::vector< Number > > | NumericMetaDataMapType |
Implementation of a TNLP for the Standard C interface.
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.
Definition at line 30 of file IpStdInterfaceTNLP.hpp.
Ipopt::StdInterfaceTNLP::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, | ||
Intermediate_CB | intermediate_cb, | ||
Number * | x_sol, | ||
Number * | z_L_sol, | ||
Number * | z_U_sol, | ||
Number * | g_sol, | ||
Number * | lam_sol, | ||
Number * | obj_sol, | ||
UserDataPtr | user_data, | ||
Number | obj_scaling = 1 , |
||
const Number * | x_scaling = NULL , |
||
const Number * | g_scaling = NULL |
||
) |
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.
|
virtual |
Default destructor.
|
private |
Default Constructor.
|
private |
Copy Constructor.
|
virtual |
|
virtual |
returns scaling parameters (if nlp_scaling_method is selected as user-scaling).
Overloaded from TNLP
Reimplemented from Ipopt::TNLP.
|
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 Ipopt::TNLP.
|
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 Ipopt::TNLP.
|
virtual |
|
virtual |
This method is called when the algorithm is complete so the TNLP can store/write the solution.
Implements Ipopt::TNLP.
Internal function to update the internal and ampl state if the x value changes.
|
private |
Overloaded Equals Operator.
|
private |
Journlist.
Definition at line 146 of file IpStdInterfaceTNLP.hpp.
|
private |
Number of variables.
Definition at line 151 of file IpStdInterfaceTNLP.hpp.
|
private |
Number of constraints.
Definition at line 153 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to Number array containing lower bounds for variables.
Definition at line 155 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to Number array containing upper bounds for variables.
Definition at line 157 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to Number array containing lower bounds for constraints.
Definition at line 159 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to Number array containing upper bounds for constraints.
Definition at line 161 of file IpStdInterfaceTNLP.hpp.
|
private |
Number of non-zero elements in the constraint Jacobian.
Definition at line 163 of file IpStdInterfaceTNLP.hpp.
|
private |
Number of non-zero elements in the Hessian.
Definition at line 165 of file IpStdInterfaceTNLP.hpp.
|
private |
Starting value of the iRow and jCol parameters for matrices.
Definition at line 167 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to Number array containing starting point for variables.
Definition at line 169 of file IpStdInterfaceTNLP.hpp.
|
private |
Poitner to Number array containing starting values for constraint multipliers.
Definition at line 172 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to Number array containing starting values for lower bound multipliers.
Definition at line 175 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to Number array containing starting values for upper bound multipliers.
Definition at line 178 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to callback function evaluating value of objective function.
Definition at line 180 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to callback function evaluating value of constraints.
Definition at line 182 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to callback function evaluating gradient of objective function.
Definition at line 185 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to callback function evaluating Jacobian of constraints.
Definition at line 187 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to callback function evaluating Hessian of Lagrangian.
Definition at line 189 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to intermediate callback function giving control to user.
Definition at line 191 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointer to user data.
Definition at line 193 of file IpStdInterfaceTNLP.hpp.
|
private |
Objective scaling factor.
Definition at line 195 of file IpStdInterfaceTNLP.hpp.
|
private |
Scaling factors for variables (if not NULL)
Definition at line 197 of file IpStdInterfaceTNLP.hpp.
|
private |
Scaling factors for constraints (if not NULL)
Definition at line 199 of file IpStdInterfaceTNLP.hpp.
|
private |
A non-const copy of x - this is kept up-to-date in apply_new_x.
Definition at line 204 of file IpStdInterfaceTNLP.hpp.
|
private |
Pointers to the user provided vectors for solution.
Definition at line 207 of file IpStdInterfaceTNLP.hpp.
|
private |
Definition at line 208 of file IpStdInterfaceTNLP.hpp.
|
private |
Definition at line 209 of file IpStdInterfaceTNLP.hpp.
|
private |
Definition at line 210 of file IpStdInterfaceTNLP.hpp.
|
private |
Definition at line 211 of file IpStdInterfaceTNLP.hpp.
|
private |
Definition at line 212 of file IpStdInterfaceTNLP.hpp.