naginterfaces.library.opt.handle_​set_​get_​real

naginterfaces.library.opt.handle_set_get_real(handle, cmdstr, rarr=None)[source]

handle_set_get_real is a part of the NAG optimization modelling suite. It allows a piece of real information to be read from or written to the problem stored in the handle. For example, it may be used to extract the current approximation of the solution during a monitoring step.

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

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/e04/e04rxf.html

Parameters
handleHandle

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

cmdstrstr

A string which identifies the item within the handle to be read or written. The string is case insensitive and space tolerant.

rarrNone or float, array-like, shape , optional

If is not None (write mode), must contain the information to be written to the handle.

Returns
lrarrint

In write mode and when the size of the input does not match the item identified by , is the correct expected size. Otherwise, it is merely the actual size of the relevant .

rarrNone or float, ndarray, shape

If was None on entry (read mode), contains the information requested by .

Raises
NagValueError
(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 )

The provided is not recognised.

(errno )

Reading mode is not supported for the given .

(errno )

Writing mode is not supported for the given .

(errno )

The requested information is not available.

(errno )

The request cannot be processed at this phase.

Notes

handle_set_get_real adds an additional means of communication to functions within the NAG optimization modelling suite. It allows you to either read or write a piece of information in the handle in the form of a real array. The item is identified by and the direction of the communication is set by the presence or absence of .

The following are available:

Primal Variables or X

The current value of the primal variables.

Dual Variables or U

The current value of the dual variables (Lagrangian multipliers for bounds, linear, quadratic and nonlinear constraints).

Dual Cone Variables or UC

The current value of the dual cone variables (Lagrangian multipliers for quadratic cone constraints).

Dual Matrix Variables or UA

The current value of the dual matrix variables (Lagrangian multipliers for matrix inequality constraints).

Residual Weights or RW

Array of residual weights.

Covariance Matrix or COV

Covariance matrix of the primal variables.

Hessian Matrix or HES

The current value of the Hessian matrix.

Variance or VAR

Variance for the primal variables.

MCS List or MCSL

Used to provide a custom initialization list for the solver glopt.handle_solve_mcs.

Slack or SLK

Slack variables.

The functionality is supported by all solvers within the NAG optimization modelling suite for the retrieval of their final solutions. handle_set_get_real, moreover, can also be used by a selection of the solvers in the NAG Library, such as, handle_solve_lp_ipm() and handle_solve_socp_ipm() for the retrieval of the approximate solutions within the monitoring step. See the documentation of the individual solvers. In addition, you can retrieve solutions from a specific solver by adding the solver name after the available mentioned above, e.g., keywords X e04mt or X handle_solve_lp_ipm return the value of primal variables only from the linear programming solver handle_solve_lp_ipm(). This is useful when a problem is solved by several different solvers. See the E04 Introduction for more details about the NAG optimization modelling suite.