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.
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/CPXopenCPLEXroutine. - 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
rmatindandrmatval. If the function returns either 0 (zero) orCPXERR_NEGATIVE_SURPLUSthen this value contains the number of elements that were stored inrmatindorrmatval. 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
rmatvalandrmatind. Specifically, row i consists of the entries inrmatvalandrmatindin the range fromrmatbeg[i-begin]tormatbeg[(i+1)-begin]-1. (Rowendconsists of the entries fromrmatbeg[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 ifrmatspaceis 0 (zero). - rmatval
-
An array to contain the nonzero entries of the specified rows. May be NULL if
rmatspaceis 0 (zero). - rmatspace
-
An integer specifying the length of the arrays
rmatindandrmatval. May be 0 (zero). - surplus_p
-
A pointer to an integer to contain the difference between
rmatspaceand the number of entries in each of the arraysrmatindandrmatval. 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, the routineCPXXgetrows/CPXgetrowsreturns 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 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);