Ipopt::TNLP Class Reference

Base class for all NLP's that use standard triplet matrix form and dense vectors. More...

#include <IpTNLP.hpp>

Inheritance diagram for Ipopt::TNLP:
Inheritance graph
[legend]
Collaboration diagram for Ipopt::TNLP:
Collaboration graph
[legend]

List of all members.

Public Types

enum  LinearityType { LINEAR, NON_LINEAR }
 

Type of the constraints.

More...

Public Member Functions

 DECLARE_STD_EXCEPTION (INVALID_TNLP)
Constructors/Destructors



 TNLP ()
 Default destructor.
virtual ~TNLP ()
 Default destructor.
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)=0
 This method is called when the algorithm is complete so the TNLP can store/write the solution.
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.
Methods for quasi-Newton approximation. If the second

derivatives are approximated by Ipopt, it is better to do this only in the space of nonlinear variables.

The following methods are call by Ipopt if the quasi-Newton approximation is selected. If -1 is returned as number of nonlinear variables, Ipopt assumes that all variables are nonlinear. Otherwise, it calls get_list_of_nonlinear_variables with an array into which the indices of the nonlinear variables should be written - the array has the lengths num_nonlin_vars, which is identical with the return value of get_number_of_nonlinear_variables(). It is assumed that the indices are counted starting with 1 in the FORTRAN_STYLE, and 0 for the C_STYLE.



virtual Index get_number_of_nonlinear_variables ()
virtual bool get_list_of_nonlinear_variables (Index num_nonlin_vars, Index *pos_nonlin_vars)

Private Member Functions

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.



 TNLP (const TNLP &)
 Default Constructor.
void operator= (const TNLP &)
 Overloaded Equals Operator.

methods to gather information about the NLP



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...
virtual bool get_nlp_info (Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, IndexStyleEnum &index_style)=0
 overload this method to return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian.
virtual bool get_bounds_info (Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u)=0
 overload this method to return the information about the bound on the variables and constraints.
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)
 overload this method to return scaling parameters.
virtual bool get_variables_linearity (Index n, LinearityType *var_types)
 overload this method to return the variables linearity (TNLP::Linear or TNLP::NonLinear).
virtual bool get_constraints_linearity (Index m, LinearityType *const_types)
 overload this method to return the constraint linearity.
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)=0
 overload this method to return the starting point.
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.
virtual bool eval_f (Index n, const Number *x, bool new_x, Number &obj_value)=0
 overload this method to return the value of the objective function
virtual bool eval_grad_f (Index n, const Number *x, bool new_x, Number *grad_f)=0
 overload this method to return the vector of the gradient of the objective w.r.t.
virtual bool eval_g (Index n, const Number *x, bool new_x, Index m, Number *g)=0
 overload this method to return the vector of constraint values
virtual bool eval_jac_g (Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values)=0
 overload this method to return the jacobian of the constraints.
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)
 overload this method to return the hessian of the lagrangian.
virtual bool set_variable_values (Index n, const Number *x, bool new_x, Index m, const Number *lambda, bool new_lambda)
 this method is called if option ??? is set.

Detailed Description

Base class for all NLP's that use standard triplet matrix form and dense vectors.

This is the standard base class for all NLP's that use the standard triplet matrix form (as for Harwell routines) and dense vectors. The class TNLPAdapter then converts this interface to an interface that can be used directly by ipopt.

This interface presents the problem form:

min f(x)

s.t. gL <= g(x) <= gU

xL <= x <= xU

In order to specify an equality constraint, set gL_i = gU_i = rhs. The value that indicates "infinity" for the bounds (i.e. the variable or constraint has no lower bound (-infinity) or upper bound (+infinity)) is set through the option nlp_lower_bound_inf and nlp_upper_bound_inf. To indicate that a variable has no upper or lower bound, set the bound to -ipopt_inf or +ipopt_inf respectively

Definition at line 48 of file IpTNLP.hpp.


Member Enumeration Documentation

Type of the constraints.

Enumerator:
LINEAR 

Constraint/Variable is linear.

NON_LINEAR 

Constraint/Varaible is non-linear.

Definition at line 52 of file IpTNLP.hpp.

overload this method to return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian.

The index_style parameter lets you specify C or Fortran style indexing for the sparse matrix iRow and jCol parameters. C_STYLE is 0-based, and FORTRAN_STYLE is 1-based.

Enumerator:
C_STYLE 
FORTRAN_STYLE 

Definition at line 78 of file IpTNLP.hpp.


Constructor & Destructor Documentation

Ipopt::TNLP::TNLP (  )  [inline]

Default destructor.

Definition at line 60 of file IpTNLP.hpp.

virtual Ipopt::TNLP::~TNLP (  )  [inline, virtual]

Default destructor.

Definition at line 64 of file IpTNLP.hpp.

Ipopt::TNLP::TNLP ( const TNLP  )  [private]

Default Constructor.

Copy Constructor


Member Function Documentation

