XPRBgetnextqterm
XPRBgetnextqterm |
Purpose
Synopsis
const void *XPRBgetnextqterm(XPRBctr ctr, const void *ref, XPRBvar *var1, XPRBvar *var2, double *coeff);
Arguments
ctr
|
Constraint whose terms are to be enumerated.
|
ref
|
Reference pointer or
NULL.
|
var1
|
BCL reference to a variable. May be
NULL if not required.
|
var2
|
BCL reference to a variable. May be
NULL if not required.
|
coeff
|
Coefficient associated to the quadratic term
var1 * var2. May be
NULL if not required.
|
Return value
Reference pointer for the next call to
XPRBgetnextqterm or
NULL if there are no more terms.
Example
XPRBprob prob; XPRBctr ctr; XPRBvar var1, var2; double coeff; const void *ref; ... ref = NULL; while ((ref = XPRBgetnextqterm(ctr, ref, &var1, &var2, &coeff)) != NULL) { XPRBprintf("Quadratic term %s * %s has coefficient %g\n", XPRBgetvarname(var1), XPRBgetvarname(var2), coeff); }
This example prints all quadratic terms of a constraint.
Further information
This function can be used to enumerate the quadratic terms of a constraint. The second parameter serves to keep track of the current location inthe enumeration; if this parameter is
NULL, the first term is returned. This function returns
NULL if it is called with the reference to the last element. Otherwise, the returned value can be used as the input parameter
ref to retrieve the following term of the same type.
Related topics