commonly used numerical methods
Topics | |
Computations With Tolerances | |
methods used by the majority of operations involving floating-point computations in SCIP | |
Macros | |
#define | SCIPisFinite(x) ((x) == (x)) |
Definition at line 1901 of file pub_misc.h.
Referenced by computeSecant(), computeTangent(), computeVertexPolyhedralFacetBivariate(), computeVertexPolyhedralFacetUnivariate(), evalFunctionGradient(), evalFunctionValue(), F77_FUNC(), F77_FUNC(), generateCut(), getDualBranchscore(), hessLagAddExpr(), readExpression(), readLinearCoefs(), readMultIncr(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPREVAL(), SCIPcreateExprValue(), SCIPexprhdlrBwDiffExpr(), SCIPexprhdlrBwFwDiffExpr(), SCIPexprhdlrEvalExpr(), SCIPexprhdlrEvalFwDiffExpr(), SCIPexprhdlrFwDiffExpr(), SCIPlpGetSol(), SCIPnlpiOracleEvalJacobian(), SCIPsolSetVal(), and setupStart().
returns the next representable value of from in the direction of to
from | value from which the next representable value should be returned |
to | direction in which the next representable value should be returned |
Definition at line 9275 of file misc.c.
References i.
Referenced by computeMaxForBilinearProp(), initSolve(), SCIPintervalCos(), SCIPintervalEntropy(), SCIPintervalExp(), SCIPintervalLog(), SCIPintervalPowerScalar(), SCIPintervalPowerScalarScalar(), SCIPintervalSignPowerScalar(), SCIPintervalSolveUnivariateQuadExpressionPositiveAllScalar(), and SCIPintervalSquareRoot().
SCIP_Longint SCIPcalcGreComDiv | ( | SCIP_Longint | val1, |
SCIP_Longint | val2 ) |
calculates the greatest common divisor of the two given values
val1 | first value of greatest common devisor calculation |
val2 | second value of greatest common devisor calculation |
Definition at line 9032 of file misc.c.
Referenced by deleteRedundantVars(), normalizeCons(), normalizeCumulativeCondition(), normalizeWeights(), rangedRowPropagation(), SCIPcalcIntegralScalar(), SCIPcalcSmaComMul(), SCIPprobScaleObj(), SCIProwCalcIntegralScalar(), SCIPsolveKnapsackExactly(), simplifyInequalities(), simplifyInequalities(), and tryAggregateIntVars().
SCIP_Longint SCIPcalcSmaComMul | ( | SCIP_Longint | val1, |
SCIP_Longint | val2 ) |
calculates the smallest common multiple of the two given values
val1 | first value of smallest common multiple calculation |
val2 | second value of smallest common multiple calculation |
Definition at line 9284 of file misc.c.
References assert(), i, and SCIPcalcGreComDiv().
Referenced by normalizeCons(), and tryAggregateIntVars().
SCIP_Longint SCIPcalcBinomCoef | ( | int | n, |
int | m ) |
calculates a binomial coefficient n over m, choose m elements out of n, maximal value will be 33 over 16 (because the n=33 is the last line in the Pascal's triangle where each entry fits in a 4 byte value), an error occurs due to big numbers or an negative value m (and m < n) and -1 will be returned
n | number of different elements |
m | number to choose out of the above |
Definition at line 10183 of file misc.c.
References assert(), i, and SCIP_LONGINT_MAX.
calculates hash for floating-point number by using Fibonacci hashing
v | number to hash |
Definition at line 10258 of file misc.c.
References i.
Referenced by SCIP_DECL_EXPRHASH(), SCIP_DECL_EXPRHASH(), SCIP_DECL_EXPRHASH(), SCIP_DECL_EXPRHASH(), SCIP_DECL_EXPRHASH(), and SCIPexprhdlrHashExpr().
SCIP_Bool SCIPrealToRational | ( | SCIP_Real | val, |
SCIP_Real | mindelta, | ||
SCIP_Real | maxdelta, | ||
SCIP_Longint | maxdnom, | ||
SCIP_Longint * | nominator, | ||
SCIP_Longint * | denominator ) |
converts a real number into a (approximate) rational representation, and returns TRUE iff the conversion was successful
val | real value r to convert into rational number |
mindelta | minimal allowed difference r - q of real r and rational q = n/d |
maxdelta | maximal allowed difference r - q of real r and rational q = n/d |
maxdnom | maximal denominator allowed |
nominator | pointer to store the nominator n of the rational number |
denominator | pointer to store the denominator d of the rational number |
Definition at line 9305 of file misc.c.
References a, assert(), b, EPSFLOOR, EPSGT, FALSE, i, NULL, REALABS, SCIP_Longint, SCIP_LONGINT_MAX, SCIP_Real, simplednoms, and TRUE.
Referenced by normalizeCons(), prettifyConss(), SCIPcalcIntegralScalar(), SCIPfindSimpleRational(), SCIProwCalcIntegralScalar(), and tryAggregateIntVars().
SCIP_RETCODE SCIPcalcIntegralScalar | ( | SCIP_Real * | vals, |
int | nvals, | ||
SCIP_Real | mindelta, | ||
SCIP_Real | maxdelta, | ||
SCIP_Longint | maxdnom, | ||
SCIP_Real | maxscale, | ||
SCIP_Real * | intscalar, | ||
SCIP_Bool * | success ) |
tries to find a value, such that all given values, if scaled with this value become integral in relative allowed difference in between mindelta and maxdelta
vals | values to scale |
nvals | number of values to scale |
mindelta | minimal relative allowed difference of scaled coefficient s*c and integral i |
maxdelta | maximal relative allowed difference of scaled coefficient s*c and integral i |
maxdnom | maximal denominator allowed in rational numbers |
maxscale | maximal allowed scalar |
intscalar | pointer to store scalar that would make the coefficients integral, or NULL |
success | stores whether returned value is valid |
Definition at line 9468 of file misc.c.
References assert(), c, EPSEQ, FALSE, i, isIntegralScalar(), nscalars, NULL, REALABS, scalars, SCIP_DEFAULT_EPSILON, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIP_REAL_MAX, SCIPcalcGreComDiv(), SCIPdebugMessage, SCIPrealToRational(), and TRUE.
Referenced by calculateScalingValue(), cutTightenCoefs(), cutTightenCoefsQuad(), SCIPcutGenerationHeuristicCMIR(), SCIPprobScaleObj(), SCIPseparateRelaxedKnapsack(), and transformNonIntegralRow().
SCIP_Bool SCIPfindSimpleRational | ( | SCIP_Real | lb, |
SCIP_Real | ub, | ||
SCIP_Longint | maxdnom, | ||
SCIP_Longint * | nominator, | ||
SCIP_Longint * | denominator ) |
given a (usually very small) interval, tries to find a rational number with simple denominator (i.e. a small number, probably multiplied with powers of 10) out of this interval; returns TRUE iff a valid rational number inside the interval was found
lb | lower bound of the interval |
ub | upper bound of the interval |
maxdnom | maximal denominator allowed for resulting rational number |
nominator | pointer to store the nominator n of the rational number |
denominator | pointer to store the denominator d of the rational number |
Definition at line 9688 of file misc.c.
References assert(), i, SCIPintervalGetRoundingMode(), SCIPintervalHasRoundingControl(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), and SCIPrealToRational().
Referenced by SCIPselectSimpleValue().
SCIP_Real SCIPselectSimpleValue | ( | SCIP_Real | lb, |
SCIP_Real | ub, | ||
SCIP_Longint | maxdnom ) |
given a (usually very small) interval, selects a value inside this interval; it is tried to select a rational number with simple denominator (i.e. a small number, probably multiplied with powers of 10); if no valid rational number inside the interval was found, selects the central value of the interval
lb | lower bound of the interval |
ub | upper bound of the interval |
maxdnom | maximal denominator allowed for resulting rational number |
Definition at line 9735 of file misc.c.
References i, MAX, SCIP_Real, SCIPdebugMessage, SCIPdebugPrintf, and SCIPfindSimpleRational().
Referenced by convertUnaryEquality(), fixVariables(), SCIP_DECL_PRESOLEXEC(), and SCIPanalyzeDeductionsProbing().
SCIP_Real SCIPcalcRootNewton | ( | SCIP_DECL_NEWTONEVAL((*function)) | , |
SCIP_DECL_NEWTONEVAL((*derivative)) | , | ||
SCIP_Real * | params, | ||
int | nparams, | ||
SCIP_Real | x, | ||
SCIP_Real | eps, | ||
int | k ) |
Performs the Newton Procedure from a given starting point to compute a root of the given function with specified precision and maximum number of iterations. If the procedure fails, SCIP_INVALID is returned.
params | parameters needed for function (can be NULL) |
nparams | number of parameters (can be 0) |
x | starting point |
eps | tolerance |
k | iteration limit |
Definition at line 9776 of file misc.c.
References assert(), eps, i, NULL, REALABS, result, SCIP_INVALID, and x.
Referenced by computeLeftSecantSin(), computeRightSecantSin(), and computeSolTangentSin().
returns the relative difference: (val1-val2)/max(|val1|,|val2|,1.0)
val1 | first value to be compared |
val2 | second value to be compared |
Definition at line 11096 of file misc.c.
Referenced by checkCons(), checkCons(), checkCons(), checkCons(), checkCons(), checkCumulativeCondition(), checkOrigPbCons(), checkSolOrig(), checkSolOrig(), createGenVBound(), getIntegralScalar(), getScaledDualWeight(), isConsViolated(), isConsViolated(), isIntegralScalar(), isIntegralScalar(), priceAndCutLoop(), SCIP_DECL_CONSCHECK(), SCIPbendersSubproblemIsOptimal(), SCIPbranchExecExtern(), SCIPbranchGetBranchingPoint(), SCIPconcsolverSync(), SCIPcutGenerationHeuristicCMIR(), SCIPintervalAreDisjointEps(), SCIPintervalIntersectEps(), SCIPtreeBranchVar(), SCIPtreeBranchVarNary(), SCIPvalidateSolve(), solveBendersSubproblems(), and updateBestCandidate().
SCIP_Real SCIPcomputeGap | ( | SCIP_Real | eps, |
SCIP_Real | inf, | ||
SCIP_Real | primalbound, | ||
SCIP_Real | dualbound ) |
computes the gap from the primal and the dual bound
eps | the value treated as zero |
inf | the value treated as infinity |
primalbound | the primal bound |
dualbound | the dual bound |
Definition at line 11114 of file misc.c.
References eps, EPSEQ, EPSZ, i, and REALABS.
Referenced by SCIPgetConcurrentGap(), SCIPgetGap(), SCIPgetTransGap(), and SCIPstoreSolutionGap().