After the
handle has been initialized (e.g.,
e04rac has been called),
e04rtc may be used to edit a model by adding or replacing a quadratic objective function or constraint of the form
and
respectively.
The matrix
is a sparse
matrix. It can be viewed as the factor of the symmetric matrix
in a general quadratic function
It is also acceptable if
is a zero matrix, in which case the corresponding objective function or constraint becomes linear. If you have the full matrix
as input data, please call function
e04rsc instead. Note that it is possible to temporarily disable and enable individual constraints in the model by
e04tcc and
e04tbc, respectively. See
Section 4.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
None.
-
1:
– 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:
– double
Input
-
On entry: the constant term in quadratic constraint.
If
,
s will not be referenced.
-
3:
– Integer
Input
-
On entry: the number of nonzero elements in the sparse vector
.
If
,
is considered to be zero and the arrays
idxr and
r will not be referenced and may be
NULL.
Constraint:
.
-
4:
– const Integer
Input
-
5:
– const double
Input
-
On entry: the nonzero elements of the sparse vector . must contain the index of
in the vector, for . No particular order is expected, but elements should not repeat. Note that is the current number of variables in the problem.
Constraint:
, for .
-
6:
– Integer
Input
-
On entry: , row dimension of matrix .
Constraint:
.
-
7:
– Integer
Input
-
On entry: the number of nonzero elements in the matrix
.
If
, the matrix
is considered to be zero, the objective function or constraint is linear and
mf,
irowf,
icolf and
f will not be referenced and may be
NULL.
Constraint:
.
-
8:
– const Integer
Input
-
9:
– const Integer
Input
-
10:
– const double
Input
-
On entry: arrays
irowf,
icolf and
f store the nonzeros of the matrix
in coordinate storage (CS) format (see
Section 2.1.1 in the
F11 Chapter Introduction).
irowf specifies one-based row indices,
icolf specifies one-based column indices and
f specifies the values of the nonzero elements in such a way that
where
,
, for
. No particular order is expected, but elements should not repeat.
Constraint:
, for .
-
11:
– Integer *
Input/Output
-
On entry:
- A new quadratic constraint is created.
- Specifies the index of an existing constraint to be replaced. i.e., replaces the idqcth constraint.
- A new quadratic objective is created and will replace any previously defined objective function.
Constraint:
.
On exit: if
on entry, then
idqc is overwritten with the index of the new quadratic constraint. By definition, this is the number of quadratic constraints already defined plus one. Otherwise,
idqc stays unchanged.
-
12:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- 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 properly initialized or it has been corrupted.
- NE_INT
-
nnzr and
nnzf cannot be zero at the same time.
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INTARR
-
On entry, , and .
Constraint: .
- 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.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
- NE_INVALID_CS
-
On entry, , and .
Constraint: .
On entry, , and .
Constraint: .
On entry, more than one element of
f has row index
and column index
.
Constraint: each element of
f must have a unique row and column index.
- NE_NO_LICENCE
-
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.
- NE_NOT_INCREASING
-
On entry, more than one element of
idxr has index
.
Constraint: each element of
idxr must have a unique index.
- NE_PHASE
-
The problem cannot be modified right now, the solver is running.
- NE_REF_MATCH
-
On entry,
.
The given
idqc does not match with any quadratic constraint already defined.
Not applicable.
Background information to multithreading can be found in the
Multithreading documentation.
None.
This example demonstrates how to define and solve a convex quadratic programming problem where the quadratic term is defined by its factors.
We solve the following norm minimization problem:
where
and
is vector of all ones. Note that
which is a convex quadratic function.
The optimal solution (to five significant figures) is
and the objective function value without the constant term
is
.