| int | GRBgetq ( | GRBmodel | *model, |
| int | *numqnzP, | ||
| int | *qrow, | ||
| int | *qcol, | ||
| double | *qval ) |
Retrieve all quadratic objective terms. Typical usage is to call this routine twice. In the first call, you provide NULL values for the qrow, qcol, and qval arguments. The routine returns the number of quadratic terms in numnzP. That allows you to make certain that 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 objective terms. 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 objective terms should be retrieved.
numqnzP: The number of quadratic objective terms retrieved.
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 array arguments give the corresponding values for each quadratic term. To give an example, if the quadratic terms in the model are 2 x0^2 + x0 * x1 + x1^2, this routine would return qrow[] = {0, 0, 1}, qcol[] = {0, 1, 1}, and qval[] = {2, 1, 1}.
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.
Example usage:
int qnz; int *qrow, *qcol; double *qval; error = GRBgetq(model, &numqnz, NULL, NULL, NULL); /* ...allocate qrow, qcol, qval to hold 'numqnz' values... */ error = GRBgetq(model, &numqnz, qrow, qcol, qval);