nag_opt_miqp_mps_write (e04mwc) writes data for sparse linear programming, mixed integer linear programming, quadratic programming or mixed integer quadratic programming problems to a file in MPS format.
#include <nag.h> |
#include <nage04.h> |
void |
nag_opt_miqp_mps_write (Nag_FileID fileid,
Integer n,
Integer m,
Integer nnzc,
Integer nnza,
Integer ncolh,
Integer nnzh,
Integer lintvar,
const Integer idxc[],
const double c[],
Integer iobj,
const double a[],
const Integer irowa[],
const Integer iccola[],
const double bl[],
const double bu[],
char pnames[][9],
char crname[][9],
const double h[],
const Integer irowh[],
const Integer iccolh[],
Integer minmax,
const Integer intvar[],
NagError *fail) |
|
nag_opt_miqp_mps_write (e04mwc) writes data for linear programming (LP) or quadratic programming (QP) problems (or their mixed integer variants) from an optimization problem to a MPS output file, see
Section 3.1 in nag_opt_miqp_mps_read (e04mxc) for the format description. The problem is expected in the form
Where
is the number of variables,
is the number of general linear constraints,
is the linear constraint matrix with dimension
by
, the vectors
and
are the lower and upper bounds, respectively.
is the Hessian matrix with dimension
by
, however, only leading
ncolh columns might contain nonzero elements and the rest is assumed to be zero.
Note that the linear term of the objective function
might be supplied either as
c or via
iobj. If
c is supplied then
idxc contains the indices of the nonzero elements of sparse vector
, whereas if
iobj is supplied (
), row
iobj of matrix
is a free row storing the nonzero elements of
.
Note: that this function uses fixed MPS format, see
IBM (1971).
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_ARRAY_INPUT
-
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry,
.
Constraint: all entries in
intvar must be unique.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
On entry, .
Constraint: or .
- NE_BOUND
-
On entry, and , is incorrect.
Constraint: .
On entry, , and are incorrect.
Constraint: .
On entry, , and , the integer variable requires at least one bound finite.
Constraint: at least one of the following conditions must be met for integer variable j: , .
On entry, and , is incorrect.
Constraint: .
- NE_FILEID
-
On entry, .
Constraint: .
- NE_INT
-
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_2
-
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
- NE_INT_3
-
On entry, and .
Constraint: .
On entry, and .
Constraint: if , .
On entry, and .
Constraint: if , .
- NE_INT_4
-
On entry, and .
Constraint: .
On entry,
and
.
Constraint: at most one of
iobj or
nnzc may be nonzero.
- 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.
An unexpected error has been triggered by this function. Please contact
NAG.
See
Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_INVALID_CS
-
On entry, , and .
Constraint: .
On entry, , , and
Constraint: (within the lower triangle).
On entry, more than one element of
a has row index
and column index
.
Constraint: each element of
a must have a unique row and column index.
On entry, more than one element of
h has row index
and column index
.
Constraint: each element of
h must have a unique row and column index.
- NE_MPS_ILLEGAL_NAME
-
On entry,
for
has been already used.
Constraint: the names in
crname must be unique.
The name specified in
is empty or has been already used among row names.
Constraint: the names in
must be unique and nonempty if
crname is provided and
.
- NE_MPS_PRINTABLE
-
On entry,
for
is incorrect.
Constraint: the names in
crname must consist only of printable characters.
On entry,
for
is incorrect.
Constraint: the names in
pnames must consist only of printable characters.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_NOT_INCREASING
-
On entry,
,
and
, the values of
iccola must be nondecreasing.
Constraint:
.
On entry,
,
and
, the values of
iccolh must be nondecreasing.
Constraint:
.
- NE_NOT_STRICTLY_INCREASING
-
On entry, , and .
Constraint: .
- NE_OBJ_BOUND
-
On entry, , and , if the bounds must be infinite.
Constraints: , .
- NE_STATE_VAL
-
On entry, , and .
Constraint: .
On entry, , and .
Constraint: .
- NE_WRITE_ERROR
-
An error occurred when writing to file.
Not applicable.
nag_opt_miqp_mps_write (e04mwc) is not threaded in any implementation.
None.
This example shows how to store an optimization problem to a file in MPS format after it has been solved by
nag_opt_sparse_convex_qp_solve (e04nqc). The problem is a minimization of the quadratic function
, where
subject to the bounds
and to the linear constraints
The initial point, which is infeasible, is
The optimal solution (to five figures) is
The generated file is called e04mwce.mps.