58#include <boost/format.hpp>
60#include <boost/multiprecision/gmp.hpp>
62#include <boost/multiprecision/number.hpp>
75 os << (
r.val.sign() > 0 ?
"+" :
"-") <<
"infinity";
102 (*rational)->isinf =
FALSE;
117 (*rational)->isinf =
FALSE;
132 (*rational)->isinf =
FALSE;
187 for(
int i = 0;
i < size; ++
i )
205 for(
int i = 0;
i < size; ++
i )
223 for(
int i = 0;
i < size; ++
i )
241 for(
int i = 0;
i < len; ++
i )
259 for(
int i = 0;
i < len; ++
i )
277 for(
int i = 0;
i < len; ++
i )
292 if( newlen < oldlen )
294 for(
int i = oldlen - 1;
i >= newlen; --
i )
305 for(
int i = oldlen;
i < newlen; ++
i )
322 if( newlen < oldlen )
324 for(
int i = oldlen - 1;
i >= newlen; --
i )
335 for(
int i = oldlen;
i < newlen; ++
i )
352 if( newlen < oldlen )
354 for(
int i = oldlen - 1;
i >= newlen; --
i )
365 for(
int i = oldlen;
i < newlen; ++
i )
374#if defined(SCIP_WITH_BOOST) && defined(SCIP_WITH_GMP)
376mpq_t* SCIPrationalGetGMP(
380 assert(rational !=
nullptr);
383 return &(rational->
val.backend().data());
387void SCIPrationalSetGMP(
392 rational->
val = numb;
405 SCIPrationalSetGMP(*rational, numb);
411void SCIPrationalSetGMPArray(
417 for(
int i = 0;
i < len;
i++ )
419 mpq_init(mpqaaray[
i]);
420 mpq_set(mpqaaray[
i], *SCIPrationalGetGMP(ratarrray[
i]));
425void SCIPrationalSetArrayGMP(
431 for(
int i = 0;
i < len;
i++ )
433 SCIPrationalSetGMP(ratarray[
i], mpqarray[
i]);
438void SCIPrationalClearArrayGMP(
443 for(
int i = 0;
i < len;
i++ )
445 mpq_clear(mpqarray[
i]);
455 assert(*rational !=
nullptr);
457 (*rational)->val.scip::Rational::~Rational();
467 assert(*rational !=
nullptr);
469 (*rational)->val.scip::Rational::~Rational();
479 assert(*rational !=
nullptr);
481 (*rational)->val.scip::Rational::~Rational();
491 assert(ratarray !=
nullptr);
493 for(
int i = 0;
i < size; ++
i )
508 assert(ratblockarray !=
nullptr);
510 for(
int i = 0;
i < size; ++
i )
525 assert(ratbufarray !=
nullptr);
527 for(
int i = size - 1;
i >= 0; --
i )
543 assert(rational !=
nullptr);
544#if defined(SCIP_WITH_GMP) && defined(SCIP_WITH_BOOST)
545 mpq_canonicalize(rational->
val.backend().data());
659 if( *desc ==
'-' || *desc ==
'+' )
662 if( *desc ==
'\0' || *desc ==
'/' )
668 desc += strspn(desc,
"0123456789");
681 desc += strspn(desc,
"0123456789");
691 mantissalen = strspn(desc,
"0123456789");
693 if( mantissalen == 0 )
699 if( *desc ==
'e' || *desc ==
'E' )
703 if( *desc ==
'-' || *desc ==
'+' )
709 desc += strspn(desc,
"0123456789");
743 res->
val = negative ? -1 : 1;
750 size_t exponentidx = s.find_first_of(
"eE");
754 if( exponentidx != std::string::npos )
756 exponent = std::stoi(s.substr(exponentidx + 1, s.length()));
757 s.resize(exponentidx);
761 if( s.find(
'.') != std::string::npos )
766 (void) s.insert(0,
"0");
769 size_t decimalpos = s.find(
'.');
770 size_t exponentpos = s.length() - 1 - decimalpos;
773 if( decimalpos != std::string::npos )
775 for(
size_t i = 0;
i < exponentpos; ++
i )
778 (void) s.erase(decimalpos, 1);
780 assert(std::all_of(s.begin()+1, s.end(), ::isdigit));
785 (void) s.append(
"/");
790 res->
val *= pow(10, exponent);
851 if( *desc ==
'\0' || *desc ==
'/' )
863 if( *(++(*endptr)) ==
'i' )
865 if( *(++(*endptr)) ==
'n' )
867 if( *(++(*endptr)) ==
'i' )
869 if( *(++(*endptr)) ==
't' )
871 if( *(++(*endptr)) ==
'y' )
881 desc += strspn(desc,
"0123456789");
891 desc += strspn(desc,
"0123456789");
894 else if( *desc !=
'\0' )
901 mantissalen = strspn(desc,
"0123456789");
903 if( mantissalen == 0 )
909 if( *desc ==
'e' || *desc ==
'E' )
913 if( *desc ==
'-' || *desc ==
'+' )
919 desc += strspn(desc,
"0123456789");
923 std::string s(*endptr, desc);
942 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
947 if( op1->
val.
sign() != op2->val.sign() && op1->
isinf && op2->isinf )
968 assert(res !=
nullptr && rat !=
nullptr);
990 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
997 SCIPerrorMessage(
"subtraction of two infinities with same sign not supported \n");
1016 assert(res !=
nullptr && rat !=
nullptr);
1035 assert(res !=
nullptr && val1 !=
nullptr && val2 !=
nullptr);
1048 else if(val2->
isinf)
1054 absval1 =
abs(val1->
val);
1055 absval2 =
abs(val2->
val);
1056 quot = absval1 >= absval2 ? absval1 : absval2;
1060 res->
val = ((val1->
val)-(val2->
val))/quot;
1073 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1104 assert(res !=
nullptr && op1 !=
nullptr);
1108 SCIPdebugMessage(
"multiplying with infinity might produce undesired behavior \n");
1125 res->
val = op1->
val * op2;
1139 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1154 assert(res !=
nullptr && op1 !=
nullptr);
1180 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1217 assert(res !=
nullptr && op1 !=
nullptr);
1234 res->
val += op1->
val * op2;
1246 assert(res !=
nullptr && op1 !=
nullptr && op2 !=
nullptr);
1275 assert(res !=
nullptr && op1 !=
nullptr);
1292 res->
val -= op1->
val * op2;
1303 assert(res !=
nullptr && op !=
nullptr);
1316 assert(res !=
nullptr && op !=
nullptr);
1329 assert(res !=
nullptr && op !=
nullptr);
1349 assert(op1 !=
nullptr && op2 !=
nullptr);
1358 else if( op2->
isinf )
1380 assert(op1 !=
nullptr && op2 !=
nullptr);
1389 else if( op2->
isinf )
1410 assert(rat1 !=
nullptr && rat2 !=
nullptr);
1412 if( rat1->
val == rat2->
val )
1427 assert(rat1 !=
nullptr && rat2 !=
nullptr);
1485 if( rat1->
val < 0 || ( rat2->
isinf && rat2->
val > 0 ) )
1490 else if( rat2->
isinf )
1536 assert(rat1 !=
nullptr && rat2 !=
nullptr);
1540 else if( rat2->
isinf )
1563 else if( rat->
isinf )
1593 else if( rat->
isinf )
1629 assert(rational !=
nullptr);
1645 assert(rational !=
nullptr);
1655 assert(rational !=
nullptr);
1665 assert(rational !=
nullptr);
1675 assert(rational !=
nullptr);
1685 assert(rational !=
nullptr);
1688 return rational->
isinf;
1696 assert(rational !=
nullptr);
1697 if( rational->
isinf )
1715 assert(rational !=
nullptr);
1752 if( rational ==
NULL )
1754 else if( rational->
isinf )
1756 if( rational->
val.
sign() > 0 )
1763 std::string s = rational->
val.
str();
1780 if( rational ==
NULL )
1783 else if( rational->
isinf )
1787 return (
int) rational->
val.
str().length();
1797 if( rational ==
NULL )
1799 else if( rational->
isinf )
1801 if( rational->
val.
sign() > 0 )
1808 std::string s = rational->
val.
str();
1825 if( msgverblevel <= verblevel )
1836 if( rational ==
NULL )
1837 std::cout <<
"unknown" << std::flush;
1839 std::cout << *rational << std::flush;
1845 const char* formatstr,
1859 while( *formatstr !=
'\0' )
1861 if( *formatstr ==
'%' && *(formatstr+1) !=
'%' )
1863 switch( *++formatstr )
1870 for( sval = va_arg(arguments,
char *); *sval; sval++ )
1871 (
void) putchar(*sval);
1887 ival = va_arg(arguments,
int);
1892 printf(
"%lld", lval);
1895 ival = va_arg(arguments,
int);
1899 cval = (char) va_arg(arguments,
int);
1903 pval = va_arg(arguments,
void*);
1907 (void) putchar(*formatstr);
1913 (void) putchar(*formatstr);
1923 const char* formatstr,
1929 va_start(ap, formatstr);
1936 const char* sourcefile,
1938 const char* formatstr,
1942 const char* filename;
1949 filename = strrchr(sourcefile,
'\\');
1951 filename = strrchr(sourcefile,
'/');
1953 if( filename ==
NULL )
1954 filename = sourcefile;
1958 printf(
"[%s:%d] debug: ", filename, sourceline);
1960 va_start(ap, formatstr);
1965#ifdef SCIP_WITH_BOOST
1975 numerator = boost::multiprecision::numerator(rational->
val);
2021 assert(rational !=
nullptr);
2030 assert(rational !=
nullptr);
2040 assert(rational !=
nullptr);
2051 assert(rational !=
nullptr);
2064#ifdef SCIP_WITH_BOOST
2076 roundint = src->
val.
sign() > 0 ? roundint : roundint - 1;
2078 res->
val = src->
val - roundint;
2088 assert(rational !=
nullptr);
2090#ifdef SCIP_WITH_BOOST
2091 if( rational->
isinf )
2096 return mpq_get_d(rational->
val.backend().data());
2114 assert(rational !=
nullptr);
2116 if( rational->
isinf )
2121#if defined(SCIP_WITH_MPFR) && defined(SCIP_WITH_BOOST) && defined(SCIP_WITH_GMP)
2127 val = SCIPrationalGetGMP(rational);
2131 (void) mpfr_init_set_q(valmpfr, *val, MPFR_RNDD);
2132 realapprox = (
SCIP_Real) mpfr_get_d(valmpfr, MPFR_RNDD);
2135 (void) mpfr_init_set_q(valmpfr, *val, MPFR_RNDU);
2136 realapprox = (
SCIP_Real) mpfr_get_d(valmpfr, MPFR_RNDU);
2139 (void) mpfr_init_set_q(valmpfr, *val, MPFR_RNDN);
2140 realapprox = (
SCIP_Real) mpfr_get_d(valmpfr, MPFR_RNDN);
2146 mpfr_clear(valmpfr);
2150 SCIPerrorMessage(
"method SCIPrationalRoundReal not supported when SCIP is compiled without Boost.\n");
2165#ifdef SCIP_WITH_BOOST
2180 roundint = src->
val.
sign() > 0 ? roundint : roundint - 1;
2183 roundint = src->
val.
sign() > 0 ? roundint + 1 : roundint;
2194 res->
val = roundint;
2212#ifdef SCIP_WITH_BOOST
2223 roundint = src->
val.
sign() > 0 ? roundint : roundint - 1;
2226 roundint = src->
val.
sign() > 0 ? roundint + 1 : roundint;
2238 if( *res == roundint )
2244#ifdef SCIP_WITH_BOOST
2260 resnum = j * p[1] + p[0];
2261 resden = j * q[1] + q[0];
2272void chooseSemiconvLong(
2283 j = (maxdenom - q[0]) / q[1];
2287 resnum = j * p[1] + p[0];
2288 resden = j * q[1] + q[0];
2301void SCIPrationalComputeApproximationLong(
2325 sign = tn >= 0 ? 1 : -1;
2331 if( td <= maxdenom )
2341 if( temp < td / (maxdenom * 1.0) )
2344 if( forcegreater == 1 && a0 * sign < src->val )
2346 res->
val = a0 * sign;
2349 else if( forcegreater == -1 && a0 * sign > src->
val )
2351 res->
val = a0 * sign;
2355 res->
val = a0 * sign;
2360 SCIPdebug(std::cout <<
"approximating " << *src <<
" by " << *res << std::endl);
2384 SCIPdebug(std::cout <<
"approximating " << *src <<
" by continued fractions with maxdenom " << maxdenom << std::endl);
2385 SCIPdebug(std::cout <<
"confrac initial values: p0 " << p[1] <<
" q0 " << q[1] <<
" p1 " << p[2] <<
" q1 " << q[2] << std::endl);
2388 if( q[2] > maxdenom )
2391 while( !done && td != 0 )
2409 p[2] = p[0] + p[1] * ai;
2410 q[2] = q[0] + q[1] * ai;
2412 SCIPdebug(std::cout <<
"ai " << ai <<
" pi " << p[2] <<
" qi " << q[2] << std::endl);
2414 if( q[2] > maxdenom )
2418 if( (forcegreater == 1 &&
scip::Rational(p[2],q[2]) * sign < src->val) ||
2428 || (forcegreater == -1 &&
scip::Rational(p[1],q[1]) * sign < src->val) )
2434 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2435 chooseSemiconvLong(resnum, resden, p, q, 1, maxdenom);
2436 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2443 if( forcegreater != 0 )
2444 chooseSemiconvLong(resnum, resden, p, q, 1, maxdenom);
2446 chooseSemiconvLong(resnum, resden, p, q, ai, maxdenom);
2447 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2448 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2472#ifdef SCIP_WITH_BOOST
2502 if( forcegreater == 1 )
2511 if( forcegreater == -1 )
2526 SCIPrationalComputeApproximationLong(res, src, maxdenom, forcegreater);
2537 if( td <= maxdenom )
2544 divide_qr(tn, td, a0, temp);
2547 if( temp * maxdenom < td )
2549 if( forcegreater == 1 && a0 * sign < src->val )
2551 res->
val = a0 * sign;
2554 else if( forcegreater == -1 && a0 * sign > src->
val )
2556 res->
val = a0 * sign;
2560 res->
val = a0 * sign;
2565 SCIPdebug(std::cout <<
"approximating " << *src <<
" by " << *res << std::endl);
2573 divide_qr(tn, td, ai, temp);
2586 SCIPdebug(std::cout <<
"approximating " << *src <<
" by continued fractions with maxdenom " << maxdenom << std::endl);
2587 SCIPdebug(std::cout <<
"confrac initial values: p0 " << p[1] <<
" q0 " << q[1] <<
" p1 " << p[2] <<
" q1 " << q[2] << std::endl);
2590 if( q[2] > maxdenom )
2593 while(!done && td != 0)
2598 divide_qr(tn, td, ai, temp);
2609 p[2] = p[0] + p[1] * ai;
2610 q[2] = q[0] + q[1] * ai;
2612 SCIPdebug(std::cout <<
"ai " << ai <<
" pi " << p[2] <<
" qi " << q[2] << std::endl);
2614 if( q[2] > maxdenom )
2618 if( (forcegreater == 1 &&
scip::Rational(p[2],q[2]) * sign < src->val) ||
2628 || (forcegreater == -1 &&
scip::Rational(p[1],q[1]) * sign < src->val) )
2634 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2635 chooseSemiconv(resnum, resden, p, q, 1,
scip::Integer(maxdenom));
2636 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2643 if( forcegreater != 0 )
2644 chooseSemiconv(resnum, resden, p, q, 1,
scip::Integer(maxdenom));
2646 chooseSemiconv(resnum, resden, p, q, ai,
scip::Integer(maxdenom));
2647 SCIPdebug(std::cout <<
" picking semiconvergent " << std::endl);
2648 SCIPdebug(std::cout <<
" use " << resnum <<
"/" << resden << std::endl);
2672 assert(rationalarray !=
nullptr);
2673 assert(blkmem !=
nullptr);
2677 (*rationalarray)->firstidx = -1;
2688 assert(rationalarray !=
nullptr);
2690 rationalarray->
vals.resize((
size_t)newsize);
2702 assert(rationalarray !=
nullptr);
2703 assert(sourcerationalarray !=
nullptr);
2706 (*rationalarray)->vals = sourcerationalarray->
vals;
2707 (*rationalarray)->firstidx = sourcerationalarray->
firstidx;
2718 assert(rationalarray !=
nullptr);
2719 assert(*rationalarray !=
nullptr);
2721 (*rationalarray)->vals.scip::sparsevec::~sparsevec();
2734 assert(rationalarray !=
nullptr);
2737 if( rationalarray->
firstidx == -1 || idx < rationalarray->firstidx
2738 || (
size_t) idx >= rationalarray->
vals.size() + (
size_t) rationalarray->
firstidx )
2751 assert(rationalarray !=
nullptr);
2754 if( rationalarray-> firstidx == -1 )
2756 rationalarray->
vals.push_back(*val);
2760 if( idx < rationalarray->firstidx )
2762 int ninserts = rationalarray->
firstidx - idx;
2764 (void) rationalarray->
vals.insert(rationalarray->
vals.begin(), ninserts,
r);
2766 rationalarray->
vals[0] = *val;
2768 else if( (
size_t) idx >= rationalarray->
vals.size() + rationalarray->
firstidx )
2770 int ninserts = idx - (int) rationalarray->
vals.size() - rationalarray->
firstidx + 1;
2772 (void) rationalarray->
vals.insert(rationalarray->
vals.end(), (
size_t) ninserts,
r);
2773 rationalarray->
vals[rationalarray->
vals.size() - 1] = *val;
2777 rationalarray->
vals[idx - rationalarray->
firstidx] = *val;
2790 assert(incval !=
nullptr);
2795 else if( idx < rationalarray->firstidx || (
size_t) idx >= rationalarray->
vals.size() + (
size_t) rationalarray->
firstidx )
2800 rationalarray->
vals[(size_t) (idx - rationalarray->
firstidx)].val += incval->
val;
2801 rationalarray->
vals[(size_t) (idx - rationalarray->
firstidx)].isfprepresentable =
FALSE;
2812 printf(
"Array with firstidx %d, length %d \n", rationalarray->
firstidx, (
int) rationalarray->
vals.size());
2813 for(
auto val : rationalarray->
vals )
2827 assert(rationalarray !=
nullptr);
2837 assert(rationalarray !=
nullptr);
2839 return rationalarray->
firstidx + (int) rationalarray->
vals.size() - 1;
2849#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,...)
std::vector< SCIP_RATIONAL > sparsevec
INLINE SCIP_Longint numerator(Rational &r)
INLINE Rational & abs(Rational &r)
INLINE SCIP_Longint denominator(Rational &r)
public methods for message output
public data structures and miscellaneous methods
static void SCIPrationalVPrintf(const char *formatstr, va_list ap)
static 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