XPRBaddqterm
XPRBaddqterm |
Purpose
Synopsis
int XPRBaddqterm(XPRBctr ctr, XPRBvar var1, XPRBvar var2, double coeff);
Arguments
ctr
|
Reference to a constraint.
|
var1
|
Reference to a variable.
|
var2
|
Reference to a variable (not necessarily different).
|
coeff
|
Value to be added to the coefficient of the term
var1 * var2.
|
Return value
0 if function executed successfully, 1 otherwise.
Example
The following example adds the term
-2*x2*x4 to the constraint
ctr1:
XPRBctr ctr1; XPRBvar x2,x4; ... ctr1 = XPRBnewctr(prob, "r1", XPRB_L); x2 = XPRBnewvar(prob, XPRB_PL, "abc1", 0, XPRB_INFINITY); x4 = XPRBnewvar(prob, XPRB_PL, "abc5",0 , XPRB_INFINITY); XPRBaddqterm(ctr1, x2, x4, -2);
Further information
This function adds a new quadratic term to a constraint, comprising the product of the variables
var1 and
var2 with coefficient
coeff. If the constraint already has a term with variables
var1 and
var2,
coeff is added to its coefficient.
- Note:
- all terms that are added to a constraint must belong to the same problem as the constraint itself.
Related topics