12 #include "CoinHelperFunctions.hpp"
14 using namespace Couenne;
19 if (lb < 0) indInf1 = (indInf1 == -1) ? i : -2;
20 if (ub > 0) indInf2 = (indInf2 == -1) ? i : -2;
22 if (lb < 0) indInf2 = (indInf2 == -1) ? i : -2;
23 if (ub > 0) indInf1 = (indInf1 == -1) ? i : -2;
39 for (lincoeff::iterator el =
lcoeff_.begin (); el !=
lcoeff_.end (); ++el) {
41 int ind = el -> first ->
Index ();
52 else qMin += coe * ui;
57 else qMax += coe *
li;
63 else qMin += coe *
li;
68 else qMax += coe * ui;
75 for (sparseQ::iterator row =
matrix_.begin (); row !=
matrix_.end (); ++row) {
77 int i = row -> first ->
Index ();
79 for (sparseQcol::iterator col = row -> second.begin (); col != row -> second.end (); ++col) {
81 int j = col -> first ->
Index ();
91 tmin = (ubi <= 0) ? (ubi * ubi) : (lbi >= 0) ? (lbi * lbi) : 0,
92 tmax = CoinMax (lbi*lbi, ubi*ubi);
98 else qMin += coe * tmax;
104 else qMax += coe * tmax;
124 b1 = coe * lbi * lbj,
125 b2 = coe * lbi * ubj,
126 b3 = coe * ubi * lbj,
127 b4 = coe * ubi * ubj;
129 if ((term = CoinMin (CoinMin (b1, b2), CoinMin (b3, b4))) > -
COUENNE_INFINITY) qMin += term;
130 if ((term = CoinMax (CoinMax (b1, b2), CoinMax (b3, b4))) <
COUENNE_INFINITY) qMax += 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
void updateInf(CouNumber coe, CouNumber lb, CouNumber ub, int &indInf1, int &indInf2, int i)
void computeQuadFiniteBound(CouNumber &qMin, CouNumber &qMax, CouNumber *l, CouNumber *u, int &indInfLo, int &indInfUp)
return lower and upper bound of quadratic expression