Try our new documentation site (beta).


GRBgetsos

int GRBgetsos ( GRBmodel *model,
    int *nummembersP,
    int *sostype,
    int *beg,
    int *ind,
    double *weight,
    int start,
    int len )

Retrieve the members and weights of a set of SOS constraints. Typical usage is to call this routine twice. In the first call, you specify the requested SOS constraints, with NULL values for ind and weight. The routine returns the total number of members for the specified SOS constraints in nummembersP. That allows you to make certain that ind and weight are of sufficient size to hold the result of the second call.

Return value:

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

nummembersP: The total number of SOS members retrieved.

sostype: The types of the SOS constraints. Possible values are GRB_SOS_TYPE1 or GRB_SOS_TYPE2

beg: SOS constraints are returned in Compressed Sparse Row (CSR) format. Each SOS constraint in the model is represented as a list of index-value pairs, where each index entry provides the variable index for an SOS member, and each value entry provides the corresponding SOS constraint weight. Each SOS constraint has an associated beg value, indicating the start position of the members of that constraint in the ind and weight arrays. The members for SOS constraint i immediately follow those for constraint i-1 in ind and weight. Thus, beg[i] indicates both the index of the first member of SOS constraint i and the end of the member list for SOS constraint i-1. For example, consider the case where beg[2] = 10 and beg[3] = 12. This would indicate that SOS constraint 2 has two members. Their variable indices can be found in ind[10] and ind[11], and their SOS weights can be found in weight[10] and weight[11].

ind: Variable indices associated with SOS members. See the description of the beg argument for more information.

weight: Weights associated with SOS members. See the description of the beg argument for more information.

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

len: The number of SOS 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