Try our new documentation site (beta).


GRBgetqconstr

int GRBgetqconstr ( GRBmodel *model,
    int qconstr,
    int *numlnzP,
    int *lind,
    double *lval,
    int *numqnzP,
    int *qrow,
    int *qcol,
    double *qval )

Retrieve the linear and quadratic terms associated with a single quadratic constraint. Typical usage is to call this routine twice. In the first call, you specify the requested quadratic constraint, with NULL values for the array arguments. The routine returns the total number of linear and quadratic terms in the specified quadratic constraint in numlnzP and numqnzP, respectively. That allows you to make certain that lind, lval, qrow, qcol, and qval 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 quadratic constraint. 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 quadratic constraint should be retrieved.

qconstr: The index of the requested quadratic constraint.

numlnzP: The number of linear terms retrieved for the requested quadratic constraint.

lind: Variable indices associated with linear terms.

lval: Numerical coefficients associated with linear terms.

numqnzP: The number of quadratic terms retrieved for the requested quadratic constraint.

qrow: Row indices associated with quadratic terms. A quadratic term is represented using three values: a pair of indices (stored in qrow and qcol), and a coefficient (stored in qval). The associated arguments arrays provide the corresponding values for each quadratic term. To give an example, if the requested quadratic constraint has quadratic terms <span>$</span>2 x_0^2 + x_0 x_1 +
x_1^2<span>$</span>, this routine would return *numqnzP=3, qrow[] = {0, 0, 1}, qcol[] = {0, 1, 1}, and qval[] = {2.0, 1.0, 1.0}.

qcol: Column indices associated with quadratic terms. See the description of the qrow argument for more information.

qval: Numerical values associated with quadratic terms. See the description of the qrow argument for more information.

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