CPXXgetrows and CPXgetrows

The routine CPXXgetrows/CPXgetrows accesses a range of rows of the constraint matrix, not including the objective function nor the bound constraints on the variables of a CPLEX problem object.

int  CPXXgetrows( CPXCENVptr env, CPXCLPptr lp, CPXNNZ * nzcnt_p, CPXNNZ * rmatbeg, CPXDIM * rmatind, double * rmatval, CPXNNZ rmatspace, CPXNNZ * surplus_p, CPXDIM begin, CPXDIM end )

int  CPXgetrows( CPXCENVptr env, CPXCLPptr lp, int * nzcnt_p, int * rmatbeg, int * rmatind, double * rmatval, int rmatspace, int * surplus_p, int begin, int end )

Description

The routine CPXXgetrows/CPXgetrows accesses a range of rows of the constraint matrix, not including the objective function nor the bound constraints on the variables 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 rows are to be returned, must be specified.

When you access more than one row, you will greatly improve efficiency of your application by accessing all rows in a single operation on an array of rows, rather than accessing multiple rows one by one in successive operations. In other words, one call of CPXXgetrows/CPXgetrows on an array is more efficient than multiple calls many times on a single row at each call. This difference in efficiency is due to the layout of a model as columns of data in memory.

Note: If the value of rmatspace is 0 then the negative of the value of surplus_p returned specifies the length needed for the arrays rmatval and rmatind.

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.
nzcnt_p
A pointer to an integer to contain the number of nonzeros returned; that is, the true length of the arrays rmatind and rmatval. If the function returns either 0 (zero) or CPXERR_NEGATIVE_SURPLUS then this value contains the number of elements that were stored in rmatind or rmatval. Otherwise, the value is either unchanged or set to 0 (zero).
rmatbeg
An array to contain indices specifying where each of the requested rows begins in the arrays rmatval and rmatind. Specifically, row i consists of the entries in rmatval and rmatind in the range from rmatbeg[i-begin] to rmatbeg[(i+1) -begin]-1. (Row end consists of the entries from rmatbeg[end-begin] to *nzcnt_p -1.) This array must be of length at least (end-begin+1).
rmatind
An array to contain the column indices of the entries of rmatval. May be NULL if rmatspace is 0 (zero).
rmatval
An array to contain the nonzero entries of the specified rows. May be NULL if rmatspace is 0 (zero).
rmatspace
An integer specifying the length of the arrays rmatind and rmatval. May be 0 (zero).
surplus_p
A pointer to an integer to contain the difference between rmatspace and the number of entries in each of the arrays rmatind and rmatval. A nonnegative value of surplus_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 CPXXgetrows/CPXgetrows returns the value CPXERR_NEGATIVE_SURPLUS, and the negative value of surplus_p specifies the amount of insufficient space in the arrays.
begin
An integer specifying the beginning of the range of rows to be returned.
end
An integer specifying the end of the range of rows 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 rmatind and rmatval to hold the nonzero coefficients.

Example


status = CPXgetrows (env, lp, &nzcnt, rmatbeg, rmatind, rmatval,
	      rmatspace, &surplus, 0, cur_numrows-1);