58#include <boost/format.hpp>
60#include <boost/multiprecision/gmp.hpp>
62#include <boost/multiprecision/number.hpp>
74 os << (
r.val.sign() > 0 ?
"+" :
"-") <<
"infinity";
101 (*rational)->isinf =
FALSE;
116 (*rational)->isinf =
FALSE;
131 (*rational)->isinf =
FALSE;
186 for(
int i = 0;
i < size; ++
i )
204 for(
int i = 0;
i < size; ++
i )
222 for(
int i = 0;
i < size; ++
i )
240 for(
int i = 0;
i < len; ++
i )
258 for(
int i = 0;
i < len; ++
i )
276 for(
int i = 0;
i < len; ++
i )
291 if( newlen < oldlen )
293 for(
int i = oldlen - 1;
i >= newlen; --
i )
304 for(
int i = oldlen;
i < newlen; ++
i )
321 if( newlen < oldlen )
323 for(
int i = oldlen - 1;
i >= newlen; --
i )
334 for(
int i = oldlen;
i < newlen; ++
i )
351 if( newlen < oldlen )
353 for(
int i = oldlen - 1;
i >= newlen; --
i )
364 for(
int i = oldlen;
i < newlen; ++
i )
373#if defined(SCIP_WITH_BOOST) && defined(SCIP_WITH_GMP)
375mpq_t* SCIPrationalGetGMP(
379 assert(rational !=
nullptr);
382 return &(rational->
val.backend().data());
386void SCIPrationalSetGMP(
391 rational->
val = numb;
404 SCIPrationalSetGMP(*rational, numb);
410void SCIPrationalSetGMPArray(
416 for(
int i = 0;
i < len;
i++ )
418 mpq_init(mpqaaray[
i]);
419 mpq_set(mpqaaray[
i], *SCIPrationalGetGMP(ratarrray[
i]));
424void SCIPrationalSetArrayGMP(
430 for(
int i = 0;
i < len;
i++ )
432 SCIPrationalSetGMP(ratarray[
i], mpqarray[
i]);
437void SCIPrationalClearArrayGMP(
442 for(
int i = 0;
i < len;
i++ )
444 mpq_clear(mpqarray[
i]);
454 assert(*rational !=
nullptr);
456 (*rational)->val.scip::Rational::~Rational();
466 assert(*rational !=
nullptr);
468 (*rational)->val.scip::Rational::~Rational();
478 assert(*rational !=
nullptr);
480 (*rational)->val.scip::Rational::~Rational();
490 assert(ratarray !=
nullptr);
492 for(
int i = 0;
i < size; ++
i )
507 assert(ratblockarray !=
nullptr);
509 for(
int i = 0;
i < size; ++
i )
524 assert(ratbufarray !=
nullptr);
526 for(
int i = size - 1;
i >= 0; --
i )
542 assert(rational !=
nullptr);
543#if defined(SCIP_WITH_GMP) && defined(SCIP_WITH_BOOST)
544 mpq_canonicalize(rational->
val.backend().data());
658 if( *desc ==
'-' || *desc ==
'+' )
661 if( *desc ==
'\0' || *desc ==
'/' )
667 desc += strspn(desc,
"0123456789");
680 desc += strspn(desc,
"0123456789");
690 mantissalen = strspn(desc,
"0123456789");
692 if( mantissalen == 0 )
698 if( *desc ==
'e' || *desc ==
'E' )
702 if( *desc ==
'-' || *desc ==
'+' )
708 desc += strspn(desc,
"0123456789");
742 res->
val = negative ? -1 : 1;
749 size_t exponentidx = s.find_first_of(
"eE");
753 if( exponentidx != std::string::npos )
755 exponent = std::stoi(s.substr(exponentidx + 1, s.length()));
756 s.resize(exponentidx);
760 if( s.find(
'.') != std::string::npos )
765 (void) s.insert(0,
"0");
768 size_t decimalpos = s.find(
'.');
769 size_t exponentpos = s.length() - 1 - decimalpos;
772 if( decimalpos != std::string::npos )
774 for(
size_t i = 0;
i < exponentpos; ++
i )
777 (void) s.erase(decimalpos, 1);
779 assert(std::all_of(s.begin()+1, s.end(), ::isdigit));
784 (void) s.append(
"/");
789 res->
val *= pow(10, exponent);
850 if( *desc ==
'\0' || *desc ==
'/' )
862 if( *(++(*endptr)) ==
'i' )
864 if( *(++(*endptr)) ==
'n' )
866 if( *(++(*endptr)) ==
'i' )
868 if( *(++(*endptr)) ==
't' )
870 if( *(++(*endptr)) ==
'y' )
880 desc += strspn(desc,
"0123456789");
890 desc += strspn(desc,
"0123456789");
893 else if( *desc !=
'\0' )
900 mantissalen = strspn(desc,
"0123456789");
902 if( mantissalen == 0 )
908 if( *desc ==
'e' || *desc ==
'E' )
912 if( *desc ==
'-' || *desc ==
'+' )
918 desc += strspn(desc,
"0123456789");
922 std::string s(*endptr, desc);
941 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
946 if( op1->
val.
sign() != op2->val.sign() && op1->
isinf && op2->isinf )
967 assert(res !=
nullptr && rat !=
nullptr);
989 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
996 SCIPerrorMessage(
"subtraction of two infinities with same sign not supported \n");
1015 assert(res !=
nullptr && rat !=
nullptr);
1034 assert(res !=
nullptr && val1 !=
nullptr && val2 !=
nullptr);
1047 else if(val2->
isinf)
1053 absval1 =
abs(val1->
val);
1054 absval2 =
abs(val2->
val);
1055 quot = absval1 >= absval2 ? absval1 : absval2;
1059 res->
val = ((val1->
val)-(val2->
val))/quot;
1072 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1103 assert(res !=
nullptr && op1 !=
nullptr);
1107 SCIPdebugMessage(
"multiplying with infinity might produce undesired behavior \n");
1124 res->
val = op1->
val * op2;
1138 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1153 assert(res !=
nullptr && op1 !=
nullptr);
1179 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1216 assert(res !=
nullptr && op1 !=
nullptr);
1233 res->
val += op1->
val * op2;
1245 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1274 assert(res !=
nullptr && op1 !=
nullptr);
1291 res->
val -= op1->
val * op2;
1302 assert(res !=
nullptr && op !=
nullptr);
1315 assert(res !=
nullptr && op !=
nullptr);
1328 assert(res !=
nullptr && op !=
nullptr);
1348 assert(op1 !=
nullptr && op2 !=
nullptr);
1357 else if( op2->
isinf )
1379 assert(op1 !=
nullptr && op2 !=
nullptr);
1388 else if( op2->
isinf )
1409 assert(rat1 !=
nullptr && rat2 !=
nullptr);
1411 if( rat1->
val == rat2->
val )
1426 assert(rat1 !=
nullptr && rat2 !=
nullptr);
1484 if( rat1->
val < 0 || ( rat2->
isinf && rat2->
val > 0 ) )
1489 else if( rat2->
isinf )
1535 assert(rat1 !=
nullptr && rat2 !=
nullptr);
1539 else if( rat2->
isinf )
1562 else if( rat->
isinf )
1592 else if( rat->
isinf )
1628 assert(rational !=
nullptr);
1644 assert(rational !=
nullptr);
1654 assert(rational !=
nullptr);
1664 assert(rational !=
nullptr);
1674 assert(rational !=
nullptr);
1684 assert(rational !=
nullptr);
1687 return rational->
isinf;
1695 assert(rational !=
nullptr);
1696 if( rational->
isinf )
1714 assert(rational !=
nullptr);
1751 if( rational ==
NULL )
1753 else if( rational->
isinf )
1755 if( rational->
val.
sign() > 0 )
1762 std::string s = rational->
val.
str();
1779 if( rational ==
NULL )
1782 else if( rational->
isinf )
1786 return (
int) rational->
val.
str().length();
1796 if( rational ==
NULL )
1798 else if( rational->
isinf )
1800 if( rational->
val.
sign() > 0 )
1807 std::string s = rational->
val.
str();
1824 if( msgverblevel <= verblevel )
1835 if( rational ==
NULL )
1836 std::cout <<
"unknown" << std::flush;
1837 else if( rational->
isinf )
1838 std::cout << (rational->
val.
sign() > 0 ?
"+" :
"-") <<
"infinity" << std::flush;
1840 std::cout << rational->
val << std::flush;
1846 const char* formatstr,
1860 while( *formatstr !=
'\0' )
1862 if( *formatstr ==
'%' && *(formatstr+1) !=
'%' )
1864 switch( *++formatstr )
1871 for( sval = va_arg(arguments,
char *); *sval; sval++ )
1872 (
void) putchar(*sval);
1888 ival = va_arg(arguments,
int);
1893 printf(
"%lld", lval);
1896 ival = va_arg(arguments,
int);
1900 cval = (char) va_arg(arguments,
int);
1904 pval = va_arg(arguments,
void*);
1908 (void) putchar(*formatstr);
1914 (void) putchar(*formatstr);
1924 const char* formatstr,
1930 va_start(ap, formatstr);
1937 const char* sourcefile,
1939 const char* formatstr,
1943 const char* filename;
1950 filename = strrchr(sourcefile,
'\\');
1952 filename = strrchr(sourcefile,
'/');
1954 if( filename ==
NULL )
1955 filename = sourcefile;
1959 printf(
"[%s:%d] debug: ", filename, sourceline);
1961 va_start(ap, formatstr);
1966#ifdef SCIP_WITH_BOOST
1976 numerator = boost::multiprecision::numerator(rational->
val);
2022 assert(rational !=
nullptr);
2031 assert(rational !=
nullptr);
2041 assert(rational !=
nullptr);
2052 assert(rational !=
nullptr);
2065#ifdef SCIP_WITH_BOOST
2077 roundint = src->
val.
sign() > 0 ? roundint : roundint - 1;
2079 res->
val = src->
val - roundint;
2089 assert(rational !=
nullptr);
2091#ifdef SCIP_WITH_BOOST
2092 if( rational->
isinf )
2097 return mpq_get_d(rational->
val.backend().data());
2115 assert(rational !=
nullptr);
2117 if( rational->
isinf )
2122#if defined(SCIP_WITH_MPFR) && defined(SCIP_WITH_BOOST) && defined(SCIP_WITH_GMP)
2128 val = SCIPrationalGetGMP(rational);
2132 (void) mpfr_init_set_q(valmpfr, *val, MPFR_RNDD);
2133 realapprox = (
SCIP_Real) mpfr_get_d(valmpfr, MPFR_RNDD);
2136 (void) mpfr_init_set_q(valmpfr, *val, MPFR_RNDU);
2137 realapprox = (
SCIP_Real) mpfr_get_d(valmpfr, MPFR_RNDU);
2140 (void) mpfr_init_set_q(valmpfr, *val, MPFR_RNDN);
2141 realapprox = (
SCIP_Real) mpfr_get_d(valmpfr, MPFR_RNDN);
2147 mpfr_clear(valmpfr);
2151 SCIPerrorMessage(
"method SCIPrationalRoundReal not supported when SCIP is compiled without Boost.\n");
2166#ifdef SCIP_WITH_BOOST
2181 roundint = src->
val.
sign() > 0 ? roundint : roundint - 1;
2184 roundint = src->
val.
sign() > 0 ? roundint + 1 : roundint;
2195 res->
val = roundint;
2213#ifdef SCIP_WITH_BOOST
2224 roundint = src->
val.
sign() > 0 ? roundint : roundint - 1;
2227 roundint = src->
val.
sign() > 0 ? roundint + 1 : roundint;
2239 if( *res == roundint )
2245#ifdef SCIP_WITH_BOOST
2261 resnum = j * p[1] + p[0];
2262 resden = j * q[1] + q[0];
2273void chooseSemiconvLong(
2284 j = (maxdenom - q[0]) / q[1];
2288 resnum = j * p[1] + p[0];
2289 resden = j * q[1] + q[0];
2302void SCIPrationalComputeApproximationLong(
2326 sign = tn >= 0 ? 1 : -1;
2332 if( td <= maxdenom )
2342 if( temp < td / (maxdenom * 1.0) )
2345 if( forcegreater == 1 && a0 * sign < src->val )
2347 res->
val = a0 * sign;
2350 else if( forcegreater == -1 && a0 * sign > src->
val )
2352 res->
val = a0 * sign;
2356 res->
val = a0 * sign;
2361 SCIPdebug(std::cout <<
"approximating " << src->
val <<
" by " << res->
val << std::endl);
2385 SCIPdebug(std::cout <<
"approximating " << src->
val <<
" by continued fractions with maxdenom " << maxdenom << std::endl);
2386 SCIPdebug(std::cout <<
"confrac initial values: p0 " << p[1] <<
" q0 " << q[1] <<
" p1 " << p[2] <<
" q1 " << q[2] << std::endl);
2389 if( q[2] > maxdenom )
2392 while( !done && td != 0 )
2410 p[2] = p[0] + p[1] * ai;
2411 q[2] = q[0] + q[1] * ai;
2413 SCIPdebug(std::cout <<
"ai " << ai <<
" pi " << p[2] <<
" qi " << q[2] << std::endl);
2415 if( q[2] > maxdenom )
2419 if( (forcegreater == 1 &&
scip::Rational(p[2],q[2]) * sign < src->val) ||
2429 || (forcegreater == -1 &&
scip::Rational(p[1],q[1]) * sign < src->val) )
2435 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2436 chooseSemiconvLong(resnum, resden, p, q, 1, maxdenom);
2437 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2444 if( forcegreater != 0 )
2445 chooseSemiconvLong(resnum, resden, p, q, 1, maxdenom);
2447 chooseSemiconvLong(resnum, resden, p, q, ai, maxdenom);
2448 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2449 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2473#ifdef SCIP_WITH_BOOST
2503 if( forcegreater == 1 )
2512 if( forcegreater == -1 )
2527 SCIPrationalComputeApproximationLong(res, src, maxdenom, forcegreater);
2538 if( td <= maxdenom )
2545 divide_qr(tn, td, a0, temp);
2548 if( temp * maxdenom < td )
2550 if( forcegreater == 1 && a0 * sign < src->val )
2552 res->
val = a0 * sign;
2555 else if( forcegreater == -1 && a0 * sign > src->
val )
2557 res->
val = a0 * sign;
2561 res->
val = a0 * sign;
2566 SCIPdebug(std::cout <<
"approximating " << src->
val <<
" by " << res->
val << std::endl);
2574 divide_qr(tn, td, ai, temp);
2587 SCIPdebug(std::cout <<
"approximating " << src->
val <<
" by continued fractions with maxdenom " << maxdenom << std::endl);
2588 SCIPdebug(std::cout <<
"confrac initial values: p0 " << p[1] <<
" q0 " << q[1] <<
" p1 " << p[2] <<
" q1 " << q[2] << std::endl);
2591 if( q[2] > maxdenom )
2594 while(!done && td != 0)
2599 divide_qr(tn, td, ai, temp);
2610 p[2] = p[0] + p[1] * ai;
2611 q[2] = q[0] + q[1] * ai;
2613 SCIPdebug(std::cout <<
"ai " << ai <<
" pi " << p[2] <<
" qi " << q[2] << std::endl);
2615 if( q[2] > maxdenom )
2619 if( (forcegreater == 1 &&
scip::Rational(p[2],q[2]) * sign < src->val) ||
2629 || (forcegreater == -1 &&
scip::Rational(p[1],q[1]) * sign < src->val) )
2635 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2636 chooseSemiconv(resnum, resden, p, q, 1,
scip::Integer(maxdenom));
2637 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2644 if( forcegreater != 0 )
2645 chooseSemiconv(resnum, resden, p, q, 1,
scip::Integer(maxdenom));
2647 chooseSemiconv(resnum, resden, p, q, ai,
scip::Integer(maxdenom));
2648 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2649 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2673 assert(rationalarray !=
nullptr);
2674 assert(blkmem !=
nullptr);
2678 (*rationalarray)->firstidx = -1;
2689 assert(rationalarray !=
nullptr);
2691 rationalarray->
vals.resize((
size_t)newsize);
2703 assert(rationalarray !=
nullptr);
2704 assert(sourcerationalarray !=
nullptr);
2707 (*rationalarray)->vals = sourcerationalarray->
vals;
2708 (*rationalarray)->firstidx = sourcerationalarray->
firstidx;
2719 assert(rationalarray !=
nullptr);
2720 assert(*rationalarray !=
nullptr);
2722 (*rationalarray)->vals.scip::sparsevec::~sparsevec();
2735 assert(rationalarray !=
nullptr);
2738 if( rationalarray->
firstidx == -1 || idx < rationalarray->firstidx
2739 || (
size_t) idx >= rationalarray->
vals.size() + (
size_t) rationalarray->
firstidx )
2752 assert(rationalarray !=
nullptr);
2755 if( rationalarray-> firstidx == -1 )
2757 rationalarray->
vals.push_back(*val);
2761 if( idx < rationalarray->firstidx )
2763 int ninserts = rationalarray->
firstidx - idx;
2765 (void) rationalarray->
vals.insert(rationalarray->
vals.begin(), ninserts,
r);
2767 rationalarray->
vals[0] = *val;
2769 else if( (
size_t) idx >= rationalarray->
vals.size() + rationalarray->
firstidx )
2771 int ninserts = idx - (int) rationalarray->
vals.size() - rationalarray->
firstidx + 1;
2773 (void) rationalarray->
vals.insert(rationalarray->
vals.end(), (
size_t) ninserts,
r);
2774 rationalarray->
vals[rationalarray->
vals.size() - 1] = *val;
2778 rationalarray->
vals[idx - rationalarray->
firstidx] = *val;
2791 assert(incval !=
nullptr);
2796 else if( idx < rationalarray->firstidx || (
size_t) idx >= rationalarray->
vals.size() + (
size_t) rationalarray->
firstidx )
2801 rationalarray->
vals[(size_t) (idx - rationalarray->
firstidx)].val += incval->
val;
2802 rationalarray->
vals[(size_t) (idx - rationalarray->
firstidx)].isfprepresentable =
FALSE;
2813 printf(
"Array with firstidx %d, length %d \n", rationalarray->
firstidx, (
int) rationalarray->
vals.size());
2814 for(
auto val : rationalarray->
vals )
2828 assert(rationalarray !=
nullptr);
2838 assert(rationalarray !=
nullptr);
2840 return rationalarray->
firstidx + (int) rationalarray->
vals.size() - 1;
2850#ifdef SCIP_THREADSAFE
#define SCIP_DEFAULT_INFINITY
SCIP_Bool SCIPrationalIsLTReal(SCIP_RATIONAL *rat, SCIP_Real real)
SCIP_Bool SCIPrationalIsFpRepresentable(SCIP_RATIONAL *rational)
void SCIPrationalMin(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
SCIP_Bool SCIPrationalRoundLong(SCIP_Longint *res, SCIP_RATIONAL *src, SCIP_ROUNDMODE_RAT roundmode)
SCIP_RETCODE SCIPrationalCreateBlock(BMS_BLKMEM *blkmem, SCIP_RATIONAL **rational)
SCIP_RETCODE SCIPrationalCreate(SCIP_RATIONAL **rational)
void SCIPrationalMult(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
void SCIPrationalInvert(SCIP_RATIONAL *res, SCIP_RATIONAL *op)
SCIP_Bool SCIPrationalIsAbsEQ(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_RETCODE SCIPrationalarrayIncVal(SCIP_RATIONALARRAY *rationalarray, int idx, SCIP_RATIONAL *incval)
void SCIPrationalPrint(SCIP_RATIONAL *rational)
void SCIPrationalSetInfinity(SCIP_RATIONAL *res)
void SCIPrationalAdd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
SCIP_Real SCIPrationalGetReal(SCIP_RATIONAL *rational)
void SCIPrationalGetFrac(SCIP_RATIONAL *res, SCIP_RATIONAL *src)
SCIP_RETCODE SCIPrationalCreateString(BMS_BLKMEM *mem, SCIP_RATIONAL **rational, const char *desc)
SCIP_RETCODE SCIPrationalCopy(SCIP_RATIONAL **result, SCIP_RATIONAL *src)
SCIP_Bool SCIPrationalIsString(const char *desc)
void SCIPrationalResetFloatingPointRepresentable(SCIP_RATIONAL *rat)
SCIP_Bool SCIPrationalIsApproxEQReal(SCIP_SET *set, SCIP_RATIONAL *rat, SCIP_Real real, SCIP_ROUNDMODE_RAT roundmode)
void SCIPrationalFreeBlock(BMS_BLKMEM *mem, SCIP_RATIONAL **rational)
int SCIPrationalToString(SCIP_RATIONAL *rational, char *str, int strlen)
void SCIPrationalarrayGetVal(SCIP_RATIONALARRAY *rationalarray, int idx, SCIP_RATIONAL *result)
SCIP_RETCODE SCIPrationalCreateBlockArray(BMS_BLKMEM *mem, SCIP_RATIONAL ***rational, int size)
#define SCIPrationalDebugMessage
void SCIPrationalPrintVerbInfo(SCIP_MESSAGEHDLR *msg, SCIP_VERBLEVEL verblevel, SCIP_VERBLEVEL msgverblevel, SCIP_RATIONAL *rational)
void SCIPrationalAbs(SCIP_RATIONAL *res, SCIP_RATIONAL *op)
void SCIPrationalRoundInteger(SCIP_RATIONAL *res, SCIP_RATIONAL *src, SCIP_ROUNDMODE_RAT roundmode)
void SCIPrationalDiv(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
SCIP_Bool SCIPrationalIsAbsInfinity(SCIP_RATIONAL *rational)
SCIP_RETCODE SCIPrationalarrayResize(SCIP_RATIONALARRAY *rationalarray, int newsize)
SCIP_Bool SCIPrationalIsLT(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
void SCIPrationalSetReal(SCIP_RATIONAL *res, SCIP_Real real)
SCIP_Bool SCIPrationalIsGT(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_RETCODE SCIPrationalCopyBlock(BMS_BLKMEM *mem, SCIP_RATIONAL **result, SCIP_RATIONAL *src)
void SCIPrationalCheckInfByValue(SCIP_RATIONAL *rational)
void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
SCIP_RETCODE SCIPrationalCopyBlockArray(BMS_BLKMEM *mem, SCIP_RATIONAL ***target, SCIP_RATIONAL **src, int len)
void SCIPrationalDiff(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
SCIP_Bool SCIPrationalIsLEReal(SCIP_RATIONAL *rat, SCIP_Real real)
SCIP_RETCODE SCIPrationalCopyBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***result, SCIP_RATIONAL **src, int len)
SCIP_Bool SCIPrationalIsPositive(SCIP_RATIONAL *rational)
SCIP_Longint SCIPrationalDenominator(SCIP_RATIONAL *rational)
int SCIPrationalGetSign(const SCIP_RATIONAL *rational)
SCIP_Real SCIPrationalGetInfinity(void)
SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
void SCIPrationalAddProd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
SCIP_Bool SCIPrationalIsZero(SCIP_RATIONAL *rational)
void SCIPrationalSetRational(SCIP_RATIONAL *res, SCIP_RATIONAL *src)
int SCIPrationalarrayGetMinIdx(SCIP_RATIONALARRAY *rationalarray)
void SCIPrationalSetString(SCIP_RATIONAL *res, const char *desc)
SCIP_Bool SCIPrationalIsGEReal(SCIP_RATIONAL *rat, SCIP_Real real)
void SCIPrationalFreeArray(SCIP_RATIONAL ***ratarray, int size)
SCIP_RETCODE SCIPrationalReallocArray(SCIP_RATIONAL ***result, int oldlen, int newlen)
SCIP_Bool SCIPrationalIsIntegral(SCIP_RATIONAL *rational)
SCIP_Bool SCIPrationalDenominatorIsLE(SCIP_RATIONAL *rational, SCIP_Longint val)
void SCIPrationalMax(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
void SCIPrationalRelDiff(SCIP_RATIONAL *res, SCIP_RATIONAL *val1, SCIP_RATIONAL *val2)
SCIP_Bool SCIPrationalIsGE(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_RETCODE SCIPrationalarraySetVal(SCIP_RATIONALARRAY *rationalarray, int idx, SCIP_RATIONAL *val)
SCIP_Bool SCIPstrToRationalValue(char *desc, SCIP_RATIONAL *value, char **endptr)
void SCIPrationalPrintDebugMessage(const char *sourcefile, int sourceline, const char *formatstr,...)
void SCIPrationalCanonicalize(SCIP_RATIONAL *rational)
void SCIPrationalMessage(SCIP_MESSAGEHDLR *msg, FILE *file, SCIP_RATIONAL *rational)
void SCIPrationalSetNegInfinity(SCIP_RATIONAL *res)
void SCIPrationalSetFraction(SCIP_RATIONAL *res, SCIP_Longint nom, SCIP_Longint denom)
void SCIPrationalNegate(SCIP_RATIONAL *res, SCIP_RATIONAL *op)
SCIP_RETCODE SCIPrationalarrayCreate(SCIP_RATIONALARRAY **rationalarray, BMS_BLKMEM *blkmem)
SCIP_Bool SCIPrationalIsNegative(SCIP_RATIONAL *rational)
void SCIPrationalDiffReal(SCIP_RATIONAL *res, SCIP_RATIONAL *rat, SCIP_Real real)
int SCIPrationalarrayGetMaxIdx(SCIP_RATIONALARRAY *rationalarray)
SCIP_Bool SCIPrationalIsInfinity(SCIP_RATIONAL *rational)
void SCIPrationalFreeBlockArray(BMS_BLKMEM *mem, SCIP_RATIONAL ***ratblockarray, int size)
SCIP_Real SCIPrationalRoundReal(SCIP_RATIONAL *rational, SCIP_ROUNDMODE_RAT roundmode)
SCIP_Longint SCIPrationalNumerator(SCIP_RATIONAL *rational)
SCIP_Bool SCIPrationalIsEQReal(SCIP_RATIONAL *rat, SCIP_Real real)
SCIP_RETCODE SCIPrationalCreateArray(SCIP_RATIONAL ***rational, int size)
SCIP_RETCODE SCIPrationalCreateBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***rational, int size)
SCIP_RETCODE SCIPrationalarrayCopy(SCIP_RATIONALARRAY **rationalarray, BMS_BLKMEM *blkmem, SCIP_RATIONALARRAY *sourcerationalarray)
SCIP_Bool SCIPrationalIsNegInfinity(SCIP_RATIONAL *rational)
void SCIPrationalFree(SCIP_RATIONAL **rational)
void SCIPrationalDiffProdReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
SCIP_RETCODE SCIPrationalarrayFree(SCIP_RATIONALARRAY **rationalarray, BMS_BLKMEM *blkmem)
void SCIPrationalDivReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
SCIP_Bool SCIPrationalIsGTReal(SCIP_RATIONAL *rat, SCIP_Real real)
SCIP_RETCODE SCIPrationalReallocBlockArray(BMS_BLKMEM *mem, SCIP_RATIONAL ***result, int oldlen, int newlen)
SCIP_Bool SCIPrationalIsEQ(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
void SCIPrationalChgInfinity(SCIP_Real inf)
void SCIPrationalDiffProd(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_RATIONAL *op2)
void SCIPrationalPrintf(const char *formatstr,...)
SCIP_RETCODE SCIPrationalReallocBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***result, int oldlen, int newlen)
void SCIPrationalMultReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
void SCIPrationalComputeApproximation(SCIP_RATIONAL *res, SCIP_RATIONAL *src, SCIP_Longint maxdenom, int forcegreater)
void SCIPrationalFreeBufferArray(BMS_BUFMEM *mem, SCIP_RATIONAL ***ratbufarray, int size)
SCIP_RETCODE SCIPrationalCopyBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **result, SCIP_RATIONAL *src)
SCIP_Bool SCIPrationalIsAbsGT(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_Bool SCIPrationalIsLE(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
void SCIPrationalAddReal(SCIP_RATIONAL *res, SCIP_RATIONAL *rat, SCIP_Real real)
SCIP_RETCODE SCIPrationalCopyArray(SCIP_RATIONAL ***target, SCIP_RATIONAL **src, int len)
SCIP_RETCODE SCIPrationalarrayPrint(SCIP_RATIONALARRAY *rationalarray)
int SCIPrationalStrLen(SCIP_RATIONAL *rational)
void SCIPrationalAddProdReal(SCIP_RATIONAL *res, SCIP_RATIONAL *op1, SCIP_Real op2)
int SCIPstrncpy(char *t, const char *s, int size)
int SCIPstrncasecmp(const char *s1, const char *s2, int length)
assert(minobj< SCIPgetCutoffbound(scip))
interval arithmetics for provable bounds
memory allocation routines
#define BMSduplicateBlockMemoryArray(mem, ptr, source, num)
#define BMSreallocBufferMemoryArray(mem, ptr, num)
#define BMSfreeMemory(ptr)
#define BMSfreeBlockMemory(mem, ptr)
#define BMSfreeBufferMemory(mem, ptr)
#define BMSduplicateBufferMemoryArray(mem, ptr, source, num)
#define BMSallocBlockMemory(mem, ptr)
#define BMSreallocMemoryArray(ptr, num)
#define BMSfreeBlockMemoryArrayNull(mem, ptr, num)
#define BMSduplicateMemoryArray(ptr, source, num)
#define BMSallocBufferMemory(mem, ptr)
#define BMSallocMemoryArray(ptr, num)
#define BMSallocBlockMemoryArray(mem, ptr, num)
#define BMSreallocBlockMemoryArray(mem, ptr, oldnum, newnum)
#define BMSallocBufferMemoryArray(mem, ptr, num)
#define BMSfreeBufferMemoryArrayNull(mem, ptr)
struct BMS_BufMem BMS_BUFMEM
struct BMS_BlkMem BMS_BLKMEM
#define BMSfreeMemoryArrayNull(ptr)
#define BMSallocMemory(ptr)
#define va_copy(dest, src)
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
SCIP_Longint denominator(Rational &r)
std::vector< SCIP_RATIONAL > sparsevec
Rational & abs(Rational &r)
SCIP_Longint numerator(Rational &r)
public methods for message output
public data structures and miscellaneous methods
static void SCIPrationalVPrintf(const char *formatstr, va_list ap)
std::ostream & operator<<(std::ostream &os, SCIP_RATIONAL const &r)
wrapper for rational number arithmetic
wrapper for rational number arithmetic that interacts with GMP
SCIP_Bool SCIPsetIsEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
internal methods for global SCIP settings
std::vector< SCIP_RATIONAL > vals
unsigned int isfprepresentable
definition of wrapper class for rational numbers
type definitions for message output methods
enum SCIP_VerbLevel SCIP_VERBLEVEL
struct SCIP_Messagehdlr SCIP_MESSAGEHDLR
type definitions for rational numbers
struct SCIP_Rational SCIP_RATIONAL
enum SCIP_RoundModeRational SCIP_ROUNDMODE_RAT
struct SCIP_RationalArray SCIP_RATIONALARRAY
@ SCIP_ISFPREPRESENTABLE_FALSE
@ SCIP_ISFPREPRESENTABLE_TRUE
@ SCIP_ISFPREPRESENTABLE_UNKNOWN
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE