After the
handle has been initialized (e.g.,
e04raf has been called),
e04rtf 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 routine
e04rsf instead. Note that it is possible to temporarily disable and enable individual constraints in the model by
e04tcf and
e04tbf, respectively. See
Section 3.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
None.
-
1:
– Type (c_ptr)
Input
-
On entry: the handle to the problem. It needs to be initialized (e.g., by
e04raf) and
must not be changed between calls to the NAG optimization modelling suite.
-
2:
– Real (Kind=nag_wp)
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.
Constraint:
.
-
4:
– Integer array
Input
-
5:
– Real (Kind=nag_wp) array
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.
Constraint:
.
-
8:
– Integer array
Input
-
9:
– Integer array
Input
-
10:
– Real (Kind=nag_wp) array
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:
– Integer
Input/Output
-
On entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended.
When the value or is used it is essential to test the value of ifail on exit.
On exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
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
.