XPRBaddqterm


Purpose
Add a quadratic term to the objective function.
Synopsis
int XPRBaddqterm(XPRBprob prob, XPRBvar var1, XPRBvar var2, double coeff);
Arguments
prob 
Reference to a problem.
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 objective function:
XPRBprob prob;
XPRBvar x2,x4;
   ...
x2 = XPRBnewvar(prob, XPRB_PL, "abc1", 0, XPRB_INFINITY);
x4 = XPRBnewvar(prob, XPRB_PL, "abc5",0 , XPRB_INFINITY);
XPRBaddqterm(prob,x2,x4,-2); 
Further information
This function adds a new quadratic term to the objective function, comprising the product of the variables var1 and var2 with coefficient coeff. If the objective already has a term with variables var1 and var2, coeff is added to its coefficient.
Related topics
XPRBdelqobj, XPRBsetqterm.


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.