methods for expressions, expression trees, expression graphs, and related
Definition in file expr.c.
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include "nlpi/pub_expr.h"
#include "nlpi/struct_expr.h"
#include "nlpi/exprinterpret.h"
#include "scip/intervalarith.h"
#include "scip/pub_misc.h"
#include "scip/pub_message.h"
Go to the source code of this file.
Macros | |
#define | SCIP_EXPRESSION_MAXCHILDEST 16 |
#define | DEFAULT_RANDSEED 73 |
#define | SIGN(x) ((x) >= 0.0 ? 1.0 : -1.0) |
#define | ensureBlockMemoryArraySize(blkmem, array1, cursize, minsize) |
#define | ensureBlockMemoryArraySize3(blkmem, array1, array2, array3, cursize, minsize) |
Expression curvature methods | |
static const char * | curvnames [4] |
SCIP_EXPRCURV | SCIPexprcurvAdd (SCIP_EXPRCURV curv1, SCIP_EXPRCURV curv2) |
SCIP_EXPRCURV | SCIPexprcurvNegate (SCIP_EXPRCURV curvature) |
SCIP_EXPRCURV | SCIPexprcurvMultiply (SCIP_Real factor, SCIP_EXPRCURV curvature) |
SCIP_EXPRCURV | SCIPexprcurvPower (SCIP_INTERVAL basebounds, SCIP_EXPRCURV basecurv, SCIP_Real exponent) |
SCIP_EXPRCURV | SCIPexprcurvMonomial (int nfactors, SCIP_Real *exponents, int *factoridxs, SCIP_EXPRCURV *factorcurv, SCIP_INTERVAL *factorbounds) |
const char * | SCIPexprcurvGetName (SCIP_EXPRCURV curv) |
Expression operand private methods | |
#define | exprcurvSin exprcurvDefault |
#define | exprcurvCos exprcurvDefault |
#define | exprevalIntTan exprevalIntDefault |
#define | exprcurvTan exprcurvDefault |
#define | EXPROPEMPTY {NULL, -1, NULL, NULL, NULL, NULL, NULL} |
static struct exprOpTableElement | exprOpTable [] |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntDefault) |
static | SCIP_DECL_EXPRCURV (exprcurvDefault) |
static | SCIP_DECL_EXPREVAL (exprevalVar) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntVar) |
static | SCIP_DECL_EXPRCURV (exprcurvVar) |
static | SCIP_DECL_EXPREVAL (exprevalConst) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntConst) |
static | SCIP_DECL_EXPRCURV (exprcurvConst) |
static | SCIP_DECL_EXPREVAL (exprevalParam) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntParam) |
static | SCIP_DECL_EXPRCURV (exprcurvParam) |
static | SCIP_DECL_EXPREVAL (exprevalPlus) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntPlus) |
static | SCIP_DECL_EXPRCURV (exprcurvPlus) |
static | SCIP_DECL_EXPREVAL (exprevalMinus) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntMinus) |
static | SCIP_DECL_EXPRCURV (exprcurvMinus) |
static | SCIP_DECL_EXPREVAL (exprevalMult) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntMult) |
static | SCIP_DECL_EXPRCURV (exprcurvMult) |
static | SCIP_DECL_EXPREVAL (exprevalDiv) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntDiv) |
static | SCIP_DECL_EXPRCURV (exprcurvDiv) |
static | SCIP_DECL_EXPREVAL (exprevalSquare) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntSquare) |
static | SCIP_DECL_EXPRCURV (exprcurvSquare) |
static | SCIP_DECL_EXPREVAL (exprevalSquareRoot) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntSquareRoot) |
static | SCIP_DECL_EXPRCURV (exprcurvSquareRoot) |
static | SCIP_DECL_EXPREVAL (exprevalRealPower) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntRealPower) |
static | SCIP_DECL_EXPRCURV (exprcurvRealPower) |
static | SCIP_DECL_EXPREVAL (exprevalIntPower) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntIntPower) |
static | SCIP_DECL_EXPRCURV (exprcurvIntPower) |
static | SCIP_DECL_EXPREVAL (exprevalSignPower) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntSignPower) |
static | SCIP_DECL_EXPRCURV (exprcurvSignPower) |
static | SCIP_DECL_EXPREVAL (exprevalExp) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntExp) |
static | SCIP_DECL_EXPRCURV (exprcurvExp) |
static | SCIP_DECL_EXPREVAL (exprevalLog) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntLog) |
static | SCIP_DECL_EXPRCURV (exprcurvLog) |
static | SCIP_DECL_EXPREVAL (exprevalSin) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntSin) |
static | SCIP_DECL_EXPREVAL (exprevalCos) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntCos) |
static | SCIP_DECL_EXPREVAL (exprevalTan) |
static | SCIP_DECL_EXPREVAL (exprevalMin) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntMin) |
static | SCIP_DECL_EXPRCURV (exprcurvMin) |
static | SCIP_DECL_EXPREVAL (exprevalMax) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntMax) |
static | SCIP_DECL_EXPRCURV (exprcurvMax) |
static | SCIP_DECL_EXPREVAL (exprevalAbs) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntAbs) |
static | SCIP_DECL_EXPRCURV (exprcurvAbs) |
static | SCIP_DECL_EXPREVAL (exprevalSign) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntSign) |
static | SCIP_DECL_EXPRCURV (exprcurvSign) |
static | SCIP_DECL_EXPREVAL (exprevalSum) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntSum) |
static | SCIP_DECL_EXPRCURV (exprcurvSum) |
static | SCIP_DECL_EXPREVAL (exprevalProduct) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntProduct) |
static | SCIP_DECL_EXPRCURV (exprcurvProduct) |
static | SCIP_DECL_EXPREVAL (exprevalLinear) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntLinear) |
static | SCIP_DECL_EXPRCURV (exprcurvLinear) |
static | SCIP_DECL_EXPRCOPYDATA (exprCopyDataLinear) |
static | SCIP_DECL_EXPRFREEDATA (exprFreeDataLinear) |
static | SCIP_DECL_EXPREVAL (exprevalQuadratic) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntQuadratic) |
static | SCIP_DECL_EXPRCURV (exprcurvQuadratic) |
static | SCIP_DECL_EXPRCOPYDATA (exprCopyDataQuadratic) |
static | SCIP_DECL_EXPRFREEDATA (exprFreeDataQuadratic) |
static | SCIP_DECL_EXPREVAL (exprevalPolynomial) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntPolynomial) |
static | SCIP_DECL_EXPRCURV (exprcurvPolynomial) |
static | SCIP_DECL_EXPRCOPYDATA (exprCopyDataPolynomial) |
static | SCIP_DECL_EXPRFREEDATA (exprFreeDataPolynomial) |
static | SCIP_DECL_EXPREVAL (exprevalUser) |
static | SCIP_DECL_EXPRINTEVAL (exprevalIntUser) |
static | SCIP_DECL_EXPRCURV (exprcurvUser) |
static | SCIP_DECL_EXPRCOPYDATA (exprCopyDataUser) |
static | SCIP_DECL_EXPRFREEDATA (exprFreeDataUser) |
Quadratic element methods | |
#define | QUADELEMS_ISBETTER(a, b) ( ((a).idx1 < (b).idx1) || ((a).idx1 == (b).idx1 && (a).idx2 < (b).idx2) ) |
#define | QUADELEMS_SWAP(x, y) |
static void | quadelemsQuickSort (SCIP_QUADELEM *elems, int start, int end) |
void | SCIPquadelemSort (SCIP_QUADELEM *quadelems, int nquadelems) |
SCIP_Bool | SCIPquadelemSortedFind (SCIP_QUADELEM *quadelems, int idx1, int idx2, int nquadelems, int *pos) |
void | SCIPquadelemSqueeze (SCIP_QUADELEM *quadelems, int nquadelems, int *nquadelemsnew) |
#define SCIP_EXPRESSION_MAXCHILDEST 16 |
estimate on maximal number of children
Definition at line 39 of file expr.c.
Referenced by exprgraphNodeEval(), exprgraphNodeUpdateBounds(), SCIPexprCheckCurvature(), SCIPexprEval(), SCIPexprEvalInt(), SCIPexprgraphGetNodePolynomialMonomialCurvature(), and SCIPexprgraphUpdateNodeBoundsCurvature().
#define DEFAULT_RANDSEED 73 |
#define SIGN | ( | x | ) | ((x) >= 0.0 ? 1.0 : -1.0) |
sign of a value (-1 or +1)
0.0 has sign +1
Definition at line 46 of file expr.c.
Referenced by SCIP_DECL_EXPREVAL().
#define ensureBlockMemoryArraySize | ( | blkmem, | |
array1, | |||
cursize, | |||
minsize | |||
) |
ensures that a block memory array has at least a given size
if cursize is 0, then *array1 can be NULL
Definition at line 52 of file expr.c.
Referenced by exprgraphMoveNode(), exprgraphNodeAddParent(), exprgraphNodeSimplify(), polynomialdataEnsureMonomialsSize(), SCIPexprgraphAddConst(), SCIPexprgraphAddNode(), SCIPexprgraphAddVars(), SCIPexprgraphReplaceVarByLinearSum(), and SCIPexprgraphSimplify().
#define ensureBlockMemoryArraySize3 | ( | blkmem, | |
array1, | |||
array2, | |||
array3, | |||
cursize, | |||
minsize | |||
) |
ensures that three block memory arrays have at least a given size
if cursize is 0, then arrays can be NULL
Definition at line 87 of file expr.c.
Referenced by exprgraphEnsureDepth(), SCIPexprgraphAddVars(), SCIPexprgraphCreate(), and SCIPexprgraphReplaceVarByLinearSum().
#define QUADELEMS_ISBETTER | ( | a, | |
b | |||
) | ( ((a).idx1 < (b).idx1) || ((a).idx1 == (b).idx1 && (a).idx2 < (b).idx2) ) |
comparing two quadratic elements
a is better than b if index1 of a is smaller than index1 of b or index1 of both is equal but index2 of a is smaller than index2 of b
Definition at line 9002 of file expr.c.
Referenced by quadelemsQuickSort(), and SCIPquadelemSqueeze().
#define QUADELEMS_SWAP | ( | x, | |
y | |||
) |
swaps two quadratic elements
Definition at line 9005 of file expr.c.
Referenced by quadelemsQuickSort().
|
static |
calculate memory size for dynamically allocated arrays (copied from scip/set.c)
num | minimum number of entries to store |
Definition at line 106 of file expr.c.
Referenced by exprsimplifyFlattenPolynomials(), and monomialdataEnsureFactorsSize().
|
static |
|
static |
checks if a given new lower bound is tighter (w.r.t. given bound strengthening epsilon) than the old one (copied from scip/set.c)
minstrength | minimal relative improvement required to be a better bound |
newlb | new lower bound |
oldlb | old lower bound |
oldub | old upper bound |
Definition at line 133 of file expr.c.
References EPSGT, FALSE, MAX, MIN, REALABS, and SCIP_Real.
Referenced by exprgraphNodeUpdateBounds(), exprgraphUpdateVarNodeBounds(), SCIPexprgraphTightenNodeBounds(), and SCIPexprgraphUpdateNodeBoundsCurvature().
|
static |
checks if a given new upper bound is tighter (w.r.t. given bound strengthening epsilon) than the old one (copied from scip/set.c)
minstrength | minimal relative improvement required to be a better bound |
newub | new upper bound |
oldlb | old lower bound |
oldub | old upper bound |
Definition at line 153 of file expr.c.
References EPSLT, FALSE, MAX, MIN, REALABS, and SCIP_Real.
Referenced by exprgraphNodeUpdateBounds(), exprgraphUpdateVarNodeBounds(), SCIPexprgraphTightenNodeBounds(), and SCIPexprgraphUpdateNodeBoundsCurvature().
SCIP_EXPRCURV SCIPexprcurvAdd | ( | SCIP_EXPRCURV | curv1, |
SCIP_EXPRCURV | curv2 | ||
) |
gives curvature for a sum of two functions with given curvature
curv1 | curvature of first summand |
curv2 | curvature of second summand |
Definition at line 189 of file expr.c.
Referenced by checkCurvature(), and SCIP_DECL_EXPRCURV().
SCIP_EXPRCURV SCIPexprcurvNegate | ( | SCIP_EXPRCURV | curvature | ) |
gives the curvature for the negation of a function with given curvature
curvature | curvature of function |
Definition at line 198 of file expr.c.
References SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIPABORT, and SCIPerrorMessage.
Referenced by reformulate(), SCIP_DECL_EXPRCURV(), SCIPexprcurvMonomial(), and SCIPexprcurvMultiply().
SCIP_EXPRCURV SCIPexprcurvMultiply | ( | SCIP_Real | factor, |
SCIP_EXPRCURV | curvature | ||
) |
gives curvature for a functions with given curvature multiplied by a constant factor
factor | constant factor |
curvature | curvature of other factor |
Definition at line 224 of file expr.c.
References SCIP_EXPRCURV_LINEAR, and SCIPexprcurvNegate().
Referenced by checkCurvature(), reformulate(), SCIP_DECL_EXPRCURV(), SCIPexprcurvMonomial(), and SCIPexprgraphGetNodePolynomialMonomialCurvature().
SCIP_EXPRCURV SCIPexprcurvPower | ( | SCIP_INTERVAL | basebounds, |
SCIP_EXPRCURV | basecurv, | ||
SCIP_Real | exponent | ||
) |
gives curvature for base^exponent for given bounds and curvature of base-function and constant exponent
basebounds | bounds on base function |
basecurv | curvature of base function |
exponent | exponent |
Definition at line 237 of file expr.c.
References EPSISINT, SCIP_Interval::inf, SCIP_Bool, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_Real, SCIPexprcurvPower(), SCIPintervalSetBounds(), sign(), and SCIP_Interval::sup.
Referenced by reformulate(), SCIP_DECL_EXPRCURV(), SCIPexprcurvMonomial(), and SCIPexprcurvPower().
SCIP_EXPRCURV SCIPexprcurvMonomial | ( | int | nfactors, |
SCIP_Real * | exponents, | ||
int * | factoridxs, | ||
SCIP_EXPRCURV * | factorcurv, | ||
SCIP_INTERVAL * | factorbounds | ||
) |
gives curvature for a monomial with given curvatures and bounds for each factor
See Maranas and Floudas, Finding All Solutions of Nonlinearly Constrained Systems of Equations, JOGO 7, 1995 for the categorization in the case that all factors are linear.
nfactors | number of factors in monomial |
exponents | exponents in monomial, or NULL if all 1.0 |
factoridxs | indices of factors (but not exponents), or NULL if identity mapping |
factorcurv | curvature of each factor |
factorbounds | bounds of each factor |
Definition at line 345 of file expr.c.
References EPSGE, EPSISINT, EPSLE, FALSE, NULL, SCIP_Bool, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_Real, SCIPexprcurvMultiply(), SCIPexprcurvNegate(), SCIPexprcurvPower(), and TRUE.
Referenced by SCIP_DECL_EXPRCURV(), and SCIPexprgraphGetNodePolynomialMonomialCurvature().
const char* SCIPexprcurvGetName | ( | SCIP_EXPRCURV | curv | ) |
gives name as string for a curvature
curv | curvature |
Definition at line 458 of file expr.c.
References curvnames, and SCIP_EXPRCURV_LINEAR.
Referenced by checkCurvature(), reformEnsureChildrenMinCurvature(), reformulate(), and registerBranchingVariables().
|
static |
creates SCIP_EXPRDATA_QUADRATIC data structure from given quadratic elements
blkmem | block memory data structure |
quadraticdata | buffer to store pointer to quadratic data |
constant | constant |
nchildren | number of children |
lincoefs | linear coefficients of children, or NULL if all 0.0 |
nquadelems | number of quadratic elements |
quadelems | quadratic elements |
Definition at line 474 of file expr.c.
References BMSallocBlockMemory, BMSduplicateBlockMemoryArray, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by SCIP_DECL_EXPRCOPYDATA(), SCIPexprCreateQuadratic(), and SCIPexprgraphCreateNodeQuadratic().
|
static |
sorts quadratic elements in a SCIP_EXPRDATA_QUADRATIC data structure
quadraticdata | quadratic data |
Definition at line 512 of file expr.c.
References SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprData_Quadratic::quadelems, SCIPquadelemSort(), SCIP_ExprData_Quadratic::sorted, and TRUE.
Referenced by SCIP_DECL_EXPRINTEVAL(), SCIPexprGetMaxDegree(), and SCIPexprSortQuadElems().
|
static |
compares two monomials
gives 0 if monomials are equal
Definition at line 548 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::nfactors, NULL, and SCIPexprSortMonomialFactors().
|
static |
ensures that the factors arrays of a monomial have at least a given size
blkmem | block memory data structure |
monomialdata | monomial data |
minsize | minimal size of factors arrays |
Definition at line 587 of file expr.c.
References BMSreallocBlockMemoryArray, calcGrowSize(), SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::factorssize, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by exprConvertToPolynomial(), polynomialdataExpandMonomialFactor(), and SCIPexprAddMonomialFactors().
|
static |
creates SCIP_EXPRDATA_POLYNOMIAL data structure from given monomials
blkmem | block memory data structure |
polynomialdata | buffer to store pointer to polynomial data |
nmonomials | number of monomials |
monomials | monomials |
constant | constant part |
copymonomials | whether to copy monomials, or copy only given pointers, in which case polynomialdata assumes ownership of monomial structure |
Definition at line 612 of file expr.c.
References BMSallocBlockMemory, BMSallocBlockMemoryArray, BMSduplicateBlockMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::nfactors, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, and SCIPexprCreateMonomial().
Referenced by exprConvertToPolynomial(), exprsimplifyFlattenPolynomials(), SCIPexprCreatePolynomial(), and SCIPexprgraphCreateNodePolynomial().
|
static |
creates a copy of a SCIP_EXPRDATA_POLYNOMIAL data structure
blkmem | block memory data structure |
polynomialdata | buffer to store pointer to polynomial data |
sourcepolynomialdata | polynomial data to copy |
Definition at line 659 of file expr.c.
References BMSallocBlockMemoryArray, BMSduplicateBlockMemory, SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPexprCreateMonomial(), and SCIP_ExprData_Monomial::sorted.
Referenced by polynomialdataExpandMonomialFactor(), polynomialdataPower(), and SCIP_DECL_EXPRCOPYDATA().
|
static |
frees a SCIP_EXPRDATA_POLYNOMIAL data structure
blkmem | block memory data structure |
polynomialdata | pointer to polynomial data to free |
Definition at line 696 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, NULL, and SCIPexprFreeMonomial().
Referenced by exprgraphNodeSimplify(), exprsimplifyFlattenPolynomials(), exprUnconvertPolynomial(), polynomialdataExpandMonomialFactor(), polynomialdataPower(), and SCIP_DECL_EXPRFREEDATA().
|
static |
ensures that the monomials array of a polynomial has at least a given size
blkmem | block memory data structure |
polynomialdata | polynomial data |
minsize | minimal size of monomials array |
Definition at line 725 of file expr.c.
References ensureBlockMemoryArraySize, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Polynomial::monomialssize, NULL, and SCIP_OKAY.
Referenced by exprConvertToPolynomial(), polynomialdataAddMonomials(), polynomialdataMultiplyByMonomial(), and polynomialdataMultiplyByPolynomial().
|
static |
adds an array of monomials to a polynomial
blkmem | block memory of expression |
polynomialdata | polynomial data |
nmonomials | number of monomials to add |
monomials | the monomials to add |
copymonomials | whether to copy monomials or to assume ownership |
Definition at line 742 of file expr.c.
References BMScopyMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Polynomial::monomialssize, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataEnsureMonomialsSize(), SCIP_CALL, SCIP_OKAY, SCIPexprCreateMonomial(), and SCIP_ExprData_Polynomial::sorted.
Referenced by exprConvertToPolynomial(), polynomialdataExpandMonomialFactor(), polynomialdataMultiplyByPolynomial(), SCIPexprAddMonomials(), and SCIPexprgraphNodePolynomialAddMonomials().
|
static |
ensures that monomials of a polynomial are sorted
polynomialdata | polynomial expression |
Definition at line 784 of file expr.c.
References SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIPsortPtr(), SCIP_ExprData_Polynomial::sorted, SCIP_ExprData_Monomial::sorted, and TRUE.
Referenced by exprgraphFindParentByOperator(), polynomialdataMergeMonomials(), and SCIPexprSortMonomials().
|
static |
merges monomials that differ only in coefficient into a single monomial
Eliminates monomials with coefficient between -eps and eps.
blkmem | block memory |
polynomialdata | polynomial data |
eps | threshold under which numbers are treat as zero |
mergefactors | whether to merge factors in monomials too |
Definition at line 817 of file expr.c.
References SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, EPSZ, FALSE, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataSortMonomials(), SCIPexprFreeMonomial(), SCIPexprMergeMonomialFactors(), and SCIP_ExprData_Polynomial::sorted.
Referenced by exprgraphNodeSimplify(), exprsimplifySeparateLinearFromPolynomial(), exprUnconvertPolynomial(), polynomialdataPower(), SCIPexprgraphNodeSplitOffLinear(), and SCIPexprMergeMonomials().
|
static |
multiplies each summand of a polynomial by a given constant
blkmem | block memory |
polynomialdata | polynomial data |
factor | constant factor |
Definition at line 909 of file expr.c.
References SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIPexprChgMonomialCoef(), and SCIPexprFreeMonomial().
Referenced by polynomialdataMultiplyByMonomial(), polynomialdataMultiplyByPolynomial(), and SCIPexprMultiplyPolynomialByConstant().
|
static |
multiplies each summand of a polynomial by a given monomial
blkmem | block memory |
polynomialdata | polynomial data |
factor | monomial factor |
childmap | map children in factor to children in expr, or NULL for 1:1 |
Definition at line 939 of file expr.c.
References SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, FALSE, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataEnsureMonomialsSize(), polynomialdataMultiplyByConstant(), SCIP_CALL, SCIP_OKAY, SCIPexprCreateMonomial(), SCIPexprMultiplyMonomialByMonomial(), and SCIP_ExprData_Polynomial::sorted.
Referenced by polynomialdataExpandMonomialFactor(), polynomialdataMultiplyByPolynomial(), and SCIPexprMultiplyPolynomialByMonomial().
|
static |
multiplies a polynomial by a polynomial
Factors need to be different.
blkmem | block memory |
polynomialdata | polynomial data |
factordata | polynomial factor data |
childmap | map children in factor to children in polynomialdata, or NULL for 1:1 |
Definition at line 983 of file expr.c.
References SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, FALSE, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataAddMonomials(), polynomialdataEnsureMonomialsSize(), polynomialdataMultiplyByConstant(), polynomialdataMultiplyByMonomial(), SCIP_CALL, SCIP_OKAY, SCIPexprChgMonomialCoef(), SCIPexprCreateMonomial(), SCIPexprMultiplyMonomialByMonomial(), SCIP_ExprData_Polynomial::sorted, and TRUE.
Referenced by polynomialdataPower(), and SCIPexprMultiplyPolynomialByPolynomial().
|
static |
takes a power of a polynomial
Exponent needs to be an integer, polynomial needs to be a monomial, if exponent is negative.
blkmem | block memory |
polynomialdata | polynomial data |
exponent | exponent of power operation |
Definition at line 1072 of file expr.c.
References SCIP_ExprData_Polynomial::constant, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataCopy(), polynomialdataFree(), polynomialdataMergeMonomials(), polynomialdataMultiplyByPolynomial(), pow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPexprFreeMonomial(), SCIPexprMonomialPower(), and TRUE.
Referenced by polynomialdataExpandMonomialFactor(), and SCIPexprPolynomialPower().
|
static |
applies a mapping of child indices to the indices used in polynomial monomials
polynomialdata | polynomial data |
childmap | mapping of child indices |
Definition at line 1142 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, FALSE, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIP_ExprData_Polynomial::sorted, and SCIP_ExprData_Monomial::sorted.
Referenced by exprgraphFindParentByOperator(), exprgraphNodeRemovePolynomialDuplicateChildren(), exprgraphNodeRemovePolynomialNullChildren(), exprsimplifyRemoveDuplicatePolynomialChildren(), exprsimplifyRemovePolynomialNullChildren(), and polynomialdataExpandMonomialFactor().
|
static |
replaces a factor in a monomial by a polynomial and expands the result
blkmem | block memory data structure |
messagehdlr | message handler |
polynomialdata | polynomial data where to expand a monomial |
monomialpos | position of monomial which factor to expand |
factorpos | position of factor in monomial to expand |
factorpolynomial | polynomial that should replace factor |
childmap | map of child indices in factorpolynomial to children of polynomial |
maxexpansionexponent | maximal exponent for which polynomials (with > 1 summands) are expanded |
success | buffer to store whether expansion has been done |
Definition at line 1171 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, EPSFLOOR, EPSISINT, SCIP_ExprData_Monomial::exponents, FALSE, monomialdataEnsureFactorsSize(), SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataAddMonomials(), polynomialdataApplyChildmap(), polynomialdataCopy(), polynomialdataFree(), polynomialdataMultiplyByMonomial(), polynomialdataPower(), pow(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPexprAddMonomialFactors(), SCIPexprFreeMonomial(), SCIPmessagePrintWarning(), SCIP_ExprData_Polynomial::sorted, SCIP_ExprData_Monomial::sorted, and TRUE.
Referenced by exprgraphNodeSimplify(), and exprsimplifyFlattenPolynomials().
|
static |
a default implementation of expression interval evaluation that always gives a correct result
Definition at line 1393 of file expr.c.
References infinity, SCIP_OKAY, and SCIPintervalSetEntire().
Referenced by SCIP_DECL_EXPRFREEDATA().
|
static |
a default implementation of expression curvature check that always gives a correct result
Definition at line 1402 of file expr.c.
References SCIP_EXPRCURV_UNKNOWN, and SCIP_OKAY.
Referenced by SCIP_DECL_EXPRFREEDATA().
|
static |
point evaluation for EXPR_VAR
Definition at line 1411 of file expr.c.
References NULL, and SCIP_OKAY.
Referenced by SCIP_DECL_EXPRFREEDATA().
|
static |
|
static |
curvature for EXPR_VAR
Definition at line 1435 of file expr.c.
References NULL, SCIP_EXPRCURV_LINEAR, and SCIP_OKAY.
|
static |
|
static |
interval evaluation for EXPR_CONST
Definition at line 1457 of file expr.c.
References NULL, SCIP_OKAY, and SCIPintervalSet().
|
static |
curvature for EXPR_CONST
Definition at line 1468 of file expr.c.
References NULL, SCIP_EXPRCURV_LINEAR, and SCIP_OKAY.
|
static |
|
static |
interval evaluation for EXPR_PARAM
Definition at line 1491 of file expr.c.
References NULL, SCIP_OKAY, and SCIPintervalSet().
|
static |
curvature for EXPR_PARAM
Definition at line 1503 of file expr.c.
References NULL, SCIP_EXPRCURV_LINEAR, and SCIP_OKAY.
|
static |
|
static |
|
static |
curvature for EXPR_PLUS
Definition at line 1538 of file expr.c.
References NULL, SCIP_OKAY, and SCIPexprcurvAdd().
|
static |
|
static |
|
static |
curvature for EXPR_MINUS
Definition at line 1574 of file expr.c.
References NULL, SCIP_OKAY, SCIPexprcurvAdd(), and SCIPexprcurvNegate().
|
static |
|
static |
|
static |
curvature for EXPR_MUL
Definition at line 1610 of file expr.c.
References NULL, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, and SCIPexprcurvMultiply().
|
static |
|
static |
|
static |
curvature for EXPR_DIV
Definition at line 1662 of file expr.c.
References NULL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, and SCIPexprcurvMultiply().
|
static |
|
static |
|
static |
curvature for EXPR_SQUARE
Definition at line 1730 of file expr.c.
References NULL, SCIP_OKAY, and SCIPexprcurvPower().
|
static |
|
static |
|
static |
curvature for EXPR_SQRT
Definition at line 1767 of file expr.c.
References NULL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_UNKNOWN, and SCIP_OKAY.
|
static |
|
static |
|
static |
curvature for EXPR_REALPOWER
Definition at line 1810 of file expr.c.
References NULL, SCIP_OKAY, and SCIPexprcurvPower().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
curvature for EXPR_SIGNPOWER
Definition at line 1910 of file expr.c.
References NULL, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIPexprcurvNegate(), SCIPexprcurvPower(), and SCIPintervalSetBounds().
|
static |
|
static |
|
static |
curvature for EXPR_EXP
Definition at line 1977 of file expr.c.
References NULL, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_UNKNOWN, and SCIP_OKAY.
|
static |
|
static |
|
static |
curvature for EXPR_LOG
Definition at line 2019 of file expr.c.
References NULL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_UNKNOWN, and SCIP_OKAY.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
curvature for EXPR_MIN
Definition at line 2172 of file expr.c.
References NULL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_UNKNOWN, and SCIP_OKAY.
|
static |
|
static |
|
static |
curvature for EXPR_MAX
Definition at line 2215 of file expr.c.
References NULL, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_UNKNOWN, and SCIP_OKAY.
|
static |
|
static |
|
static |
curvature for EXPR_ABS
Definition at line 2257 of file expr.c.
References NULL, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, and SCIPexprcurvMultiply().
|
static |
|
static |
|
static |
curvature for EXPR_SIGN
Definition at line 2306 of file expr.c.
References NULL, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, and SCIP_OKAY.
|
static |
|
static |
interval evaluation for EXPR_SUM
Definition at line 2338 of file expr.c.
References infinity, NULL, SCIP_OKAY, SCIPintervalAdd(), and SCIPintervalSet().
|
static |
curvature for EXPR_SUM
Definition at line 2355 of file expr.c.
References NULL, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, and SCIPexprcurvAdd().
|
static |
|
static |
interval evaluation for EXPR_PRODUCT
Definition at line 2388 of file expr.c.
References infinity, NULL, SCIP_OKAY, SCIPintervalMul(), and SCIPintervalSet().
|
static |
curvature for EXPR_PRODUCT
Definition at line 2405 of file expr.c.
References FALSE, NULL, SCIP_Bool, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, SCIP_Real, SCIPexprcurvMultiply(), and TRUE.
|
static |
|
static |
interval evaluation for EXPR_LINEAR
Definition at line 2471 of file expr.c.
References infinity, NULL, SCIP_OKAY, SCIP_Real, SCIPintervalAddScalar(), and SCIPintervalScalprodScalars().
|
static |
curvature for EXPR_LINEAR
Definition at line 2485 of file expr.c.
References NULL, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIP_Real, SCIPexprcurvAdd(), and SCIPexprcurvMultiply().
|
static |
expression data copy for EXPR_LINEAR
Definition at line 2506 of file expr.c.
References BMSduplicateBlockMemoryArray, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIP_Real.
Referenced by SCIP_DECL_EXPRFREEDATA().
|
static |
expression data free for EXPR_LINEAR
Definition at line 2524 of file expr.c.
References BMSfreeBlockMemoryArray, NULL, and SCIP_Real.
Referenced by SCIP_DECL_EXPRFREEDATA().
|
static |
point evaluation for EXPR_QUADRATIC
Definition at line 2539 of file expr.c.
References SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprData_Quadratic::quadelems, SCIP_OKAY, and SCIP_Real.
|
static |
interval evaluation for EXPR_QUADRATIC
Definition at line 2576 of file expr.c.
References SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, infinity, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprData_Quadratic::quadelems, quadraticdataSort(), SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPintervalAdd(), SCIPintervalAddScalar(), SCIPintervalMulScalar(), SCIPintervalQuad(), SCIPintervalQuadBivar(), and SCIPintervalSet().
|
static |
curvature for EXPR_QUADRATIC
Definition at line 2703 of file expr.c.
References SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprData_Quadratic::quadelems, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, SCIP_Real, SCIPexprcurvAdd(), SCIPexprcurvMultiply(), and SCIPexprcurvPower().
|
static |
expression data copy for EXPR_QUADRATIC
Definition at line 2771 of file expr.c.
References SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprData_Quadratic::quadelems, quadraticdataCreate(), SCIP_CALL, and SCIP_OKAY.
|
static |
expression data free for EXPR_QUADRATIC
Definition at line 2789 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Quadratic::nquadelems, NULL, and SCIP_ExprData_Quadratic::quadelems.
|
static |
point evaluation for EXPR_POLYNOMIAL
Definition at line 2815 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, pow(), SCIP_OKAY, SCIP_Real, and sqrt().
|
static |
interval evaluation for EXPR_POLYNOMIAL
Definition at line 2913 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, SCIP_ExprData_Monomial::exponents, infinity, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIP_OKAY, SCIP_Real, SCIPintervalAdd(), SCIPintervalDiv(), SCIPintervalIsEmpty(), SCIPintervalIsEntire(), SCIPintervalMul(), SCIPintervalPowerScalar(), SCIPintervalSet(), SCIPintervalSetEmpty(), SCIPintervalSquare(), and SCIPintervalSquareRoot().
|
static |
curvature for EXPR_POLYNOMIAL
Definition at line 3007 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, SCIPexprcurvAdd(), SCIPexprcurvMonomial(), and SCIPexprcurvMultiply().
|
static |
|
static |
expression data free for EXPR_POLYNOMIAL
Definition at line 3061 of file expr.c.
References NULL, and polynomialdataFree().
|
static |
|
static |
interval evaluation for user expression
Definition at line 3088 of file expr.c.
References infinity, NULL, SCIP_CALL, SCIP_OKAY, SCIPintervalSetEntire(), and SCIP_ExprData_User::userdata.
|
static |
curvature check for user expression
Definition at line 3109 of file expr.c.
References infinity, NULL, SCIP_CALL, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, and SCIP_ExprData_User::userdata.
|
static |
data copy for user expression
Definition at line 3130 of file expr.c.
References BMSduplicateBlockMemory, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, and SCIP_ExprData_User::userdata.
|
static |
data free for user expression
Definition at line 3162 of file expr.c.
References BMSfreeBlockMemory, eval(), NULL, SCIP_DECL_EXPRCOPYDATA(), SCIP_DECL_EXPRCURV(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPRFREEDATA(), SCIP_DECL_EXPRINTEVAL(), and SCIP_ExprData_User::userdata.
const char* SCIPexpropGetName | ( | SCIP_EXPROP | op | ) |
gives the name of an operand as string
op | expression operand |
Definition at line 3247 of file expr.c.
References SCIP_EXPR_LAST.
Referenced by exprgraphNodeUpdateBounds(), exprgraphPrintNodeExpression(), getCoeffsAndConstantFromLinearExpr(), printExpr(), printRowNl(), reformulate(), SCIPexprgraphNodeSplitOffLinear(), SCIPexprgraphReleaseNode(), SCIPexprgraphUpdateNodeBoundsCurvature(), and SCIPwritePip().
int SCIPexpropGetNChildren | ( | SCIP_EXPROP | op | ) |
gives the number of children of a simple operand
op | expression operand |
Definition at line 3257 of file expr.c.
References SCIP_EXPR_LAST.
|
static |
creates an expression
Note, that the expression is allocated but for the children only the pointer is copied.
blkmem | block memory data structure |
expr | pointer to buffer for expression address |
op | operand of expression |
nchildren | number of children |
children | children |
opdata | operand data |
Definition at line 3276 of file expr.c.
References BMSallocBlockMemory, SCIP_Expr::data, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by SCIPexprCreate(), SCIPexprCreateLinear(), SCIPexprCreatePolynomial(), SCIPexprCreateQuadratic(), and SCIPexprCreateUser().
|
static |
tries to convert a given (operator,operatordata) pair into a polynomial operator with corresponding data
Does not do this for constants. If conversion is not possible or operator is already polynomial, *op and *data are left untouched.
blkmem | block memory |
op | pointer to expression operator |
data | pointer to expression data |
nchildren | number of children of operator |
Definition at line 3307 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, EPSISINT, FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, monomialdataEnsureFactorsSize(), SCIP_ExprData_Polynomial::monomialssize, SCIP_ExprData_Quadratic::nquadelems, NULL, polynomialdataAddMonomials(), polynomialdataCreate(), polynomialdataEnsureMonomialsSize(), SCIP_ExprData_Quadratic::quadelems, SCIP_CALL, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIP_Real, SCIPexprAddMonomialFactors(), SCIPexprCreateMonomial(), SCIPexprFreeMonomial(), and TRUE.
Referenced by exprgraphNodeSimplify(), and exprsimplifyConvertToPolynomials().
|
static |
converts polynomial expression back into simpler expression, if possible
blkmem | block memory data structure |
op | pointer to expression operator |
data | pointer to expression data holding polynomial data |
nchildren | number of children of operator |
children | children array |
Definition at line 3745 of file expr.c.
References BMSallocBlockMemory, BMSallocBlockMemoryArray, BMSclearMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, EPSISINT, EPSROUND, SCIP_ExprData_Monomial::exponents, FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, MAX, MIN, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprData_Quadratic::nquadelems, NULL, polynomialdataFree(), polynomialdataMergeMonomials(), SCIP_ExprData_Quadratic::quadelems, SCIP_ALLOC, SCIP_EXPR_DEGREEINFINITY, SCIP_EXPR_DIV, SCIP_EXPR_INTPOWER, SCIP_EXPR_LINEAR, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_OKAY, SCIP_Real, SCIP_ExprData_Quadratic::sorted, and TRUE.
Referenced by exprsimplifyUnconvertPolynomials(), and SCIPexprgraphSimplify().
|
static |
adds copies of expressions to the array of children of a sum, product, linear, quadratic, or polynomial expression
For a sum or product expression, this corresponds to add additional summands and factors, resp. For a linear expression, this corresponds to add each expression with coefficient 1.0. For a quadratic or polynomial expression, only the children array may be enlarged, the expression itself remains the same.
blkmem | block memory |
expr | quadratic or polynomial expression |
nexprs | number of expressions to add |
exprs | expressions to add |
comparechildren | whether to compare expressions with already existing children (no effect for sum and product) |
eps | which epsilon to use when comparing expressions |
childmap | array where to store mapping of indices from exprs to children array in expr, or NULL if not of interest |
Definition at line 4130 of file expr.c.
References BMSclearMemoryArray, BMSreallocBlockMemoryArray, SCIP_Expr::children, SCIP_Expr::data, FALSE, SCIP_ExprData_Quadratic::lincoefs, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_LINEAR, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_SUM, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPerrorMessage, SCIPexprAreEqual(), SCIPexprCopyDeep(), and TRUE.
Referenced by exprsimplifyFlattenPolynomials().
|
static |
converts expressions into polynomials, where possible and obvious
blkmem | block memory data structure |
expr | expression to convert |
Definition at line 4249 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::data, exprConvertToPolynomial(), SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIPexprSimplify().
|
static |
removes duplicate children in a polynomial expression
Leaves NULL's in children array.
blkmem | block memory data structure |
expr | expression |
eps | threshold for zero |
Definition at line 4273 of file expr.c.
References BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_Expr::children, SCIP_Expr::data, FALSE, SCIP_Expr::nchildren, NULL, polynomialdataApplyChildmap(), SCIP_ALLOC, SCIP_Bool, SCIP_EXPR_POLYNOMIAL, SCIP_OKAY, SCIPexprAreEqual(), SCIPexprFreeDeep(), SCIPexprGetOperator(), and TRUE.
Referenced by exprsimplifyFlattenPolynomials().
|
static |
eliminates NULL's in children array and shrinks it to actual size
blkmem | block memory data structure |
expr | expression |
Definition at line 4327 of file expr.c.
References BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, BMSreallocBlockMemoryArray, SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, polynomialdataApplyChildmap(), SCIP_ALLOC, SCIP_EXPR_POLYNOMIAL, SCIP_OKAY, and SCIPexprGetOperator().
Referenced by exprsimplifyFlattenPolynomials(), and exprsimplifySeparateLinearFromPolynomial().
|
static |
checks which children are still in use and frees those which are not
blkmem | block memory data structure |
expr | polynomial expression |
Definition at line 4393 of file expr.c.
References BMSallocBlockMemoryArray, BMSclearMemoryArray, BMSfreeBlockMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_Expr::children, SCIP_Expr::data, SCIP_ExprData_Polynomial::monomials, SCIP_Expr::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIP_ALLOC, SCIP_Bool, SCIP_OKAY, SCIPexprFreeDeep(), and TRUE.
Referenced by exprsimplifyFlattenPolynomials().
|
static |
flattens polynomials in polynomials, check for constants in non-polynomials expressions
exprsimplifyConvertToPolynomials should have been called before to eliminate simple polynomial operands.
blkmem | block memory data structure |
messagehdlr | message handler |
expr | expression |
eps | threshold, under which values are treat as 0 |
maxexpansionexponent | maximal exponent for which we still expand non-monomial polynomials |
Definition at line 4444 of file expr.c.
References BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, BMSreallocBlockMemoryArray, calcGrowSize(), SCIP_ExprData_Monomial::childidxs, SCIP_Expr::children, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, SCIP_Expr::data, EPSISINT, SCIP_ExprData_Monomial::exponents, exprsimplifyAddChildren(), exprsimplifyRemoveDuplicatePolynomialChildren(), exprsimplifyRemovePolynomialNullChildren(), exprsimplifyRemovePolynomialUnusedChildren(), FALSE, SCIP_ExprData_Polynomial::monomials, SCIP_Expr::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, SCIP_Expr::op, polynomialdataCreate(), polynomialdataExpandMonomialFactor(), polynomialdataFree(), pow(), SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIP_Real, SCIPdebug, SCIPdebugMessage, SCIPdebugPrintf, SCIPexprEval(), SCIPexprFindMonomialFactor(), SCIPexprFreeDeep(), SCIPexprGetNChildren(), SCIPexprGetNMonomials(), SCIPexprGetOperator(), SCIPexprGetOpReal(), SCIPexprMergeMonomials(), SCIPexprPrint(), SCIPmessagePrintWarning(), SCIP_ExprData_Polynomial::sorted, SCIP_ExprData_Monomial::sorted, and TRUE.
Referenced by SCIPexprSimplify().
|
static |
separates linear monomials from an expression, if it is a polynomial expression
Separates only those linear terms whose variable is not used otherwise in the expression.
blkmem | block memory data structure |
expr | expression |
eps | threshold, under which positive values are treat as 0 |
nvars | number of variables in expression |
nlinvars | buffer to store number of linear variables in linear part |
linidxs | array to store indices of variables in expression tree which belong to linear part |
lincoefs | array to store coefficients of linear part |
Definition at line 4773 of file expr.c.
References BMSallocBlockMemoryArray, BMSclearMemoryArray, BMSfreeBlockMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_Expr::children, SCIP_ExprData_Monomial::coef, SCIP_Expr::data, SCIP_ExprData_Monomial::exponents, exprsimplifyRemovePolynomialNullChildren(), FALSE, SCIP_ExprData_Polynomial::monomials, SCIP_Expr::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataMergeMonomials(), SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIPexprFreeDeep(), SCIPexprGetNChildren(), SCIPexprGetOperator(), SCIPexprGetOpIndex(), and SCIPexprGetVarsUsage().
Referenced by SCIPexprSimplify().
|
static |
converts polynomial expressions back into simpler expressions, where possible
blkmem | block memory data structure |
expr | expression to convert back |
Definition at line 4874 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::data, exprUnconvertPolynomial(), SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, SCIP_EXPR_POLYNOMIAL, and SCIP_OKAY.
Referenced by SCIPexprSimplify().
|
static |
|
static |
parses a variable name from a string and creates corresponding expression
Creates a new variable index if variable not seen before, updates varnames and vartable structures.
blkmem | block memory data structure |
str | pointer to the string to be parsed |
expr | buffer to store pointer to created expression |
nvars | running number of encountered variables so far |
varnames | pointer to buffer to store new variable names |
vartable | hash table for variable names and corresponding expression index |
coefficient | coefficient to be used when creating the expression |
varnameendptr | if a <varname> should be parsed, set this to NULL. Then, str points to the '<' else, str should point to the first letter of the varname, and varnameendptr should point one char behind the last char of the variable name |
Definition at line 4908 of file expr.c.
References NULL, SCIP_CALL, SCIP_EXPR_VARIDX, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_READERROR, SCIP_VARTYPE_BINARY_CHAR, SCIP_VARTYPE_CONTINUOUS_CHAR, SCIP_VARTYPE_IMPLINT_CHAR, SCIP_VARTYPE_INTEGER_CHAR, SCIPerrorMessage, SCIPexprCreate(), SCIPexprCreateLinear(), SCIPhashtableInsert(), and SCIPhashtableRetrieve().
Referenced by exprParse().
|
static |
if str[0] points to an opening parenthesis, this function sets endptr to point to the matching closing bracket in str
Searches for at most length characters.
str | pointer to the string to be parsed |
endptr | pointer to point to the closing parenthesis |
length | length of the string to be parsed |
Definition at line 5001 of file expr.c.
References SCIP_OKAY, SCIP_READERROR, and SCIPerrorMessage.
Referenced by exprParse().
|
static |
this function sets endptr to point to the next separating comma in str
That is, for a given string like "x+f(x,y),z", endptr will point to the comma before "z"
Searches for at most length characters.
str | pointer to the string to be parsed |
endptr | pointer to point to the comma |
length | length of the string to be parsed |
Definition at line 5040 of file expr.c.
References SCIP_OKAY, SCIP_READERROR, and SCIPerrorMessage.
Referenced by exprParse().
|
static |
parses an expression from a string
blkmem | block memory data structure |
messagehdlr | message handler |
expr | buffer to store pointer to created expression |
str | pointer to the string to be parsed |
length | length of the string to be parsed |
lastchar | pointer to the last char of str that should be parsed |
nvars | running number of encountered variables so far |
varnames | pointer to buffer to store new variable names |
vartable | hash table for variable names and corresponding expression index |
recursiondepth | current recursion depth |
Definition at line 5072 of file expr.c.
References EPSISINT, exprparseFindClosingParenthesis(), exprparseFindSeparatingComma(), exprparseReadVariable(), NULL, number, SCIP_CALL, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MUL, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_TAN, SCIP_OKAY, SCIP_READERROR, SCIP_Real, SCIPdebug, SCIPdebugMessage, SCIPerrorMessage, SCIPexprAdd(), SCIPexprCreate(), SCIPexprFreeDeep(), SCIPexprFreeShallow(), SCIPexprGetOperator(), SCIPexprGetOpReal(), SCIPexprMulConstant(), SCIPexprPrint(), SCIPmessagePrintInfo(), SCIPstrToIntValue(), and SCIPstrToRealValue().
Referenced by SCIPexprParse().
SCIP_EXPROP SCIPexprGetOperator | ( | SCIP_EXPR * | expr | ) |
gives operator of expression
expr | expression |
Definition at line 5654 of file expr.c.
References NULL, and SCIP_Expr::op.
Referenced by addUserEstimator(), analyzeTree(), atomic_userexpr< Type >::atomic_userexpr(), checkCurvature(), eval(), exprIsNonSmooth(), exprParse(), exprsimplifyFlattenPolynomials(), exprsimplifyRemoveDuplicatePolynomialChildren(), exprsimplifyRemovePolynomialNullChildren(), exprsimplifySeparateLinearFromPolynomial(), generateCut(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), getCoeffsAndConstantFromLinearExpr(), getLinearAndQuadraticCoefs(), initSepaDataCreateVred(), printExpr(), printRowNl(), readConstraints(), readExpression(), readObjective(), SCIPexprAdd(), SCIPexprMulConstant(), and SCIPwritePip().
int SCIPexprGetNChildren | ( | SCIP_EXPR * | expr | ) |
gives number of children of an expression
expr | expression |
Definition at line 5664 of file expr.c.
References SCIP_Expr::nchildren, and NULL.
Referenced by addUserEstimator(), analyzeTree(), atomic_userexpr< Type >::atomic_userexpr(), eval(), evalUser(), exprIsNonSmooth(), exprsimplifyFlattenPolynomials(), exprsimplifySeparateLinearFromPolynomial(), getCoeffsAndConstantFromLinearExpr(), getExprSize(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readObjective(), SCIPexprAdd(), SCIPexprMulConstant(), and SCIPwritePip().
gives pointer to array with children of an expression
expr | expression |
Definition at line 5674 of file expr.c.
References SCIP_Expr::children, and NULL.
Referenced by addUserEstimator(), analyzeTree(), eval(), exprIsNonSmooth(), getCoeffsAndConstantFromLinearExpr(), getExprSize(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readObjective(), SCIPexprAdd(), and SCIPwritePip().
int SCIPexprGetOpIndex | ( | SCIP_EXPR * | expr | ) |
gives index belonging to a SCIP_EXPR_VARIDX or SCIP_EXPR_PARAM operand
expr | expression |
Definition at line 5684 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, SCIP_EXPR_PARAM, and SCIP_EXPR_VARIDX.
Referenced by eval(), exprsimplifySeparateLinearFromPolynomial(), getCoeffsAndConstantFromLinearExpr(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), and readObjective().
gives real belonging to a SCIP_EXPR_CONST operand
expr | expression |
Definition at line 5695 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_CONST.
Referenced by eval(), exprParse(), exprsimplifyFlattenPolynomials(), getCoeffsAndConstantFromLinearExpr(), printExpr(), printRowNl(), readExpression(), SCIPexprAdd(), and SCIPexprMulConstant().
void* SCIPexprGetOpData | ( | SCIP_EXPR * | expr | ) |
gives void* belonging to a complex operand
expr | expression |
Definition at line 5706 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_SUM.
gives exponent belonging to a SCIP_EXPR_REALPOWER expression
expr | expression |
Definition at line 5717 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_REALPOWER.
Referenced by eval(), printExpr(), printRowNl(), and SCIPwritePip().
int SCIPexprGetIntPowerExponent | ( | SCIP_EXPR * | expr | ) |
gives exponent belonging to a SCIP_EXPR_INTPOWER expression
expr | expression |
Definition at line 5728 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_INTPOWER.
Referenced by eval(), printExpr(), printRowNl(), and SCIPwritePip().
gives exponent belonging to a SCIP_EXPR_SIGNPOWER expression
expr | expression |
Definition at line 5739 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_SIGNPOWER.
Referenced by atomic_signpower< Type >::atomic_signpower(), evalSignPower(), and printExpr().
gives linear coefficients belonging to a SCIP_EXPR_LINEAR expression
expr | expression |
Definition at line 5750 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, SCIP_EXPR_LINEAR, and SCIP_Real.
Referenced by eval(), getCoeffsAndConstantFromLinearExpr(), printExpr(), printRowNl(), and SCIPexprAdd().
gives constant belonging to a SCIP_EXPR_LINEAR expression
expr | expression |
Definition at line 5763 of file expr.c.
References SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_EXPR_LINEAR, and SCIP_Real.
Referenced by eval(), getCoeffsAndConstantFromLinearExpr(), printExpr(), printRowNl(), and SCIPexprAdd().
SCIP_QUADELEM* SCIPexprGetQuadElements | ( | SCIP_EXPR * | expr | ) |
gives quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression
expr | quadratic expression |
Definition at line 5776 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_QUADRATIC.
Referenced by eval(), printExpr(), and printRowNl().
gives constant belonging to a SCIP_EXPR_QUADRATIC expression
expr | quadratic expression |
Definition at line 5788 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_QUADRATIC.
Referenced by eval(), printExpr(), and printRowNl().
gives linear coefficients belonging to a SCIP_EXPR_QUADRATIC expression can be NULL if all coefficients are 0.0
expr | quadratic expression |
Definition at line 5801 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_QUADRATIC.
Referenced by eval(), printExpr(), and printRowNl().
int SCIPexprGetNQuadElements | ( | SCIP_EXPR * | expr | ) |
gives number of quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression
expr | quadratic expression |
Definition at line 5813 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_QUADRATIC.
Referenced by eval(), printExpr(), and printRowNl().
SCIP_EXPRDATA_MONOMIAL** SCIPexprGetMonomials | ( | SCIP_EXPR * | expr | ) |
gives the monomials belonging to a SCIP_EXPR_POLYNOMIAL expression
expr | expression |
Definition at line 5825 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_POLYNOMIAL.
Referenced by eval(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readObjective(), and SCIPwritePip().
int SCIPexprGetNMonomials | ( | SCIP_EXPR * | expr | ) |
gives the number of monomials belonging to a SCIP_EXPR_POLYNOMIAL expression
expr | expression |
Definition at line 5837 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_POLYNOMIAL.
Referenced by eval(), exprsimplifyFlattenPolynomials(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readConstraints(), readObjective(), and SCIPwritePip().
gives the constant belonging to a SCIP_EXPR_POLYNOMIAL expression
expr | expression |
Definition at line 5849 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_POLYNOMIAL.
Referenced by eval(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), and readObjective().
SCIP_Real SCIPexprGetMonomialCoef | ( | SCIP_EXPRDATA_MONOMIAL * | monomial | ) |
gets coefficient of a monomial
monomial | monomial |
Definition at line 5861 of file expr.c.
References SCIP_ExprData_Monomial::coef, and NULL.
Referenced by eval(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readObjective(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
int SCIPexprGetMonomialNFactors | ( | SCIP_EXPRDATA_MONOMIAL * | monomial | ) |
gets number of factors of a monomial
monomial | monomial |
Definition at line 5871 of file expr.c.
References SCIP_ExprData_Monomial::nfactors, and NULL.
Referenced by eval(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readObjective(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIP_DECL_NONLINCONSUPGD(), and SCIPwritePip().
int* SCIPexprGetMonomialChildIndices | ( | SCIP_EXPRDATA_MONOMIAL * | monomial | ) |
gets indices of children corresponding to factors of a monomial
monomial | monomial |
Definition at line 5881 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, and NULL.
Referenced by eval(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readObjective(), and reformulate().
SCIP_Real* SCIPexprGetMonomialExponents | ( | SCIP_EXPRDATA_MONOMIAL * | monomial | ) |
gets exponents in factors of a monomial
monomial | monomial |
Definition at line 5891 of file expr.c.
References SCIP_ExprData_Monomial::exponents, and NULL.
Referenced by eval(), getLinearAndQuadraticCoefs(), printExpr(), printRowNl(), readObjective(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIP_DECL_NONLINCONSUPGD(), and SCIPwritePip().
SCIP_USEREXPRDATA* SCIPexprGetUserData | ( | SCIP_EXPR * | expr | ) |
gets user data of a user expression
Definition at line 5901 of file expr.c.
References SCIP_Expr::data, and NULL.
indicates whether a user expression has the estimator callback defined
Definition at line 5912 of file expr.c.
References SCIP_Expr::data, and NULL.
Referenced by addUserEstimator().
SCIP_EXPRINTCAPABILITY SCIPexprGetUserEvalCapability | ( | SCIP_EXPR * | expr | ) |
gives the evaluation capability of a user expression
Definition at line 5923 of file expr.c.
References SCIP_Expr::data, and NULL.
Referenced by analyzeTree().
SCIP_RETCODE SCIPexprCreate | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr, | ||
SCIP_EXPROP | op, | ||
... | |||
) |
creates a simple expression
blkmem | block memory data structure |
expr | pointer to buffer for expression address |
op | operand of expression |
Definition at line 5934 of file expr.c.
References BMSallocBlockMemoryArray, BMSduplicateBlockMemoryArray, SCIP_Expr::data, exprCreate(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, and SCIPerrorMessage.
Referenced by createConsFromQuadTerm(), createExprtreeFromMonomial(), createNlRow(), exprgraphNodeCreateExpr(), exprParse(), exprparseReadVariable(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternA(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternB(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), initSepaData(), initSepaDataCreateVred(), readExpression(), readNonlinearExprs(), readPolynomial(), removeFixedVariables(), SCIPexprAdd(), SCIPexprgraphGetSeparableTrees(), SCIPexprgraphGetSumTrees(), SCIPexprMulConstant(), SCIPexprtreeAddExpr(), SCIPexprtreeRemoveFixedVars(), SCIPwritePip(), and setupProblem().
SCIP_RETCODE SCIPexprCopyDeep | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | targetexpr, | ||
SCIP_EXPR * | sourceexpr | ||
) |
copies an expression including its children
blkmem | block memory data structure |
targetexpr | buffer to store pointer to copied expression |
sourceexpr | expression to copy |
Definition at line 6100 of file expr.c.
References BMSallocBlockMemoryArray, BMSduplicateBlockMemory, SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, and SCIPexprCopyDeep().
Referenced by exprsimplifyAddChildren(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), initSepaData(), initSepaDataCreateVred(), SCIPexprCopyDeep(), SCIPexprintCompile(), SCIPexprSubstituteVars(), SCIPexprtreeAddExpr(), SCIPexprtreeCopy(), and SCIPexprtreeSubstituteVars().
void SCIPexprFreeDeep | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr | ||
) |
frees an expression including its children
blkmem | block memory data structure |
expr | pointer to expression to free |
Definition at line 6142 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, NULL, and SCIPexprFreeDeep().
Referenced by exprParse(), exprsimplifyFlattenPolynomials(), exprsimplifyRemoveDuplicatePolynomialChildren(), exprsimplifyRemovePolynomialUnusedChildren(), exprsimplifySeparateLinearFromPolynomial(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternA(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternB(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), initSepaData(), initSepaDataCreateVred(), readExpression(), removeFixedVariables(), SCIPexprAdd(), SCIPexprFreeDeep(), SCIPexprintCompile(), SCIPexprintFreeData(), SCIPexprMulConstant(), SCIPexprSubstituteVars(), SCIPexprtreeFree(), SCIPexprtreeRemoveFixedVars(), and SCIPexprtreeSubstituteVars().
void SCIPexprFreeShallow | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr | ||
) |
frees an expression but not its children
blkmem | block memory data structure |
expr | pointer to expression to free |
Definition at line 6180 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, and NULL.
Referenced by exprParse(), and SCIPexprAdd().
SCIP_RETCODE SCIPexprAdd | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr, | ||
SCIP_Real | coef1, | ||
SCIP_EXPR * | term1, | ||
SCIP_Real | coef2, | ||
SCIP_EXPR * | term2, | ||
SCIP_Real | constant | ||
) |
creates an expression from the addition of two given expression, with coefficients, and a constant
The given expressions may be modified or freed, otherwise it will be used a child expression. Favors creation and maintaining of SCIP_EXPR_LINEAR over SCIP_EXPR_PLUS or SCIP_EXPR_SUM.
blkmem | block memory data structure |
expr | pointer to store pointer to created expression |
coef1 | coefficient of first term |
term1 | expression of first term, or NULL |
coef2 | coefficient of second term |
term2 | expression of second term, or NULL |
constant | constant term to add |
Definition at line 6205 of file expr.c.
References SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_LINEAR, SCIP_OKAY, SCIP_Real, SCIPexprAddToLinear(), SCIPexprCreate(), SCIPexprCreateLinear(), SCIPexprFreeDeep(), SCIPexprFreeShallow(), SCIPexprGetChildren(), SCIPexprGetLinearCoefs(), SCIPexprGetLinearConstant(), SCIPexprGetNChildren(), SCIPexprGetOperator(), and SCIPexprGetOpReal().
Referenced by exprParse(), and readExpression().
SCIP_RETCODE SCIPexprMulConstant | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr, | ||
SCIP_EXPR * | term, | ||
SCIP_Real | factor | ||
) |
creates an expression from the multiplication of an expression with a constant
The given expressions may be modified or freed, otherwise it will be used a child expression. Favors creation and maintaining SCIP_EXPR_LINEAR over SCIP_EXPR_PLUS or SCIP_EXPR_SUM.
blkmem | block memory data structure |
expr | buffer to store pointer to created expression |
term | term to multiply by factor |
factor | factor |
Definition at line 6363 of file expr.c.
References SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_Expr::data, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_Expr::nchildren, NULL, SCIP_ExprData_Quadratic::quadelems, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_LINEAR, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_QUADRATIC, SCIP_OKAY, SCIP_Real, SCIPexprCreate(), SCIPexprCreateLinear(), SCIPexprFreeDeep(), SCIPexprGetNChildren(), SCIPexprGetOperator(), and SCIPexprGetOpReal().
Referenced by exprParse(), and readExpression().
SCIP_RETCODE SCIPexprCreateLinear | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr, | ||
int | nchildren, | ||
SCIP_EXPR ** | children, | ||
SCIP_Real * | coefs, | ||
SCIP_Real | constant | ||
) |
creates a SCIP_EXPR_LINEAR expression that is (affine) linear in its children: constant + sum_i coef_i child_i
blkmem | block memory data structure |
expr | pointer to buffer for expression address |
nchildren | number of children |
children | children of expression |
coefs | coefficients of children |
constant | constant part |
Definition at line 6461 of file expr.c.
References BMSallocBlockMemoryArray, BMScopyMemoryArray, BMSduplicateBlockMemoryArray, exprCreate(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_LINEAR, SCIP_OKAY, and SCIP_Real.
Referenced by createNlRow(), exprgraphNodeCreateExpr(), exprparseReadVariable(), initSepaData(), initSepaDataCreateVred(), readExpression(), removeFixedVariables(), SCIPexprAdd(), SCIPexprgraphGetSeparableTrees(), SCIPexprMulConstant(), SCIPexprtreeRemoveFixedVars(), and setupProblem().
SCIP_RETCODE SCIPexprAddToLinear | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
int | nchildren, | ||
SCIP_Real * | coefs, | ||
SCIP_EXPR ** | children, | ||
SCIP_Real | constant | ||
) |
adds new terms to a linear expression
blkmem | block memory |
expr | linear expression |
nchildren | number of children to add |
coefs | coefficients of additional children |
children | additional children expressions |
constant | constant to add |
Definition at line 6498 of file expr.c.
References BMScopyMemoryArray, BMSreallocBlockMemoryArray, SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_ALLOC, SCIP_EXPR_LINEAR, SCIP_OKAY, and SCIP_Real.
Referenced by SCIPexprAdd().
SCIP_RETCODE SCIPexprCreateQuadratic | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr, | ||
int | nchildren, | ||
SCIP_EXPR ** | children, | ||
SCIP_Real | constant, | ||
SCIP_Real * | lincoefs, | ||
int | nquadelems, | ||
SCIP_QUADELEM * | quadelems | ||
) |
creates a SCIP_EXPR_QUADRATIC expression: constant + sum_i coef_i child_i + sum_i coef_i child1_i child2_i
blkmem | block memory data structure |
expr | pointer to buffer for expression address |
nchildren | number of children |
children | children of expression |
constant | constant |
lincoefs | linear coefficients of children, or NULL if all 0.0 |
nquadelems | number of quadratic elements |
quadelems | quadratic elements specifying coefficients and child indices |
Definition at line 6543 of file expr.c.
References BMSduplicateBlockMemoryArray, exprCreate(), NULL, quadraticdataCreate(), SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_QUADRATIC, and SCIP_OKAY.
Referenced by createConsFromQuadTerm(), exprgraphNodeCreateExpr(), readExpression(), readNonlinearExprs(), and SCIPexprgraphGetSeparableTrees().
void SCIPexprSortQuadElems | ( | SCIP_EXPR * | expr | ) |
ensures that quadratic elements of a quadratic expression are sorted
expr | quadratic expression |
Definition at line 6579 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, quadraticdataSort(), and SCIP_EXPR_QUADRATIC.
Referenced by eval(), and SCIPexprAreEqual().
SCIP_RETCODE SCIPexprCreatePolynomial | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr, | ||
int | nchildren, | ||
SCIP_EXPR ** | children, | ||
int | nmonomials, | ||
SCIP_EXPRDATA_MONOMIAL ** | monomials, | ||
SCIP_Real | constant, | ||
SCIP_Bool | copymonomials | ||
) |
creates a SCIP_EXPR_POLYNOMIAL expression from an array of monomials: constant + sum_i monomial_i
blkmem | block memory data structure |
expr | pointer to buffer for expression address |
nchildren | number of children |
children | children of expression |
nmonomials | number of monomials |
monomials | monomials |
constant | constant part |
copymonomials | should monomials by copied or ownership be assumed? |
Definition at line 6591 of file expr.c.
References BMSduplicateBlockMemoryArray, exprCreate(), NULL, polynomialdataCreate(), SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_POLYNOMIAL, and SCIP_OKAY.
Referenced by createExprtreeFromMonomial(), createNlRow(), exprgraphNodeCreateExpr(), readPolynomial(), SCIPexprgraphGetSeparableTrees(), SCIPexprgraphGetSumTrees(), and setupProblem().
SCIP_RETCODE SCIPexprAddMonomials | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
int | nmonomials, | ||
SCIP_EXPRDATA_MONOMIAL ** | monomials, | ||
SCIP_Bool | copymonomials | ||
) |
adds an array of monomials to a SCIP_EXPR_POLYNOMIAL expression
blkmem | block memory of expression |
expr | expression |
nmonomials | number of monomials to add |
monomials | the monomials to add |
copymonomials | should monomials by copied or ownership be assumed? |
Definition at line 6626 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, polynomialdataAddMonomials(), SCIP_CALL, SCIP_EXPR_POLYNOMIAL, and SCIP_OKAY.
changes the constant in a SCIP_EXPR_POLYNOMIAL expression
expr | expression |
constant | new value for constant |
Definition at line 6648 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, and SCIP_EXPR_POLYNOMIAL.
void SCIPexprMultiplyPolynomialByConstant | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
SCIP_Real | factor | ||
) |
multiplies each summand of a polynomial by a given constant
blkmem | block memory |
expr | polynomial expression |
factor | constant factor |
Definition at line 6661 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, polynomialdataMultiplyByConstant(), and SCIP_EXPR_POLYNOMIAL.
SCIP_RETCODE SCIPexprMultiplyPolynomialByMonomial | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
SCIP_EXPRDATA_MONOMIAL * | factor, | ||
int * | childmap | ||
) |
multiplies each summand of a polynomial by a given monomial
blkmem | block memory |
expr | polynomial expression |
factor | monomial factor |
childmap | map children in factor to children in expr, or NULL for 1:1 |
Definition at line 6675 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, polynomialdataMultiplyByMonomial(), SCIP_CALL, SCIP_EXPR_POLYNOMIAL, and SCIP_OKAY.
SCIP_RETCODE SCIPexprMultiplyPolynomialByPolynomial | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
SCIP_EXPR * | factor, | ||
int * | childmap | ||
) |
multiplies this polynomial by a polynomial
Factor needs to be different from expr. Children of factor need to be children of expr already, w.r.t. an optional mapping of child indices.
blkmem | block memory |
expr | polynomial expression |
factor | polynomial factor |
childmap | map children in factor to children in expr, or NULL for 1:1 |
Definition at line 6698 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, polynomialdataMultiplyByPolynomial(), SCIP_CALL, SCIP_EXPR_POLYNOMIAL, SCIP_OKAY, and SCIPexprAreEqual().
SCIP_RETCODE SCIPexprPolynomialPower | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
int | exponent | ||
) |
takes a power of the polynomial
Exponent need to be an integer. Polynomial needs to be a monomial, if exponent is negative.
blkmem | block memory |
expr | polynomial expression |
exponent | exponent of power operation |
Definition at line 6744 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, polynomialdataPower(), SCIP_CALL, SCIP_EXPR_POLYNOMIAL, and SCIP_OKAY.
void SCIPexprMergeMonomials | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
SCIP_Real | eps, | ||
SCIP_Bool | mergefactors | ||
) |
merges monomials in a polynomial expression that differ only in coefficient into a single monomial
Eliminates monomials with coefficient between -eps and eps.
blkmem | block memory |
expr | polynomial expression |
eps | threshold under which numbers are treat as zero |
mergefactors | whether to merge factors in monomials too |
Definition at line 6764 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, polynomialdataMergeMonomials(), and SCIP_EXPR_POLYNOMIAL.
Referenced by exprsimplifyFlattenPolynomials().
SCIP_Bool SCIPexprAreMonomialsEqual | ( | SCIP_EXPRDATA_MONOMIAL * | monomial1, |
SCIP_EXPRDATA_MONOMIAL * | monomial2, | ||
SCIP_Real | eps | ||
) |
checks if two monomials are equal
monomial1 | first monomial |
monomial2 | second monomial |
eps | threshold under which numbers are treated as 0.0 |
Definition at line 6779 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, EPSEQ, SCIP_ExprData_Monomial::exponents, FALSE, SCIP_ExprData_Monomial::nfactors, NULL, SCIPexprSortMonomialFactors(), and TRUE.
Referenced by exprgraphFindParentByOperator(), and SCIPexprAreEqual().
void SCIPexprChgMonomialCoef | ( | SCIP_EXPRDATA_MONOMIAL * | monomial, |
SCIP_Real | newcoef | ||
) |
changes coefficient of monomial
monomial | monomial |
newcoef | new coefficient |
Definition at line 6810 of file expr.c.
References SCIP_ExprData_Monomial::coef, and NULL.
Referenced by polynomialdataMultiplyByConstant(), and polynomialdataMultiplyByPolynomial().
SCIP_RETCODE SCIPexprAddMonomialFactors | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRDATA_MONOMIAL * | monomial, | ||
int | nfactors, | ||
int * | childidxs, | ||
SCIP_Real * | exponents | ||
) |
adds factors to a monomial
blkmem | block memory |
monomial | monomial |
nfactors | number of factors to add |
childidxs | indices of children corresponding to factors |
exponents | exponent in each factor |
Definition at line 6821 of file expr.c.
References BMScopyMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::exponents, monomialdataEnsureFactorsSize(), SCIP_ExprData_Monomial::nfactors, NULL, SCIP_CALL, SCIP_OKAY, and SCIP_ExprData_Monomial::sorted.
Referenced by exprConvertToPolynomial(), polynomialdataExpandMonomialFactor(), and SCIPexprMultiplyMonomialByMonomial().
SCIP_RETCODE SCIPexprMultiplyMonomialByMonomial | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRDATA_MONOMIAL * | monomial, | ||
SCIP_EXPRDATA_MONOMIAL * | factor, | ||
int * | childmap | ||
) |
multiplies a monomial with a monomial
blkmem | block memory |
monomial | monomial |
factor | factor monomial |
childmap | map to apply to children in factor, or NULL for 1:1 |
Definition at line 6850 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::nfactors, NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprAddMonomialFactors().
Referenced by polynomialdataMultiplyByMonomial(), and polynomialdataMultiplyByPolynomial().
void SCIPexprMonomialPower | ( | SCIP_EXPRDATA_MONOMIAL * | monomial, |
int | exponent | ||
) |
replaces the monomial by a power of the monomial
Allows only integers as exponent.
monomial | monomial |
exponent | integer exponent of power operation |
Definition at line 6885 of file expr.c.
References SCIP_ExprData_Monomial::coef, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::nfactors, NULL, pow(), and SCIP_Real.
Referenced by polynomialdataPower().
void SCIPexprMergeMonomialFactors | ( | SCIP_EXPRDATA_MONOMIAL * | monomial, |
SCIP_Real | eps | ||
) |
merges factors that correspond to the same child by adding exponents
Eliminates factors with exponent between -eps and eps.
monomial | monomial |
eps | threshold under which numbers are treated as 0.0 |
Definition at line 6915 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, EPSEQ, EPSISINT, EPSROUND, EPSZ, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::nfactors, NULL, and SCIPexprSortMonomialFactors().
Referenced by polynomialdataMergeMonomials().
void SCIPexprSortMonomials | ( | SCIP_EXPR * | expr | ) |
ensures that monomials of a polynomial are sorted
expr | polynomial expression |
Definition at line 6982 of file expr.c.
References SCIP_Expr::data, NULL, SCIP_Expr::op, polynomialdataSortMonomials(), and SCIP_EXPR_POLYNOMIAL.
Referenced by SCIPexprAreEqual().
SCIP_RETCODE SCIPexprCreateMonomial | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRDATA_MONOMIAL ** | monomial, | ||
SCIP_Real | coef, | ||
int | nfactors, | ||
int * | childidxs, | ||
SCIP_Real * | exponents | ||
) |
creates a monomial
blkmem | block memory |
monomial | buffer where to store pointer to new monomial |
coef | coefficient of monomial |
nfactors | number of factors in monomial |
childidxs | indices of children corresponding to factors, or NULL if identity |
exponents | exponent in each factor, or NULL if all 1.0 |
Definition at line 6994 of file expr.c.
References BMSallocBlockMemory, BMSallocBlockMemoryArray, BMSduplicateBlockMemoryArray, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by createExprtreeFromMonomial(), createNlRow(), exprConvertToPolynomial(), polynomialdataAddMonomials(), polynomialdataCopy(), polynomialdataCreate(), polynomialdataMultiplyByMonomial(), polynomialdataMultiplyByPolynomial(), readPolynomial(), reformulate(), SCIPexprgraphGetSeparableTrees(), SCIPexprgraphGetSumTrees(), and setupProblem().
void SCIPexprFreeMonomial | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRDATA_MONOMIAL ** | monomial | ||
) |
frees a monomial
blkmem | block memory |
monomial | pointer to monomial that should be freed |
Definition at line 7051 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, and NULL.
Referenced by exprConvertToPolynomial(), polynomialdataExpandMonomialFactor(), polynomialdataFree(), polynomialdataMergeMonomials(), polynomialdataMultiplyByConstant(), and polynomialdataPower().
void SCIPexprSortMonomialFactors | ( | SCIP_EXPRDATA_MONOMIAL * | monomial | ) |
ensures that factors in a monomial are sorted
monomial | monomial |
Definition at line 7075 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::nfactors, NULL, SCIPsortIntReal(), SCIP_ExprData_Monomial::sorted, and TRUE.
Referenced by SCIP_DECL_SORTPTRCOMP(), SCIPexprAreMonomialsEqual(), SCIPexprFindMonomialFactor(), and SCIPexprMergeMonomialFactors().
SCIP_Bool SCIPexprFindMonomialFactor | ( | SCIP_EXPRDATA_MONOMIAL * | monomial, |
int | childidx, | ||
int * | pos | ||
) |
finds a factor corresponding to a given child index in a monomial
Note that if the factors have not been merged, the position of some factor corresponding to a given child is given. Returns TRUE if a factor is found, FALSE if not.
monomial | monomial |
childidx | index of the child which factor to search for |
pos | buffer to store position of factor |
Definition at line 7095 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, FALSE, SCIP_ExprData_Monomial::nfactors, NULL, SCIPexprSortMonomialFactors(), and SCIPsortedvecFindInt().
Referenced by exprgraphNodeSimplify(), and exprsimplifyFlattenPolynomials().
SCIP_RETCODE SCIPexprCreateUser | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR ** | expr, | ||
int | nchildren, | ||
SCIP_EXPR ** | children, | ||
SCIP_USEREXPRDATA * | data, | ||
SCIP_EXPRINTCAPABILITY | evalcapability, | ||
SCIP_DECL_USEREXPREVAL((*eval)) | , | ||
SCIP_DECL_USEREXPRINTEVAL((*inteval)) | , | ||
SCIP_DECL_USEREXPRCURV((*curv)) | , | ||
SCIP_DECL_USEREXPRPROP((*prop)) | , | ||
SCIP_DECL_USEREXPRESTIMATE((*estimate)) | , | ||
SCIP_DECL_USEREXPRCOPYDATA((*copydata)) | , | ||
SCIP_DECL_USEREXPRFREEDATA((*freedata)) | , | ||
SCIP_DECL_USEREXPRPRINT((*print)) | |||
) |
creates a user expression
blkmem | block memory data structure |
expr | pointer to buffer for expression address |
nchildren | number of children |
children | children of expression |
data | user data for expression, expression assumes ownership |
evalcapability | capability of evaluation functions (partially redundant, currently) |
Definition at line 7112 of file expr.c.
References BMSallocBlockMemory, BMSduplicateBlockMemoryArray, eval(), SCIP_ExprData_User::evalcapability, exprCreate(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_USER, SCIP_EXPRINTCAPABILITY_FUNCVALUE, SCIP_EXPRINTCAPABILITY_INTFUNCVALUE, SCIP_OKAY, and SCIP_ExprData_User::userdata.
Referenced by exprgraphNodeCreateExpr().
indicates whether the expression contains a SCIP_EXPR_PARAM
expr | expression |
Definition at line 7172 of file expr.c.
References SCIP_Expr::children, FALSE, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_EXPR_PARAM, SCIPexprHasParam(), and TRUE.
Referenced by SCIPexprHasParam(), and SCIPexprtreeHasParam().
SCIP_RETCODE SCIPexprGetMaxDegree | ( | SCIP_EXPR * | expr, |
int * | maxdegree | ||
) |
gets maximal degree of expression, or SCIP_EXPR_DEGREEINFINITY if not a polynomial
expr | expression |
maxdegree | buffer to store maximal degree |
Definition at line 7191 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_Expr::children, SCIP_Expr::data, SCIP_ExprData_Monomial::exponents, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, MAX, SCIP_ExprData_Polynomial::monomials, SCIP_Expr::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_Expr::op, SCIP_ExprData_Quadratic::quadelems, quadraticdataSort(), SCIP_CALL, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DEGREEINFINITY, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIPABORT, and SCIPexprGetMaxDegree().
Referenced by SCIPexprGetMaxDegree(), and SCIPexprtreeGetMaxDegree().
void SCIPexprGetVarsUsage | ( | SCIP_EXPR * | expr, |
int * | varsusage | ||
) |
counts usage of variables in expression
expr | expression to update |
varsusage | array with counters of variable usage |
Definition at line 7516 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_EXPR_VARIDX, and SCIPexprGetVarsUsage().
Referenced by exprsimplifySeparateLinearFromPolynomial(), SCIPexprGetVarsUsage(), and SCIPexprtreeGetVarsUsage().
compares whether two expressions are the same
Inconclusive, i.e., may give FALSE even if expressions are equivalent (x*y != y*x).
expr1 | first expression |
expr2 | second expression |
eps | threshold under which numbers are assumed to be zero |
Definition at line 7539 of file expr.c.
References SCIP_Expr::children, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_Expr::data, EPSEQ, EPSZ, FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_Expr::nchildren, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_Expr::op, SCIP_ExprData_Quadratic::quadelems, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_Real, SCIPABORT, SCIPerrorMessage, SCIPexprAreEqual(), SCIPexprAreMonomialsEqual(), SCIPexprSortMonomials(), SCIPexprSortQuadElems(), and TRUE.
Referenced by exprsimplifyAddChildren(), exprsimplifyRemoveDuplicatePolynomialChildren(), SCIPexprAreEqual(), and SCIPexprMultiplyPolynomialByPolynomial().
SCIP_RETCODE SCIPexprSimplify | ( | BMS_BLKMEM * | blkmem, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_EXPR * | expr, | ||
SCIP_Real | eps, | ||
int | maxexpansionexponent, | ||
int | nvars, | ||
int * | nlinvars, | ||
int * | linidxs, | ||
SCIP_Real * | lincoefs | ||
) |
aims at simplifying an expression and splitting of a linear expression
If linear variables are split off, expression interpreter data, if stored in the tree, is freed.
blkmem | block memory data structure |
messagehdlr | message handler |
expr | expression |
eps | threshold, under which positive values are treat as 0 |
maxexpansionexponent | maximal exponent for which we still expand non-monomial polynomials |
nvars | number of variables in expression |
nlinvars | buffer to store number of linear variables in linear part, or NULL if linear part should not be separated |
linidxs | array to store indices of variables in expression tree which belong to linear part, or NULL |
lincoefs | array to store coefficients of linear part, or NULL |
Definition at line 7754 of file expr.c.
References exprsimplifyConvertToPolynomials(), exprsimplifyFlattenPolynomials(), exprsimplifySeparateLinearFromPolynomial(), exprsimplifyUnconvertPolynomials(), NULL, SCIP_CALL, SCIP_OKAY, SCIPdebug, SCIPdebugMessage, SCIPdebugPrintf, and SCIPexprPrint().
Referenced by SCIPexprtreeSimplify().
SCIP_RETCODE SCIPexprEvalShallow | ( | SCIP_EXPR * | expr, |
SCIP_Real * | argvals, | ||
SCIP_Real * | varvals, | ||
SCIP_Real * | param, | ||
SCIP_Real * | val | ||
) |
evaluates an expression w.r.t. given values for children expressions
expr | expression |
argvals | values for children, can be NULL if the expression has no children |
varvals | values for variables, can be NULL if the expression operand is not a variable |
param | values for parameters, can be NULL if the expression operand is not a parameter |
val | buffer to store value |
Definition at line 7806 of file expr.c.
References SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, and SCIP_OKAY.
SCIP_RETCODE SCIPexprEval | ( | SCIP_EXPR * | expr, |
SCIP_Real * | varvals, | ||
SCIP_Real * | param, | ||
SCIP_Real * | val | ||
) |
evaluates an expression w.r.t. a point
expr | expression |
varvals | values for variables, can be NULL if the expression is constant |
param | values for parameters, can be NULL if the expression is not parameterized |
val | buffer to store value |
Definition at line 7825 of file expr.c.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_ALLOC, SCIP_CALL, SCIP_EXPRESSION_MAXCHILDEST, SCIP_OKAY, SCIP_Real, and SCIPexprEval().
Referenced by addUserEstimator(), exprsimplifyFlattenPolynomials(), SCIPexprEval(), and SCIPexprtreeEval().
SCIP_RETCODE SCIPexprEvalIntShallow | ( | SCIP_EXPR * | expr, |
SCIP_Real | infinity, | ||
SCIP_INTERVAL * | argvals, | ||
SCIP_INTERVAL * | varvals, | ||
SCIP_Real * | param, | ||
SCIP_INTERVAL * | val | ||
) |
evaluates an expression w.r.t. given interval values for children expressions
expr | expression |
infinity | value to use for infinity |
argvals | interval values for children, can be NULL if the expression has no children |
varvals | interval values for variables, can be NULL if the expression is constant |
param | values for parameters, can be NULL if the expression is not parameterized |
val | buffer to store value |
Definition at line 7866 of file expr.c.
References SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, and SCIP_OKAY.
SCIP_RETCODE SCIPexprEvalInt | ( | SCIP_EXPR * | expr, |
SCIP_Real | infinity, | ||
SCIP_INTERVAL * | varvals, | ||
SCIP_Real * | param, | ||
SCIP_INTERVAL * | val | ||
) |
evaluates an expression w.r.t. an interval
expr | expression |
infinity | value to use for infinity |
varvals | interval values for variables, can be NULL if the expression is constant |
param | values for parameters, can be NULL if the expression is not parameterized |
val | buffer to store value |
Definition at line 7886 of file expr.c.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_ALLOC, SCIP_CALL, SCIP_EXPRESSION_MAXCHILDEST, SCIP_OKAY, and SCIPexprEvalInt().
Referenced by addUserEstimator(), SCIPexprEvalInt(), and SCIPexprtreeEvalInt().
SCIP_RETCODE SCIPexprEvalUser | ( | SCIP_EXPR * | expr, |
SCIP_Real * | argvals, | ||
SCIP_Real * | val, | ||
SCIP_Real * | gradient, | ||
SCIP_Real * | hessian | ||
) |
evaluates a user expression w.r.t. given values for children expressions
expr | expression |
argvals | values for children |
val | buffer to store function value |
gradient | buffer to store gradient values, or NULL if not requested |
hessian | buffer to store values of full Hessian, or NULL if not requested |
Definition at line 7928 of file expr.c.
References SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, SCIP_EXPR_USER, SCIP_OKAY, and SCIP_ExprData_User::userdata.
Referenced by exprEvalUser().
SCIP_RETCODE SCIPexprEvalIntUser | ( | SCIP_EXPR * | expr, |
SCIP_Real | infinity, | ||
SCIP_INTERVAL * | argvals, | ||
SCIP_INTERVAL * | val, | ||
SCIP_INTERVAL * | gradient, | ||
SCIP_INTERVAL * | hessian | ||
) |
evaluates a user expression w.r.t. an interval
expr | expression |
infinity | value to use for infinity |
argvals | values for children |
val | buffer to store value |
gradient | buffer to store gradient values, or NULL if not requested |
hessian | buffer to store values of full Hessian, or NULL if not requested |
Definition at line 7951 of file expr.c.
References SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, SCIP_EXPR_USER, SCIP_OKAY, SCIPintervalSetEntire(), and SCIP_ExprData_User::userdata.
Referenced by exprEvalUser().
SCIP_RETCODE SCIPexprCheckCurvature | ( | SCIP_EXPR * | expr, |
SCIP_Real | infinity, | ||
SCIP_INTERVAL * | varbounds, | ||
SCIP_Real * | param, | ||
SCIP_EXPRCURV * | curv, | ||
SCIP_INTERVAL * | bounds | ||
) |
tries to determine the curvature type of an expression w.r.t. given variable domains
expr | expression to check |
infinity | value to use for infinity |
varbounds | domains of variables |
param | values for parameters, can be NULL if the expression is not parameterized |
curv | buffer to store curvature of expression |
bounds | buffer to store bounds on expression |
Definition at line 7984 of file expr.c.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_ALLOC, SCIP_CALL, SCIP_EXPRCURV_LINEAR, SCIP_EXPRESSION_MAXCHILDEST, SCIP_OKAY, and SCIPexprCheckCurvature().
Referenced by SCIPexprCheckCurvature(), and SCIPexprtreeCheckCurvature().
SCIP_RETCODE SCIPexprEstimateUser | ( | SCIP_EXPR * | expr, |
SCIP_Real | infinity, | ||
SCIP_Real * | argvals, | ||
SCIP_INTERVAL * | argbounds, | ||
SCIP_Bool | overestimate, | ||
SCIP_Real * | coeffs, | ||
SCIP_Real * | constant, | ||
SCIP_Bool * | success | ||
) |
under-/overestimates a user expression w.r.t. to given values and bounds for children expressions
expr | expression |
infinity | value to use for infinity |
argvals | values for children |
argbounds | bounds for children |
overestimate | whether to overestimate the expression |
coeffs | buffer to store the linear coefficients for each child expression that gives a valid under-/overestimator |
constant | buffer to store the constant value of the linear under-/overestimator |
success | buffer to store whether an estimator was successfully computed |
Definition at line 8042 of file expr.c.
References SCIP_Expr::data, FALSE, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, SCIP_EXPR_USER, SCIP_OKAY, and SCIP_ExprData_User::userdata.
Referenced by addUserEstimator().
SCIP_RETCODE SCIPexprSubstituteVars | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr, | ||
SCIP_EXPR ** | substexprs | ||
) |
substitutes variables (SCIP_EXPR_VARIDX) by expressions
Note that only the children of the given expr are checked! A variable with index i is replaced by a copy of substexprs[i], if the latter is not NULL. If substexprs[i] == NULL, then the variable expression i is not touched.
blkmem | block memory data structure |
expr | expression, which of the children may be replaced |
substexprs | array of substitute expressions; single entries can be NULL |
Definition at line 8080 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_CALL, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIPexprCopyDeep(), SCIPexprFreeDeep(), and SCIPexprSubstituteVars().
Referenced by generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), initSepaDataCreateVred(), SCIPexprSubstituteVars(), and SCIPexprtreeSubstituteVars().
void SCIPexprReindexVars | ( | SCIP_EXPR * | expr, |
int * | newindices | ||
) |
updates variable indices in expression tree
expr | expression to update |
newindices | new indices of variables |
Definition at line 8118 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_EXPR_VARIDX, and SCIPexprReindexVars().
Referenced by initSepaData(), removeFixedVariables(), SCIPexprReindexVars(), and SCIPexprtreeRemoveFixedVars().
void SCIPexprReindexParams | ( | SCIP_EXPR * | expr, |
int * | newindices | ||
) |
updates parameter indices in expression tree
expr | expression to update |
newindices | new indices of variables |
Definition at line 8139 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::data, SCIP_Expr::nchildren, NULL, SCIP_Expr::op, SCIP_EXPR_PARAM, and SCIPexprReindexParams().
Referenced by SCIPexprReindexParams().
void SCIPexprPrint | ( | SCIP_EXPR * | expr, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
FILE * | file, | ||
const char ** | varnames, | ||
const char ** | paramnames, | ||
SCIP_Real * | paramvals | ||
) |
prints an expression
expr | expression |
messagehdlr | message handler |
file | file for printing, or NULL for stdout |
varnames | names of variables, or NULL for default names |
paramnames | names of parameters, or NULL for default names |
paramvals | values of parameters, or NULL for not printing |
Definition at line 8160 of file expr.c.
References SCIP_ExprData_Monomial::childidxs, SCIP_Expr::children, SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_Expr::data, SCIP_ExprData_Monomial::exponents, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_Expr::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_Expr::op, SCIP_ExprData_Quadratic::quadelems, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_Real, SCIPABORT, SCIPerrorMessage, SCIPexprPrint(), SCIPmessageFPrintInfo(), and SCIP_ExprData_User::userdata.
Referenced by exprParse(), exprsimplifyFlattenPolynomials(), SCIPexprPrint(), SCIPexprSimplify(), and SCIPexprtreePrint().
SCIP_RETCODE SCIPexprParse | ( | BMS_BLKMEM * | blkmem, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_EXPR ** | expr, | ||
const char * | str, | ||
const char * | lastchar, | ||
int * | nvars, | ||
int * | varnames | ||
) |
parses an expression from a string
blkmem | block memory data structure |
messagehdlr | message handler |
expr | buffer to store pointer to created expression |
str | pointer to the string to be parsed |
lastchar | pointer to the last char of str that should be parsed |
nvars | buffer to store number of variables |
varnames | buffer to store variable names, prefixed by index (as int) |
Definition at line 8472 of file expr.c.
References exprParse(), NULL, SCIP_CALL, SCIPhashtableCreate(), and SCIPhashtableFree().
Referenced by SCIP_DECL_CONSPARSE().
SCIP_EXPR* SCIPexprtreeGetRoot | ( | SCIP_EXPRTREE * | tree | ) |
returns root expression of an expression tree
tree | expression tree |
Definition at line 8533 of file expr.c.
References NULL, and SCIP_ExprTree::root.
Referenced by addUserEstimator(), checkCurvature(), generateCut(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), getExprtreeSize(), getLinearAndQuadraticCoefs(), initSepaData(), initSepaDataCreateVred(), printNonlinearRow(), printRowNl(), readConstraints(), readObjective(), removeFixedVariables(), SCIPexprintCompile(), SCIPexprintEval(), SCIPexprintEvalInt(), SCIPnlpiOraclePrintProblemGams(), and SCIPwritePip().
int SCIPexprtreeGetNVars | ( | SCIP_EXPRTREE * | tree | ) |
returns number of variables in expression tree
tree | expression tree |
Definition at line 8543 of file expr.c.
References NULL, and SCIP_ExprTree::nvars.
Referenced by addConcaveEstimatorBivariate(), addConcaveEstimatorMultivariate(), addConcaveEstimatorUnivariate(), addIntervalGradientEstimator(), addLinearization(), addUserEstimator(), checkCurvature(), computeGradient(), computeViolation(), consdataAddExprtrees(), createConstraint(), evalFunctionGradient(), evalFunctionValue(), freeConstraint(), generateCut(), getGradientMaxElement(), getLinearAndQuadraticCoefs(), hessLagAddExprtree(), hessLagSparsitySetNzFlagForExprtree(), nlpAddNlRows(), nlpSetupNlpiIndices(), nlrowCalcActivityBounds(), nlrowExprtreeChanged(), nlrowRemoveFixedExprtreeVars(), printFunction(), printRowNl(), processNlRow(), readObjective(), registerBranchingVariables(), registerLargeRelaxValueVariableForBranching(), removeFixedVariables(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSENFOPS(), SCIP_DECL_CONSEXITPRE(), SCIP_DECL_CONSGETNVARS(), SCIP_DECL_CONSGETVARS(), SCIP_DECL_CONSINITLP(), SCIPcreateConsBivariate(), SCIPcreateNlpiProb(), SCIPevalExprtreeGlobalBounds(), SCIPevalExprtreeLocalBounds(), SCIPevalExprtreeSol(), SCIPexprintCompile(), SCIPexprintEval(), SCIPexprintEvalInt(), SCIPexprintGrad(), SCIPexprintGradInt(), SCIPexprintHessianDense(), SCIPexprintHessianSparsityDense(), SCIPexprtreeSimplify(), SCIPgetExprtreeTransformedVars(), SCIPnlpGetVarsNonlinearity(), SCIPnlpHasContinuousNonlinearity(), SCIPnlpiOracleChgExprtree(), SCIPnlpiOracleDelVarSet(), SCIPnlpiOracleEvalJacobian(), SCIPnlpiOracleGetJacobianSparsity(), SCIPnlrowGetSolActivity(), SCIPnlrowRecalcNLPActivity(), SCIPnlrowRecalcPseudoActivity(), SCIPwritePip(), solveDerivativeEquation(), and updateVariableDegreesCons().
int SCIPexprtreeGetNParams | ( | SCIP_EXPRTREE * | tree | ) |
returns number of parameters in expression tree
tree | expression tree |
Definition at line 8553 of file expr.c.
References SCIP_ExprTree::nparams, and NULL.
Referenced by nlrowExprtreeParamChanged(), nlrowRemoveFixedExprtreeVars(), SCIPnlpiOracleChgExprParam(), and SCIPnlrowChgExprtreeParams().
SCIP_Real* SCIPexprtreeGetParamVals | ( | SCIP_EXPRTREE * | tree | ) |
returns values of parameters or NULL if none
tree | expression tree |
Definition at line 8563 of file expr.c.
References NULL, and SCIP_ExprTree::params.
Referenced by addUserEstimator(), nlrowExprtreeParamChanged(), SCIPexprintEval(), and SCIPexprintEvalInt().
void SCIPexprtreeSetParamVal | ( | SCIP_EXPRTREE * | tree, |
int | paramidx, | ||
SCIP_Real | paramval | ||
) |
sets value of a single parameter in expression tree
tree | expression tree |
paramidx | index of parameter |
paramval | new value of parameter |
Definition at line 8573 of file expr.c.
References NULL, and SCIP_ExprTree::params.
Referenced by generateConvexConcaveUnderestimator(), SCIPnlpiOracleChgExprParam(), and SCIPnlrowChgExprtreeParam().
SCIP_EXPRINTDATA* SCIPexprtreeGetInterpreterData | ( | SCIP_EXPRTREE * | tree | ) |
gets data of expression tree interpreter, or NULL if not set
tree | expression tree |
Definition at line 8588 of file expr.c.
References SCIP_ExprTree::interpreterdata, and NULL.
Referenced by addIntervalGradientEstimator(), addLinearization(), computeGradient(), computeViolation(), generateLinearizationCut(), getGradientMaxElement(), initSepaData(), SCIP_DECL_CONSINITLP(), SCIPexprintCompile(), SCIPexprintEval(), SCIPexprintEvalInt(), SCIPexprintGetExprtreeCapability(), SCIPexprintGrad(), SCIPexprintGradInt(), SCIPexprintHessianDense(), SCIPexprintHessianSparsityDense(), SCIPexprintNewParametrization(), and solveDerivativeEquation().
void SCIPexprtreeSetInterpreterData | ( | SCIP_EXPRTREE * | tree, |
SCIP_EXPRINTDATA * | interpreterdata | ||
) |
sets data of expression tree interpreter
tree | expression tree |
interpreterdata | expression interpreter data |
Definition at line 8598 of file expr.c.
References SCIP_ExprTree::interpreterdata, and NULL.
Referenced by SCIPexprintCompile().
SCIP_RETCODE SCIPexprtreeFreeInterpreterData | ( | SCIP_EXPRTREE * | tree | ) |
frees data of expression tree interpreter, if any
tree | expression tree |
Definition at line 8611 of file expr.c.
References SCIP_ExprTree::interpreterdata, NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprintFreeData().
Referenced by SCIPexprtreeAddExpr(), SCIPexprtreeFree(), SCIPexprtreeSimplify(), and SCIPexprtreeSubstituteVars().
SCIP_Bool SCIPexprtreeHasParam | ( | SCIP_EXPRTREE * | tree | ) |
indicates whether there are parameterized constants (SCIP_EXPR_PARAM) in expression tree
tree | expression tree |
Definition at line 8625 of file expr.c.
References NULL, SCIP_ExprTree::root, and SCIPexprHasParam().
SCIP_RETCODE SCIPexprtreeGetMaxDegree | ( | SCIP_EXPRTREE * | tree, |
int * | maxdegree | ||
) |
Gives maximal degree of expression in expression tree.
If constant expression, gives 0, if linear expression, gives 1, if polynomial expression, gives its maximal degree, otherwise (nonpolynomial nonconstant expressions) gives at least SCIP_EXPR_DEGREEINFINITY.
tree | expression tree |
maxdegree | buffer to store maximal degree |
Definition at line 8641 of file expr.c.
References NULL, SCIP_ExprTree::root, SCIP_CALL, SCIP_OKAY, and SCIPexprGetMaxDegree().
Referenced by SCIPwriteGms().
SCIP_RETCODE SCIPexprtreeEval | ( | SCIP_EXPRTREE * | tree, |
SCIP_Real * | varvals, | ||
SCIP_Real * | val | ||
) |
evaluates an expression tree w.r.t. a point
tree | expression tree |
varvals | values for variables |
val | buffer to store expression tree value |
Definition at line 8654 of file expr.c.
References NULL, SCIP_ExprTree::nvars, SCIP_ExprTree::params, SCIP_ExprTree::root, SCIP_CALL, SCIP_OKAY, and SCIPexprEval().
Referenced by addConcaveEstimatorBivariate(), addConcaveEstimatorMultivariate(), addConcaveEstimatorUnivariate(), generateConvexConcaveUnderestimator(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), nlrowRemoveFixedExprtreeVars(), SCIPevalExprtreeSol(), SCIPexprintEval(), SCIPexprtreeSimplify(), SCIPnlrowGetSolActivity(), SCIPnlrowRecalcNLPActivity(), and SCIPnlrowRecalcPseudoActivity().
SCIP_RETCODE SCIPexprtreeEvalInt | ( | SCIP_EXPRTREE * | tree, |
SCIP_Real | infinity, | ||
SCIP_INTERVAL * | varvals, | ||
SCIP_INTERVAL * | val | ||
) |
evaluates an expression tree w.r.t. an interval
tree | expression tree |
infinity | value for infinity |
varvals | intervals for variables |
val | buffer to store expression tree value |
Definition at line 8670 of file expr.c.
References NULL, SCIP_ExprTree::nvars, SCIP_ExprTree::params, SCIP_ExprTree::root, SCIP_CALL, SCIP_OKAY, and SCIPexprEvalInt().
Referenced by nlrowCalcActivityBounds(), SCIPevalExprtreeGlobalBounds(), SCIPevalExprtreeLocalBounds(), and SCIPexprintEvalInt().
void SCIPexprtreePrint | ( | SCIP_EXPRTREE * | tree, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
FILE * | file, | ||
const char ** | varnames, | ||
const char ** | paramnames | ||
) |
prints an expression tree
tree | expression tree |
messagehdlr | message handler |
file | file for printing, or NULL for stdout |
varnames | names of variables, or NULL for default names |
paramnames | names of parameters, or NULL for default names |
Definition at line 8687 of file expr.c.
References NULL, SCIP_ExprTree::params, SCIP_ExprTree::root, and SCIPexprPrint().
Referenced by generateConvexConcaveUnderestimator(), isConvexLocal(), printFunction(), and SCIPexprtreePrintWithNames().
SCIP_RETCODE SCIPexprtreeCreate | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRTREE ** | tree, | ||
SCIP_EXPR * | root, | ||
int | nvars, | ||
int | nparams, | ||
SCIP_Real * | params | ||
) |
creates an expression tree
blkmem | block memory data structure |
tree | buffer to store address of created expression tree |
root | pointer to root expression, not copied deep !, can be NULL |
nvars | number of variables in variable mapping |
nparams | number of parameters in expression |
params | values for parameters, or NULL (if NULL but nparams > 0, then params is initialized with zeros) |
Definition at line 8702 of file expr.c.
References BMSallocBlockMemory, BMSallocBlockMemoryArray, BMSclearMemoryArray, BMSduplicateBlockMemoryArray, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by createConsFromQuadTerm(), createExprtreeFromMonomial(), createNlRow(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), initSepaData(), initSepaDataCreateVred(), readNonlinearExprs(), readPolynomial(), SCIP_DECL_CONSPARSE(), SCIPexprgraphGetSeparableTrees(), SCIPexprgraphGetSumTrees(), SCIPexprgraphGetTree(), SCIPwritePip(), and setupProblem().
SCIP_RETCODE SCIPexprtreeCopy | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRTREE ** | targettree, | ||
SCIP_EXPRTREE * | sourcetree | ||
) |
copies an expression tree
blkmem | block memory that should be used in new expression tree |
targettree | buffer to store address of copied expression tree |
sourcetree | expression tree to copy |
Definition at line 8743 of file expr.c.
References BMSduplicateBlockMemory, BMSduplicateBlockMemoryArray, SCIP_ExprTree::nparams, NULL, SCIP_ExprTree::nvars, SCIP_ExprTree::params, SCIP_ExprTree::root, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPexprCopyDeep(), and SCIP_ExprTree::vars.
Referenced by consdataAddExprtrees(), createConstraint(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternA(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternB(), initSepaData(), removeFixedVariables(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSTRANS(), SCIPcreateConsBivariate(), SCIPnlpiOracleChgExprtree(), SCIPnlrowChgExprtree(), and SCIPnlrowCreate().
SCIP_RETCODE SCIPexprtreeFree | ( | SCIP_EXPRTREE ** | tree | ) |
frees an expression tree
tree | pointer to expression tree that is freed |
Definition at line 8783 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, NULL, SCIP_CALL, SCIP_OKAY, SCIPexprFreeDeep(), and SCIPexprtreeFreeInterpreterData().
Referenced by consdataFree(), consdataSetExprtrees(), createConsFromMonomial(), createConsFromQuadTerm(), createNlRow(), freeConstraint(), freeSepaData(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternA(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternB(), generateOrthogonal_lx_ly_Underestimator(), generateOrthogonal_lx_uy_Underestimator(), generateUnderestimatorParallelYFacets(), nlrowRemoveFixedExprtreeVars(), readConstraints(), readNonlinearExprs(), readObjective(), removeFixedVariables(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSDELETE(), SCIP_DECL_CONSPARSE(), SCIP_DECL_CONSPRINT(), SCIPnlpiOracleChgExprtree(), SCIPnlpiOracleDelVarSet(), SCIPnlrowChgExprtree(), SCIPnlrowFree(), SCIPwriteGms(), SCIPwritePip(), and setupProblem().
SCIP_RETCODE SCIPexprtreeSetParams | ( | SCIP_EXPRTREE * | tree, |
int | nparams, | ||
SCIP_Real * | paramvals | ||
) |
sets number and values of all parameters in expression tree
tree | expression tree |
nparams | number of parameters |
paramvals | values of parameters, can be NULL if nparams == 0 |
Definition at line 8807 of file expr.c.
References SCIP_ExprTree::blkmem, BMScopyMemoryArray, BMSduplicateBlockMemoryArray, BMSfreeBlockMemoryArrayNull, BMSreallocBlockMemoryArray, SCIP_ExprTree::nparams, NULL, SCIP_ExprTree::params, SCIP_ALLOC, and SCIP_OKAY.
Referenced by generateConvexConcaveUnderestimator(), initSepaData(), and SCIPnlrowChgExprtreeParams().
void SCIPexprtreeGetVarsUsage | ( | SCIP_EXPRTREE * | tree, |
int * | varsusage | ||
) |
gives the number of usages for each variable in the expression tree
tree | expression tree |
varsusage | array where to store for each variable how often it is used in the tree |
Definition at line 8838 of file expr.c.
References BMSclearMemoryArray, NULL, SCIP_ExprTree::nvars, SCIP_ExprTree::root, and SCIPexprGetVarsUsage().
SCIP_RETCODE SCIPexprtreeSimplify | ( | SCIP_EXPRTREE * | tree, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_Real | eps, | ||
int | maxexpansionexponent, | ||
int * | nlinvars, | ||
int * | linidxs, | ||
SCIP_Real * | lincoefs | ||
) |
aims at simplifying an expression and splitting of a linear expression
If linear variables are split off, expression interpreter data, if stored in the tree, is freed.
tree | expression tree |
messagehdlr | message handler |
eps | threshold, under which positive values are treat as 0 |
maxexpansionexponent | maximal exponent for which we still expand non-monomial polynomials |
nlinvars | buffer to store number of linear variables in linear part, or NULL if linear part should not be separated |
linidxs | array to store indices of variables in expression tree which belong to linear part, or NULL |
lincoefs | array to store coefficients of linear part, or NULL |
Definition at line 8857 of file expr.c.
References SCIP_ExprTree::blkmem, BMSallocMemoryArray, BMSfreeMemoryArray, EPSZ, NULL, SCIP_ExprTree::nvars, SCIP_ExprTree::root, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPexprSimplify(), SCIPexprtreeEval(), SCIPexprtreeFreeInterpreterData(), SCIPexprtreeGetNVars(), SCIPrandomCreate(), SCIPrandomFree(), SCIPrandomGetReal(), and SCIPrelDiff().
SCIP_RETCODE SCIPexprtreeAddExpr | ( | SCIP_EXPRTREE * | tree, |
SCIP_EXPR * | expr, | ||
SCIP_Bool | copyexpr | ||
) |
adds an expression to the root expression of the tree
The root is replaced with an SCIP_EXPR_PLUS expression which has the previous root and the given expression (or a copy of it) as children.
tree | expression tree |
expr | expression to add to tree |
copyexpr | whether expression should be copied |
Definition at line 8911 of file expr.c.
References SCIP_ExprTree::blkmem, NULL, SCIP_ExprTree::root, SCIP_CALL, SCIP_EXPR_PLUS, SCIP_OKAY, SCIPexprCopyDeep(), SCIPexprCreate(), and SCIPexprtreeFreeInterpreterData().
Referenced by SCIPexprgraphGetSumTrees().
SCIP_RETCODE SCIPexprtreeCheckCurvature | ( | SCIP_EXPRTREE * | tree, |
SCIP_Real | infinity, | ||
SCIP_INTERVAL * | varbounds, | ||
SCIP_EXPRCURV * | curv, | ||
SCIP_INTERVAL * | bounds | ||
) |
tries to determine the curvature type of an expression tree w.r.t. given variable domains
tree | expression tree |
infinity | value for infinity |
varbounds | domains of variables |
curv | buffer to store curvature of expression |
bounds | buffer to store bounds on expression, or NULL if not needed |
Definition at line 8934 of file expr.c.
References NULL, SCIP_ExprTree::params, SCIP_ExprTree::root, SCIP_CALL, SCIP_OKAY, and SCIPexprCheckCurvature().
Referenced by checkCurvature().
SCIP_RETCODE SCIPexprtreeSubstituteVars | ( | SCIP_EXPRTREE * | tree, |
SCIP_EXPR ** | substexprs | ||
) |
substitutes variables (SCIP_EXPR_VARIDX) in an expression tree by expressions
A variable with index i is replaced by a copy of substexprs[i], if that latter is not NULL. If substexprs[i] == NULL, then the variable expression i is not touched.
tree | expression tree |
substexprs | array of substitute expressions; single entries can be NULL |
Definition at line 8960 of file expr.c.
References SCIP_ExprTree::blkmem, SCIP_Expr::data, NULL, SCIP_Expr::op, SCIP_ExprTree::root, SCIP_CALL, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIPexprCopyDeep(), SCIPexprFreeDeep(), SCIPexprSubstituteVars(), and SCIPexprtreeFreeInterpreterData().
Referenced by generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternA(), generate1ConvexIndefiniteUnderestimatorInTheInteriorPatternB(), initSepaData(), removeFixedVariables(), and SCIPexprtreeRemoveFixedVars().
|
static |
quicksort an array of quadratic elements; pivot is the medial element (taken from scip/sorttpl.c)
elems | array to be sorted |
start | starting index |
end | ending index |
Definition at line 9014 of file expr.c.
References QUADELEMS_ISBETTER, and QUADELEMS_SWAP.
Referenced by SCIPquadelemSort().
void SCIPquadelemSort | ( | SCIP_QUADELEM * | quadelems, |
int | nquadelems | ||
) |
sorts an array of quadratic elements
The elements are sorted such that the first index is increasing and such that among elements with the same first index, the second index is increasing. For elements with same first and second index, the order is not defined.
quadelems | array of quadratic elements |
nquadelems | number of quadratic elements |
Definition at line 9124 of file expr.c.
References quadelemsQuickSort().
Referenced by createConstraint(), exprgraphFindParentByOperator(), nlrowSortQuadElem(), quadraticdataSort(), SCIPnlpiOracleChgQuadCoefs(), and SCIPnlpiOracleDelVarSet().
SCIP_Bool SCIPquadelemSortedFind | ( | SCIP_QUADELEM * | quadelems, |
int | idx1, | ||
int | idx2, | ||
int | nquadelems, | ||
int * | pos | ||
) |
Finds an index pair in a sorted array of quadratic elements.
If (idx1,idx2) is found in quadelems, then returns TRUE and stores position of quadratic element in *pos. If (idx1,idx2) is not found in quadelems, then returns FALSE and stores position where a quadratic element with these indices would be inserted in *pos. Assumes that idx1 <= idx2.
quadelems | array of quadratic elements |
idx1 | index of first variable in element to search for |
idx2 | index of second variable in element to search for |
nquadelems | number of quadratic elements in array |
pos | buffer to store position of found quadratic element or position where it would be inserted, or NULL |
Definition at line 9149 of file expr.c.
References FALSE, NULL, and TRUE.
Referenced by nlrowSearchQuadElem(), and SCIPnlpiOracleChgQuadCoefs().
void SCIPquadelemSqueeze | ( | SCIP_QUADELEM * | quadelems, |
int | nquadelems, | ||
int * | nquadelemsnew | ||
) |
Adds quadratic elements with same index and removes elements with coefficient 0.0.
Assumes that elements have been sorted before.
quadelems | array of quadratic elements |
nquadelems | number of quadratic elements |
nquadelemsnew | pointer to store new (reduced) number of quadratic elements |
Definition at line 9201 of file expr.c.
References SCIP_QuadElement::coef, NULL, and QUADELEMS_ISBETTER.
Referenced by createConstraint(), and SCIPnlpiOracleChgQuadCoefs().
|
static |
adds a parent to an expression graph node
blkmem | block memory |
node | expression graph node where to add a parent |
parent | parent node |
Definition at line 9257 of file expr.c.
References SCIP_ExprGraphNode::depth, ensureBlockMemoryArraySize, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::parents, SCIP_ExprGraphNode::parentssize, SCIP_ExprGraphNode::parentssorted, SCIP_ExprGraphNode::pos, and SCIP_OKAY.
Referenced by exprgraphNodeAddChildren(), exprgraphNodeReplaceChild(), SCIPexprgraphAddNode(), and SCIPexprgraphReplaceVarByLinearSum().
|
static |
ensures that array of parents in a node is sorted
node | expression graph node |
Definition at line 9286 of file expr.c.
References SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::parents, SCIP_ExprGraphNode::parentssorted, SCIPsortPtr(), and TRUE.
Referenced by exprgraphNodeIsParent(), and exprgraphNodeRemoveParent().
|
static |
removes a parent from an expression graph node
If the node is not used and has no other parents, then it is freed.
exprgraph | expression graph |
node | expression graph node where to remove a parent, *node will be set to NULL |
parent | parent node to remove |
Definition at line 9312 of file expr.c.
References SCIP_ExprGraphNode::depth, exprgraphNodeSortParents(), SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::nuses, SCIP_ExprGraphNode::pos, SCIP_CALL, SCIP_OKAY, SCIPexprgraphCaptureNode(), SCIPexprgraphReleaseNode(), and SCIPsortedvecFindPtr().
Referenced by exprgraphNodeRemovePolynomialDuplicateChildren(), exprgraphNodeReplaceChild(), exprgraphNodeSimplify(), SCIPexprgraphNodeSplitOffLinear(), and SCIPexprgraphReleaseNode().
|
static |
checks if a node is parent of a node
node | expression graph node |
parent | parent to look for |
Definition at line 9363 of file expr.c.
References SCIP_ExprGraphNode::depth, exprgraphNodeSortParents(), FALSE, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::parents, and SCIPsortedvecFindPtr().
Referenced by exprgraphFindParentByOperator(), and exprgraphNodeRemovePolynomialDuplicateChildren().
|
static |
adds expression graph nodes to the array of children of a sum, product, linear, quadratic, or polynomial expression
For a sum or product expression, this corresponds to add additional summands and factors, resp. For a linear expression, this corresponds to add each expression with coefficient 1.0. For a quadratic or polynomial expression, only the children array may be enlarged, the expression itself remains the same.
It is assumed that node and all exprs are in the expression graph already. It is assumed that all expressions that are added have lower depth than node.
blkmem | block memory |
node | expression graph node |
nexprs | number of children to add |
exprs | children nodes to add |
childmap | array where to store mapping of indices from exprs to children array in node, or NULL if not of interest |
Definition at line 9394 of file expr.c.
References BMSclearMemoryArray, BMSreallocBlockMemoryArray, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, exprgraphNodeAddParent(), FALSE, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_LINEAR, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_SUM, SCIP_OKAY, SCIP_Real, SCIP_ExprGraphNode::simplified, and TRUE.
Referenced by exprgraphNodeSimplify().
|
static |
replaces a child node by another node
Assumes that both nodes represent the same expression. If this node was the last parent of oldchild and oldchild is not in use, then it is freed. newchild must have deeper depth than node.
exprgraph | expression graph |
node | pointer to expression graph node |
oldchild | child node that should be replaced, it may be freed |
newchild | node that should take position of oldchild |
Definition at line 9495 of file expr.c.
References SCIP_ExprGraph::blkmem, exprgraphNodeAddParent(), exprgraphNodeRemoveParent(), FALSE, NULL, SCIP_CALL, SCIP_OKAY, and SCIPdebugMessage.
Referenced by SCIPexprgraphMoveNodeParents(), and SCIPexprgraphSimplify().
|
static |
comparison of SCIP_EXPRGRAPHNODE's that are of type SCIP_EXPR_CONST
A node is larger than another node, if their corresponding constants are related that way.
Definition at line 9545 of file expr.c.
References NULL, and SCIP_EXPR_CONST.
|
static |
sort array of nodes that holds constants
exprgraph | expression graph |
Definition at line 9564 of file expr.c.
References SCIP_ExprGraph::constnodes, SCIP_ExprGraph::constssorted, SCIP_ExprGraph::nconsts, NULL, SCIPsortPtr(), and TRUE.
Referenced by exprgraphFindConstNodePos(), and SCIPexprgraphFindConstNode().
|
static |
finds position of expression graph node corresponding to a constant in constnodes array
exprgraph | expression graph |
node | node to search for |
pos | buffer to store position of node, if found |
Definition at line 9580 of file expr.c.
References SCIP_ExprGraph::constnodes, SCIP_ExprGraph::constssorted, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, exprgraphSortConstNodes(), FALSE, SCIP_ExprGraph::nconsts, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, and SCIP_EXPR_CONST.
Referenced by SCIPexprgraphReleaseNode().
|
static |
creates an expression graph node
blkmem | block memory |
node | buffer to store expression graph node |
op | operator type of expression |
opdata | operator data of expression |
Definition at line 9635 of file expr.c.
References BMSallocBlockMemory, BMSclearMemory, NULL, SCIP_ALLOC, SCIP_EXPR_CONST, SCIP_EXPR_PARAM, SCIP_EXPR_VARIDX, SCIP_EXPRBOUNDSTATUS_VALID, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_INVALID, SCIP_OKAY, SCIP_REAL_MAX, SCIPintervalSetEntire(), and TRUE.
Referenced by exprgraphAddExpr(), SCIPexprgraphAddConst(), SCIPexprgraphAddExprtreeSum(), SCIPexprgraphAddVars(), SCIPexprgraphCreateNode(), SCIPexprgraphCreateNodeLinear(), SCIPexprgraphCreateNodePolynomial(), SCIPexprgraphCreateNodeQuadratic(), SCIPexprgraphCreateNodeUser(), and SCIPexprgraphNodeSplitOffLinear().
|
static |
prints the expression corresponding to a node (not recursively)
< gaussian error function (1 operand)
< imaginary part of gaussian error function (1 operand)
node | node of expression graph |
messagehdlr | message handler |
file | file to print to, or NULL for stdout |
varnames | variable names, or NULL for generic names |
printchildrenbounds | whether to print bounds of children |
Definition at line 9679 of file expr.c.
References SCIP_ExprGraphNode::bounds, SCIP_ExprData_Monomial::childidxs, SCIP_ExprGraphNode::children, SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::data, SCIP_ExprData_Monomial::exponents, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_Interval::inf, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_ExprGraphNode::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraphNode::op, SCIP_ExprData_Quadratic::quadelems, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_VARIDX, SCIP_Real, SCIPABORT, SCIPexpropGetName(), SCIPmessageFPrintInfo(), and SCIP_Interval::sup.
Referenced by exprgraphNodeSimplify(), exprgraphPrintNodeDot(), and SCIPexprgraphPrintNode().
|
static |
prints a node of an expression graph
exprgraph | expression graph |
node | node of expression graph |
messagehdlr | message handler |
file | file to print to, or NULL for stdout |
varnames | variable names, or NULL for generic names |
Definition at line 9935 of file expr.c.
References SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, exprgraphPrintNodeExpression(), FALSE, SCIP_Interval::inf, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, SCIP_EXPR_LAST, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_CHILDTIGHTENED, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENT, SCIP_Real, SCIPmessageFPrintInfo(), and SCIP_Interval::sup.
Referenced by SCIPexprgraphPrintDot().
|
static |
evaluate node of expression graph w.r.t. values stored in children
node | expression graph node |
varvals | values for variables |
Definition at line 9977 of file expr.c.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, SCIP_ALLOC, SCIP_CALL, SCIP_EXPRESSION_MAXCHILDEST, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIP_ExprGraphNode::value.
Referenced by exprgraphNodeEvalWithChildren(), SCIPexprgraphAddNode(), SCIPexprgraphEval(), and SCIPexprgraphSimplify().
|
static |
evaluates node including subtree
node | expression graph node |
varvals | values for variables |
Definition at line 10021 of file expr.c.
References SCIP_ExprGraphNode::children, exprgraphNodeEval(), SCIP_ExprGraphNode::nchildren, NULL, SCIP_CALL, and SCIP_OKAY.
Referenced by exprgraphNodeSimplify().
|
static |
updates bounds of a node if a children has changed its bounds
node | node of expression graph |
infinity | value for infinity in interval arithmetics |
minstrength | minimal required relative bound strengthening in a node to trigger a bound recalculation in parent nodes |
parenttightenisinvalid | whether to consider bounds that have been tightened by parents as invalid |
Definition at line 10042 of file expr.c.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, SCIP_Interval::inf, isLbBetter(), isUbBetter(), SCIP_ExprGraphNode::nchildren, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::parents, SCIP_ExprGraphNode::pos, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_PARAM, SCIP_EXPR_VARIDX, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_CHILDTIGHTENED, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENT, SCIP_EXPRBOUNDSTATUS_VALID, SCIP_EXPRESSION_MAXCHILDEST, SCIP_OKAY, SCIPdebugMessage, SCIPexpropGetName(), SCIPintervalIntersect(), SCIPintervalIsEmpty(), SCIPintervalSet(), and SCIP_Interval::sup.
Referenced by SCIPexprgraphPropagateVarBounds().
|
static |
propagate bounds of a node into children by reverting the nodes expression
exprgraph | expression graph |
node | node in expression graph with no parents |
infinity | value for infinity in interval arithmetics |
minstrength | minimal required relative bound strengthening in a node to trigger a propagation into children nodes |
cutoff | buffer to store whether a node's bounds were propagated to an empty interval |
Definition at line 10136 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, SCIP_ExprData_Monomial::childidxs, SCIP_ExprGraphNode::children, SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, SCIP_ExprData_Monomial::exponents, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_Interval::inf, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_ExprGraphNode::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, SCIP_ExprData_Quadratic::quadelems, SCIP_ALLOC_ABORT, SCIP_CALL_ABORT, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENT, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTFORCE, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTRECENT, SCIP_Real, SCIPABORT, SCIPdebugMessage, SCIPdebugPrintf, SCIPexprgraphTightenNodeBounds(), SCIPintervalAdd(), SCIPintervalAddScalar(), SCIPintervalDiv(), SCIPintervalExp(), SCIPintervalGetRoundingMode(), SCIPintervalIsEmpty(), SCIPintervalIsEntire(), SCIPintervalLog(), SCIPintervalMul(), SCIPintervalMulScalar(), SCIPintervalNegateReal(), SCIPintervalPowerScalar(), SCIPintervalPowerScalarInverse(), SCIPintervalSet(), SCIPintervalSetBounds(), SCIPintervalSetEntire(), SCIPintervalSetRoundingMode(), SCIPintervalSetRoundingModeDownwards(), SCIPintervalSignPowerScalar(), SCIPintervalSolveBivariateQuadExpressionAllScalar(), SCIPintervalSolveUnivariateQuadExpression(), SCIPintervalSquare(), SCIPintervalSquareRoot(), SCIPintervalSub(), SCIPintervalSubScalar(), SCIP_Interval::sup, TRUE, and SCIP_ExprData_User::userdata.
Referenced by SCIPexprgraphPropagateNodeBounds().
|
static |
removes duplicate children in a polynomial expression node
Leaves NULL's in children array.
exprgraph | expression graph |
node | expression graph node |
Definition at line 11243 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, exprgraphNodeIsParent(), exprgraphNodeRemoveParent(), FALSE, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, polynomialdataApplyChildmap(), SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_POLYNOMIAL, SCIP_OKAY, and TRUE.
Referenced by exprgraphNodeSimplify().
|
static |
eliminates NULL's in children array and shrinks it to actual size
blkmem | block memory |
node | expression graph node |
Definition at line 11301 of file expr.c.
References BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, BMSreallocBlockMemoryArray, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, polynomialdataApplyChildmap(), SCIP_ALLOC, SCIP_EXPR_POLYNOMIAL, and SCIP_OKAY.
Referenced by exprgraphNodeSimplify(), and SCIPexprgraphNodeSplitOffLinear().
|
static |
aims at simplifying a node in an expression graph, assuming all children have been simplified
Converts node into polynomial, if possible and not constant.
exprgraph | expression graph |
node | expression graph node |
messagehdlr | message handler |
eps | threshold, under which positive values are treat as 0 |
maxexpansionexponent | maximal exponent for which we still expand non-monomial polynomials |
havechange | flag to set if the node has been changed |
Definition at line 11370 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSclearMemoryArray, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, SCIP_ExprData_Monomial::childidxs, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::depth, ensureBlockMemoryArraySize, EPSISINT, SCIP_ExprData_Monomial::exponents, exprConvertToPolynomial(), exprgraphNodeAddChildren(), exprgraphNodeEvalWithChildren(), exprgraphNodeRemoveParent(), exprgraphNodeRemovePolynomialDuplicateChildren(), exprgraphNodeRemovePolynomialNullChildren(), exprgraphPrintNodeExpression(), FALSE, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, NULL, polynomialdataExpandMonomialFactor(), polynomialdataFree(), polynomialdataMergeMonomials(), pow(), SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_POLYNOMIAL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPdebug, SCIPdebugMessage, SCIPdebugPrintf, SCIPexprFindMonomialFactor(), SCIPmessagePrintWarning(), SCIP_ExprData_Polynomial::sorted, SCIP_ExprData_Monomial::sorted, and TRUE.
Referenced by SCIPexprgraphSimplify().
|
static |
creates an expression from a given node in an expression graph
Assembles mapping of variables from graph to tree.
exprgraph | expression graph |
node | expression graph node which expression should be created |
expr | buffer to store pointer to created expression |
nexprvars | current number of variables in expression |
varidx | current mapping of variable indices from graph to expression |
Definition at line 11696 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArrayNull, SCIP_ExprGraphNode::children, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::data, SCIP_ExprData_User::evalcapability, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_ExprGraphNode::nchildren, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::op, SCIP_ExprData_Quadratic::quadelems, SCIP_ALLOC, SCIP_CALL, SCIP_ERROR, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIP_Real, SCIPerrorMessage, SCIPexprCreate(), SCIPexprCreateLinear(), SCIPexprCreatePolynomial(), SCIPexprCreateQuadratic(), SCIPexprCreateUser(), TRUE, and SCIP_ExprData_User::userdata.
Referenced by SCIPexprgraphGetSeparableTrees(), SCIPexprgraphGetSumTrees(), and SCIPexprgraphGetTree().
|
static |
counts how often expression graph variables are used in a subtree of the expression graph
node | root node of expression graph subtree |
varsusage | array where to count usage of variables, length must be at least the number of variables in the graph |
Definition at line 11878 of file expr.c.
References SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_VARIDX.
Referenced by SCIPexprgraphGetSubtreeVarsUsage(), and SCIPexprgraphNodeSplitOffLinear().
|
static |
checks whether a node can be put into a component when checking block separability of an expression
If a variable used by node is already in another component, components are merged and component number is updated.
node | node to which we assign a component |
compnr | component number to assign, may be reduced if variables overlap |
nchildcomps | number of entries for which childcomps have been set already |
childcomps | component numbers of children |
nvars | number of variables |
varcomps | component numbers of variables |
Definition at line 11903 of file expr.c.
References SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_VARIDX.
Referenced by SCIPexprgraphGetSeparableTrees().
|
static |
assert that expression tree has at least a given depth
exprgraph | buffer to store pointer to expression graph |
mindepth | minimal depth that should be ensured |
Definition at line 11963 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSclearMemoryArray, SCIP_ExprGraph::depth, ensureBlockMemoryArraySize3, SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, SCIP_ExprGraph::nodessize, NULL, and SCIP_OKAY.
Referenced by exprgraphMoveNode(), SCIPexprgraphAddNode(), and SCIPexprgraphCreate().
|
static |
remove a variable from the variables arrays, assuming that its node will be removed or converted next
exprgraph | expression graph |
varidx | variable index |
Definition at line 11990 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraph::nvars, SCIP_CALL, SCIP_OKAY, SCIPhashmapRemove(), SCIPhashmapSetImage(), SCIP_ExprGraph::userdata, SCIP_ExprGraph::varbounds, SCIP_ExprGraph::varidxs, SCIP_ExprGraph::varnodes, and SCIP_ExprGraph::vars.
Referenced by SCIPexprgraphReleaseNode(), and SCIPexprgraphReplaceVarByLinearSum().
|
static |
moves a node in an expression graph to a different depth
New depth must be larger than children depth. Moves parent nodes to higher depth, if needed. Variable nodes cannot be moved.
exprgraph | expression graph |
node | node that shall be moved |
newdepth | new depth to which to move node |
Definition at line 12043 of file expr.c.
References SCIP_ExprGraph::blkmem, SCIP_ExprGraph::constnodes, SCIP_ExprGraph::constssize, SCIP_ExprGraph::constssorted, SCIP_ExprGraphNode::depth, SCIP_ExprGraph::depth, ensureBlockMemoryArraySize, exprgraphEnsureDepth(), SCIP_ExprGraph::nconsts, nnodes, SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, SCIP_ExprGraph::nodessize, NULL, SCIP_ExprGraphNode::pos, SCIP_CALL, SCIP_ERROR, SCIP_EXPR_CONST, SCIP_EXPR_VARIDX, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIPdebugMessage, and SCIPerrorMessage.
Referenced by SCIPexprgraphMoveNodeParents(), SCIPexprgraphReplaceVarByLinearSum(), and SCIPexprgraphSimplify().
|
static |
given a list of children, tries to find a common parent that represents a given operator with the same given data
exprgraph | expression graph |
nchildren | number of children |
children | children which parents to inspect |
op | operator |
opdata | operator data |
exprchildren | children of expression to consider when modifying (reordering) operator data, or NULL |
parent | buffer to store parent node if any is found, or NULL if none found |
Definition at line 12131 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::data, exprgraphNodeIsParent(), SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprGraphNode::nparents, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraphNode::parents, polynomialdataApplyChildmap(), polynomialdataSortMonomials(), SCIP_ExprData_Quadratic::quadelems, SCIP_ALLOC, SCIP_ERROR, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPerrorMessage, SCIPexprAreMonomialsEqual(), SCIPquadelemSort(), SCIPsortPtr(), SCIPsortPtrInt(), SCIPsortPtrPtrInt(), SCIPsortPtrPtrReal(), SCIPsortPtrPtrRealInt(), SCIPsortPtrReal(), SCIPsortPtrRealInt(), SCIP_ExprData_Quadratic::sorted, and TRUE.
Referenced by exprgraphAddExpr(), and SCIPexprgraphAddExprtreeSum().
|
static |
adds an expression into an expression graph
Enables corresponding nodes.
exprgraph | expression graph |
expr | expression to add |
vars | variables corresponding to VARIDX expressions |
params | parameter values |
exprnode | buffer to store expression graph node corresponding to root of this expression |
exprnodeisnew | buffer to indicate whether the node in *exprnode has been newly created for this expression (otherwise, expression was already in graph) |
Definition at line 12599 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_Expr::children, SCIP_Expr::data, exprgraphCreateNode(), exprgraphFindParentByOperator(), FALSE, SCIP_Expr::nchildren, NULL, SCIP_ExprGraph::nvars, SCIP_Expr::op, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_PARAM, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIPdebugMessage, SCIPexprgraphAddConst(), SCIPexprgraphAddNode(), SCIPexprgraphAddVars(), TRUE, and SCIP_ExprGraph::vars.
Referenced by SCIPexprgraphAddExprtreeSum().
|
static |
sets bounds in variable nodes to those stored in exprgraph's varbounds array
exprgraph | expression graph |
clearreverseprop | flag to set if we had reset bound tightenings from reverse propagation |
boundchanged | buffer to store whether a variables bound has changes, compared to those stored in nodes |
Definition at line 12731 of file expr.c.
References SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, FALSE, SCIP_Interval::inf, isLbBetter(), isUbBetter(), MAX, MIN, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::parents, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_CHILDTIGHTENED, SCIP_EXPRBOUNDSTATUS_VALID, SCIP_Real, SCIPdebugMessage, SCIP_Interval::sup, TRUE, SCIP_ExprGraph::varbounds, and SCIP_ExprGraph::varnodes.
Referenced by SCIPexprgraphCheckCurvature(), and SCIPexprgraphPropagateVarBounds().
void SCIPexprgraphCaptureNode | ( | SCIP_EXPRGRAPHNODE * | node | ) |
captures node, i.e., increases number of uses
node | expression graph node to capture |
Definition at line 12844 of file expr.c.
References SCIP_ExprGraphNode::nuses, and SCIPdebugMessage.
Referenced by exprgraphNodeRemoveParent(), reformReplaceNode(), SCIPcreateConsNonlinear2(), SCIPexprgraphAddExprtreeSum(), and SCIPexprgraphNodeSplitOffLinear().
SCIP_Bool SCIPexprgraphIsNodeEnabled | ( | SCIP_EXPRGRAPHNODE * | node | ) |
returns whether a node is currently enabled
node | expression graph node to enable |
Definition at line 12856 of file expr.c.
References SCIP_ExprGraphNode::enabled, and NULL.
Referenced by reformulate().
int SCIPexprgraphGetNodeNChildren | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets number of children of a node in an expression graph
node | expression graph node |
Definition at line 12866 of file expr.c.
References SCIP_ExprGraphNode::nchildren, and NULL.
Referenced by reformEnsureChildrenMinCurvature(), reformMonomial(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIP_DECL_NONLINCONSUPGD(), and splitOffLinearPart().
SCIP_EXPRGRAPHNODE** SCIPexprgraphGetNodeChildren | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets children of a node in an expression graph
node | expression graph node |
Definition at line 12876 of file expr.c.
References SCIP_ExprGraphNode::children, and NULL.
Referenced by reformEnsureChildrenMinCurvature(), reformMonomial(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
int SCIPexprgraphGetNodeNParents | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets number of parents of a node in an expression graph
node | expression graph node |
Definition at line 12886 of file expr.c.
References SCIP_ExprGraphNode::nparents, and NULL.
Referenced by reformMonomial(), reformReplaceNode(), and reformulate().
SCIP_EXPRGRAPHNODE** SCIPexprgraphGetNodeParents | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets parents of a node in an expression graph
node | expression graph node |
Definition at line 12896 of file expr.c.
References NULL, and SCIP_ExprGraphNode::parents.
Referenced by reformMonomial().
int SCIPexprgraphGetNodeDepth | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets depth of node in expression graph
node | expression graph node |
Definition at line 12906 of file expr.c.
References SCIP_ExprGraphNode::depth, and NULL.
Referenced by reformEnsureChildrenMinCurvature(), reformNode2Var(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
int SCIPexprgraphGetNodePosition | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets position of node in expression graph at its depth level
node | expression graph node |
Definition at line 12916 of file expr.c.
References NULL, and SCIP_ExprGraphNode::pos.
Referenced by reformEnsureChildrenMinCurvature(), reformNode2Var(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_EXPROP SCIPexprgraphGetNodeOperator | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets operator of a node in an expression graph
node | expression graph node |
Definition at line 12926 of file expr.c.
References NULL, and SCIP_ExprGraphNode::op.
Referenced by reformEnsureChildrenMinCurvature(), reformMonomial(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIP_DECL_NONLINCONSUPGD(), and SCIPexprgraphNodePolynomialAddMonomials().
int SCIPexprgraphGetNodeOperatorIndex | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives index belonging to a SCIP_EXPR_VARIDX or SCIP_EXPR_PARAM operand
node | expression graph node |
Definition at line 12936 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, SCIP_EXPR_PARAM, and SCIP_EXPR_VARIDX.
SCIP_Real SCIPexprgraphGetNodeOperatorReal | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives real belonging to a SCIP_EXPR_CONST operand
node | expression graph node |
Definition at line 12947 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_CONST.
void* SCIPexprgraphGetNodeVar | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node | ||
) |
gives variable belonging to a SCIP_EXPR_VARIDX expression
exprgraph | expression graph |
node | expression graph node |
Definition at line 12958 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::op, SCIP_EXPR_VARIDX, and SCIP_ExprGraph::vars.
Referenced by SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_Real SCIPexprgraphGetNodeRealPowerExponent | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives exponent belonging to a SCIP_EXPR_REALPOWER expression
node | expression graph node |
Definition at line 12973 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_REALPOWER.
Referenced by reformMonomial(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
int SCIPexprgraphGetNodeIntPowerExponent | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives exponent belonging to a SCIP_EXPR_INTPOWER expression
node | expression graph node |
Definition at line 12984 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_INTPOWER.
Referenced by reformMonomial(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_Real SCIPexprgraphGetNodeSignPowerExponent | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives exponent belonging to a SCIP_EXPR_SIGNPOWER expression
node | expression graph node |
Definition at line 12995 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_SIGNPOWER.
Referenced by reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_Real* SCIPexprgraphGetNodeLinearCoefs | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives linear coefficients belonging to a SCIP_EXPR_LINEAR expression
node | expression graph node |
Definition at line 13006 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, SCIP_EXPR_LINEAR, and SCIP_Real.
Referenced by SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_Real SCIPexprgraphGetNodeLinearConstant | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives constant belonging to a SCIP_EXPR_LINEAR expression
node | expression graph node |
Definition at line 13017 of file expr.c.
References SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, SCIP_EXPR_LINEAR, and SCIP_Real.
Referenced by SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_Real SCIPexprgraphGetNodeQuadraticConstant | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives constant belonging to a SCIP_EXPR_QUADRATIC expression
node | expression graph node |
Definition at line 13029 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_QUADRATIC.
Referenced by SCIP_DECL_NONLINCONSUPGD().
SCIP_Real* SCIPexprgraphGetNodeQuadraticLinearCoefs | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives linear coefficients belonging to a SCIP_EXPR_QUADRATIC expression, or NULL if all coefficients are 0.0
node | expression graph node |
Definition at line 13041 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_QUADRATIC.
Referenced by SCIP_DECL_NONLINCONSUPGD().
SCIP_QUADELEM* SCIPexprgraphGetNodeQuadraticQuadElements | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression
node | expression graph node |
Definition at line 13053 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_QUADRATIC.
Referenced by SCIP_DECL_NONLINCONSUPGD().
int SCIPexprgraphGetNodeQuadraticNQuadElements | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives number of quadratic elements belonging to a SCIP_EXPR_QUADRATIC expression
node | expression graph node |
Definition at line 13065 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_QUADRATIC.
Referenced by SCIP_DECL_NONLINCONSUPGD().
SCIP_EXPRDATA_MONOMIAL** SCIPexprgraphGetNodePolynomialMonomials | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives the monomials belonging to a SCIP_EXPR_POLYNOMIAL expression
node | expression graph node |
Definition at line 13077 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_POLYNOMIAL.
Referenced by reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
int SCIPexprgraphGetNodePolynomialNMonomials | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives the number of monomials belonging to a SCIP_EXPR_POLYNOMIAL expression
node | expression graph node |
Definition at line 13089 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_POLYNOMIAL.
Referenced by reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_Real SCIPexprgraphGetNodePolynomialConstant | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives the constant belonging to a SCIP_EXPR_POLYNOMIAL expression
node | expression graph node |
Definition at line 13101 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_POLYNOMIAL.
Referenced by reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_RETCODE SCIPexprgraphGetNodePolynomialMonomialCurvature | ( | SCIP_EXPRGRAPHNODE * | node, |
int | monomialidx, | ||
SCIP_Real | infinity, | ||
SCIP_EXPRCURV * | curv | ||
) |
gives the curvature of a single monomial belonging to a SCIP_EXPR_POLYNOMIAL expression
Assumes that curvature of children and bounds of children and node itself are valid.
node | expression graph node |
monomialidx | index of monomial |
infinity | value for infinity in interval arithmetics |
curv | buffer to store monomial curvature |
Definition at line 13116 of file expr.c.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, SCIP_ExprData_Monomial::childidxs, SCIP_ExprGraphNode::children, SCIP_ExprData_Monomial::coef, SCIP_ExprGraphNode::curv, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, SCIP_ExprData_Monomial::exponents, SCIP_ExprData_Monomial::nfactors, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, SCIP_ALLOC, SCIP_EXPR_POLYNOMIAL, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_VALID, SCIP_EXPRCURV_LINEAR, SCIP_EXPRESSION_MAXCHILDEST, SCIP_OKAY, SCIPexprcurvMonomial(), SCIPexprcurvMultiply(), and SCIPintervalIsEmpty().
Referenced by reformulate().
SCIP_USEREXPRDATA* SCIPexprgraphGetNodeUserData | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives the user data belonging to a SCIP_EXPR_USER expression
Definition at line 13194 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_USER.
SCIP_Bool SCIPexprgraphHasNodeUserEstimator | ( | SCIP_EXPRGRAPHNODE * | node | ) |
indicates whether a user expression has the estimator callback defined
Definition at line 13206 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraphNode::op, and SCIP_EXPR_USER.
SCIP_INTERVAL SCIPexprgraphGetNodeBounds | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets bounds of a node in an expression graph
node | expression graph node |
Definition at line 13218 of file expr.c.
References SCIP_ExprGraphNode::bounds, and NULL.
Referenced by propagateBounds(), propagateBoundsCons(), propagateConstraintSides(), reformEnsureChildrenMinCurvature(), reformMonomial(), reformNode2Var(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_Real SCIPexprgraphGetNodeVal | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets value of expression associated to node from last evaluation call
node | expression graph node |
Definition at line 13228 of file expr.c.
References NULL, and SCIP_ExprGraphNode::value.
Referenced by computeViolation(), reformMonomial(), reformNode2Var(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIP_DECL_NONLINCONSUPGD(), and SCIPexprgraphSimplify().
SCIP_EXPRCURV SCIPexprgraphGetNodeCurvature | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gets curvature of expression associated to node from last curvature check call
node | expression graph node |
Definition at line 13238 of file expr.c.
References SCIP_ExprGraphNode::curv, and NULL.
Referenced by reformEnsureChildrenMinCurvature(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIP_DECL_NONLINCONSUPGD().
SCIP_RETCODE SCIPexprgraphCreateNode | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPHNODE ** | node, | ||
SCIP_EXPROP | op, | ||
... | |||
) |
creates an expression graph node
blkmem | block memory |
node | buffer to store expression graph node |
op | operator type of expression |
Definition at line 13248 of file expr.c.
References exprgraphCreateNode(), NULL, SCIP_CALL, SCIP_ERROR, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LAST, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, and SCIPerrorMessage.
Referenced by reformMonomial(), and reformulate().
SCIP_RETCODE SCIPexprgraphCreateNodeLinear | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPHNODE ** | node, | ||
int | ncoefs, | ||
SCIP_Real * | coefs, | ||
SCIP_Real | constant | ||
) |
creates an expression graph node for a linear expression
blkmem | block memory |
node | buffer to store expression graph node |
ncoefs | number of coefficients |
coefs | coefficients of linear expression |
constant | constant of linear expression |
Definition at line 13331 of file expr.c.
References BMSallocBlockMemoryArray, BMScopyMemoryArray, exprgraphCreateNode(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_LINEAR, SCIP_OKAY, and SCIP_Real.
Referenced by reformulate(), and SCIP_DECL_EXPRGRAPHNODEREFORM().
SCIP_RETCODE SCIPexprgraphCreateNodeQuadratic | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPHNODE ** | node, | ||
int | nchildren, | ||
SCIP_Real * | lincoefs, | ||
int | nquadelems, | ||
SCIP_QUADELEM * | quadelems, | ||
SCIP_Real | constant | ||
) |
creates an expression graph node for a quadratic expression
blkmem | block memory |
node | buffer to store expression graph node |
nchildren | number of children |
lincoefs | linear coefficients for children, or NULL |
nquadelems | number of quadratic elements |
quadelems | quadratic elements, or NULL if nquadelems == 0 |
constant | constant |
Definition at line 13357 of file expr.c.
References exprgraphCreateNode(), NULL, quadraticdataCreate(), SCIP_CALL, SCIP_EXPR_QUADRATIC, and SCIP_OKAY.
Referenced by reformulate().
SCIP_RETCODE SCIPexprgraphCreateNodePolynomial | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPHNODE ** | node, | ||
int | nmonomials, | ||
SCIP_EXPRDATA_MONOMIAL ** | monomials, | ||
SCIP_Real | constant, | ||
SCIP_Bool | copymonomials | ||
) |
creates an expression graph node for a polynomial expression
blkmem | block memory |
node | buffer to store expression graph node |
nmonomials | number of monomials |
monomials | monomials |
constant | constant of polynomial |
copymonomials | whether to copy monomials or to assume ownership |
Definition at line 13383 of file expr.c.
References exprgraphCreateNode(), NULL, polynomialdataCreate(), SCIP_CALL, SCIP_EXPR_POLYNOMIAL, and SCIP_OKAY.
Referenced by reformulate().
SCIP_RETCODE SCIPexprgraphNodePolynomialAddMonomials | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPHNODE * | node, | ||
int | nmonomials, | ||
SCIP_EXPRDATA_MONOMIAL ** | monomials, | ||
SCIP_Bool | copymonomials | ||
) |
adds monomials to an expression graph node that is a polynomial expression
blkmem | block memory |
node | store expression graph node with polynomial operator |
nmonomials | number of monomials |
monomials | monomials |
copymonomials | whether to copy monomials or to assume ownership |
Definition at line 13408 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, polynomialdataAddMonomials(), SCIP_CALL, SCIP_EXPR_POLYNOMIAL, SCIP_OKAY, and SCIPexprgraphGetNodeOperator().
SCIP_RETCODE SCIPexprgraphCreateNodeUser | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPHNODE ** | node, | ||
SCIP_USEREXPRDATA * | data, | ||
SCIP_EXPRINTCAPABILITY | evalcapability, | ||
SCIP_DECL_USEREXPREVAL((*eval)) | , | ||
SCIP_DECL_USEREXPRINTEVAL((*inteval)) | , | ||
SCIP_DECL_USEREXPRCURV((*curv)) | , | ||
SCIP_DECL_USEREXPRPROP((*prop)) | , | ||
SCIP_DECL_USEREXPRESTIMATE((*estimate)) | , | ||
SCIP_DECL_USEREXPRCOPYDATA((*copydata)) | , | ||
SCIP_DECL_USEREXPRFREEDATA((*freedata)) | , | ||
SCIP_DECL_USEREXPRPRINT((*print)) | |||
) |
creates an expression graph node for a user expression
blkmem | block memory |
node | buffer to store expression graph node |
data | user data for expression, node assumes ownership |
evalcapability | evaluation capability |
Definition at line 13427 of file expr.c.
References BMSallocBlockMemory, eval(), SCIP_ExprData_User::evalcapability, exprgraphCreateNode(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_USER, SCIP_EXPRINTCAPABILITY_FUNCVALUE, SCIP_EXPRINTCAPABILITY_INTFUNCVALUE, SCIP_OKAY, and SCIP_ExprData_User::userdata.
SCIP_RETCODE SCIPexprgraphNodeSplitOffLinear | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE ** | node, | ||
int | linvarssize, | ||
int * | nlinvars, | ||
void ** | linvars, | ||
SCIP_Real * | lincoefs, | ||
SCIP_Real * | constant | ||
) |
given a node of an expression graph, splitup a linear part which variables are not used somewhere else in the same expression
E.g., if the expression is 1 + x + y + y^2, one gets 1 + x and the node remains at y + y^2. If the node is a linear expression, it may be freed. If it is not linear, the node may change, i.e., the remaining nonlinear part may be stored in a new node. It is assumed that the user had captured the node. It is assumed that the expression graph has been simplified before.
exprgraph | expression graph |
node | expression graph node where to splitup linear part |
linvarssize | length of linvars and lincoefs arrays |
nlinvars | buffer to store length of linear term that have been splitup |
linvars | buffer to store variables of linear part |
lincoefs | buffer to store coefficients of linear part |
constant | buffer to store constant part |
Definition at line 13481 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSclearMemoryArray, BMSfreeBlockMemoryArray, BMSreallocBlockMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_ExprGraphNode::children, SCIP_ExprData_Monomial::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, SCIP_ExprData_Monomial::exponents, exprgraphCreateNode(), exprgraphNodeGetVarsUsage(), exprgraphNodeRemoveParent(), exprgraphNodeRemovePolynomialNullChildren(), FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_ExprGraphNode::nchildren, SCIP_ExprGraph::needvarboundprop, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::op, polynomialdataMergeMonomials(), SCIP_ExprData_Quadratic::quadelems, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_ABS, SCIP_EXPR_CONST, SCIP_EXPR_COS, SCIP_EXPR_DIV, SCIP_EXPR_EXP, SCIP_EXPR_INTPOWER, SCIP_EXPR_LINEAR, SCIP_EXPR_LOG, SCIP_EXPR_MAX, SCIP_EXPR_MIN, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_PRODUCT, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SIGN, SCIP_EXPR_SIGNPOWER, SCIP_EXPR_SIN, SCIP_EXPR_SQRT, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_EXPR_TAN, SCIP_EXPR_USER, SCIP_EXPR_VARIDX, SCIP_EXPRBOUNDSTATUS_CHILDTIGHTENED, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIP_REAL_MAX, SCIPdebugMessage, SCIPexprgraphAddNode(), SCIPexprgraphCaptureNode(), SCIPexprgraphReleaseNode(), SCIPexpropGetName(), SCIPintervalSetEntire(), SCIP_ExprData_Quadratic::sorted, SCIP_ExprData_Polynomial::sorted, TRUE, and SCIP_ExprGraph::vars.
Referenced by splitOffLinearPart().
SCIP_RETCODE SCIPexprgraphMoveNodeParents | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE ** | srcnode, | ||
SCIP_EXPRGRAPHNODE * | targetnode | ||
) |
moves parents from a one node to another node
In other words, replaces the child srcnode by targetnode in all parents of srcnode. srcnode may be freed, if not captured. It is assumed that targetnode represents the same expression as srcnode.
exprgraph | expression graph |
srcnode | node which parents to move |
targetnode | node where to move parents to |
Definition at line 14293 of file expr.c.
References SCIP_ExprGraphNode::depth, exprgraphMoveNode(), exprgraphNodeReplaceChild(), NULL, SCIP_CALL, and SCIP_OKAY.
Referenced by reformReplaceNode(), SCIPexprgraphReplaceVarByLinearSum(), and SCIPexprgraphSimplify().
SCIP_RETCODE SCIPexprgraphReleaseNode | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE ** | node | ||
) |
releases node, i.e., decreases number of uses
node is freed if no parents and no other uses. Children are recursively released if they have no other parents. Nodes that are removed are also freed. If node correspond to a variable, then the variable is removed from the expression graph; similarly for constants.
exprgraph | expression graph |
node | expression graph node to release |
Definition at line 14325 of file expr.c.
References SCIP_ExprGraph::blkmem, SCIP_ExprGraph::constnodes, SCIP_ExprGraph::constssorted, SCIP_ExprGraph::depth, exprgraphFindConstNodePos(), exprgraphNodeRemoveParent(), exprgraphRemoveVar(), SCIP_ExprGraph::nconsts, SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, NULL, SCIP_ExprGraphNode::pos, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIPdebugMessage, SCIPexprgraphFreeNode(), and SCIPexpropGetName().
Referenced by exprgraphNodeRemoveParent(), reformReplaceNode(), SCIP_DECL_CONSDEACTIVE(), and SCIPexprgraphNodeSplitOffLinear().
void SCIPexprgraphFreeNode | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPHNODE ** | node | ||
) |
frees a node of an expression graph
blkmem | block memory |
node | pointer to expression graph node that should be freed |
Definition at line 14415 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, and NULL.
Referenced by SCIPexprgraphReleaseNode().
void SCIPexprgraphEnableNode | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node | ||
) |
enables a node and recursively all its children in an expression graph
exprgraph | expression graph |
node | expression graph node to enable |
Definition at line 14440 of file expr.c.
References SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, SCIP_ExprGraph::needvarboundprop, NULL, SCIP_ExprGraphNode::pos, SCIP_REAL_MAX, SCIPdebugMessage, SCIPexprgraphEnableNode(), SCIPintervalSetEntire(), and TRUE.
Referenced by SCIP_DECL_CONSENABLE(), and SCIPexprgraphEnableNode().
void SCIPexprgraphDisableNode | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node | ||
) |
disables a node and recursively all children which have no enabled parents in an expression graph
exprgraph | expression graph |
node | expression graph node to enable |
Definition at line 14467 of file expr.c.
References SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, FALSE, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::nuses, SCIP_ExprGraphNode::parents, SCIP_ExprGraphNode::pos, SCIPdebugMessage, SCIPexprgraphDisableNode(), and TRUE.
Referenced by SCIP_DECL_CONSDISABLE(), and SCIPexprgraphDisableNode().
SCIP_Bool SCIPexprgraphHasNodeSibling | ( | SCIP_EXPRGRAPHNODE * | node | ) |
returns whether the node has siblings in the expression graph
node | expression graph node |
Definition at line 14505 of file expr.c.
References FALSE, SCIP_ExprGraphNode::nchildren, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::parents, and TRUE.
Referenced by reformulate(), and SCIP_DECL_EXPRGRAPHNODEREFORM().
SCIP_Bool SCIPexprgraphAreAllNodeChildrenVars | ( | SCIP_EXPRGRAPHNODE * | node | ) |
returns whether all children of an expression graph node are variable nodes
Returns TRUE for nodes without children.
node | expression graph node |
Definition at line 14524 of file expr.c.
References SCIP_ExprGraphNode::children, FALSE, SCIP_ExprGraphNode::nchildren, NULL, SCIP_ExprGraphNode::op, SCIP_EXPR_VARIDX, and TRUE.
Referenced by SCIP_DECL_NONLINCONSUPGD().
SCIP_Bool SCIPexprgraphHasNodeNonlinearAncestor | ( | SCIP_EXPRGRAPHNODE * | node | ) |
returns whether the node has an ancestor which has a nonlinear expression operand
node | expression graph node |
Definition at line 14540 of file expr.c.
References SCIP_ExprGraphNode::depth, FALSE, SCIP_ExprGraphNode::nparents, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::parents, SCIP_EXPR_CONST, SCIP_EXPR_LINEAR, SCIP_EXPR_MINUS, SCIP_EXPR_PARAM, SCIP_EXPR_PLUS, SCIP_EXPR_SUM, SCIP_EXPR_VARIDX, SCIPexprgraphHasNodeNonlinearAncestor(), and TRUE.
Referenced by reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIPexprgraphHasNodeNonlinearAncestor().
void SCIPexprgraphPrintNode | ( | SCIP_EXPRGRAPHNODE * | node, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
FILE * | file | ||
) |
prints an expression graph node
node | expression graph node |
messagehdlr | message handler |
file | file to print to, or NULL for stdout |
Definition at line 14577 of file expr.c.
References exprgraphPrintNodeExpression(), FALSE, and NULL.
Referenced by reformulate().
void SCIPexprgraphTightenNodeBounds | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node, | ||
SCIP_INTERVAL | nodebounds, | ||
SCIP_Real | minstrength, | ||
SCIP_Real | infinity, | ||
SCIP_Bool * | cutoff | ||
) |
tightens the bounds in a node of the graph
Preparation for reverse propagation. Sets bound status to SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTRECENT if tightening is strong enough and not cutoff.
exprgraph | expression graph |
node | node in expression graph with no parents |
nodebounds | new bounds for node |
minstrength | minimal required relative bound strengthening in a node to trigger a propagation into children nodes (set to negative value if propagation should always be triggered) |
infinity | value for infinity in interval arithmetics |
cutoff | buffer to store whether a node's bounds were propagated to an empty interval |
Definition at line 14593 of file expr.c.
References SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, FALSE, SCIP_Interval::inf, isLbBetter(), isUbBetter(), NULL, SCIP_ExprGraphNode::pos, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENT, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTFORCE, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTRECENT, SCIPdebugMessage, SCIPdebugPrintf, SCIPintervalIntersect(), SCIPintervalIsEmpty(), SCIP_Interval::sup, and TRUE.
Referenced by exprgraphNodePropagateBounds(), propagateBoundsCons(), propagateConstraintSides(), and reformNode2Var().
SCIP_RETCODE SCIPexprgraphUpdateNodeBoundsCurvature | ( | SCIP_EXPRGRAPHNODE * | node, |
SCIP_Real | infinity, | ||
SCIP_Real | minstrength, | ||
SCIP_Bool | clearreverseprop | ||
) |
ensures that bounds and curvature information in a node is uptodate
Assumes that bounds and curvature in children are uptodate.
node | expression graph node |
infinity | value for infinity in interval arithmetics |
minstrength | minimal required relative bound strengthening to trigger a bound recalculation in parent nodes |
clearreverseprop | whether to reset bound tightenings from reverse propagation |
Definition at line 14655 of file expr.c.
References BMSallocMemoryArray, BMSfreeMemoryArray, SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::curv, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, SCIP_ExprGraphNode::enabled, SCIP_Interval::inf, isLbBetter(), isUbBetter(), SCIP_ExprGraphNode::nchildren, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::parents, SCIP_ExprGraphNode::pos, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_PARAM, SCIP_EXPR_VARIDX, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_CHILDTIGHTENED, SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENT, SCIP_EXPRBOUNDSTATUS_VALID, SCIP_EXPRCURV_LINEAR, SCIP_EXPRESSION_MAXCHILDEST, SCIP_OKAY, SCIPdebugMessage, SCIPexpropGetName(), SCIPintervalIntersect(), SCIPintervalIsEmpty(), and SCIP_Interval::sup.
Referenced by reformEnsureChildrenMinCurvature(), reformMonomial(), reformulate(), and SCIPexprgraphCheckCurvature().
int SCIPexprgraphGetDepth | ( | SCIP_EXPRGRAPH * | exprgraph | ) |
get current maximal depth of expression graph
exprgraph | expression graph |
Definition at line 14805 of file expr.c.
References SCIP_ExprGraph::depth, and NULL.
Referenced by reformulate().
int* SCIPexprgraphGetNNodes | ( | SCIP_EXPRGRAPH * | exprgraph | ) |
gets array with number of nodes at each depth of expression graph
exprgraph | expression graph |
Definition at line 14815 of file expr.c.
References SCIP_ExprGraph::nnodes, and NULL.
Referenced by reformulate().
SCIP_EXPRGRAPHNODE*** SCIPexprgraphGetNodes | ( | SCIP_EXPRGRAPH * | exprgraph | ) |
gets nodes of expression graph, one array per depth
exprgraph | expression graph |
Definition at line 14825 of file expr.c.
References SCIP_ExprGraph::nodes, and NULL.
Referenced by reformulate().
int SCIPexprgraphGetNVars | ( | SCIP_EXPRGRAPH * | exprgraph | ) |
gets number of variables in expression graph
exprgraph | pointer to expression graph that should be freed |
Definition at line 14835 of file expr.c.
References NULL, and SCIP_ExprGraph::nvars.
Referenced by computeViolations(), presolveUpgrade(), propagateBounds(), propagateConstraintSides(), reformulate(), removeFixedNonlinearVariables(), SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSFREE(), SCIP_DECL_CONSGETNVARS(), and SCIP_DECL_CONSGETVARS().
void** SCIPexprgraphGetVars | ( | SCIP_EXPRGRAPH * | exprgraph | ) |
gets array of variables in expression graph
exprgraph | pointer to expression graph that should be freed |
Definition at line 14845 of file expr.c.
References NULL, and SCIP_ExprGraph::vars.
Referenced by computeViolations(), presolveUpgrade(), propagateBounds(), propagateConstraintSides(), reformulate(), removeFixedNonlinearVariables(), SCIP_DECL_CONSCHECK(), and SCIP_DECL_CONSGETVARS().
SCIP_EXPRGRAPHNODE** SCIPexprgraphGetVarNodes | ( | SCIP_EXPRGRAPH * | exprgraph | ) |
gets array of expression graph nodes corresponding to variables
exprgraph | pointer to expression graph that should be freed |
Definition at line 14855 of file expr.c.
References NULL, and SCIP_ExprGraph::varnodes.
Referenced by propagateBounds(), and propagateConstraintSides().
void SCIPexprgraphSetVarNodeValue | ( | SCIP_EXPRGRAPHNODE * | varnode, |
SCIP_Real | value | ||
) |
sets value for a single variable given as expression graph node
varnode | expression graph node corresponding to variable |
value | new value for variable |
Definition at line 14865 of file expr.c.
References NULL, SCIP_ExprGraphNode::op, SCIP_EXPR_VARIDX, and SCIP_ExprGraphNode::value.
Referenced by reformMonomial(), reformNode2Var(), reformulate(), and SCIP_DECL_EXPRGRAPHNODEREFORM().
void SCIPexprgraphSetVarsBounds | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_INTERVAL * | varbounds | ||
) |
sets bounds for variables
exprgraph | expression graph |
varbounds | new bounds for variables |
Definition at line 14877 of file expr.c.
References BMScopyMemoryArray, NULL, SCIP_ExprGraph::nvars, and SCIP_ExprGraph::varbounds.
void SCIPexprgraphSetVarBounds | ( | SCIP_EXPRGRAPH * | exprgraph, |
void * | var, | ||
SCIP_INTERVAL | varbounds | ||
) |
sets bounds for a single variable
exprgraph | expression graph |
var | variable |
varbounds | new bounds of variable |
Definition at line 14889 of file expr.c.
References NULL, SCIPhashmapExists(), SCIPhashmapGetImage(), SCIP_ExprGraph::varbounds, SCIP_ExprGraph::varidxs, and SCIP_ExprGraph::vars.
void SCIPexprgraphSetVarNodeBounds | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | varnode, | ||
SCIP_INTERVAL | varbounds | ||
) |
sets bounds for a single variable given as expression graph node
exprgraph | expression graph |
varnode | expression graph node corresponding to variable |
varbounds | new bounds of variable |
Definition at line 14909 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_ExprGraph::varbounds, and SCIP_ExprGraph::varnodes.
Referenced by SCIP_DECL_EXPRGRAPHVARADDED().
void SCIPexprgraphSetVarNodeLb | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | varnode, | ||
SCIP_Real | lb | ||
) |
sets lower bound for a single variable given as expression graph node
exprgraph | expression graph |
varnode | expression graph node corresponding to variable |
lb | new lower bound for variable |
Definition at line 14929 of file expr.c.
References SCIP_ExprGraphNode::data, SCIP_Interval::inf, NULL, SCIP_ExprGraph::varbounds, and SCIP_ExprGraph::varnodes.
Referenced by SCIP_DECL_EVENTEXEC().
void SCIPexprgraphSetVarNodeUb | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | varnode, | ||
SCIP_Real | ub | ||
) |
sets upper bound for a single variable given as expression graph node
exprgraph | expression graph |
varnode | expression graph node corresponding to variable |
ub | new upper bound for variable |
Definition at line 14949 of file expr.c.
References SCIP_ExprGraphNode::data, NULL, SCIP_Interval::sup, SCIP_ExprGraph::varbounds, and SCIP_ExprGraph::varnodes.
Referenced by SCIP_DECL_EVENTEXEC().
SCIP_INTERVAL* SCIPexprgraphGetVarsBounds | ( | SCIP_EXPRGRAPH * | exprgraph | ) |
gets bounds that are stored for all variables
exprgraph | expression graph |
Definition at line 14969 of file expr.c.
References SCIP_ExprGraph::varbounds.
SCIP_RETCODE SCIPexprgraphCreate | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRGRAPH ** | exprgraph, | ||
int | varssizeinit, | ||
int | depthinit, | ||
SCIP_DECL_EXPRGRAPHVARADDED((*exprgraphvaradded)) | , | ||
SCIP_DECL_EXPRGRAPHVARREMOVE((*exprgraphvarremove)) | , | ||
SCIP_DECL_EXPRGRAPHVARCHGIDX((*exprgraphvarchgidx)) | , | ||
void * | userdata | ||
) |
creates an empty expression graph
blkmem | block memory |
exprgraph | buffer to store pointer to expression graph |
varssizeinit | minimal initial size for variables array, or -1 to choose automatically |
depthinit | minimal initial depth of expression graph, or -1 to choose automatically |
userdata | user data to pass to callback functions |
Definition at line 14977 of file expr.c.
References BMSallocBlockMemory, BMSclearMemory, ensureBlockMemoryArraySize3, exprgraphEnsureDepth(), MAX, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPhashmapCreate(), and TRUE.
Referenced by SCIPincludeConshdlrBivariate(), and SCIPincludeConshdlrNonlinear().
SCIP_RETCODE SCIPexprgraphFree | ( | SCIP_EXPRGRAPH ** | exprgraph | ) |
frees an expression graph
exprgraph | pointer to expression graph that should be freed |
Definition at line 15016 of file expr.c.
References BMSfreeBlockMemory, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, NULL, SCIP_OKAY, and SCIPhashmapFree().
Referenced by SCIP_DECL_CONSFREE().
SCIP_RETCODE SCIPexprgraphAddNode | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node, | ||
int | mindepth, | ||
int | nchildren, | ||
SCIP_EXPRGRAPHNODE ** | children | ||
) |
adds an expression graph node to an expression graph
Expression graph assumes ownership of node. Children are notified about new parent. Depth will be chosen to be the maximum of mindepth and the depth of all children plus one.
exprgraph | expression graph |
node | expression graph node to add |
mindepth | minimal depth in expression graph where to add node, e.g., 0 or smaller to choose automatically |
nchildren | number of children |
children | children nodes, or NULL if no children |
Definition at line 15065 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSduplicateBlockMemoryArray, SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, SCIP_ExprGraph::depth, ensureBlockMemoryArraySize, exprgraphEnsureDepth(), exprgraphNodeAddParent(), exprgraphNodeEval(), MAX, SCIP_ExprGraphNode::nchildren, SCIP_ExprGraph::needvarboundprop, SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, SCIP_ExprGraph::nodessize, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_VARIDX, SCIP_EXPRBOUNDSTATUS_CHILDTIGHTENED, SCIP_EXPRBOUNDSTATUS_VALID, SCIP_INVALID, SCIP_OKAY, SCIP_REAL_MAX, SCIPintervalSet(), SCIPintervalSetEntire(), TRUE, and SCIP_ExprGraphNode::value.
Referenced by exprgraphAddExpr(), reformMonomial(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), SCIPexprgraphAddConst(), SCIPexprgraphAddExprtreeSum(), SCIPexprgraphAddVars(), and SCIPexprgraphNodeSplitOffLinear().
SCIP_RETCODE SCIPexprgraphAddVars | ( | SCIP_EXPRGRAPH * | exprgraph, |
int | nvars, | ||
void ** | vars, | ||
SCIP_EXPRGRAPHNODE ** | varnodes | ||
) |
adds variables to an expression graph, if not existing yet
Also already existing nodes are enabled.
exprgraph | expression graph |
nvars | number of variables to add |
vars | variables to add |
varnodes | array to store nodes corresponding to variables, or NULL if not of interest |
Definition at line 15149 of file expr.c.
References SCIP_ExprGraph::blkmem, SCIP_ExprGraphNode::depth, SCIP_ExprGraph::depth, SCIP_ExprGraphNode::enabled, ensureBlockMemoryArraySize, ensureBlockMemoryArraySize3, exprgraphCreateNode(), SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, SCIP_ExprGraph::nodessize, NULL, SCIP_ExprGraph::nvars, SCIP_CALL, SCIP_EXPR_VARIDX, SCIP_OKAY, SCIP_REAL_MAX, SCIPdebugMessage, SCIPexprgraphAddNode(), SCIPexprgraphFindVarNode(), SCIPhashmapExists(), SCIPhashmapInsert(), SCIPintervalSetEntire(), TRUE, SCIP_ExprGraph::userdata, SCIP_ExprGraph::varbounds, SCIP_ExprGraph::varidxs, SCIP_ExprGraph::varnodes, SCIP_ExprGraph::vars, and SCIP_ExprGraph::varssize.
Referenced by exprgraphAddExpr(), reformMonomial(), reformNode2Var(), reformulate(), SCIP_DECL_EXPRGRAPHNODEREFORM(), and SCIPexprgraphReplaceVarByLinearSum().
SCIP_RETCODE SCIPexprgraphAddConst | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_Real | constant, | ||
SCIP_EXPRGRAPHNODE ** | constnode | ||
) |
adds a constant to an expression graph, if not existing yet
Also already existing nodes are enabled.
exprgraph | expression graph |
constant | constant to add |
constnode | buffer to store pointer to expression graph node corresponding to constant |
Definition at line 15222 of file expr.c.
References SCIP_ExprGraph::blkmem, SCIP_ExprGraph::constnodes, SCIP_ExprGraph::constssize, SCIP_ExprGraph::constssorted, SCIP_ExprGraphNode::depth, ensureBlockMemoryArraySize, exprgraphCreateNode(), SCIP_ExprGraph::nconsts, SCIP_ExprGraph::nnodes, NULL, SCIP_CALL, SCIP_EXPR_CONST, SCIP_OKAY, SCIPdebugMessage, SCIPexprgraphAddNode(), SCIPexprgraphFindConstNode(), and TRUE.
Referenced by exprgraphAddExpr().
SCIP_RETCODE SCIPexprgraphAddExprtreeSum | ( | SCIP_EXPRGRAPH * | exprgraph, |
int | nexprtrees, | ||
SCIP_EXPRTREE ** | exprtrees, | ||
SCIP_Real * | coefs, | ||
SCIP_EXPRGRAPHNODE ** | rootnode, | ||
SCIP_Bool * | rootnodeisnew | ||
) |
adds sum of expression trees into expression graph
node will also be captured.
exprgraph | expression graph |
nexprtrees | number of expression trees to add |
exprtrees | expression trees that should be added |
coefs | coefficients of expression trees, or NULL if all 1.0 |
rootnode | buffer to store expression graph node corresponding to root of expression tree |
rootnodeisnew | buffer to indicate whether the node in *rootnode has been newly created for this expression tree (otherwise, expression tree was already in graph) |
Definition at line 15269 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMScopyMemoryArray, BMSfreeBlockMemoryArray, SCIP_ExprGraphNode::depth, exprgraphAddExpr(), exprgraphCreateNode(), exprgraphFindParentByOperator(), FALSE, NULL, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_LINEAR, SCIP_EXPR_MINUS, SCIP_EXPR_PLUS, SCIP_EXPR_SUM, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPexprgraphAddNode(), SCIPexprgraphCaptureNode(), and TRUE.
Referenced by SCIP_DECL_CONSACTIVE().
SCIP_RETCODE SCIPexprgraphReplaceVarByLinearSum | ( | SCIP_EXPRGRAPH * | exprgraph, |
void * | var, | ||
int | ncoefs, | ||
SCIP_Real * | coefs, | ||
void ** | vars, | ||
SCIP_Real | constant | ||
) |
replaces variable in expression graph by a linear sum of variables
Variables will be added if not in the graph yet.
exprgraph | expression graph |
var | variable to replace |
ncoefs | number of coefficients in linear term |
coefs | coefficients in linear term, or NULL if ncoefs == 0 |
vars | variables in linear term |
constant | constant offset |
Definition at line 15409 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMScopyMemoryArray, SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::boundstatus, SCIP_ExprGraphNode::children, SCIP_ExprGraph::constnodes, SCIP_ExprGraph::constssize, SCIP_ExprGraph::constssorted, SCIP_ExprGraphNode::data, ensureBlockMemoryArraySize, ensureBlockMemoryArraySize3, exprgraphMoveNode(), exprgraphNodeAddParent(), exprgraphRemoveVar(), FALSE, SCIP_ExprGraphNode::nchildren, SCIP_ExprGraph::nconsts, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::nuses, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::parents, SCIP_ALLOC, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_LINEAR, SCIP_EXPR_SUM, SCIP_EXPRBOUNDSTATUS_CHILDRELAXED, SCIP_EXPRBOUNDSTATUS_VALID, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIP_REAL_MAX, SCIPdebugMessage, SCIPexprgraphAddVars(), SCIPexprgraphFindConstNode(), SCIPexprgraphFindVarNode(), SCIPexprgraphMoveNodeParents(), SCIPhashmapExists(), SCIPhashmapGetImage(), SCIPhashmapInsert(), SCIPintervalSet(), SCIPintervalSetEntire(), SCIP_ExprGraphNode::simplified, SCIP_ExprGraph::userdata, SCIP_ExprGraphNode::value, SCIP_ExprGraph::varbounds, SCIP_ExprGraph::varidxs, SCIP_ExprGraph::varnodes, SCIP_ExprGraph::vars, and SCIP_ExprGraph::varssize.
Referenced by removeFixedNonlinearVariables().
SCIP_Bool SCIPexprgraphFindVarNode | ( | SCIP_EXPRGRAPH * | exprgraph, |
void * | var, | ||
SCIP_EXPRGRAPHNODE ** | varnode | ||
) |
finds expression graph node corresponding to a variable
exprgraph | expression graph |
var | variable to search for |
varnode | buffer to store node corresponding to variable, if found, or NULL if not found |
Definition at line 15581 of file expr.c.
References FALSE, NULL, SCIP_EXPR_VARIDX, SCIPhashmapExists(), SCIPhashmapGetImage(), TRUE, SCIP_ExprGraph::varidxs, and SCIP_ExprGraph::varnodes.
Referenced by SCIPexprgraphAddVars(), and SCIPexprgraphReplaceVarByLinearSum().
SCIP_Bool SCIPexprgraphFindConstNode | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_Real | constant, | ||
SCIP_EXPRGRAPHNODE ** | constnode | ||
) |
finds expression graph node corresponding to a constant
exprgraph | expression graph |
constant | constant to search for |
constnode | buffer to store node corresponding to constant, if found, or NULL if not found |
Definition at line 15610 of file expr.c.
References SCIP_ExprGraph::constnodes, SCIP_ExprGraph::constssorted, SCIP_ExprGraphNode::data, exprgraphSortConstNodes(), FALSE, SCIP_ExprGraph::nconsts, NULL, SCIP_EXPR_CONST, and TRUE.
Referenced by SCIPexprgraphAddConst(), SCIPexprgraphReplaceVarByLinearSum(), and SCIPexprgraphSimplify().
SCIP_RETCODE SCIPexprgraphPrintDot | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
FILE * | file, | ||
const char ** | varnames | ||
) |
prints an expression graph in dot format
exprgraph | expression graph |
messagehdlr | message handler |
file | file to print to, or NULL for stdout |
varnames | variable names, or NULL for generic names |
Definition at line 15658 of file expr.c.
References SCIP_ExprGraph::depth, exprgraphPrintNodeDot(), SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, SCIP_ExprGraphNode::nparents, NULL, SCIP_OKAY, and SCIPmessageFPrintInfo().
Referenced by propagateBounds(), propagateConstraintSides(), SCIP_DECL_CONSINIT(), and SCIPexprgraphSimplify().
SCIP_RETCODE SCIPexprgraphEval | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_Real * | varvals | ||
) |
evaluates nodes of expression graph for given values of variables
exprgraph | expression graph |
varvals | values for variables |
Definition at line 15707 of file expr.c.
References SCIP_ExprGraph::depth, exprgraphNodeEval(), SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, NULL, SCIP_ExprGraph::nvars, SCIP_CALL, and SCIP_OKAY.
Referenced by computeViolations(), presolveUpgrade(), reformulate(), SCIP_DECL_CONSCHECK(), and SCIPexprgraphSimplify().
SCIP_RETCODE SCIPexprgraphPropagateVarBounds | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_Real | infinity, | ||
SCIP_Bool | clearreverseprop, | ||
SCIP_Bool * | domainerror | ||
) |
propagates bound changes in variables forward through the expression graph
exprgraph | expression graph |
infinity | value for infinity in interval arithmetics |
clearreverseprop | whether to reset bound tightenings from reverse propagation |
domainerror | buffer to store whether a node with empty bounds has been found, propagation is interrupted in this case |
Definition at line 15728 of file expr.c.
References SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::depth, SCIP_ExprGraph::depth, exprgraphNodeUpdateBounds(), exprgraphUpdateVarNodeBounds(), FALSE, SCIP_ExprGraph::needvarboundprop, SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, SCIPintervalIsEmpty(), and TRUE.
Referenced by propagateBounds(), reformulate(), and SCIP_DECL_CONSPRESOL().
void SCIPexprgraphPropagateNodeBounds | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_Real | infinity, | ||
SCIP_Real | minstrength, | ||
SCIP_Bool * | cutoff | ||
) |
propagates bound changes in nodes backward through the graph
New bounds are not stored in varbounds, but only in nodes corresponding to variables. NOTE: it is assumed that SCIPexprgraphPropagateVarBounds was called before if variable bounds were relaxed.
exprgraph | expression graph |
infinity | value for infinity in interval arithmetics |
minstrength | minimal required relative bound strengthening in a node to trigger a propagation into children nodes |
cutoff | buffer to store whether a node's bounds were propagated to an empty interval |
Definition at line 15782 of file expr.c.
References SCIP_ExprGraph::depth, exprgraphNodePropagateBounds(), FALSE, SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, and NULL.
Referenced by propagateBounds(), and propagateConstraintSides().
SCIP_RETCODE SCIPexprgraphCheckCurvature | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_Real | infinity, | ||
SCIP_Bool | clearreverseprop | ||
) |
updates curvature information in expression graph nodes w.r.t. currently stored variable bounds
Implies update of bounds in expression graph.
exprgraph | expression graph |
infinity | value for infinity in interval arithmetics |
clearreverseprop | whether to reset bound tightenings from reverse propagation |
Definition at line 15814 of file expr.c.
References SCIP_ExprGraphNode::bounds, SCIP_ExprGraphNode::curv, SCIP_ExprGraph::depth, exprgraphUpdateVarNodeBounds(), SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, NULL, SCIP_Bool, SCIP_CALL, SCIP_EXPRCURV_LINEAR, SCIP_OKAY, SCIPerrorMessage, SCIPexprgraphUpdateNodeBoundsCurvature(), and SCIPintervalIsEmpty().
SCIP_RETCODE SCIPexprgraphSimplify | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_Real | eps, | ||
int | maxexpansionexponent, | ||
SCIP_Bool * | havechange, | ||
SCIP_Bool * | domainerror | ||
) |
aims at simplifying an expression graph
A domain error can occur when variables were fixed to values for which a parent expression is not defined (e.g., 0^(-1) or log(-1)).
exprgraph | expression graph |
messagehdlr | message handler |
eps | threshold, under which positive values are treat as 0 |
maxexpansionexponent | maximal exponent for which we still expand non-monomial polynomials |
havechange | buffer to indicate whether the graph has been modified |
domainerror | buffer to indicate whether a domain error has been encountered, i.e., some expressions turned into NaN |
Definition at line 15857 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocMemoryArray, BMSfreeBlockMemoryArrayNull, BMSfreeMemoryArray, SCIP_ExprGraphNode::children, SCIP_ExprGraphNode::data, DEFAULT_RANDSEED, SCIP_ExprGraph::depth, ensureBlockMemoryArraySize, EPSZ, exprgraphMoveNode(), exprgraphNodeEval(), exprgraphNodeReplaceChild(), exprgraphNodeSimplify(), exprUnconvertPolynomial(), FALSE, SCIP_ExprGraphNode::nchildren, SCIP_ExprGraph::nnodes, SCIP_ExprGraph::nodes, SCIP_ExprGraphNode::nparents, NULL, SCIP_ExprGraphNode::nuses, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::parents, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPR_CONST, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_SUM, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPexprgraphEval(), SCIPexprgraphFindConstNode(), SCIPexprgraphGetNodeVal(), SCIPexprgraphMoveNodeParents(), SCIPexprgraphPrintDot(), SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPhashmapInsert(), SCIPisFinite, SCIPrandomCreate(), SCIPrandomFree(), SCIPrandomGetReal(), SCIPrelDiff(), SCIP_ExprGraphNode::simplified, TRUE, and SCIP_ExprGraphNode::value.
Referenced by SCIP_DECL_CONSEXITPRE(), and SCIP_DECL_CONSPRESOL().
SCIP_RETCODE SCIPexprgraphGetTree | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | rootnode, | ||
SCIP_EXPRTREE ** | exprtree | ||
) |
creates an expression tree from a given node in an expression graph
exprgraph | expression graph |
rootnode | expression graph node that should represent root of expression tree |
exprtree | buffer to store pointer to created expression tree |
Definition at line 16118 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_ExprGraphNode::depth, exprgraphNodeCreateExpr(), NULL, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::pos, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPexprtreeCreate(), and SCIP_ExprGraph::vars.
Referenced by createNlRow(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSDEACTIVE(), SCIP_DECL_CONSPRINT(), SCIPexprgraphGetSeparableTrees(), SCIPexprgraphGetSumTrees(), and SCIPwriteGms().
SCIP_RETCODE SCIPexprgraphGetSeparableTrees | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node, | ||
int | exprtreessize, | ||
int * | nexprtrees, | ||
SCIP_EXPRTREE ** | exprtrees, | ||
SCIP_Real * | exprtreecoefs | ||
) |
creates a sum of expression trees with pairwise disjoint variables from a given node in an expression graph
Giving SCIPexprgraphGetNodeNChildren() for exprtreesize is always sufficient.
exprgraph | expression graph |
node | expression graph node which represents expression to get |
exprtreessize | length of exprtrees and exprtreecoefs arrays, need to be at least one |
nexprtrees | buffer to store number of expression trees |
exprtrees | array where to store expression trees |
exprtreecoefs | array where to store coefficients of expression trees |
Definition at line 16171 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, SCIP_ExprData_Monomial::childidxs, SCIP_ExprGraphNode::children, SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, SCIP_ExprData_Monomial::exponents, exprgraphNodeCheckSeparabilityComponent(), exprgraphNodeCreateExpr(), FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, MAX, MIN, SCIP_ExprData_Polynomial::monomials, SCIP_ExprGraphNode::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, nodedata, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, SCIP_ExprData_Quadratic::quadelems, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_ERROR, SCIP_EXPR_CONST, SCIP_EXPR_LINEAR, SCIP_EXPR_MINUS, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_QUADRATIC, SCIP_EXPR_SUM, SCIP_OKAY, SCIP_Real, SCIPerrorMessage, SCIPexprCreate(), SCIPexprCreateLinear(), SCIPexprCreateMonomial(), SCIPexprCreatePolynomial(), SCIPexprCreateQuadratic(), SCIPexprgraphGetTree(), SCIPexprtreeCreate(), TRUE, SCIP_ExprTree::vars, and SCIP_ExprGraph::vars.
void SCIPexprgraphGetSubtreeVarsUsage | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node, | ||
int * | varsusage | ||
) |
returns how often expression graph variables are used in a subtree of the expression graph
exprgraph | expression graph |
node | root node of expression graph subtree |
varsusage | array where to count usage of variables, length must be at least the number of variables in the graph |
Definition at line 16605 of file expr.c.
References BMSclearMemoryArray, exprgraphNodeGetVarsUsage(), NULL, and SCIP_ExprGraph::nvars.
Referenced by SCIP_DECL_CONSGETNVARS(), and SCIP_DECL_CONSGETVARS().
int SCIPexprgraphGetSumTreesNSummands | ( | SCIP_EXPRGRAPHNODE * | node | ) |
gives the number of summands which the expression of an expression graph node consists of
node | expression graph node |
Definition at line 16621 of file expr.c.
References SCIP_ExprGraphNode::data, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprGraphNode::nchildren, SCIP_ExprData_Polynomial::nmonomials, nodedata, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraphNode::op, SCIP_EXPR_LINEAR, SCIP_EXPR_MINUS, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_QUADRATIC, and SCIP_EXPR_SUM.
Referenced by SCIP_DECL_CONSEXITPRE().
SCIP_RETCODE SCIPexprgraphGetSumTrees | ( | SCIP_EXPRGRAPH * | exprgraph, |
SCIP_EXPRGRAPHNODE * | node, | ||
int | exprtreessize, | ||
int * | nexprtrees, | ||
SCIP_EXPRTREE ** | exprtrees, | ||
SCIP_Real * | exprtreecoefs | ||
) |
creates a sum of expression trees, possibly sharing variables, from a given node in an expression graph
exprgraph | expression graph |
node | expression graph node which represents expression to get |
exprtreessize | length of exprtrees and exptreecoefs arrays, should be at least SCIPexprgraphGetSumTreesNSummands() |
nexprtrees | buffer to store number of expression trees |
exprtrees | array where to store expression trees |
exprtreecoefs | array where to store coefficients of expression trees |
Definition at line 16657 of file expr.c.
References SCIP_ExprGraph::blkmem, BMSallocBlockMemoryArray, BMSfreeBlockMemoryArray, SCIP_ExprData_Monomial::childidxs, SCIP_ExprGraphNode::children, SCIP_ExprData_Monomial::coef, SCIP_QuadElement::coef, SCIP_ExprData_Quadratic::constant, SCIP_ExprData_Polynomial::constant, SCIP_ExprGraphNode::data, SCIP_ExprGraphNode::depth, EPSISINT, SCIP_ExprData_Monomial::exponents, exprgraphNodeCreateExpr(), FALSE, SCIP_QuadElement::idx1, SCIP_QuadElement::idx2, SCIP_ExprData_Quadratic::lincoefs, SCIP_ExprData_Polynomial::monomials, SCIP_ExprGraphNode::nchildren, SCIP_ExprData_Monomial::nfactors, SCIP_ExprData_Polynomial::nmonomials, nodedata, SCIP_ExprData_Quadratic::nquadelems, NULL, SCIP_ExprGraph::nvars, SCIP_ExprGraphNode::op, SCIP_ExprGraphNode::pos, SCIP_ExprData_Quadratic::quadelems, SCIP_ALLOC, SCIP_CALL, SCIP_ERROR, SCIP_EXPR_CONST, SCIP_EXPR_INTPOWER, SCIP_EXPR_LINEAR, SCIP_EXPR_MINUS, SCIP_EXPR_MUL, SCIP_EXPR_PLUS, SCIP_EXPR_POLYNOMIAL, SCIP_EXPR_QUADRATIC, SCIP_EXPR_REALPOWER, SCIP_EXPR_SQUARE, SCIP_EXPR_SUM, SCIP_OKAY, SCIP_Real, SCIPerrorMessage, SCIPexprCreate(), SCIPexprCreateMonomial(), SCIPexprCreatePolynomial(), SCIPexprgraphGetTree(), SCIPexprtreeAddExpr(), SCIPexprtreeCreate(), SCIP_ExprTree::vars, and SCIP_ExprGraph::vars.
Referenced by SCIP_DECL_CONSEXITPRE().
|
static |
curvature names as strings
Definition at line 178 of file expr.c.
Referenced by SCIPexprcurvGetName().