35#define _USE_MATH_DEFINES
51#if defined(__INTEL_COMPILER) || defined(_MSC_VER)
52#pragma fenv_access (on)
53#elif defined(__GNUC__) && !defined(__clang__)
54#pragma STDC FENV_ACCESS ON
64#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
66#pragma clang optimize off
68#pragma GCC optimize ("O0")
75#ifdef SCIP_ROUNDING_FE
84#define SCIP_ROUND_DOWNWARDS FE_DOWNWARD
85#define SCIP_ROUND_UPWARDS FE_UPWARD
86#define SCIP_ROUND_NEAREST FE_TONEAREST
87#define SCIP_ROUND_ZERO FE_TOWARDZERO
104 if( fesetround(roundmode) != 0 )
110 (void) fesetround(roundmode);
127#ifdef SCIP_ROUNDING_FP
136#define SCIP_ROUND_DOWNWARDS FP_RND_RM
137#define SCIP_ROUND_UPWARDS FP_RND_RP
138#define SCIP_ROUND_NEAREST FP_RND_RN
139#define SCIP_ROUND_ZERO FP_RND_RZ
156 if( write_rnd(roundmode) != 0 )
162 (void) write_rnd(roundmode);
179#ifdef SCIP_ROUNDING_MS
188#define SCIP_ROUND_DOWNWARDS RC_DOWN
189#define SCIP_ROUND_UPWARDS RC_UP
190#define SCIP_ROUND_NEAREST RC_NEAR
191#define SCIP_ROUND_ZERO RC_CHOP
208 if( (_controlfp(roundmode, _MCW_RC) & _MCW_RC) != roundmode )
214 (void) _controlfp(roundmode, _MCW_RC);
224 return _controlfp(0, 0) & _MCW_RC;
234#define SCIP_ROUND_DOWNWARDS 0
235#define SCIP_ROUND_UPWARDS 1
236#define SCIP_ROUND_NEAREST 2
237#define SCIP_ROUND_ZERO 3
253 SCIPerrorMessage(
"setting rounding mode not available - interval arithmetic is invalid!\n");
284#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
298 __asm
volatile (
"fldl %1; fchs; fstpl %0" :
"=m" (
x) :
"m" (
x));
305#elif defined(_MSC_VER) && (defined(__INTEL_COMPILER) || !defined(_M_X64))
394#undef SCIPintervalGetInf
395#undef SCIPintervalGetSup
396#undef SCIPintervalSet
397#undef SCIPintervalSetBounds
398#undef SCIPintervalSetEmpty
399#undef SCIPintervalIsEmpty
400#undef SCIPintervalSetEntire
401#undef SCIPintervalIsEntire
402#undef SCIPintervalIsPositiveInfinity
403#undef SCIPintervalIsNegativeInfinity
429 resultant->
inf = value;
430 resultant->
sup = value;
455 resultant->
inf = inf;
456 resultant->
sup = sup;
466 resultant->
inf = 1.0;
467 resultant->
sup = -1.0;
479 return operand.
sup < operand.
inf;
529 if( operand1.
inf > operand1.
sup )
533 if( operand2.
inf > operand2.
sup )
546 return (operand1.
sup < operand2.
inf) || (operand2.
sup < operand1.
inf);
560 if( operand1.
sup < operand2.
inf )
563 if( operand1.
inf > operand2.
sup )
601 if( operand1.
sup < operand2.
inf )
609 else if( operand1.
inf > operand2.
sup )
630 if( operand1.
inf > operand1.
sup )
633 *resultant = operand2;
637 if( operand2.
inf > operand2.
sup )
640 *resultant = operand1;
671 resultant->
inf = operand1.
inf + operand2.
inf;
698 resultant->
sup = operand1.
sup + operand2.
sup;
757 resultant->
inf = operand1.
inf + operand2;
773 resultant->
sup = operand1.
sup + operand2;
795 for(
i = 0;
i < length; ++
i )
801 for(
i = 0;
i < length; ++
i )
837 resultant->
inf = operand1.
inf - operand2.
sup;
851 resultant->
sup = operand1.
sup - operand2.
inf;
920 cand1 = operand1.
inf * operand2.
inf;
921 cand2 = operand1.
inf * operand2.
sup;
922 cand3 = operand1.
sup * operand2.
inf;
923 cand4 = operand1.
sup * operand2.
sup;
924 resultant->
inf =
MIN(
MIN(cand1, cand2),
MIN(cand3, cand4));
980 cand1 = operand1.
inf * operand2.
inf;
981 cand2 = operand1.
inf * operand2.
sup;
982 cand3 = operand1.
sup * operand2.
inf;
983 cand4 = operand1.
sup * operand2.
sup;
984 resultant->
sup =
MAX(
MAX(cand1, cand2),
MAX(cand3, cand4));
1030 if( operand1.
inf > 0 )
1032 else if( operand1.
inf < 0 )
1035 resultant->
inf = 0.0;
1040 if( operand1.
sup > 0 )
1042 else if( operand1.
sup < 0 )
1045 resultant->
inf = 0.0;
1047 else if( operand2 == 0.0 )
1049 resultant->
inf = 0.0;
1051 else if( operand2 > 0.0 )
1058 resultant->
inf = operand1.
inf * operand2;
1067 resultant->
inf = operand1.
sup * operand2;
1086 if( operand1.
sup > 0 )
1088 else if( operand1.
sup < 0 )
1091 resultant->
sup = 0.0;
1096 if( operand1.
inf > 0 )
1098 else if( operand1.
inf < 0 )
1101 resultant->
sup = 0.0;
1103 else if( operand2 == 0.0 )
1105 resultant->
sup = 0.0;
1107 else if( operand2 > 0.0 )
1114 resultant->
sup = operand1.
sup * operand2;
1123 resultant->
sup = operand1.
inf * operand2;
1140 if( operand2 == 1.0 )
1142 *resultant = operand1;
1146 if( operand2 == -1.0 )
1148 resultant->
inf = -operand1.
sup;
1149 resultant->
sup = -operand1.
inf;
1181 if( operand2.
inf <= 0.0 && operand2.
sup >= 0.0 )
1188 if( operand1.
inf == 0.0 && operand1.
sup == 0.0 )
1204 intmed.
inf = 1.0 / operand2.
sup;
1213 intmed.
sup = 1.0 / operand2.
inf;
1238 resultant->
inf = 0.0;
1239 resultant->
sup = 0.0;
1241 else if( operand2 > 0.0 )
1253 resultant->
inf = operand1.
inf / operand2;
1266 resultant->
sup = operand1.
sup / operand2;
1269 else if( operand2 < 0.0 )
1281 resultant->
inf = operand1.
sup / operand2;
1294 resultant->
sup = operand1.
inf / operand2;
1299 if( operand1.
inf >= 0 )
1305 else if( operand1.
sup <= 0 )
1338 resultant->
inf = 0.0;
1339 resultant->
sup = 0.0;
1377 resultant->
inf = 0.0;
1403 resultant->
sup = 0.0;
1428 resultant->
inf = 0.0;
1429 resultant->
sup = 0.0;
1457 if( operand.
sup <= 0.0 )
1464 resultant->
inf = operand.
sup * operand.
sup;
1472 resultant->
sup = operand.
inf * operand.
inf;
1475 else if( operand.
inf >= 0.0 )
1482 resultant->
inf = operand.
inf * operand.
inf;
1490 resultant->
sup = operand.
sup * operand.
sup;
1495 resultant->
inf = 0.0;
1504 x = operand.
inf * operand.
inf;
1505 y = operand.
sup * operand.
sup;
1525 if( operand.
sup < 0.0 )
1531 if( operand.
inf == operand.
sup )
1543 tmp = sqrt(operand.
inf);
1551 if( operand.
inf <= 0.0 )
1552 resultant->
inf = 0.0;
1588 if( operand2.
inf == operand2.
sup )
1597 if( operand1.
sup == 0.0 )
1599 if( operand2.
inf <= 0.0 && operand2.
sup >= 0.0 )
1633 if( operand1 == 0.0 )
1643 if( operand1 == 1.0 || operand2 == 0 )
1665 n = (
unsigned int)operand2;
1716 if( operand1 == 0.0 )
1726 if( operand1 == 1.0 || operand2 == 0 )
1748 n = (
unsigned int)operand2;
1791 if( operand1 == 0.0 )
1807 if( operand1 == 1.0 || operand2 == 0 )
1834 n = (
unsigned int)operand2;
1847 result_sup = result_sup * z_sup;
1855 z_sup = z_sup * z_sup;
1861 resultant->
inf = result_inf;
1862 resultant->
sup = result_sup;
1883 if( operand1 == 0.0 )
1899 if( operand1 == 1.0 || operand2 == 0 )
1906 result = pow(operand1, operand2);
1934 if( operand1.
inf < 0.0 )
1937 resultant->
inf = 0.0;
1938 if( operand1.
sup > 0.0 )
1941 resultant->
sup = 0.0;
1945 if( operand2 == 0.0 )
1947 if( operand1.
inf == 0.0 && operand1.
sup == 0.0 )
1949 resultant->
inf = 0.0;
1950 resultant->
sup = 0.0;
1952 else if( operand1.
inf <= 0.0 || operand1.
sup >= 0.0 )
1954 resultant->
inf = 0.0;
1955 resultant->
sup = 1.0;
1959 resultant->
inf = 1.0;
1960 resultant->
sup = 1.0;
1965 if( operand2 == 1.0 )
1968 *resultant = operand1;
1972 op2isint = (ceil(operand2) == operand2);
1974 if( !op2isint && operand1.
inf < 0.0 )
1977 if( operand1.
sup < operand1.
inf )
1984 if( operand1.
inf >= 0.0 )
1986 if( operand2 >= 0.0 )
1991 else if( operand1.
inf > 0.0 )
1997 resultant->
inf = 0.0;
2001 else if( operand1.
sup > 0.0 )
2007 resultant->
sup = 0.0;
2012 resultant->
inf = 0.0;
2013 else if( operand1.
sup == 0.0 )
2017 if( ceil(operand2/2) == operand2/2 )
2029 if( operand1.
inf == 0.0 )
2038 else if( operand1.
sup <= 0.0 )
2041 if( operand2 >= 0.0 && ceil(operand2/2) == operand2/2 )
2055 else if( operand2 <= 0.0 && ceil(operand2/2) != operand2/2 )
2060 resultant->
inf = 0.0;
2061 else if( operand1.
sup == 0.0 )
2069 resultant->
sup = 0.0;
2070 else if( operand1.
inf == 0.0 )
2076 else if( operand2 >= 0.0 )
2093 resultant->
inf = 0.0;
2094 else if( operand1.
inf == 0.0 )
2101 resultant->
sup = 0.0;
2102 else if( operand1.
sup == 0.0 )
2113 if( operand2 >= 0.0 && operand2/2 == ceil(operand2/2) )
2116 resultant->
inf = 0.0;
2122 else if( operand2 <= 0.0 && ceil(operand2/2) == operand2/2 )
2127 resultant->
inf = 0.0;
2131 else if( operand2 >= 0.0 )
2180 if( exponent == 0.0 )
2183 if( image.
inf <= 1.0 && image.
sup >= 1.0 )
2186 *resultant = basedomain;
2188 else if( image.
inf <= 0.0 && image.
sup >= 0.0 )
2212 if( image.
sup >= 0.0 )
2216 if( basedomain.
inf <= -resultant->
inf &&
EPSISINT(exponent, 0.0) && (
int)exponent % 2 == 0 )
2218 if( basedomain.
sup < resultant->
inf )
2230 if( image.
inf < 0.0 && basedomain.
inf < 0.0 &&
EPSISINT(exponent, 0.0) && ((
int)exponent % 2 != 0) )
2265 if( operand1.
inf < 0.0 )
2268 resultant->
inf = 0.0;
2269 if( operand1.
sup > 0.0 )
2272 resultant->
sup = 0.0;
2276 if( operand2 == 0.0 )
2279 if( operand1.
inf < 0.0 )
2280 resultant->
inf = -1.0;
2281 else if( operand1.
inf == 0.0 )
2282 resultant->
inf = 0.0;
2284 resultant->
inf = 1.0;
2286 if( operand1.
sup < 0.0 )
2287 resultant->
sup = -1.0;
2288 else if( operand1.
sup == 0.0 )
2289 resultant->
sup = 0.0;
2291 resultant->
sup = 1.0;
2296 if( operand2 == 1.0 )
2298 *resultant = operand1;
2304 if( operand2 == 2.0 )
2314 else if( operand1.
inf > 0.0 )
2317 resultant->
inf = operand1.
inf * operand1.
inf;
2334 else if( operand1.
sup > 0.0 )
2337 resultant->
sup = operand1.
sup * operand1.
sup;
2347 else if( operand2 == 0.5 )
2353 else if( operand1.
inf >= 0.0 )
2368 else if( operand1.
sup > 0.0 )
2386 else if( operand1.
inf > 0.0 )
2401 else if( operand1.
sup > 0.0 )
2429 if( operand.
inf == 0.0 && operand.
sup == 0.0 )
2438 if( operand.
inf >= 0.0 )
2441 resultant->
inf = 0.0;
2445 resultant->
inf = 1.0 / operand.
sup;
2449 resultant->
sup = 0.0;
2450 else if( operand.
inf == 0.0 )
2455 resultant->
sup = 1.0 / operand.
inf;
2460 else if( operand.
sup <= 0.0 )
2463 resultant->
inf = 0.0;
2464 else if( operand.
sup == 0.0 )
2469 resultant->
inf = 1.0 / operand.
sup;
2477 resultant->
sup = 1.0 / operand.
inf;
2502 resultant->
inf = 0.0;
2503 resultant->
sup = 0.0;
2514 if( operand.
inf == operand.
sup )
2516 if( operand.
inf == 0.0 )
2518 resultant->
inf = 1.0;
2519 resultant->
sup = 1.0;
2526 tmp = exp(operand.
inf);
2537 resultant->
inf = 0.0;
2539 else if( operand.
inf == 0.0 )
2541 resultant->
inf = 1.0;
2548 tmp = exp(operand.
inf);
2559 else if( operand.
sup == 0.0 )
2561 resultant->
sup = 1.0;
2587 if( operand.
sup <= 0.0 )
2593 if( operand.
inf == operand.
sup )
2595 if( operand.
sup == 1.0 )
2597 resultant->
inf = 0.0;
2598 resultant->
sup = 0.0;
2605 tmp = log(operand.
inf);
2613 if( operand.
inf <= 0.0 )
2617 else if( operand.
inf == 1.0 )
2619 resultant->
inf = 0.0;
2631 else if( operand.
sup == 1.0 )
2633 resultant->
sup = 0.0;
2692 if( operand.
inf <= 0.0 && operand.
sup >= 0.0)
2694 resultant->
inf = 0.0;
2697 else if( operand.
inf > 0.0 )
2699 *resultant = operand;
2703 resultant->
inf = -operand.
sup;
2704 resultant->
sup = -operand.
inf;
2713static const double pi_d_l = (3373259426.0 + 273688.0 / (1<<21)) / (1<<30);
2714static const double pi_d_u = (3373259426.0 + 273689.0 / (1<<21)) / (1<<30);
2716#define pi_d_l ((3373259426.0 + 273688.0 / (1<<21)) / (1<<30))
2717#define pi_d_u ((3373259426.0 + 273689.0 / (1<<21)) / (1<<30))
2745 tmp = -resultant->
sup;
2746 resultant->
sup = -resultant->
inf;
2747 resultant->
inf = tmp;
2757 resultant->
inf = 0.0;
2759 resultant->
sup = 0.0;
2788 if( operand.
inf == operand.
sup )
2793 tmp = cos(operand.
inf);
2802 if( operand.
sup > 1e12 || operand.
inf < -1e12 )
2812 negwidth = operand.
inf - operand.
sup;
2813 if( -negwidth >= 2.0*
pi_d_l )
2843 resultant->
inf =
MAX(-1.0, resultant->
inf);
2844 if( operand.
inf == 0.0 )
2845 resultant->
sup = 1.0;
2849 resultant->
sup =
MIN( 1.0, resultant->
sup);
2856 resultant->
inf = -1.0;
2857 if( operand.
inf == 0.0 )
2858 resultant->
sup = 1.0;
2864 cinf = cos(operand.
inf);
2865 csup = cos(operand.
sup);
2867 resultant->
sup =
MIN(1.0, resultant->
sup);
2877 if( fmod(k, 2.0) != 0.0 )
2880 resultant->
sup = -resultant->
inf;
2881 resultant->
inf = tmp;
2899 if( operand.
sup < 0.0 )
2901 resultant->
inf = -1.0;
2902 resultant->
sup = -1.0;
2904 else if( operand.
inf >= 0.0 )
2906 resultant->
inf = 1.0;
2907 resultant->
sup = 1.0;
2911 resultant->
inf = -1.0;
2912 resultant->
sup = 1.0;
2937 if( operand.
sup < 0.0 )
2944 if( operand.
sup == 0.0 )
2954 if( operand.
inf > 0.0 )
2956 loginf = log(operand.
inf);
2963 logsup = log(operand.
sup);
2972 if( operand.
inf > 0.0 )
2997 inf =
MIN(infcand1, infcand2);
3000 if( operand.
inf <= extr && extr <= operand.
sup )
3003 sup =
MAX3(supcand1, supcand2, extr);
3006 sup =
MAX(supcand1, supcand2);
3049 cand1 = b_.
inf *
x.inf;
3050 cand2 = b_.
inf *
x.sup;
3051 cand3 = b_.
sup *
x.inf;
3052 cand4 = b_.
sup *
x.sup;
3053 u =
MAX(
MAX(cand1, cand2),
MAX(cand3, cand4));
3084 u =
MAX(
x.inf * (
a*
x.inf +
b),
x.sup * (
a*
x.sup +
b));
3087 if( t >
x.inf &&
negate(2*
a)*
x.sup >
b && s*t > u )
3104 return MAX(cand1, cand2);
3126 if( sqrcoeff == 0.0 )
3135 lincoeff.
inf = -lincoeff.
sup;
3136 lincoeff.
sup = -tmp;
3160 resultant->
inf = 0.0;
3209 lincoeff.
inf = -lincoeff.
sup;
3210 lincoeff.
sup = -tmp;
3218 tmp = resultant->
inf;
3219 resultant->
inf = -resultant->
sup;
3220 resultant->
sup = -tmp;
3247 if( sqrcoeff == 0.0 )
3260 if( lincoeff <= 0.0 && rhs > 0.0 )
3266 if( lincoeff >= 0.0 && rhs <= 0.0 )
3270 resultant->
sup = xbnds.
sup;
3276 if( lincoeff < 0.0 && rhs <= 0.0 )
3282 resultant->
sup = rhs / lincoeff;
3283 if( xbnds.
sup < resultant->
sup )
3284 resultant->
sup = xbnds.
sup;
3294 resultant->
inf = rhs / lincoeff;
3295 if( resultant->
inf < xbnds.
inf )
3296 resultant->
inf = xbnds.
inf;
3298 resultant->
sup = xbnds.
sup;
3306 resultant->
inf = 0.0;
3317 if( lincoeff >= 0.0 )
3322 delta =
b*
b + sqrcoeff*rhs;
3334 if( sqrcoeff < 0.0 )
3340 if( sqrcoeff < 0.0 )
3343 delta =
b*
b + sqrcoeff*rhs;
3356 if( sqrcoeff > 0.0 )
3359 delta =
b*
b + sqrcoeff*rhs;
3364 resultant->
inf = z / sqrcoeff;
3374 delta =
b*
b + sqrcoeff * rhs;
3388 if( sqrcoeff > 0.0 )
3397 if( xbnds.
sup < zdiva )
3401 else if( xbnds.
inf > resultant->
sup )
3404 resultant->
inf = zdiva;
3454 if( sqrcoeff.
inf == 0.0 && sqrcoeff.
sup == 0.0 && (lincoeff.
inf > 0.0 || lincoeff.
sup < 0.0) )
3458 SCIPdebugMessage(
"solving [%g,%g]*x = [%g,%g] for x in [%g,%g] gives [%g,%g]\n", lincoeff.
inf, lincoeff.
sup, rhs.
inf, rhs.
sup, xbnds.
inf, xbnds.
sup, resultant->
inf, resultant->
sup);
3462 SCIPdebugMessage(
"solving [%g,%g]*x^2 + [%g,%g]*x = [%g,%g] for x in [%g,%g]\n", sqrcoeff.
inf, sqrcoeff.
sup, lincoeff.
inf, lincoeff.
sup, rhs.
inf, rhs.
sup, xbnds.
inf, xbnds.
sup);
3465 if( xbnds.
sup >= 0 )
3468 SCIPdebugMessage(
" solutions of [%g,%g]*x^2 + [%g,%g]*x in [%g,%g] for x in [%g,%g] are [%.15g,%.15g]\n",
3469 sqrcoeff.
inf, sqrcoeff.
sup, lincoeff.
inf, lincoeff.
sup, rhs.
inf, rhs.
sup,
MAX(xbnds.
inf, 0.0), xbnds.
sup, xpos.
inf, xpos.
sup);
3477 if( xbnds.
inf <= 0.0 )
3480 SCIPdebugMessage(
" solutions of [%g,%g]*x^2 + [%g,%g]*x in [%g,%g] for x in [%g,%g] are [%g,%g]\n",
3481 sqrcoeff.
inf, sqrcoeff.
sup, lincoeff.
inf, lincoeff.
sup, rhs.
inf, rhs.
sup, xbnds.
inf,
MIN(xbnds.
sup, 0.0), xneg.
inf, xneg.
sup);
3545 denom = 4.0 * ax * ay - axy * axy;
3548 x = (axy * by - 2.0 * ay * bx) / denom;
3549 y = (axy * bx - 2.0 * ax * by) / denom;
3552 val = (axy * bx * by - ay * bx * bx - ax * by * by) / denom;
3553 minval =
MIN(val, minval);
3554 maxval =
MAX(val, maxval);
3557 else if(
REALABS(2.0 * ay * bx - axy * by) <= 1e-9 )
3565 val = -ay * bx * bx / (axy * axy);
3566 minval =
MIN(val, minval);
3567 maxval =
MAX(val, maxval);
3580 else if( ax == 0.0 )
3586 else if( bx + axy * ybnds.
inf < 0.0 )
3590 minval =
MIN(val, minval);
3591 maxval =
MAX(val, maxval);
3595 else if( bx + axy * ybnds.
sup < 0.0 )
3599 minval =
MIN(val, minval);
3600 maxval =
MAX(val, maxval);
3612 minval =
MIN(tmp.
inf, minval);
3613 maxval =
MAX(tmp.
sup, maxval);
3623 else if( ax == 0.0 )
3629 else if( bx + axy * ybnds.
inf > 0.0 )
3633 minval =
MIN(val, minval);
3634 maxval =
MAX(val, maxval);
3638 else if( bx + axy * ybnds.
sup > 0.0 )
3642 minval =
MIN(val, minval);
3643 maxval =
MAX(val, maxval);
3655 minval =
MIN(tmp.
inf, minval);
3656 maxval =
MAX(tmp.
sup, maxval);
3666 else if( ay == 0.0 )
3672 else if( by + axy * xbnds.
inf < 0.0 )
3676 minval =
MIN(val, minval);
3677 maxval =
MAX(val, maxval);
3681 else if( by + axy * xbnds.
sup < 0.0 )
3685 minval =
MIN(val, minval);
3686 maxval =
MAX(val, maxval);
3698 minval =
MIN(tmp.
inf, minval);
3699 maxval =
MAX(tmp.
sup, maxval);
3709 else if( ay == 0.0 )
3715 else if( by + axy * xbnds.
inf > 0.0 )
3719 minval =
MIN(val, minval);
3720 maxval =
MAX(val, maxval);
3724 else if( by + axy * xbnds.
sup > 0.0 )
3728 minval =
MIN(val, minval);
3729 maxval =
MAX(val, maxval);
3741 minval =
MIN(tmp.
inf, minval);
3742 maxval =
MAX(tmp.
sup, maxval);
3745 minval -= 1e-10 *
REALABS(minval);
3746 maxval += 1e-10 *
REALABS(maxval);
3749 SCIPdebugMessage(
"range for %gx^2 + %gy^2 + %gxy + %gx + %gy = [%g, %g] for x = [%g, %g], y=[%g, %g]\n",
3750 ax, ay, axy, bx, by, minval, maxval, xbnds.
inf, xbnds.
sup, ybnds.
inf, ybnds.
sup);
3794 if( xbnds.
sup >= 0.0 )
3803 if( xbnds.
inf < 0.0 )
3885 rcoef_y = axy * bx / (2.0*ax) - by;
3886 rcoef_yy = axy * axy / (4.0*ax) - ay;
3887 rcoef_const = bx * bx / (4.0*ax);
3889#define CALCB(y) ((bx + axy * (y)) / (2.0 * sqrtax))
3890#define CALCR(c,y) (rcoef_const + (c) + (rcoef_y + rcoef_yy * (y)) * (y))
3901 if(
EPSN(ub, 1e-9) )
3941 if( !
EPSZ(ay, 1e-9) && axy * axy >= 4.0 * ax * ay )
3962 else if( !
EPSZ(ay, 1e-9) )
3969 minvalleft = -by / 2.0;
3970 maxvalleft = -by / 2.0;
3991 minvalleft =
MIN(-sqrtc -
b, minvalleft);
3992 maxvalright =
MAX( sqrtc -
b, maxvalright);
4005 maxvalleft =
MAX(-sqrtc -
b, maxvalleft);
4006 minvalright =
MIN( sqrtc -
b, minvalright);
4015 if( !
EPSZ(ay, 1e-9) && axy * axy >= 4.0 * ax * ay )
4036 else if( !
EPSZ(ay, 1e-9) )
4045 minvalright =
MIN(minvalright, -by / 2.0);
4046 maxvalright =
MAX(maxvalright, -by / 2.0);
4065 minvalleft =
MIN(-sqrtc -
b, minvalleft);
4066 maxvalright =
MAX( sqrtc -
b, maxvalright);
4079 maxvalleft =
MAX(-sqrtc -
b, maxvalleft);
4080 minvalright =
MIN( sqrtc -
b, minvalright);
4087 if( !
EPSZ(ay, 1e-9) )
4089 if(
REALABS(axy*axy - 4.0*ax*ay) > 1e-9 )
4095 sqrtterm = axy * axy * ay * (ay * bx * bx - axy * bx * by + ax * by * by - axy * axy * rhs.
sup + 4.0 * ax * ay * rhs.
sup);
4096 if( !
EPSN(sqrtterm, 1e-9) )
4098 sqrtterm = sqrt(
MAX(sqrtterm, 0.0));
4100 ymin = axy * ay * bx - 2.0 * ax * ay * by - sqrtterm;
4102 ymin /= 4.0 * ax * ay - axy * axy;
4104 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4117 minvalleft =
MIN(-sqrtc -
b, minvalleft);
4118 maxvalright =
MAX( sqrtc -
b, maxvalright);
4123 ymin = axy * ay * bx - 2.0 * ax * ay * by + sqrtterm;
4125 ymin /= 4.0 * ax * ay - axy * axy;
4127 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4140 minvalleft =
MIN(-sqrtc -
b, minvalleft);
4141 maxvalright =
MAX( sqrtc -
b, maxvalright);
4149 sqrtterm = axy * axy * ay * (ay * bx * bx - axy * bx * by + ax * by * by - axy * axy * rhs.
inf + 4.0 * ax * ay * rhs.
inf);
4150 if( !
EPSN(sqrtterm, 1e-9) )
4152 sqrtterm = sqrt(
MAX(sqrtterm, 0.0));
4154 ymin = axy * ay * bx - 2.0 * ax * ay * by - sqrtterm;
4156 ymin /= 4.0 * ax * ay - axy * axy;
4158 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4171 maxvalleft =
MAX(-sqrtc -
b, maxvalleft);
4172 minvalright =
MIN( sqrtc -
b, minvalright);
4177 ymin = axy * ay * bx - 2.0 * ax * ay * by + sqrtterm;
4179 ymin /= 4.0 * ax * ay - axy * axy;
4181 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4194 maxvalleft =
MAX(-sqrtc -
b, maxvalleft);
4195 minvalright =
MIN( sqrtc -
b, minvalright);
4201 else if(
REALABS(2.0 * ay * bx - axy * by) > 1e-9 )
4205 ymin = - (4.0 * ay * bx * by - axy * by * by + 4.0 * axy * ay * rhs.
sup);
4207 ymin /= 2.0 * ay * bx - axy * by;
4209 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4222 minvalleft =
MIN(-sqrtc -
b, minvalleft);
4223 maxvalright =
MAX( sqrtc -
b, maxvalright);
4230 ymin = - (4.0 * ay * bx * by - axy * by * by + 4.0 * axy * ay * rhs.
inf);
4232 ymin /= 2.0 * ay * bx - axy * by;
4234 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4247 maxvalleft =
MAX(-sqrtc -
b, maxvalleft);
4248 minvalright =
MIN( sqrtc -
b, minvalright);
4279 if( ybnds.
sup >= 0.0 )
4288 minvalleft =
MIN(minvalleft, -
b);
4289 maxvalleft =
MAX(maxvalleft, -
b);
4290 minvalright =
MIN(minvalright, -
b);
4291 maxvalright =
MAX(maxvalright, -
b);
4296 minvalleft =
MIN(minvalleft, -
b);
4297 maxvalleft =
MAX(maxvalleft, -
b);
4298 minvalright =
MIN(minvalright, -
b);
4299 maxvalright =
MAX(maxvalright, -
b);
4322 if( ybnds.
inf < 0.0 )
4332 minvalleft =
MIN(minvalleft, -
b);
4333 maxvalleft =
MAX(maxvalleft, -
b);
4334 minvalright =
MIN(minvalright, -
b);
4335 maxvalright =
MAX(maxvalright, -
b);
4354 minvalleft =
MIN(minvalleft, -
b);
4355 maxvalleft =
MAX(maxvalleft, -
b);
4356 minvalright =
MIN(minvalright, -
b);
4357 maxvalright =
MAX(maxvalright, -
b);
4421 if(
EPSGE(-bx / axy, ybnds.
inf, 1e-9) &&
EPSLE(-bx / axy, ybnds.
sup, 1e-9) )
4431 if( xbnds.
inf < 0.0 && xbnds.
sup > 0.0 )
4449 if( lincoef.
inf == 0.0 && lincoef.
sup == 0.0 )
4452 if( myrhs.
inf <= 0.0 && myrhs.
sup >= 0.0 )
4457 else if( xbnds.
inf >= 0.0 )
4488 if( bx + axy * (axy > 0.0 ? ybnds.
inf : ybnds.
sup) > 0.0 )
4498 if(
EPSZ(ay, 1e-9) )
4500 else if( ay * axy < 0.0 )
4505 val = (
c - ay * ybnds.
inf * ybnds.
inf - by * ybnds.
inf) / (bx + axy * ybnds.
inf);
4506 minval =
MIN(val, minval);
4512 if(
EPSZ(ay, 1e-9) )
4513 minval =
MIN(minval, -by / axy);
4514 else if( ay * axy > 0.0 )
4519 val = (
c - ay * ybnds.
sup * ybnds.
sup - by * ybnds.
sup) / (bx + axy * ybnds.
sup);
4520 minval =
MIN(val, minval);
4523 if( !
EPSZ(ay, 1e-9) )
4525 d = ay * (ay * bx * bx - axy * (bx * by + axy *
c));
4526 if( !
EPSN(d, 1e-9) )
4528 ymin = -ay * bx + sqrt(
MAX(d, 0.0));
4531 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4533 assert(bx + axy * ymin != 0.0);
4535 val = (
c - ay * ymin * ymin - by * ymin) / (bx + axy * ymin);
4536 minval =
MIN(val, minval);
4539 ymin = -ay * bx - sqrt(
MAX(d, 0.0));
4542 if(ymin > ybnds.
inf && ymin < ybnds.
sup )
4544 assert(bx + axy * ymin != 0.0);
4546 val = (
c - ay * ymin * ymin - by * ymin) / (bx + axy * ymin);
4547 minval =
MIN(val, minval);
4558 if( bx + axy * (axy > 0.0 ? ybnds.
inf : ybnds.
sup) > 0.0 )
4568 if(
EPSZ(ay, 1e-9) )
4570 else if( ay * axy > 0.0 )
4575 val = (
c - ay * ybnds.
inf * ybnds.
inf - by * ybnds.
inf) / (bx + axy * ybnds.
inf);
4576 maxval =
MAX(val, maxval);
4582 if(
EPSZ(ay, 1e-9) )
4583 maxval =
MAX(maxval, -by / axy);
4584 else if( ay * axy < 0.0 )
4589 val = (
c - ay * ybnds.
sup * ybnds.
sup - by * ybnds.
sup) / (bx + axy * ybnds.
sup);
4590 maxval =
MAX(val, maxval);
4593 if( !
EPSZ(ay, 1e-9) )
4595 d = ay * (ay * bx * bx - axy * (bx * by + axy *
c));
4596 if( !
EPSN(d, 1e-9) )
4598 ymin = ay * bx + sqrt(
MAX(d, 0.0));
4601 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4603 assert(bx + axy * ymin != 0.0);
4604 val = (
c - ay * ymin * ymin - by * ymin) / (bx + axy * ymin);
4605 maxval =
MAX(val, maxval);
4608 ymin = ay * bx - sqrt(
MAX(d, 0.0));
4611 if( ymin > ybnds.
inf && ymin < ybnds.
sup )
4613 assert(bx + axy * ymin != 0.0);
4614 val = (
c - ay * ymin * ymin - by * ymin) / (bx + axy * ymin);
4615 maxval =
MAX(val, maxval);
4626 resultant->
inf = minval - 1e-10 *
REALABS(minval);
4630 resultant->
sup = maxval + 1e-10 *
REALABS(maxval);
4661 int minlinactivityinf;
4662 int maxlinactivityinf;
4663 int nreductions = 0;
4672 *infeasible =
FALSE;
4681 minlinactivity = constant;
4682 maxlinactivity = -constant;
4683 minlinactivityinf = 0;
4684 maxlinactivityinf = 0;
4686 SCIPdebugMessage(
"reverse prop with %d children: %.20g", noperands, constant);
4691 for(
c = 0;
c < noperands; ++
c )
4693 childbounds = operands[
c];
4706 ++maxlinactivityinf;
4710 maxlinactivity -= resultants[
c].
sup;
4714 ++minlinactivityinf;
4718 minlinactivity += resultants[
c].
inf;
4721 maxlinactivity = -maxlinactivity;
4724 minlinactivityinf ? -
infinity : minlinactivity,
4725 maxlinactivityinf ?
infinity : maxlinactivity,
4729 if( (minlinactivityinf >= 2 || rhs.
sup >=
infinity) && (maxlinactivityinf >= 2 || rhs.
inf <= -
infinity) )
4735 for(
c = 0;
c < noperands; ++
c )
4745 if( resultants[
c].inf <= -
infinity && minlinactivityinf <= 1 )
4747 assert(minlinactivityinf == 1);
4750 else if( minlinactivityinf == 0 )
4762 if( resultants[
c].sup >=
infinity && maxlinactivityinf <= 1 )
4764 assert(maxlinactivityinf == 1);
4765 childbounds.
inf = rhs.
inf - maxlinactivity;
4767 else if( maxlinactivityinf == 0 )
4769 childbounds.
inf = rhs.
inf - maxlinactivity + resultants[
c].
sup;
4801 if( resultants[
c].inf != operands[
c].inf || resultants[
c].sup != operands[
c].sup )
common defines and data types used in all packages of SCIP
SCIP_Real SCIPnextafter(SCIP_Real from, SCIP_Real to)
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
void SCIPintervalMulSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalSetRoundingModeUpwards(void)
void SCIPintervalIntersectEps(SCIP_INTERVAL *resultant, SCIP_Real eps, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalAddSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalMulScalarInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
void SCIPintervalSetRoundingModeDownwards(void)
SCIP_Real SCIPintervalGetInf(SCIP_INTERVAL interval)
SCIP_Real SCIPintervalQuadUpperBound(SCIP_Real infinity, SCIP_Real a, SCIP_INTERVAL b_, SCIP_INTERVAL x)
SCIP_Bool SCIPintervalIsEntire(SCIP_Real infinity, SCIP_INTERVAL operand)
void SCIPintervalScalprodScalarsInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_Real *operand2)
void SCIPintervalSub(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalSetEntire(SCIP_Real infinity, SCIP_INTERVAL *resultant)
SCIP_Bool SCIPintervalIsPositiveInfinity(SCIP_Real infinity, SCIP_INTERVAL operand)
SCIP_Real SCIPintervalPowerScalarIntegerSup(SCIP_Real operand1, int operand2)
void SCIPintervalSquareRoot(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalMulInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalScalprodScalarsSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_Real *operand2)
SCIP_ROUNDMODE SCIPintervalGetRoundingMode(void)
void SCIPintervalSetRoundingModeToNearest(void)
void SCIPintervalPower(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalSolveUnivariateQuadExpression(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds)
void SCIPintervalSignPowerScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
SCIP_Real SCIPintervalPowerScalarIntegerInf(SCIP_Real operand1, int operand2)
void SCIPintervalSetRoundingMode(SCIP_ROUNDMODE roundmode)
void SCIPintervalScalprodScalars(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_Real *operand2)
void SCIPintervalUnify(SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalAbs(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
SCIP_Real SCIPintervalAbsMax(SCIP_INTERVAL interval)
void SCIPintervalSubScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
void SCIPintervalSetRoundingModeTowardsZero(void)
void SCIPintervalCos(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalSolveBivariateQuadExpressionAllScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real ax, SCIP_Real ay, SCIP_Real axy, SCIP_Real bx, SCIP_Real by, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds, SCIP_INTERVAL ybnds)
void SCIPintervalMax(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalIntersect(SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalSquare(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalSet(SCIP_INTERVAL *resultant, SCIP_Real value)
SCIP_Bool SCIPintervalIsSubsetEQ(SCIP_Real infinity, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
SCIP_Bool SCIPintervalIsEmpty(SCIP_Real infinity, SCIP_INTERVAL operand)
void SCIPintervalPowerScalarInverse(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL basedomain, SCIP_Real exponent, SCIP_INTERVAL image)
SCIP_Bool SCIPintervalHasRoundingControl(void)
void SCIPintervalSin(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalSolveUnivariateQuadExpressionPositive(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds)
void SCIPintervalSetBounds(SCIP_INTERVAL *resultant, SCIP_Real inf, SCIP_Real sup)
struct SCIP_Interval SCIP_INTERVAL
void SCIPintervalAddInf(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalMin(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalAddVectors(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_INTERVAL *operand2)
SCIP_Bool SCIPintervalIsNegativeInfinity(SCIP_Real infinity, SCIP_INTERVAL operand)
void SCIPintervalMulScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
void SCIPintervalReciprocal(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalPowerScalarInteger(SCIP_INTERVAL *resultant, SCIP_Real operand1, int operand2)
void SCIPintervalEntropy(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalMul(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalDiv(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalPowerScalarScalar(SCIP_INTERVAL *resultant, SCIP_Real operand1, SCIP_Real operand2)
void SCIPintervalQuad(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL xrng)
void SCIPintervalSign(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalPowerScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
void SCIPintervalLog(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalAddScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
void SCIPintervalMulScalarSup(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
void SCIPintervalDivScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_Real operand2)
SCIP_Bool SCIPintervalAreDisjointEps(SCIP_Real eps, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalSolveUnivariateQuadExpressionNegative(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL sqrcoeff, SCIP_INTERVAL lincoeff, SCIP_INTERVAL rhs, SCIP_INTERVAL xbnds)
SCIP_Real SCIPintervalGetSup(SCIP_INTERVAL interval)
void SCIPintervalSolveUnivariateQuadExpressionPositiveAllScalar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real sqrcoeff, SCIP_Real lincoeff, SCIP_Real rhs, SCIP_INTERVAL xbnds)
void SCIPintervalQuadBivar(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_Real ax, SCIP_Real ay, SCIP_Real axy, SCIP_Real bx, SCIP_Real by, SCIP_INTERVAL xbnds, SCIP_INTERVAL ybnds)
SCIP_Real SCIPintervalNegateReal(SCIP_Real x)
SCIP_Bool SCIPintervalAreDisjoint(SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
int SCIPintervalPropagateWeightedSum(SCIP_Real infinity, int noperands, SCIP_INTERVAL *operands, SCIP_Real *weights, SCIP_Real constant, SCIP_INTERVAL rhs, SCIP_INTERVAL *resultants, SCIP_Bool *infeasible)
void SCIPintervalExp(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand)
void SCIPintervalAdd(SCIP_Real infinity, SCIP_INTERVAL *resultant, SCIP_INTERVAL operand1, SCIP_INTERVAL operand2)
void SCIPintervalSetRational(SCIP_INTERVAL *resultant, SCIP_RATIONAL *value)
void SCIPintervalScalprod(SCIP_Real infinity, SCIP_INTERVAL *resultant, int length, SCIP_INTERVAL *operand1, SCIP_INTERVAL *operand2)
void SCIPintervalSetEmpty(SCIP_INTERVAL *resultant)
SCIP_Real SCIPrationalRoundReal(SCIP_RATIONAL *rational, SCIP_ROUNDMODE_RAT roundmode)
assert(minobj< SCIPgetCutoffbound(scip))
static const double pi_d_l
#define SCIP_ROUND_NEAREST
static SCIP_Real negate(SCIP_Real x)
static SCIP_ROUNDMODE intervalGetRoundingMode(void)
#define SCIP_ROUND_UPWARDS
static const double pi_d_u
#define SCIP_ROUND_DOWNWARDS
static void intervalSetRoundingMode(SCIP_ROUNDMODE roundmode)
interval arithmetics for provable bounds
#define BMScopyMemoryArray(ptr, source, num)
SCIP_Real SCIPnegateReal(SCIP_Real x)
internal miscellaneous methods
public methods for message output
wrapper for rational number arithmetic
struct SCIP_Rational SCIP_RATIONAL