naginterfaces.library.opt.handle_print(handle, nout, cmdstr, io_manager=None)[source]

handle_print is a part of the NAG optimization modelling suite. It allows you to print information about the problem, stored as a handle, such as which parts have already been defined or details of the constraints.

For full information please refer to the NAG Library document for e04ry


The handle to the problem. It needs to be initialized (e.g., by handle_init()) and must not be changed between calls to the NAG optimization modelling suite.


The unit number (see unit_from_fileobj()) which identifies the file to be written to.


A command string which contains one or more keywords which identify the piece of information about the handle to be printed. Keywords are case-insensitive and space tolerant. Multiple keywords in must be separated by commas or semicolons.

io_managerFileObjManager, optional

Manager for I/O in this routine.

(errno )

has not been initialized.

(errno )

does not belong to the NAG optimization modelling suite, has not been initialized properly or is corrupted.

(errno )

has not been initialized properly or is corrupted.

(errno )

On entry, .

Constraint: .

(errno )

Keyword number is not recognized.

(errno )

Keyword number is not recognized, it is too long.

(errno )

does not contain any keywords or is empty.

(errno )

An error occurred when writing to output.


handle_print prints information on a problem handle which has been previously correctly initialized (e.g., by handle_init()). Various pieces of information can be retrieved and printed to the given output unit. This can be helpful when the function is interfaced from interactive environments, for debugging purposes or to help familiarize you with the NAG optimization modelling suite.

The printer is guided by a command string which contains one or more of the following keywords:


Gives a brief overview of the problem handle, particularly, the problem dimension and which parts of the problem have already been set.


Prints the objective function as it was defined by handle_set_linobj(), handle_set_quadobj(), handle_set_qconstr() or handle_set_qconstr_fac() when it is linear or quadratic. Prints the sparsity structure of the objective function as it was defined by handle_set_nlnobj() when it is nonlinear or nonlinear least squares by handle_set_nlnls().

Simple bounds

Prints the variable bounds as defined by handle_set_simplebounds(). This might help you understand the effect of the option ‘Infinite Bound Size’ on the bounds.

Linear constraints bounds Linear constraints detailed

Prints the bounds or the linear constraint matrix as defined by handle_set_linconstr().

Quadratic constraints detailed

Prints all the quadratic constraints including all nonzeros of quadratic, linear and constant terms as defined by handle_set_qconstr() and handle_set_qconstr_fac().

Cone constraints Cone constraints detailed

Prints all second-order cone constraints as defined by handle_set_group(). For each cone constraint, its , dimension and type are printed. If details are requested, the variables composing the cone constraint are also listed.

Matrix constraints

Gives a list of the matrix constraints as defined by handle_set_linmatineq() and handle_set_quadmatineq(). For each matrix constraint its , dimension and order (e.g., linear, bilinear) are printed.

Matrix constraints detailed

Prints all the matrix constraints including all nonzeros of all the matrices as formulated by handle_set_linmatineq() and handle_set_quadmatineq().

Nonlinear constraints bounds Nonlinear constraints detailed

Prints the bounds or sparsity structure of the nonlinear constraints as defined by handle_set_nlnconstr().

Multipliers sizes

Prints the expected dimensions of arrays storing the Lagrangian multipliers, such as and of the solver handle_solve_pennon() which store the Lagrangian multipliers for standard and matrix constraints, respectively. This might be helpful with Overview and Matrix constraints to check the way the sizes of the arrays are derived.

Options Options solver

Prints all the current options. It flags whether the argument is set to its default, whether you have set it or whether it is chosen by the solver (for example, options left on ‘AUTO’ setting after the solver has been called). In addition, you can print optional parameters belonging to a specific solver by adding the solver name after Options, e.g., keywords Options e04mt or Options handle_solve_lp_ipm print options only belonging to the linear programming solver handle_solve_lp_ipm().

Note that the output data might not match your input exactly. The sparse matrices are typically transposed, sorted and explicit zeros removed and in certain cases transformed as needed (for example, matrices and are merged by handle_set_quadmatineq()).

See the E04 Introduction for more details about the NAG optimization modelling suite.