CPXXgetcols and CPXgetcols
The routine CPXXgetcols/CPXgetcols accesses a range of
columns of the constraint matrix of a CPLEX problem object.
int CPXXgetcols( CPXCENVptr env, CPXCLPptr lp, CPXNNZ * nzcnt_p, CPXNNZ * cmatbeg, CPXDIM * cmatind, double * cmatval, CPXNNZ cmatspace, CPXNNZ * surplus_p, CPXDIM begin, CPXDIM end )
int CPXgetcols( CPXCENVptr env, CPXCLPptr lp, int * nzcnt_p, int * cmatbeg, int * cmatind, double * cmatval, int cmatspace, int * surplus_p, int begin, int end )
Description
The routine CPXXgetcols/CPXgetcols accesses a range of
columns of the constraint matrix of a CPLEX problem object. The beginning
and end of the range, along with the length of the arrays in which the
nonzero entries of these columns are to be returned, must be specified.
cmatspace is zero, the negative of the value of
surplus_p returned specifies the length needed for the arrays
cmatind and cmatval.Arguments
- env
-
A pointer to the CPLEX environment as returned by
CPXXopenCPLEX/CPXopenCPLEX. - lp
-
A pointer to a CPLEX problem object as returned by
CPXXcreateprob/CPXcreateprob. - nzcnt_p
-
A pointer to an integer to contain the number of nonzeros
returned; that is, the true length of the arrays
cmatindandcmatval. If the function returns either 0 (zero) orCPXERR_NEGATIVE_SURPLUS, then this value contains the number of elements that were stored incmatindorcmatval. Otherwise, the value is either unchanged or set to 0 (zero). - cmatbeg
-
An array to contain indices specifying where each of the requested columns begins in the arrays
cmatvalandcmatind. Specifically, columnjconsists of the entries incmatvalandcmatindin the range fromcmatbeg[j-begin]tocmatbeg[(j+1)-begin]-1. (Columnendconsists of the entries fromcmatbeg[end-begin]tonzcnt_p-1.) This array must be of length at least (end-begin+1). - cmatind
-
An array to contain the row indices associated with the elements of
cmatval. May be NULL ifcmatspaceis zero. - cmatval
-
An array to contain the nonzero coefficients of the specified columns. May be NULL if
cmatspaceis zero. - cmatspace
-
An integer specifying the length of the arrays
cmatindandcmatval. May be zero. - surplus_p
-
A pointer to an integer to contain the difference between
cmatspaceand the number of entries in each of the arrayscmatindandcmatval. A nonnegative value ofsurplus_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,CPXXgetcols/CPXgetcolsreturns the valueCPXERR_NEGATIVE_SURPLUS, and the negative value ofsurplus_pspecifies the amount of insufficient space in the arrays. - begin
- An integer specifying the beginning of the range of columns to be returned.
- end
- An integer specifying the end of the range of columns to be returned.
Return
The routine returns 0 (zero) if successful and nonzero if an error occurs. The value CPXERR_NEGATIVE_SURPLUS
specifies that insufficient space was available in the arrays
cmatind and cmatval to hold the
nonzero coefficients.
Example
status = CPXgetcols (env, lp, &nzcnt, cmatbeg, cmatind,
cmatval, cmatspace, &surplus, 0,
cur_numcols-1);