All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pub_expr.h
Go to the documentation of this file.
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
69 /** gives curvature for base^exponent for given bounds and curvature of base-function and constant exponent */
105 * @return -1 for invalid operands and -2 for complex operands (those where the number of children depends on the expression)
252 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
269 #define SCIPexprGetQuadLinearCoefs(expr) ((SCIP_EXPRDATA_QUADRATIC*)(expr)->data.data)->lincoefs
270 #define SCIPexprGetNQuadElements(expr) ((SCIP_EXPRDATA_QUADRATIC*)(expr)->data.data)->nquadelems
273 #define SCIPexprGetPolynomialConstant(expr) ((SCIP_EXPRDATA_POLYNOMIAL*)(expr)->data.data)->constant
312 /** creates an expression from the addition of two given expression, with coefficients, and a constant
341 /** creates a SCIP_EXPR_LINEAR expression that is (affine) linear in its children: constant + sum_i coef_i child_i */
363 /** creates a SCIP_EXPR_QUADRATIC expression: constant + sum_i coef_i child_i + sum_i coef_i child1_i child2_i */
381 /** creates a SCIP_EXPR_POLYNOMIAL expression from an array of monomials: constant + sum_i monomial_i */
449 /** merges monomials in a polynomial expression that differ only in coefficient into a single monomial
485 * note that if the factors have not been merged, the position of some factor corresponding to a given child is given
584 * if linear variables are split off, expression interpreter data, if stored in the tree, is freed
592 int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
594 int* nlinvars, /**< buffer to store number of linear variables in linear part, or NULL if linear part should not be separated */
595 int* linidxs, /**< array to store indices of variables in expression tree which belong to linear part, or NULL */
604 SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
613 SCIP_INTERVAL* varvals, /**< interval values for variables, can be NULL if the expression is constant */
614 SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
624 SCIP_Real* param, /**< values for parameters, can be NULL if the expression is not parameterized */
781 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
789 #define SCIPexprtreeSetParamVal(tree, paramidx, paramval) do { (tree)->params[(paramidx)] = paramval; } while (FALSE)
791 #define SCIPexprtreeSetInterpreterData(tree, newinterpreterdata) do { (tree)->interpreterdata = newinterpreterdata; } while (FALSE)
792 #define SCIPexprtreeFreeInterpreterData(tree) ((tree)->interpreterdata != NULL ? SCIPexprintFreeData(&(tree)->interpreterdata) : SCIP_OKAY)
795 #define SCIPexprtreeEval(tree, varvals, val) SCIPexprEval((tree)->root, varvals, (tree)->params, val)
796 #define SCIPexprtreeEvalInt(tree, infinity, varvals, val) SCIPexprEvalInt((tree)->root, infinity, varvals, (tree)->params, val)
797 #define SCIPexprtreePrint(tree, messagehdlr, file, varnames, paramnames) SCIPexprPrint((tree)->root, messagehdlr, file, varnames, paramnames, (tree)->params)
809 SCIP_Real* params /**< values for parameters, or NULL (if NULL but nparams > 0, then params is initialized with zeros) */
842 * if linear variables are split off, expression interpreter data, if stored in the tree, is freed
849 int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
850 int* nlinvars, /**< buffer to store number of linear variables in linear part, or NULL if linear part should not be separated */
851 int* linidxs, /**< array to store indices of variables in expression tree which belong to linear part, or NULL */
856 * the root is replaced with an SCIP_EXPR_PLUS expression which has the previous root and the given expression as children
865 /** tries to determine the curvature type of an expression tree w.r.t. given variable domains */
902 * If (idx1,idx2) is found in quadelems, then returns TRUE and stores position of quadratic element in *pos.
903 * 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.
912 int* pos /**< buffer to store position of found quadratic element, or position where it would be inserted */
1039 /** gives linear coefficients belonging to a SCIP_EXPR_QUADRATIC expression, or NULL if all coefficients are 0.0 */
1095 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1115 #define SCIPexprgraphGetNodeLinearConstant(node) (((SCIP_Real*)(node)->data.data)[(node)->nchildren])
1116 #define SCIPexprgraphGetNodeQuadraticConstant(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->constant
1117 #define SCIPexprgraphGetNodeQuadraticLinearCoefs(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->lincoefs
1118 #define SCIPexprgraphGetNodeQuadraticQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->quadelems
1119 #define SCIPexprgraphGetNodeQuadraticNQuadElements(node) ((SCIP_EXPRDATA_QUADRATIC*)(node)->data.data)->nquadelems
1120 #define SCIPexprgraphGetNodePolynomialMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->monomials
1121 #define SCIPexprgraphGetNodePolynomialNMonomials(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->nmonomials
1122 #define SCIPexprgraphGetNodePolynomialConstant(node) ((SCIP_EXPRDATA_POLYNOMIAL*)(node)->data.data)->constant
1181 /** given a node of an expression graph, splitup a linear part which variables are not used somewhere else in the same expression
1184 * If it is not linear, the node may change, i.e., the remaining nonlinear part may be stored in a new node.
1238 /** disables a node and recursively all children which have no enabled parents in an expression graph */
1275 * sets bound status to SCIP_EXPRBOUNDSTATUS_TIGHTENEDBYPARENTRECENT if tightening is strong enough and not cutoff
1282 SCIP_Real 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) */
1283 SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1293 SCIP_Real minstrength, /**< minimal required relative bound strengthening to trigger a bound recalculation in parent nodes */
1392 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1402 #define SCIPexprgraphSetVarNodeValue(varnode, newvalue) do { (varnode)->value = newvalue; } while (FALSE)
1403 #define SCIPexprgraphSetVarsBounds(exprgraph, newvarbounds) BMScopyMemoryArray((exprgraph)->varbounds, newvarbounds, (exprgraph)->nvars)
1404 #define SCIPexprgraphSetVarBounds(exprgraph, var, newvarbounds) do { (exprgraph)->varbounds[(int)(size_t)SCIPhashmapGetImage((exprgraph)->varidxs, var)] = newvarbounds; } while (FALSE)
1405 #define SCIPexprgraphSetVarNodeBounds(exprgraph, varnode, newvarbounds) do { (exprgraph)->varbounds[(varnode)->data.intval] = newvarbounds; } while (FALSE)
1406 #define SCIPexprgraphSetVarNodeLb(exprgraph, varnode, lb) do { (exprgraph)->varbounds[(varnode)->data.intval].inf = lb; } while (FALSE)
1407 #define SCIPexprgraphSetVarNodeUb(exprgraph, varnode, ub) do { (exprgraph)->varbounds[(varnode)->data.intval].sup = ub; } while (FALSE)
1417 int varssizeinit, /**< minimal initial size for variables array, or -1 to choose automatically */
1418 int depthinit, /**< minimal initial depth of expression graph, or -1 to choose automatically */
1419 SCIP_DECL_EXPRGRAPHVARADDED((*exprgraphvaradded)), /** callback method to invoke when a variable has been added to the expression graph, or NULL if not needed */
1420 SCIP_DECL_EXPRGRAPHVARREMOVE((*exprgraphvarremove)), /** callback method to invoke when a variable will be removed from the expression graph, or NULL if not needed */
1421 SCIP_DECL_EXPRGRAPHVARCHGIDX((*exprgraphvarchgidx)), /** callback method to invoke when a variable changes its index in the expression graph, or NULL if not needed */
1440 int mindepth, /**< minimal depth in expression graph where to add node, e.g., 0 or smaller to choose automatically */
1453 SCIP_EXPRGRAPHNODE** varnodes /**< array to store nodes corresponding to variables, or NULL if not of interest */
1462 SCIP_EXPRGRAPHNODE** constnode /**< buffer to store pointer to expression graph node corresponding to constant */
1474 SCIP_EXPRGRAPHNODE** rootnode, /**< buffer to store expression graph node corresponding to root of expression tree */
1475 SCIP_Bool* rootnodeisnew /**< buffer to indicate whether the node in *rootnode has been newly created for this expression tree (otherwise, expression tree was already in graph) */
1496 SCIP_EXPRGRAPHNODE** varnode /**< buffer to store node corresponding to variable, if found, or NULL if not found */
1504 SCIP_EXPRGRAPHNODE** constnode /**< buffer to store node corresponding to constant, if found, or NULL if not found */
1528 SCIP_Bool clearreverseprop, /**< whether to reset bound tightenings from reverse propagation */
1529 SCIP_Bool* domainerror /**< buffer to store whether a node with empty bounds has been found, propagation is interrupted in this case */
1534 * NOTE: it is assumed that SCIPexprgraphPropagateVarBounds was called before if variable bounds were relaxed
1540 SCIP_Real minstrength, /**< minimal required relative bound strengthening in a node to trigger a propagation into children nodes */
1541 SCIP_Bool* cutoff /**< buffer to store whether a node's bounds were propagated to an empty interval */
1544 /** updates curvature information in expression graph nodes w.r.t. currently stored variable bounds
1555 * 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))
1562 int maxexpansionexponent,/**< maximal exponent for which we still expand non-monomial polynomials */
1564 SCIP_Bool* domainerror /**< buffer to indicate whether a domain error has been encountered, i.e., some expressions turned into NaN */
1571 SCIP_EXPRGRAPHNODE* rootnode, /**< expression graph node that should represent root of expression tree */
1575 /** creates a sum of expression trees with pairwise disjoint variables from a given node in an expression graph
1582 int exprtreessize, /**< length of exprtrees and exprtreecoefs arrays, need to be at least one */
1588 /** returns how often expression graph variables are used in a subtree of the expression graph */
1593 int* varsusage /**< array where to count usage of variables, length must be at least the number of variables in the graph */
1596 /** gives the number of summands which the expression of an expression graph node consists of */
1602 /** creates a sum of expression trees, possibly sharing variables, from a given node in an expression graph */
|