NAG CL Interface
e04tac (handle_​add_​vars)

Settings help

CL Name Style:

1 Purpose

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

2 Specification

#include <nag.h>
void  e04tac (void *handle, Integer nadd, Integer *nvar, NagError *fail)
The function may be called by the names: e04tac or nag_opt_handle_add_vars.

3 Description

After the handle has been initialized (e.g., e04rac has been called), e04tac may be used to define nadd new unconstrained continuous variables to the problem. If nnow denotes the current number of variables in the model, the total number of variables will be n=nnow+nadd and the new variables will be indexed by nnow+1,,nnow+nadd. 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 Section 4.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

4 References


5 Arguments

1: handle void * Input
On entry: the handle to the problem. It needs to be initialized (e.g., by e04rac) and must not be changed between calls to the NAG optimization modelling suite.
2: nadd Integer Input
On entry: nadd, the number of decision variables to add to the problem.
Constraint: nadd>0.
3: nvar Integer * Output
On exit: n, the new total number of the variables in the problem.
4: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument value had an illegal value.
The supplied handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been properly initialized or it has been corrupted.
On entry, nadd=value.
Constraint: nadd>0.
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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
The problem cannot be modified right now, the solver is running.

7 Accuracy

Not applicable.

8 Parallelism and Performance

e04tac is not threaded in any implementation.

9 Further Comments


10 Example

This example demonstrates, using a simple production-planning problem, how to use the functions of the NAG optimization modelling suite to edit and solve different variants of the problem.
We consider a situation where a factory can manufacture two different chemicals A1 and A2. The goal for the factory is to determine the quantities x1 and x2 of each chemical to maximize profit under the following circumstances: Note that since the chemicals are considered fluid, the quantities x1 and x2 are not limited to integer values.
We can now formulate the problem as a linear program:
maximize xn 2x1+4.5x2 subject to   1.2x1+3x21500   (machine time constraint)    6x1+10x26000   (packaging material constraint)    40x1+80x216000   (transport constraint)    0x1   (capacity constraint)    0x2100   (capacity constraint)  
If the factory expands its capabilities and is now capable of producing a new chemical A3 with: The problem becomes:
maximize xn 2x1+4.5x2+7x3 subject to   1.2x1+3x2+5x31500   (machine time constraint)    6x1+10x2+12x36000   (packaging material constraint)    40x1+80x2+120x316000   (transport constraint)    0x1   (capacity constraint)    0x2100   (capacity constraint)    0x350   (capacity constraint)  
At a later date, regulation changes require that products A2 and A3 follow a rigorous quality assurance test before being sent to market. Now the factory is only able to process a total of 100 units per day which amounts to adding the following constraint to our linear program:
   x2+x3100   (regulation constraint)  

10.1 Program Text

Program Text (e04tace.c)

10.2 Program Data


10.3 Program Results

Program Results (e04tace.r)