Try our new documentation site (beta).


GRBgetconstrs

int GRBgetconstrs ( GRBmodel *model,
    int *numnzP,
    int *cbeg,
    int *cind,
    double *cval,
    int start,
    int len )

Retrieve the non-zeros for a set of linear constraints from the constraint matrix. Typical usage is to call this routine twice. In the first call, you specify the requested set of constraints, with NULL values for cbeg, cind, and cval. The routine returns the number of non-zero values for the specified constraint range in numnzP. That allows you to make certain that cind and cval 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 GRBXgetconstrs variant of this routine.

Return value:

A non-zero return value indicates that a problem occurred while retrieving the constraint 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 linear constraints should be retrieved.

numnzP: The number of non-zero values retrieved.

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

cind: Variable indices associated with non-zero values. See the description of the cbeg argument for more information.

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

start: The index of the first linear constraint to retrieve.

len: The number of linear constraints to retrieve.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization