11 #include "CoinHelperFunctions.hpp"
14 using namespace Couenne;
53 for (lincoeff::iterator el =
lcoeff_.begin (); el !=
lcoeff_.end (); ++el) {
56 coe = el -> second, term = 0.,
57 lb = el -> first -> lb (),
58 ub = el -> first -> ub ();
60 if (((coe < 0.) && (sign < 0)) ||
61 ((coe > 0.) && (sign > 0)))
69 printf (
"quadBound --- linear, %cb = %g\n", (sign < 0) ?
'l' :
'u', bound);
73 for (sparseQ::iterator row =
matrix_.begin (); row !=
matrix_.end (); ++row) {
75 int xind = row -> first ->
Index ();
78 lbi = row -> first -> lb (),
79 ubi = row -> first -> ub ();
81 for (sparseQcol::iterator col = row -> second.begin (); col != row -> second.end (); ++col) {
83 int yind = col -> first ->
Index ();
89 if (((coe > 0.) && (sign < 0)) ||
90 ((coe < 0.) && (sign > 0)))
91 term = (ubi < 0) ? (ubi * ubi) : (lbi > 0) ? (lbi * lbi) : 0.;
99 printf (
"Qii %d %g %g -> %g\n", xind, coe, term, bound + term);
106 lbj = col -> first -> lb (),
107 ubj = col -> first -> ub (),
108 b1 = coe * lbi * lbj,
109 b2 = coe * lbi * ubj,
110 b3 = coe * ubi * lbj,
111 b4 = coe * ubi * ubj;
113 if (fabs (lbi) == 0)
b1 = b2 = 0;
114 if (fabs (lbj) == 0)
b1 = b3 = 0;
115 if (fabs (ubi) == 0) b3 = b4 = 0;
116 if (fabs (ubj) == 0) b2 = b4 = 0;
126 printf (
"Qij %d %d %g %g -> %g\n", xind, yind, coe, term, bound + term);
CouNumber c0_
constant term
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
lincoeff lcoeff_
coefficients and indices of the linear term
double CouNumber
main number type in Couenne
CouNumber computeQBound(int sign)
method to compute the bound based on sign: -1 for lower, +1 for upper