Description
The routine CPXgetcols() is used to access a range of columns of the constraint matrix of an LP 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. Return Value
The routine returns a zero on success, and a nonzero if an error occurs. The value CPXERR_NEGATIVE_SURPLUS indicates that insufficient space was available in the cmatind and cmatval arrays to hold the nonzero coefficients.Synopsis
int CPXgetcols (CPXENVptr env,
CPXLPptr lp,
int *nzcnt_p,
int *cmatbeg,
int *cmatind,
double *cmatval,
int cmatspace,
int *surplus_p,
int begin,
int end);
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 *nzcnt_pA pointer to an integer that will contain the number of nonzeros returned; i.e., the true length of the arrays
cmatind and cmatval.
int *cmatbegAn array that will contain indices indicating where each of the requested columns begins in the arrays
cmatval and cmatind. Specifically, column j consists of the entries in cmatval and cmatind in the range from cmatbeg[j - begin] tocmatbeg[(j + 1) - begin]-1. (Column end consists of the entries from cmatbeg[end - begin] to nzcnt_p-1.) This array must be of length at least(end - begin + 1).
int *cmatindAn array that will contain the row indices associated with the elements of
cmatval. cmatind may be NULL if cmatspace is 0.
double *cmatvalAn array that will contain the nonzero coefficients of the specified columns.
cmatval may be NULL if cmatspace is 0.
int cmatspaceAn integer indicating the length of the arrays
cmatind and cmatval. cmatspace may be 0.
int *surplus_pA pointer to an integer that will contain the difference between
cmatspace and the number of entries in each of the arrays cmatind and cmatval. A non-negative value of *surplus_p indicates that the length of the arrays was sufficient. A negative value indicates that the length was insufficient and that the routine could not complete its task. In this case, CPXgetcols() returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of *surplus_p indicates the amount of insufficient space in the arrays.
|
|
If the value of cmatspace is 0 then the negative of the value of *surplus_p returned indicates the length needed for the arrays cmatind and cmatval.
|
int beginAn integer indicating the beginning of the range of columns to be returned.
int endAn integer indicating the end of the range of columns to be returned.
status = CPXgetcols (env, lp, &nzcnt, cmatbeg, cmatind,
cmatval, cmatspace, &surplus, 0,
cur_numcols-1);