CPXXgetqconstr and CPXgetqconstr
The routine CPXXgetqconstr/CPXgetqconstr is used to access a specified
quadratic constraint on the variables of a CPLEX problem object.
int CPXXgetqconstr( CPXCENVptr env, CPXCLPptr lp, CPXDIM * linnzcnt_p, CPXNNZ * quadnzcnt_p, double * rhs_p, char * sense_p, CPXDIM * linind, double * linval, CPXDIM linspace, CPXDIM * linsurplus_p, CPXDIM * quadrow, CPXDIM * quadcol, double * quadval, CPXNNZ quadspace, CPXNNZ * quadsurplus_p, CPXDIM which )
int CPXgetqconstr( CPXCENVptr env, CPXCLPptr lp, int * linnzcnt_p, int * quadnzcnt_p, double * rhs_p, char * sense_p, int * linind, double * linval, int linspace, int * linsurplus_p, int * quadrow, int * quadcol, double * quadval, int quadspace, int * quadsurplus_p, int which )
Description
The routine CPXXgetqconstr/CPXgetqconstr is used to access a specified
quadratic constraint on the variables of a CPLEX problem object.
The length of the arrays in which the nonzero linear and quadratic
coefficients of the constraint are to be returned must be specified.
If the value of linspace is 0 (zero),
then the negative of the value
of *linsurplus_p returned specifies the length needed for the
arrays linind and linval.
If the value of quadspace is 0 (zero),
then the negative of the value
of *quadsurplus_p returned specifies the length needed for the
arrays quadrow, quadcol, and quadval.
Arguments
- env
-
A pointer to the CPLEX environment as returned by the
CPXXopenCPLEX/CPXopenCPLEXroutine. - lp
-
A pointer to a CPLEX problem object as returned by
CPXXcreateprob/CPXcreateprob. - linnzcnt_p
-
A pointer to an integer to contain the number of linear
coefficients returned; that is, the true length of the arrays
linindandlinval. If the function returns either 0 (zero) orCPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored inlinindorlinval. Otherwise, the value is either unchanged or set to 0 (zero). - quadnzcnt_p
-
A pointer to an integer to contain the number of quadratic
coefficients returned; that is, the true length of the arrays
quadrow,quadcolandquadval. If the function returns either 0 (zero) orCPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored inquadrow,quadcolorquadval. Otherwise, the value is either unchanged or set to 0 (zero). - rhs_p
-
A pointer to a
doublecontaining the righthand-side value of the quadratic constraint. - sense_p
- A pointer to a character specifying the sense of the constraint. Possible values are L for a <= constraint or G for a >= constraint.
- linind
-
An array to contain the variable indices of the entries of
linval. May be NULL iflinspaceis 0 (zero). - linval
-
An array to contain the linear coefficients of the specified constraint. May be NULL if
linspaceis 0 (zero). - linspace
-
An integer specifying the length of the arrays
linindandlinval. May be 0 (zero). - linsurplus_p
-
A pointer to an integer to contain the difference between
linspaceand the number of entries in each of the arrayslinindandlinval. A nonnegative value of*linsurplus_pspecifies that the length of the arrays was sufficient. A negative value specifies that the length was insufficient and that the routine could not complete its task. In this case, the routineCPXXgetqconstr/CPXgetqconstrreturns the valueCPXERR_NEGATIVE_SURPLUS, and the negative value of*linsurplus_pspecifies the amount of insufficient space in the arrays. May be NULL iflinspaceis 0 (zero). - quadrow
-
An array to contain the variable indices of the entries of
quadval. If the quadratic coefficients were stored in a matrix,quadrowwould give the row indexes of the quadratic terms. May be NULL ifquadspaceis 0 (zero). - quadcol
-
An array to contain the variable indices of the entries of
quadval. If the quadratic coefficients were stored in a matrix,quadcolwould give the column indexes of the quadratic terms. May be NULL ifquadspaceis 0 (zero). - quadval
-
An array to contain the quadratic coefficients of the specified constraint. May be NULL if
quadspaceis 0 (zero). - quadspace
-
An integer specifying the length of the arrays
quadrow,quadcolandquadval. May be 0 (zero). - quadsurplus_p
-
A pointer to an integer to contain the difference between
quadspaceand the number of entries in each of the arraysquadrow,quadcolandquadval. A nonnegative value of*quadsurplus_pspecifies that the length of the arrays was sufficient. A negative value specifies that the length was insufficient and that the routine could not complete its task. In this case, the routineCPXXgetqconstr/CPXgetqconstrreturns the valueCPXERR_NEGATIVE_SURPLUS, and the negative value of*quadsurplus_pspecifies the amount of insufficient space in the arrays. May be NULL ifquadspaceis 0 (zero). - which
- An integer specifying which quadratic constraint to return.
Return
The routine returns 0 (zero) on success and nonzero if an error occurs. The value CPXERR_NEGATIVE_SURPLUS specifies that insufficient space was available in either the arrays linind and linval or quadrow, quadcol, and quadval to hold the nonzero coefficients.
Example
status = CPXgetqconstr (env, lp, &linnzcnt, &quadnzcnt,
&rhs, &sense, linind, linval,
linspace, &linsurplus, quadrow, quadcol, quadval,
quadspace, &quadsurplus, 0);