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.

Note:

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/CPXopenCPLEX routine.
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 linind and linval. If the function returns either 0 (zero) or CPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored in linind or linval. 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, quadcol and quadval. If the function returns either 0 (zero) or CPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored in quadrow, quadcol or quadval. Otherwise, the value is either unchanged or set to 0 (zero).
rhs_p
A pointer to a double containing 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 if linspace is 0 (zero).
linval
An array to contain the linear coefficients of the specified constraint. May be NULL if linspace is 0 (zero).
linspace
An integer specifying the length of the arrays linind and linval. May be 0 (zero).
linsurplus_p
A pointer to an integer to contain the difference between linspace and the number of entries in each of the arrays linind and linval. A nonnegative value of *linsurplus_p specifies 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 routine CPXXgetqconstr/CPXgetqconstr returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of *linsurplus_p specifies the amount of insufficient space in the arrays. May be NULL if linspace is 0 (zero).
quadrow
An array to contain the variable indices of the entries of quadval. If the quadratic coefficients were stored in a matrix, quadrow would give the row indexes of the quadratic terms. May be NULL if quadspace is 0 (zero).
quadcol
An array to contain the variable indices of the entries of quadval. If the quadratic coefficients were stored in a matrix, quadcol would give the column indexes of the quadratic terms. May be NULL if quadspace is 0 (zero).
quadval
An array to contain the quadratic coefficients of the specified constraint. May be NULL if quadspace is 0 (zero).
quadspace
An integer specifying the length of the arrays quadrow, quadcol and quadval. May be 0 (zero).
quadsurplus_p
A pointer to an integer to contain the difference between quadspace and the number of entries in each of the arrays quadrow, quadcol and quadval. A nonnegative value of *quadsurplus_p specifies 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 routine CPXXgetqconstr/CPXgetqconstr returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of *quadsurplus_p specifies the amount of insufficient space in the arrays. May be NULL if quadspace is 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);