#### Method get_nlp_info

with prototype
```virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
Index& nnz_h_lag, IndexStyleEnum& index_style)
```
Give IPOPT the information about the size of the problem (and hence, the size of the arrays that it needs to allocate).
• n: (out), the number of variables in the problem (dimension of ).
• m: (out), the number of constraints in the problem (dimension of ).
• nnz_jac_g: (out), the number of nonzero entries in the Jacobian.
• nnz_h_lag: (out), the number of nonzero entries in the Hessian.
• index_style: (out), the numbering style used for row/col entries in the sparse matrix format (C_STYLE: 0-based, FORTRAN_STYLE: 1-based; see also Appendix A).
IPOPT uses this information when allocating the arrays that it will later ask you to fill with values. Be careful in this method since incorrect values will cause memory bugs which may be very difficult to find.

Our example problem has 4 variables (n), and 2 constraints (m). The constraint Jacobian for this small problem is actually dense and has 8 nonzeros (we still need to represent this Jacobian using the sparse matrix triplet format). The Hessian of the Lagrangian has 10 ``symmetric'' nonzeros (i.e., nonzeros in the lower left triangular part.). Keep in mind that the number of nonzeros is the total number of elements that may ever be nonzero, not just those that are nonzero at the starting point. This information is set once for the entire problem.

```bool HS071_NLP::get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
Index& nnz_h_lag, IndexStyleEnum& index_style)
{
// The problem described in HS071_NLP.hpp has 4 variables, x[0] through x[3]
n = 4;

// one equality constraint and one inequality constraint
m = 2;

// in this example the Jacobian is dense and contains 8 nonzeros
nnz_jac_g = 8;

// the Hessian is also dense and has 16 total nonzeros, but we
// only need the lower left corner (since it is symmetric)
nnz_h_lag = 10;

// use the C style indexing (0-based)
index_style = TNLP::C_STYLE;

return true;
}
```

Andreas Waechter 2010-12-22