NAG CPP Interface
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.
template <typename COMM>
void function handle_print(COMM &comm, const types::f77_integer nout, const string cmdstr, OptionalE04RY opt)
template <typename COMM>
void function handle_print(COMM &comm, const types::f77_integer nout, const string cmdstr)
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, e04rsf (no CPP interface) and e04rtf (no CPP interface) 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 optional parameter 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 e04rsf (no CPP interface) and e04rtf (no CPP interface).
- Cone constraints
Cone constraints detailed
- Prints all second-order cone constraints as defined by handle_set_group. For each cone constraint, its idgroup, 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 e04rnf (no CPP interface) and e04rpf (no CPP interface). For each matrix constraint its idblk, 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 e04rnf (no CPP interface) and e04rpf (no CPP interface).
- 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 u and ua of the solver e04svf (no CPP interface) 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.
- Prints all the current optional parameters. 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
are merged by e04rpf (no CPP interface)
See Section 3.1
in the E04
Chapter Introduction for more details about the NAG optimization modelling suite.
An object of either the derived class CommE04RA
or its base class NoneCopyableComm
can be supplied.
It is recommended that the derived class is used. If the base class is supplied it must
first be initialized via a call to opt::handle_init (e04ra)
On entry: the Fortran unit number 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 cmdstr
must be separated by commas or semicolons.
can only contain one or more of the following accepted keywords: overview, objective, simple bounds, linear constraints bounds, linear constraints detailed, matrix constraints, matrix constraints detailed, nonlinear constraints bounds, nonlinear constraints detailed, multipliers sizes, options.
Optional parameter container, derived from Optional
Exceptions and Warnings
Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid
, stored either as a member of the thrown exception object (see errorid
), or as a member of
, depending on how errors
and warnings are being handled (see Error Handling
for more details).
- Raises: ErrorException
- comm::handle has not been initialized.
- comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
- comm::handle has not been initialized properly or is corrupted.
- On entry, .
- Keyword number is not recognized.
- Keyword number is not recognized, it is too long.
- cmdstr does not contain any keywords or is empty.
- An error occurred when writing to output.
- On entry, the communication class has not been initialized correctly.
- An exception was thrown during IO (writing).
- An unexpected error has been triggered by this routine.
- Your licence key may have expired or may not have been installed correctly.
- Dynamic memory allocation failed.
Parallelism and Performance
Please see the description for the underlying computational routine in this section of the
FL Interface documentation
Examples of the use of this method may be found in the examples for: handle_solve_ipopt