Documentation


GRBgetvars

int GRBgetvars ( GRBmodel *model,
    int *numnzP,
    int *vbeg,
    int *vind,
    double *vval,
    int start,
    int len )

Retrieve the non-zeros for a set of variables from the constraint matrix. Typical usage is to call this routine twice. In the first call, you specify the requested set of variables, with NULL values for vbeg, vind, and vval. The routine returns the number of non-zero values for the specified variables in numnzP. That allows you to make certain that vind and vval are of sufficient size to hold the result of the second call.

If your constraint matrix may contain more than 2 billion non-zero values, you should consider using the GRBXgetvars variant of this routine.

Return value:

A non-zero return value indicates that a problem occurred while retrieving the variable coefficients. Refer to the Error Code table for a list of possible return values. Details on the error can be obtained by calling GRBgeterrormsg.

Arguments:

model: The model from which the variables should be retrieved.

numnzP: The number of non-zero values retrieved.

vbeg: Constraint matrix non-zero values are returned in Compressed Sparse Column (CSC) format by this routine. Each column in the constraint matrix is represented as a list of index-value pairs, where each index entry provides the constraint index for a non-zero coefficient, and each value entry provides the corresponding non-zero value. Each variable has an associated vbeg value, indicating the start position of the non-zeros for that constraint in the vind and vval arrays. The non-zeros for variable i immediately follow those for variable i-1 in vind and vval. Thus, vbeg[i] indicates both the index of the first non-zero in variable i and the end of the non-zeros for variable i-1. For example, consider the case where vbeg[2] = 10 and vbeg[3] = 12. This would indicate that variable 2 has two non-zero values associated with it. Their constraint indices can be found in vind[10] and vind[11], and the numerical values for those non-zeros can be found in vval[10] and vval[11].

vind: Constraint indices associated with non-zero values. See the description of the vbeg argument for more information.

vval: Numerical values associated with constraint matrix non-zeros. See the description of the vbeg argument for more information.

start: The index of the first variable to retrieve.

len: The number of variables to retrieve.