Ipopt::TNLP::DECLARE_STD_EXCEPTION ( INVALID_TNLP   ) 
virtual bool Ipopt::TNLP::get_nlp_info ( Index n,
Index m,
Index nnz_jac_g,
Index nnz_h_lag,
IndexStyleEnum index_style 
) [pure virtual]

overload this method to return the number of variables and constraints, and the number of non-zeros in the jacobian and the hessian.

The index_style parameter lets you specify C or Fortran style indexing for the sparse matrix iRow and jCol parameters. C_STYLE is 0-based, and FORTRAN_STYLE is 1-based.

Implemented in MatlabProgram, MyNLP, HS071_NLP, LuksanVlcek1, LuksanVlcek2, LuksanVlcek3, LuksanVlcek4, LuksanVlcek5, LuksanVlcek6, LuksanVlcek7, MittelmannBndryCntrlDiriBase, MittelmannBndryCntrlDiriBase3D, MittelmannBndryCntrlDiriBase3D_27, MittelmannBndryCntrlDiriBase3Dsin, MittelmannBndryCntrlNeumBase, MittelmannDistCntrlDiriBase, MittelmannDistCntrlNeumABase, MittelmannDistCntrlNeumBBase, MittelmannParaCntrlBase< T >, Ipopt::AmplTNLP, Ipopt::StdInterfaceTNLP, and IpoptProblem.

virtual bool Ipopt::TNLP::get_bounds_info ( Index  n,
Number x_l,
Number x_u,
Index  m,
Number g_l,
Number g_u 
) [pure virtual]

overload this method to return the information about the bound on the variables and constraints.

The value that indicates that a bound does not exist is specified in the parameters nlp_lower_bound_inf and nlp_upper_bound_inf. By default, nlp_lower_bound_inf is -1e19 and nlp_upper_bound_inf is 1e19. (see TNLPAdapter)

Implemented in MatlabProgram, MyNLP, HS071_NLP, LuksanVlcek1, LuksanVlcek2, LuksanVlcek3, LuksanVlcek4, LuksanVlcek5, LuksanVlcek6, LuksanVlcek7, MittelmannBndryCntrlDiriBase, MittelmannBndryCntrlDiriBase3D, MittelmannBndryCntrlDiriBase3D_27, MittelmannBndryCntrlDiriBase3Dsin, MittelmannBndryCntrlNeumBase, MittelmannDistCntrlDiriBase, MittelmannDistCntrlNeumABase, MittelmannDistCntrlNeumBBase, MittelmannParaCntrlBase< T >, Ipopt::AmplTNLP, Ipopt::StdInterfaceTNLP, and IpoptProblem.

virtual bool Ipopt::TNLP::get_scaling_parameters ( Number obj_scaling,
bool &  use_x_scaling,
Index  n,
Number x_scaling,
bool &  use_g_scaling,
Index  m,
Number g_scaling 
) [inline, virtual]

overload this method to return scaling parameters.

This is only called if the options are set to retrieve user scaling. There, use_x_scaling (or use_g_scaling) should get set to true only if the variables (or constraints) are to be scaled. This method should return true only if the scaling parameters could be provided.

Reimplemented in MittelmannBndryCntrlDiriBase, MittelmannBndryCntrlDiriBase3D, MittelmannBndryCntrlDiriBase3D_27, MittelmannBndryCntrlDiriBase3Dsin, MittelmannBndryCntrlNeumBase, MittelmannDistCntrlDiriBase, MittelmannDistCntrlNeumABase, MittelmannDistCntrlNeumBBase, MittelmannParaCntrlBase< T >, Ipopt::AmplTNLP, Ipopt::StdInterfaceTNLP, and IpoptProblem.

Definition at line 98 of file IpTNLP.hpp.

virtual bool Ipopt::TNLP::get_variables_linearity ( Index  n,
LinearityType var_types 
) [inline, virtual]

overload this method to return the variables linearity (TNLP::Linear or TNLP::NonLinear).

The var_types array should be allocated with length at least n. (default implementation just return false and does not fill the array).

Definition at line 111 of file IpTNLP.hpp.

virtual bool Ipopt::TNLP::get_constraints_linearity ( Index  m,
LinearityType const_types 
) [inline, virtual]

overload this method to return the constraint linearity.

array should be alocated with length at least n. (default implementation just return false and does not fill the array).

Reimplemented in Ipopt::AmplTNLP.

Definition at line 119 of file IpTNLP.hpp.

virtual bool Ipopt::TNLP::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 
) [pure virtual]

overload this method to return the starting point.

The bools init_x and init_lambda are both inputs and outputs. As inputs, they indicate whether or not the algorithm wants you to initialize x and lambda respectively. If, for some reason, the algorithm wants you to initialize these and you cannot, set the respective bool to false.

Implemented in MatlabProgram, MyNLP, HS071_NLP, LuksanVlcek1, LuksanVlcek2, LuksanVlcek3, LuksanVlcek4, LuksanVlcek5, LuksanVlcek6, LuksanVlcek7, MittelmannBndryCntrlDiriBase, MittelmannBndryCntrlDiriBase3D, MittelmannBndryCntrlDiriBase3D_27, MittelmannBndryCntrlDiriBase3Dsin, MittelmannBndryCntrlNeumBase, MittelmannDistCntrlDiriBase, MittelmannDistCntrlNeumABase, MittelmannDistCntrlNeumBBase, MittelmannParaCntrlBase< T >, Ipopt::AmplTNLP, Ipopt::StdInterfaceTNLP, and IpoptProblem.

