naginterfaces.library.opt.handle_add_vars(handle, nadd)[source]

handle_add_vars is a part of the NAG optimization modelling suite and adds new variables to the problem.

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


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 number of decision variables to add to the problem.


, the new total number of the variables in the problem.

(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 problem cannot be modified right now, the solver is running.

(errno )

On entry, .

Constraint: .


After the has been initialized (e.g., handle_init() has been called), handle_add_vars may be used to define new unconstrained continuous variables to the problem. If denotes the current number of variables in the model, the total number of variables will be and the new variables will be indexed by . The objective function or constraints, if already defined in the model, won’t be affected as they will be naturally extended as if the new variables were not referred during their definition (e.g., for a linear objective function the coefficients for the new variables would be set to zero). If the new variables should enter any already defined parts of the problem, you should modify them with the appropriate functions from the suite.

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