XPRSloadqglobal


Purpose
Used to load a global problem with quadratic objective coefficients in to the Optimizer data structures. Integer, binary, partial integer, semi-continuous and semi-continuous integer variables can be defined, together with sets of type 1 and 2. The reference row values for the set members are passed as an array rather than specifying a reference row.
Synopsis
int XPRS_CC XPRSloadqglobal(XPRSprob prob, const char *probname, int ncol, int nrow, const char qrtype[], const double rhs[], const double range[], const double obj[], const int mstart[], const int mnel[], const int mrwind[], const double dmatval[], const double dlb[], const double dub[], const int nqtr, const int mqc1[], const int mqc2[], const double dqe[], const int ngents, const int nsets, const char qgtype[], const int mgcols[], const double dlim[], const char qstype[], const int msstart[], const int mscols[], const double dref[]);
Arguments
prob 
The current problem.
probname 
A string of up to 200 characters containing a name for the problem.
ncol 
Number of structural columns in the matrix.
nrow 
Number of rows in the matrix (not including the objective). Objective coefficients must be supplied in the obj array, and the objective function should not be included in any of the other arrays.
qrtype 
Character array of length nrow containing the row type:
indicates a Maths/leq.png constraint;
indicates an = constraint;
indicates a Maths/geq.png constraint;
indicates a range constraint;
indicates a nonbinding constraint.
rhs 
Double array of length nrow containing the right hand side coefficients. The right hand side value for a range row gives the upper bound on the row.
range 
Double array of length nrow containing the range values for range rows. The values in the range array will only be read for R type rows. The entries for other type rows will be ignored. May be NULL if not required. The lower bound on a range row is the right hand side value minus the range value. The sign of the range value is ignored - the absolute value is used in all cases.
obj 
Double array of length ncol containing the objective function coefficients.
mstart 
Integer array containing the offsets in the mrwind and dmatval arrays of the start of the elements for each column. This array is of length ncol or, if mnel is NULL, length ncol+1.
mnel 
Integer array of length ncol containing the number of nonzero elements in each column. May be NULL if not required. This array is not required if the non-zero coefficients in the mrwind and dmatval arrays are continuous, and the mstart array has ncol+1 entries as described above. It may be NULL if not required.
mrwind 
Integer arrays containing the row indices for the nonzero elements in each column. If the indices are input contiguously, with the columns in ascending order, then the length of mrwind is mstart[ncol-1]+mnel[ncol-1] or, if mnel is NULL, mstart[ncol].
dmatval 
Double array containing the nonzero element values length as for mrwind.
dlb 
Double array of length ncol containing the lower bounds on the columns. Use XPRS_MINUSINFINITY to represent a lower bound of minus infinity.
dub 
Double array of length ncol containing the upper bounds on the columns. Use XPRS_PLUSINFINITY to represent an upper bound of plus infinity.
nqtr 
Number of quadratic terms.
mqc1 
Integer array of size nqtr containing the column index of the first variable in each quadratic term.
mqc2 
Integer array of size nqtr containing the column index of the second variable in each quadratic term.
dqe 
Double array of size nqtr containing the quadratic coefficients.
ngents 
Number of binary, integer, semi-continuous, semi-continuous integer and partial integer entities.
nsets 
Number of SOS1 and SOS2 sets.
qgtype 
Character array of length ngents containing the entity types:
binary variables;
integer variables;
partial integer variables;
semi-continuous variables;
semi-continuous integers.
mgcols 
Integer array length ngents containing the column indices of the global entities.
dlim 
Double array length ngents containing the integer limits for the partial integer variables and lower bounds for semi-continuous and semi-continuous integer variables (any entries in the positions corresponding to binary and integer variables will be ignored). May be NULL if not required.
qstype 
Character array of length nsets containing:
SOS1 type sets;
SOS2 type sets.
May be NULL if not required.
msstart 
Integer array containing the offsets in the mscols and dref arrays indicating the start of the sets. This array is of length nsets+1, the last member containing the offset where set nsets+1 would start. May be NULL if not required.
mscols 
Integer array of length msstart[nsets]-1 containing the columns in each set. May be NULL if not required.
dref 
Double array of length msstart[nsets]-1 containing the reference row entries for each member of the sets. May be NULL if not required.
Related Controls
Integer
Number of extra columns to be allowed for.
Number of extra matrix elements to be allowed for.
Number of extra global entities to be allowed for.
Number of extra elements to allow for in presolve.
Number of extra rows to be allowed for.
Status for nonbinding rows.
Type of scaling.

Double
Zero tolerance on matrix elements.
Minimum gap between reference row entries.

Example
Minimize -6x1 + 2x12 - 2x1x2 + 2x22 subject to x1 + x2 Maths/leq.png 1.9, where x1 must be an integer:
int nrow = 1, ncol = 2, nquad = 3;
int mstart[] = {0, 1, 2};
int mrwind[] = {0, 0};
double dmatval[] = {1, 1};
double rhs[] = {1.9};
char qrtype[] = {"L"};
double lbound[] = {0, 0};
double ubound[] = {XPRS_PLUSINFINITY, XPRS_PLUSINFINITY};

double obj[] = {-6, 0};
int mqc1[] = {0, 0, 1};
int mqc2[] = {0, 1, 1};
double dquad[] = {4, -2, 4};

int ngents = 1, nsets = 0;
int mgcols[] = {0};
char qgtype[]={'I'};

double *primal, *dual;

primal = malloc(ncol*sizeof(double));
dual = malloc(nrow*sizeof(double));
...
XPRSloadqglobal(prob, "myprob", ncol, nrow, qrtype, rhs, 
                NULL, obj, mstart, NULL, mrwind, 
                dmatval, lbound, ubound, nquad, mqc1, mqc2, 
                dquad, ngents, nsets, qgtype, mgcols, NULL, 
                NULL, NULL, NULL, NULL)
Further information
1. The objective function is of the form c'x+x'Qx where Q is positive semi-definite for minimization problems and negative semi-definite for maximization problems. If this is not the case the optimization algorithms may converge to a local optimum or may not converge at all. Note that only the upper or lower triangular part of the Q matrix is specified.
2. The row and column indices follow the usual C convention of going from 0 to nrow-1 and 0 to ncol-1 respectively.
3. The double constants XPRS_PLUSINFINITY and XPRS_MINUSINFINITY are defined in the Optimizer library header file.
Related topics
XPRSaddsetnames, XPRSloadglobal, XPRSloadlp, XPRSloadqp, XPRSreadprob.


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.