17 #include "CoinFinite.hpp"
22 using namespace Couenne;
30 bool resL, resU = resL =
false;
82 *xl = l + xi, *yl = l + yi,
83 *xu = u + xi, *yu = u + yi;
87 bool resxL, resxU, resyL, resyU =
88 resxL = resxU = resyL =
false;
100 if ((!xuIsZero) && (!yuIsZero) && (*xu * *yu < wl)) {
102 resxU = (*xu * *yl < wl) &&
updateBound (+1, xu, wl / *yl);
103 xuIsZero = (fabs(*xu) <
COUENNE_EPS ?
true :
false);
106 resyU = (*xl * *yu < wl) &&
updateBound (+1, yu, wl / *xl);
107 yuIsZero = (fabs(*yu) <
COUENNE_EPS ?
true :
false);
113 if ((!xlIsZero) && (!ylIsZero) && (*xl * *yl < wl)) {
115 resxL = (*xl * *yu < wl) &&
updateBound (-1, xl, wl / *yu);
116 xlIsZero = (fabs(*xl) <
COUENNE_EPS ?
true :
false);
119 resyL = (*xu * *yl < wl) &&
updateBound (-1, yl, wl / *xu);
120 ylIsZero = (fabs(*yl) <
COUENNE_EPS ?
true :
false);
130 if (*xu * *yu < wl) {
133 if((*xu * *yl < wl) && (ylIsZero)) {
134 printf(
"ylIsZero (A): %g\n", *yl);
137 if((*xl * *yu < wl) && (xlIsZero)) {
138 printf(
"xlIsZero (B): %g\n", *xl);
143 resxU = (*xu * *yl < wl) &&
updateBound (+1, xu, wl / *yl);
144 xuIsZero = (fabs(*xu) <
COUENNE_EPS ?
true :
false);
145 resyU = (*xl * *yu < wl) &&
updateBound (+1, yu, wl / *xl);
146 yuIsZero = (fabs(*yu) <
COUENNE_EPS ?
true :
false);
151 if (*xl * *yl < wl) {
154 if((*xl * *yu < wl) && (yuIsZero)) {
155 printf(
"yuIsZero (C): %g\n", *yu);
158 if((*xu * *yl < wl) && (xuIsZero)) {
159 printf(
"xuIsZero (D): %g\n", *xu);
163 resxL = (*xl * *yu < wl) && (!yuIsZero) &&
updateBound (-1, xl, wl / *yu);
164 xlIsZero = (fabs(*xl) <
COUENNE_EPS ?
true :
false);
165 resyL = (*xu * *yl < wl) && (!xuIsZero) &&
updateBound (-1, yl, wl / *xu);
166 ylIsZero = (fabs(*yl) <
COUENNE_EPS ?
true :
false);
176 if(((*xl * *yl < wl) && (*yl > 0)) && (ylIsZero)) {
177 printf(
"ylIsZero (E): %g\n", *yl);
179 if(((*xu * *yu < wl) && (*yu > 0)) && (xuIsZero)) {
180 printf(
"xuIsZero (F): %g\n", *xu);
183 if(((*xl * *yl < wl) && (*yl < 0)) && (xlIsZero)) {
184 printf(
"xlIsZero (G): %g\n", *xl);
187 if(( (*xu * *yu < wl) && (*yu < 0)) && (yuIsZero)) {
188 printf(
"yuIsZero (H): %g\n", *yu);
192 resxL = (*xl * *yl < wl) && (*yl > 0.) && (!ylIsZero) &&
updateBound (-1, xl, wl / *yl);
193 xlIsZero = (fabs(*xl) <
COUENNE_EPS ?
true :
false);
194 resyU = (*xu * *yu < wl) && (*yu > 0.) && (!xuIsZero) &&
updateBound (+1, yu, wl / *xu);
195 yuIsZero = (fabs(*yu) <
COUENNE_EPS ?
true :
false);
198 resyL = (*xl * *yl < wl) && (*yl < 0.) && (!xlIsZero) &&
updateBound (-1, yl, wl / *xl);
199 ylIsZero = (fabs(*yl) <
COUENNE_EPS ?
true :
false);
200 resxU = (*xu * *yu < wl) && (*yu < 0.) && (!yuIsZero) &&
updateBound (+1, xu, wl / *yu);
201 xuIsZero = (fabs(*xu) <
COUENNE_EPS ?
true :
false);
210 if (resxU && xInt) *xu = floor (*xu +
COUENNE_EPS);
212 if (resyU && yInt) *yu = floor (*yu +
COUENNE_EPS);
219 if((!xuIsZero) && (!ylIsZero) && (*xu * *yl > wu)) {
221 resxU = (*xu * *yu > wu) &&
updateBound (+1, xu, wu / *yu) || resxU;
222 xuIsZero = (fabs(*xu) <
COUENNE_EPS ?
true :
false);
225 resyL = (*xl * *yl > wu) &&
updateBound (-1, yl, wu / *xl) || resyL;
226 ylIsZero = (fabs(*yl) <
COUENNE_EPS ?
true :
false);
230 if((!xlIsZero) && (!yuIsZero) && (*xl * *yu > wu)) {
232 resxL = (*xl * *yl > wu) &&
updateBound (-1, xl, wu / *yl) || resxL;
233 xlIsZero = (fabs(*xl) <
COUENNE_EPS ?
true :
false);
236 resyU = (*xu * *yu > wu) &&
updateBound (+1, yu, wu / *xu) || resyU;
237 yuIsZero = (fabs(*yu) <
COUENNE_EPS ?
true :
false);
252 if(((*xu * *yl > wu) && (*yl > 0)) && (ylIsZero)) {
253 printf(
"ylIsZero (A2): yl: %g xu: %g wu: %g\n", *yl, *xu, wu);
256 if(((*xl * *yu > wu) && (*yu > 0)) && (xlIsZero)) {
257 printf(
"xlIsZero (B2): %g\n", *xl);
263 resxU = ((*xu * *yl > wu) && (*yl > 0.) && (!ylIsZero) &&
updateBound (+1, xu, wu / *yl)) || resxU;
264 xuIsZero = (fabs(*xu) <
COUENNE_EPS ?
true :
false);
265 resyU = ((*xl * *yu > wu) && (*yu > 0.) && (!xlIsZero) &&
updateBound (+1, yu, wu / *xl)) || resyU;
266 yuIsZero = (fabs(*yu) <
COUENNE_EPS ?
true :
false);
269 if(((*xl * *yu > wu) && (*yu < 0)) && (yuIsZero)) {
270 printf(
"yuIsZero (C2): %g\n", *yu);
272 if(((*xu * *yl > wu) && (*yl < 0)) && (xuIsZero)) {
273 printf(
"xuIsZero (D2): %g\n", *xu);
279 resxL = ((*xl * *yu > wu) && (*yu < 0.) && (!yuIsZero) &&
updateBound (-1, xl, wu / *yu)) || resxL;
280 xlIsZero = (fabs(*xl) <
COUENNE_EPS ?
true :
false);
281 resyL = ((*xu * *yl > wu) && (*yl < 0.) && (!xuIsZero) &&
updateBound (-1, yl, wu / *xu)) || resyL;
282 ylIsZero = (fabs(*yl) <
COUENNE_EPS ?
true :
false);
289 if (*xu * *yl > wu) {
292 if((*xu * *yu > wu) && (yuIsZero)) {
293 printf(
"yuIsZero (E2): %g\n", *yu);
296 if((*xl * *yl > wu) && (xlIsZero)) {
297 printf(
"xlIsZero (F2): %g\n", *xl);
302 resxU = ((*xu * *yu > wu) && (!yuIsZero) &&
updateBound (+1, xu, wu / *yu)) || resxU;
303 xuIsZero = (fabs(*xu) <
COUENNE_EPS ?
true :
false);
304 resyL = ((*xl * *yl > wu) && (!xlIsZero) &&
updateBound (-1, yl, wu / *xl)) || resyL;
305 ylIsZero = (fabs(*yl) <
COUENNE_EPS ?
true :
false);
310 if (*xl * *yu > wu) {
313 if((*xl * *yl > wu) && (ylIsZero)) {
314 printf(
"ylIsZero (G2): %g\n", *yl);
317 if((*xu * *yu > wu) && (xuIsZero)) {
318 printf(
"xuIsZero (H2): %g\n", *xu);
323 resxL = ((*xl * *yl > wu) && (!ylIsZero) &&
updateBound (-1, xl, wu / *yl)) || resxL;
324 xlIsZero = (fabs(*xl) <
COUENNE_EPS ?
true :
false);
325 resyU = ((*xu * *yu > wu) && (!xuIsZero) &&
updateBound (+1, yu, wu / *xu)) || resyU;
326 yuIsZero = (fabs(*yu) <
COUENNE_EPS ?
true :
false);
338 resL = resxL || resyL;
339 resU = resxU || resyU;
342 return (resL || resU);
bool updateBound(register int sign, register CouNumber *dst, register CouNumber src)
updates maximum violation.
status of lower/upper bound of a variable, to be checked/modified in bound tightening ...
virtual bool isInteger()
is this expression integer?
void setLower(ChangeStatus lower)
void setUpper(ChangeStatus upper)
virtual enum nodeType Type() const
Node type.
virtual int Index() const
Return index of variable (only valid for exprVar and exprAux)
auxSign
"sign" of the constraint defining an auxiliary.
virtual bool impliedBound(int, CouNumber *, CouNumber *, t_chg_bounds *, enum Couenne::expression::auxSign=Couenne::expression::AUX_EQ)
implied bound processing
expression ** arglist_
argument list is an array of pointers to other expressions
double CouNumber
main number type in Couenne
virtual CouNumber Value() const
value (empty)