virtual bool Ipopt::TNLP::get_warm_start_iterate ( IteratesVector warm_start_iterate  )  [inline, virtual]

overload this method to provide an Ipopt iterate (already in the form Ipopt requires it internally) for a warm start.

Since this is only for expert users, a default dummy implementation is provided and returns false.

Definition at line 140 of file IpTNLP.hpp.

virtual bool Ipopt::TNLP::eval_f ( Index  n,
const Number x,
bool  new_x,
Number obj_value 
) [pure virtual]
virtual bool Ipopt::TNLP::eval_grad_f ( Index  n,
const Number x,
bool  new_x,
Number grad_f 
) [pure virtual]
virtual bool Ipopt::TNLP::eval_g ( Index  n,
const Number x,
bool  new_x,
Index  m,
Number g 
) [pure virtual]
virtual bool Ipopt::TNLP::eval_jac_g ( Index  n,
const Number x,
bool  new_x,
Index  m,
Index  nele_jac,
Index iRow,
Index jCol,
Number values 
) [pure virtual]

overload this method to return the jacobian of the constraints.

The vectors iRow and jCol only need to be set once. The first call is used to set the structure only (iRow and jCol will be non-NULL, and values will be NULL) For subsequent calls, iRow and jCol will be NULL.

Implemented in MatlabProgram, MyNLP, HS071_NLP, LuksanVlcek1, LuksanVlcek2, LuksanVlcek3, LuksanVlcek4, LuksanVlcek5, LuksanVlcek6, LuksanVlcek7, MittelmannBndryCntrlDiriBase, MittelmannBndryCntrlDiriBase3D, MittelmannBndryCntrlDiriBase3D_27, MittelmannBndryCntrlDiriBase3Dsin, MittelmannBndryCntrlNeumBase, MittelmannDistCntrlDiriBase, MittelmannDistCntrlNeumABase, MittelmannDistCntrlNeumBBase, MittelmannParaCntrlBase< T >, Ipopt::AmplTNLP, Ipopt::StdInterfaceTNLP, and IpoptProblem.

virtual bool Ipopt::TNLP::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 
) [inline, virtual]

overload this method to return the hessian of the lagrangian.

The vectors iRow and jCol only need to be set once (during the first call). The first call is used to set the structure only (iRow and jCol will be non-NULL, and values will be NULL) For subsequent calls, iRow and jCol will be NULL. This matrix is symmetric - specify the lower diagonal only. A default implementation is provided, in case the user wants to se quasi-Newton approximations to estimate the second derivatives and doesn't not neet to implement this method.

Reimplemented in MatlabProgram, MyNLP, HS071_NLP, LuksanVlcek1, LuksanVlcek2, LuksanVlcek3, LuksanVlcek4, LuksanVlcek5, LuksanVlcek6, LuksanVlcek7, MittelmannBndryCntrlDiriBase, MittelmannBndryCntrlDiriBase3D, MittelmannBndryCntrlDiriBase3D_27, MittelmannBndryCntrlDiriBase3Dsin, MittelmannBndryCntrlNeumBase, MittelmannDistCntrlDiriBase, MittelmannDistCntrlNeumABase, MittelmannDistCntrlNeumBBase, MittelmannParaCntrlBase< T >, Ipopt::AmplTNLP, Ipopt::StdInterfaceTNLP, and IpoptProblem.

Definition at line 175 of file IpTNLP.hpp.

virtual bool Ipopt::TNLP::set_variable_values ( Index  n,
const Number x,
bool  new_x,
Index  m,
const Number lambda,
bool  new_lambda 
) [inline, virtual]

this method is called if option ??? is set.

In that case, the algorithm calls this method with the values of variables and multipliers that will be used for the next calls of any evaluation method.

Definition at line 187 of file IpTNLP.hpp.

virtual void Ipopt::TNLP::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 
) [pure virtual]
virtual bool Ipopt::TNLP::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 
) [inline, virtual]

Intermediate Callback method for the user.

Providing dummy default implementation. For details see IntermediateCallBack in IpNLP.hpp.

Definition at line 208 of file IpTNLP.hpp.

virtual Index Ipopt::TNLP::get_number_of_nonlinear_variables (  )  [inline, virtual]

Reimplemented in Ipopt::AmplTNLP.

Definition at line 235 of file IpTNLP.hpp.

virtual bool Ipopt::TNLP::get_list_of_nonlinear_variables ( Index  num_nonlin_vars,
Index pos_nonlin_vars 
) [inline, virtual]

Reimplemented in Ipopt::AmplTNLP.

Definition at line 240 of file IpTNLP.hpp.

void Ipopt::TNLP::operator= ( const TNLP  )  [private]

The documentation for this class was generated from the following file:

Generated on 15 Mar 2015 for Coin-All by  doxygen 1.6.1