CPXgetcols


Description

The routine CPXgetcols() is used to access 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.

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 (CPXCENVptr env,
                  CPXCLPptr lp,
                  int *nzcnt_p,
                  int *cmatbeg,
                  int *cmatind,
                  double *cmatval,
                  int cmatspace,
                  int *surplus_p,
                  int begin,
                  int end);

Arguments

CPXCENVptr env

The pointer to the CPLEX environment as returned by CPXopenCPLEX().

CPXCLPptr lp

A pointer to a CPLEX problem object as returned by CPXcreateprob().

int *nzcnt_p

A pointer to an integer to contain the number of nonzeros returned; that is, the true length of the arrays cmatind and cmatval.

int *cmatbeg

An array to 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] to cmatbeg[(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 *cmatind

An array to contain the row indices associated with the elements of cmatval. May be NULL if cmatspace is zero.

double *cmatval

An array to contain the nonzero coefficients of the specified columns. May be NULL if cmatspace is zero.

int cmatspace

An integer indicating the length of the arrays cmatind and cmatval. May be zero.

int *surplus_p

A pointer to an integer to 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.

int begin

An integer indicating the beginning of the range of columns to be returned.

int end

An integer indicating the end of the range of columns to be returned.

Example

  status = CPXgetcols (env, lp, &nzcnt, cmatbeg, cmatind,
                       cmatval, cmatspace, &surplus, 0,
                       cur_numcols-1);


Previous Page: CPXgetcolname Return to Top Next Page: CPXgetcovcnt