nag_opt_handle_print (e04ryc) (PDF version)
e04 Chapter Contents
e04 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_opt_handle_print (e04ryc)

 Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_opt_handle_print (e04ryc) 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 matrix constraints.

2  Specification

#include <nag.h>
#include <nage04.h>
void  nag_opt_handle_print (void *handle, Nag_FileID fileid, const char *cmdstr, NagError *fail)

3  Description

nag_opt_handle_print (e04ryc) prints information on a problem handle which has been previously initialized by nag_opt_handle_init (e04rac). 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:
Overview
Gives a brief overview of the problem handle, particularly, which phase it is in, if the problem or optional parameters can be edited and which parts of the problem have already been set. This might be helpful to clarify situations when fail.code= NE_ALREADY_DEFINED or NE_PHASE is obtained from functions, such as, nag_opt_handle_set_linobj (e04rec), nag_opt_handle_set_quadobj (e04rfc), nag_opt_handle_set_simplebounds (e04rhc) and nag_opt_handle_set_linconstr (e04rjc).
Objective
Prints the objective function as it was defined by nag_opt_handle_set_linobj (e04rec) or nag_opt_handle_set_quadobj (e04rfc) if it is linear or quadratic. Prints the sparsity structure of the objective function as it was defined by nag_opt_handle_set_nlnobj (e04rgc) if it is nonlinear.
Simple bounds
Prints the variable bounds as defined by nag_opt_handle_set_simplebounds (e04rhc). This might help you understand the effect of the optional parameter Infinite Bound Size on the bounds.
Linear constraints bounds
Linear constraints detailed
Print bounds or linear constraint matrix as defined by nag_opt_handle_set_linconstr (e04rjc).
Matrix constraints
Gives a list of the matrix constraints as defined by nag_opt_handle_set_linmatineq (e04rnc) and nag_opt_handle_set_quadmatineq (e04rpc). 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 nag_opt_handle_set_linmatineq (e04rnc) and nag_opt_handle_set_quadmatineq (e04rpc).
Nonlinear constraints bounds
Nonlinear constraints detailed
Print bounds or sparsity structure of the nonlinear constraints as defined by nag_opt_handle_set_nlnconstr (e04rkc).
Multipliers sizes
Prints the expected dimensions of array arguments u and ua of the solver nag_opt_handle_solve_pennon (e04svc) which store the Lagrangian multipliers for standard and matrix constraints, respectively. This might be helpful in particular in connection with Overview and Matrix constraints to check the way the sizes of the arrays are derived.
Options
Prints all the current optional parameters. It flags whether the argument is at its default choice, 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).
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 Qij and Qji are merged by nag_opt_handle_set_quadmatineq (e04rpc)).

4  References

None.

5  Arguments

1:     handle void *Input
On entry: the handle to the problem. It needs to be initialized by nag_opt_handle_init (e04rac) and must not be changed.
2:     fileid Nag_FileIDInput
On entry: the identifier associated with the file (or standard output) to be written to, as returned by a call of nag_open_file (x04acc).
Constraint: fileid0.
3:     cmdstr const char *Input
On entry: 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.
Constraint: cmdstr 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.
4:     fail NagError *Input/Output
The NAG error argument (see Section 2.7 in How to Use the NAG Library and its Documentation).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_FILEID
On entry, fileid=value.
Constraint: fileid0.
NE_HANDLE
The supplied handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been initialized by nag_opt_handle_init (e04rac) or it has been corrupted.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
An unexpected error has been triggered by this function. Please contact NAG.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_STR_UNKNOWN
cmdstr does not contain any keywords or is empty.
Keyword number value is not recognized.
Keyword number value is not recognized, it is too long.
NE_WRITE_ERROR
An error occurred when writing to output.

7  Accuracy

Not applicable.

8  Parallelism and Performance

nag_opt_handle_print (e04ryc) is not threaded in any implementation.

9  Further Comments

None.

10  Example

This example shows the life-cycle of a handle of a typical (BMI-SDP) problem by printing the overview of the handle in various stages of the problem formulation and after the solution is found. It is also helpful to notice how a linear matrix inequality is extended with the bilinear term, see nag_opt_handle_init (e04rac) and nag_opt_handle_set_quadmatineq (e04rpc) for further details.
The problem is as follows:
minimize x,y​ ​​ ​ y subject to   1 x-1 y x-1 3/4 0 y 0 16 0 x -xy -xy 1 0 x0 -3y3  
The solution is x=1/4, y=-2.
Note that the matrix constraints need to be supplied in the form of equation (3) in nag_opt_handle_set_quadmatineq (e04rpc), i.e.,
i,j=1 n xi xj Qijk + i=1 n xi Aik - A0k 0 ,  k=1,,mA .  
Therefore the first constraint is defined by matrices
A 0 1 = -1 1 0 -3/4 0 -16 ,  A 1 1 = 0 1 0 0 0 0 ,  A 2 1 = 0 0 1 0 0 0  
and the second one by
A 0 2 = 0 0 -1 ,  A 1 2 = 1 0 0 ,  A 2 2 ​ empty,  Q 12 2 = 0 -1 0 0 .  
See also Section 10 in nag_opt_handle_init (e04rac) for links to further examples in the suite.

10.1  Program Text

Program Text (e04ryce.c)

10.2  Program Data

None.

10.3  Program Results

Program Results (e04ryce.r)


nag_opt_handle_print (e04ryc) (PDF version)
e04 Chapter Contents
e04 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2016