Usage
Barrier Users OnlyDescription
This routine copies a Q matrix when Q is not diagonal. qmatbeg, qmatcnt, qmatind, and qmatval are used to specify the nonzero coefficients of the matrix Q. The meaning of these vectors is identical to the meaning of the corresponding vectors matbeg, matcnt, matind and matval that are used to specify the structure of A in a call to CPXcopylp(). Note that Q must be symmetric when copied using this function. Therefore if the quadratic coefficient in algebraic form is 2x1x2, then x2 should be in the list for x1, and x1 should be in the list for x2, and the coefficient would be 1.0 in each of those entries. See the corresponding example C program to review how the symmetry requirement is implemented. Note that CPLEX will evaluate the corresponding objective with a factor of 0.5 in front of the quadratic objective term.
|
|
The problem type must be CPXPROB_LP or CPXPROB_QP for this routine to succeed. Use CPXchgprobtype() to change the problem type. After successful execution of CPXcopyquad(), the problem type will be CPXPROB_QP.
|
int CPXcopyquad (CPXENVptr env,
CPXLPptr lp,
int *qmatbeg,
int *qmatcnt,
int *qmatind,
double *qmatval);
CPXENVptr envThe pointer to the CPLEX environment as returned by one of the
CPXopenCPLEX routines.
CPXLPptr lpA pointer to a CPLEX LP problem object as returned by
CPXcreateprob().
int *qmatbeg int *qmatcnt int *qmatind double *qmatvalThese four arguments are all arrays that describe the quadratic coefficient matrix. The arrays
qmatbeg and qmatcnt should be of length at least CPXgetnumcols(env,lp). The arrays qmatind and qmatval should be of length at leastqmatbeg[numcols-1]+qmatcnt[numcols-1]. CPLEX requires only the nonzero coefficients grouped by column in the array qmatval. Every column must be stored in sequential locations in this array with qmatbeg[j] containing the index of the beginning of column j and qmatcnt[j] containing the number of entries in column j. Note that the components of qmatbeg must be in ascending order. For each k, qmatind[k] indicates the column number of the corresponding coefficient, qmatval[k]. These arrays are accessed as follows:Suppose that CPLEX wants to access the entries in a column j. These are assumed to be given by the array entries:
The corresponding column/index entries are:qmatval[qmatbeg[j]],..,qmatval[qmatbeg[j]+qmatcnt[j]-1]
qmatind[qmatbeg[j]],..,qmatind[qmatbeg[j]+qmatcnt[j]-1The entries in
qmatind[k] are not required to be in column order. Duplicate entries in qmatind and qmatval within a single column are not allowed. Note that any column j that has only a linear objective term has qmatcnt[j] = 0 and no entries in qmatind and qmatval.
status = CPXcopyquad (env, lp, qmatbeg, qmatcnt, qmatind,
qmatval);
CPXreadcopyqp()