Detailed Description
an algebraic expression used for nonlinear constraints and NLPs
Quadratic Expressions | |
void | SCIPexprGetQuadraticData (SCIP_EXPR *expr, SCIP_Real *constant, int *nlinexprs, SCIP_EXPR ***linexprs, SCIP_Real **lincoefs, int *nquadexprs, int *nbilinexprs, SCIP_Real **eigenvalues, SCIP_Real **eigenvectors) |
void | SCIPexprGetQuadraticQuadTerm (SCIP_EXPR *quadexpr, int termidx, SCIP_EXPR **expr, SCIP_Real *lincoef, SCIP_Real *sqrcoef, int *nadjbilin, int **adjbilin, SCIP_EXPR **sqrexpr) |
void | SCIPexprGetQuadraticBilinTerm (SCIP_EXPR *expr, int termidx, SCIP_EXPR **expr1, SCIP_EXPR **expr2, SCIP_Real *coef, int *pos2, SCIP_EXPR **prodexpr) |
SCIP_Bool | SCIPexprAreQuadraticExprsVariables (SCIP_EXPR *expr) |
Core Expression Handlers | |
SCIP_VAR * | SCIPgetVarExprVar (SCIP_EXPR *expr) |
SCIP_Real | SCIPgetValueExprValue (SCIP_EXPR *expr) |
SCIP_Real * | SCIPgetCoefsExprSum (SCIP_EXPR *expr) |
SCIP_Real | SCIPgetConstantExprSum (SCIP_EXPR *expr) |
SCIP_Real | SCIPgetCoefExprProduct (SCIP_EXPR *expr) |
SCIP_Real | SCIPgetExponentExprPow (SCIP_EXPR *expr) |
Expression Iterator | |
More details on the DFS mode: Many algorithms over expression trees need to traverse the tree in depth-first manner and a natural way of implementing these algorithms is by using recursion. In general, a function which traverses the tree in depth-first looks like fun( expr ) enterexpr() continue skip or abort for( child in expr->children ) visitingchild() continue skip or abort fun(child, data, proceed) visitedchild() continue skip or abort leaveexpr() Given that some expressions might be quite deep we provide this functionality in an iterative fashion. Consider an expression (x*y) + z + log(x-y). The corresponding expression graph is [+] / | \ [*] | [log] / \ | | / \ | [-] | | | / \ [x] [y] [z] [x] [y] (where [x] and [y] are actually the same expression). If a pointer to the [+] expression is given as root to this expression, it will iterate the graph in a depth-first manner and stop at various stages.
Thus, for the above expression, the expression are visited in the following order and stages:
The caller can direct the iterator to skip parts of the tree:
| |
SCIP_Bool | SCIPexpriterIsInit (SCIP_EXPRITER *iterator) |
SCIP_RETCODE | SCIPexpriterInit (SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_TYPE type, SCIP_Bool allowrevisit) |
SCIP_EXPR * | SCIPexpriterRestartDFS (SCIP_EXPRITER *iterator, SCIP_EXPR *expr) |
void | SCIPexpriterSetStagesDFS (SCIP_EXPRITER *iterator, SCIP_EXPRITER_STAGE stopstages) |
SCIP_EXPR * | SCIPexpriterGetCurrent (SCIP_EXPRITER *iterator) |
SCIP_EXPRITER_STAGE | SCIPexpriterGetStageDFS (SCIP_EXPRITER *iterator) |
int | SCIPexpriterGetChildIdxDFS (SCIP_EXPRITER *iterator) |
SCIP_EXPR * | SCIPexpriterGetChildExprDFS (SCIP_EXPRITER *iterator) |
SCIP_EXPR * | SCIPexpriterGetParentDFS (SCIP_EXPRITER *iterator) |
SCIP_EXPRITER_USERDATA | SCIPexpriterGetCurrentUserData (SCIP_EXPRITER *iterator) |
SCIP_EXPRITER_USERDATA | SCIPexpriterGetChildUserDataDFS (SCIP_EXPRITER *iterator) |
SCIP_EXPRITER_USERDATA | SCIPexpriterGetExprUserData (SCIP_EXPRITER *iterator, SCIP_EXPR *expr) |
void | SCIPexpriterSetCurrentUserData (SCIP_EXPRITER *iterator, SCIP_EXPRITER_USERDATA userdata) |
void | SCIPexpriterSetExprUserData (SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_USERDATA userdata) |
void | SCIPexpriterSetChildUserData (SCIP_EXPRITER *iterator, SCIP_EXPRITER_USERDATA userdata) |
SCIP_EXPR * | SCIPexpriterGetNext (SCIP_EXPRITER *iterator) |
SCIP_EXPR * | SCIPexpriterSkipDFS (SCIP_EXPRITER *iterator) |
SCIP_Bool | SCIPexpriterIsEnd (SCIP_EXPRITER *iterator) |
Function Curvature | |
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 | SCIPexprcurvPowerInv (SCIP_INTERVAL basebounds, SCIP_Real exponent, SCIP_EXPRCURV powercurv) |
SCIP_EXPRCURV | SCIPexprcurvMonomial (int nfactors, SCIP_Real *exponents, int *factoridxs, SCIP_EXPRCURV *factorcurv, SCIP_INTERVAL *factorbounds) |
SCIP_Bool | SCIPexprcurvMonomialInv (SCIP_EXPRCURV monomialcurv, int nfactors, SCIP_Real *exponents, SCIP_INTERVAL *factorbounds, SCIP_EXPRCURV *factorcurv) |
const char * | SCIPexprcurvGetName (SCIP_EXPRCURV curv) |
Differentiation | |
Given a function, say, \(f(s(x,y),t(x,y))\) there is a common mnemonic technique to compute its partial derivatives, using a tree diagram. Suppose we want to compute the partial derivative of \(f\) w.r.t. \(x\). Write the function as a tree: f |-----| s t |--| |--| x y x y The weight of an edge between two nodes represents the partial derivative of the parent w.r.t. the children, e.g., f | s is \( \partial_sf \). The weight of a path is the product of the weight of the edges in the path. The partial derivative of \(f\) w.r.t. \(x\) is then the sum of the weights of all paths connecting \(f\) with \(x\): \[ \frac{\partial f}{\partial x} = \partial_s f \cdot \partial_x s + \partial_t f \cdot \partial_x t. \] We follow this method in order to compute the gradient of an expression (root) at a given point (point). Note that an expression is a DAG representation of a function, but there is a 1-1 correspondence between paths in the DAG and path in a tree diagram of a function. Initially, we set For example:
However, when the child is a variable expressions, we actually need to initialize
Note that, to compute this, we only need to know, for each expression, its partial derivatives w.r.t a given child at a point. This is what the callback An equivalent way of interpreting the procedure is that
Computing the Hessian is more complicated since it is the derivative of the gradient, which is a function with more than one output. We compute the Hessian by computing "directions" of the Hessian, that is \(H\cdot u\) for different \(u\). This is easy in general, since it is the gradient of the scalar function \(\nabla f u\), that is, the directional derivative of \(f\) in the direction \(u\): \(D_u f\). This is easily computed via the so called forward mode. Just as Starting with Once we have this information, we compute the gradient of this function, following the same idea as before. We define This way, \begin{eqnarray*} \texttt{expr->bardot} & = & D_u (\partial_{\text{expr}} f) \\ & = & D_u ( \partial_{\text{parent}} f \cdot \partial_{\text{expr}} \text{parent} ) \\ & = & D_u ( \texttt{parent->derivative} \cdot \partial_{\text{expr}} \text{parent} ) \\ & = & \partial_{\text{expr}} \text{parent} \cdot D_u (\texttt{parent->derivative}) + \texttt{parent->derivative} \cdot D_u (\partial_{\text{expr}} \text{parent}) \\ & = & \texttt{parent->bardot} \cdot \partial_{\text{expr}} \text{parent} + \texttt{parent->derivative} \cdot D_u (\partial_{\text{expr}} \text{parent}) \end{eqnarray*} Note that we have computed | |
SCIP_RETCODE | SCIPevalExprGradient (SCIP *scip, SCIP_EXPR *expr, SCIP_SOL *sol, SCIP_Longint soltag) |
SCIP_RETCODE | SCIPevalExprHessianDir (SCIP *scip, SCIP_EXPR *expr, SCIP_SOL *sol, SCIP_Longint soltag, SCIP_SOL *direction) |
Expression Handler Callbacks | |
SCIP_DECL_EXPRPRINT (SCIPcallExprPrint) | |
SCIP_DECL_EXPRCURVATURE (SCIPcallExprCurvature) | |
SCIP_DECL_EXPRMONOTONICITY (SCIPcallExprMonotonicity) | |
SCIP_RETCODE | SCIPcallExprEval (SCIP *scip, SCIP_EXPR *expr, SCIP_Real *childrenvalues, SCIP_Real *val) |
SCIP_RETCODE | SCIPcallExprEvalFwdiff (SCIP *scip, SCIP_EXPR *expr, SCIP_Real *childrenvalues, SCIP_Real *direction, SCIP_Real *val, SCIP_Real *dot) |
SCIP_DECL_EXPRINTEVAL (SCIPcallExprInteval) | |
SCIP_DECL_EXPRESTIMATE (SCIPcallExprEstimate) | |
SCIP_DECL_EXPRINITESTIMATES (SCIPcallExprInitestimates) | |
SCIP_DECL_EXPRSIMPLIFY (SCIPcallExprSimplify) | |
SCIP_DECL_EXPRREVERSEPROP (SCIPcallExprReverseprop) | |
Expression Iterator | |
SCIP_RETCODE | SCIPcreateExpriter (SCIP *scip, SCIP_EXPRITER **iterator) |
void | SCIPfreeExpriter (SCIP_EXPRITER **iterator) |
Quadratic Expressions | |
SCIP_RETCODE | SCIPcheckExprQuadratic (SCIP *scip, SCIP_EXPR *expr, SCIP_Bool *isquadratic) |
void | SCIPfreeExprQuadratic (SCIP *scip, SCIP_EXPR *expr) |
SCIP_Real | SCIPevalExprQuadratic (SCIP *scip, SCIP_EXPR *expr, SCIP_SOL *sol) |
SCIP_RETCODE | SCIPprintExprQuadratic (SCIP *scip, SCIP_EXPR *expr) |
SCIP_RETCODE | SCIPcomputeExprQuadraticCurvature (SCIP *scip, SCIP_EXPR *expr, SCIP_EXPRCURV *curv, SCIP_HASHMAP *assumevarfixed, SCIP_Bool storeeigeninfo) |
Function Documentation
◆ SCIPexprGetNUses()
int SCIPexprGetNUses | ( | SCIP_EXPR * | expr | ) |
gets the number of times the expression is currently captured
- Parameters
-
expr expression
Definition at line 3788 of file expr.c.
References NULL, and SCIP_Expr::nuses.
Referenced by enforceSP12(), SCIPaddExprNonlinear(), and SCIPaddLinearVarNonlinear().
◆ SCIPexprGetNChildren()
int SCIPexprGetNChildren | ( | SCIP_EXPR * | expr | ) |
gives the number of children of an expression
- Parameters
-
expr expression
Definition at line 3798 of file expr.c.
References SCIP_Expr::nchildren, and NULL.
Referenced by atomic_userexpr::atomic_userexpr(), bilinboundGetX(), bilinearTermsInsertAll(), buildQuadExprMatrix(), checkAndCollectQuadratic(), collectLeafs(), computeEstimatorsTrig(), computeInitialCutsTrig(), computeSymmetryGroup(), constructExpr(), createNlhdlrExprData(), createNlRow(), DECL_CURVCHECK(), detectExpr(), detectMinors(), detectSocNorm(), detectSocQuadraticComplex(), detectSocQuadraticSimple(), doBfsNext(), doReverseTopologicalNext(), enforceSP11(), enforceSP12(), eval(), evalExprInAux(), exprIsMultivarLinear(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), findUnlockedLinearVar(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), getBilinearBinaryTerms(), getBinaryProductExpr(), getBinaryProductExprDo(), getExprSize(), getFactorizedBinaryQuadraticExpr(), getFeasiblePointsBilinear(), hashExpr(), intevalBilinear(), isBinaryProduct(), isExprPolynomial(), isExprSignomial(), isPackingCons(), nlhdlrExprCreate(), nlhdlrExprGrowChildren(), presolveImplint(), presolveSingleLockedVars(), printRowNl(), printSignomial(), propagateLocks(), readConstraints(), readObjective(), replaceBinaryProducts(), reversePropBilinear(), reversePropQueue(), scaleConsSides(), SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRBWFWDIFF(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRCOPYDATA(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRESTIMATE(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_EXPRHASH(), SCIP_DECL_EXPRINITESTIMATES(), SCIP_DECL_EXPRINTEGRALITY(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_EXPRREVERSEPROP(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_NLHDLRINITSEPA(), SCIP_DECL_NLHDLRREVERSEPROP(), SCIPaddIneqBilinear(), SCIPappendExprSumExpr(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPexprCheckQuadratic(), SCIPexprintCompile(), SCIPisExprVaridx(), SCIPmultiplyByConstantExprSum(), SCIPregisterExprUsageNonlinear(), SCIPtightenExprIntervalNonlinear(), simplifyFactor(), simplifyTerm(), and transformExpr().
◆ SCIPexprGetChildren()
gives the children of an expression (can be NULL if no children)
- Parameters
-
expr expression
Definition at line 3808 of file expr.c.
References SCIP_Expr::children, and NULL.
Referenced by bilinboundGetX(), bilinearTermsInsertAll(), buildQuadExprMatrix(), checkAndCollectQuadratic(), constructExpr(), createNlhdlrExprData(), createNlRow(), DECL_CURVCHECK(), detectExpr(), detectMinors(), detectSocNorm(), detectSocQuadraticSimple(), doBfsNext(), doReverseTopologicalNext(), enforceSP11(), enforceSP12(), eval(), evalExprInAux(), exprIsMultivarLinear(), exprIsSemicontinuous(), findUnlockedLinearVar(), forbidNonlinearVariablesMultiaggration(), getBilinearBinaryTerms(), getBinaryProductExpr(), getBinaryProductExprDo(), getExprSize(), getFactorizedBinaryQuadraticExpr(), getFeasiblePointsBilinear(), hashExpr(), intevalBilinear(), isBinaryProduct(), isExprPolynomial(), isExprSignomial(), isPackingCons(), mergeProductExprlist(), nlhdlrExprGrowChildren(), presolveImplint(), presolveSingleLockedVars(), printRowNl(), printSignomial(), readConstraints(), readObjective(), reversePropBilinear(), reversePropQueue(), scaleConsSides(), SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRBWFWDIFF(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRESTIMATE(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_EXPRINITESTIMATES(), SCIP_DECL_EXPRINTEGRALITY(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_NLHDLRINITSEPA(), SCIP_DECL_NLHDLRREVERSEPROP(), SCIPaddIneqBilinear(), SCIPcomputeExprCurvature(), SCIPexprCheckQuadratic(), SCIPexprintCompile(), simplifyFactor(), simplifyTerm(), and transformExpr().
◆ SCIPexprGetHdlr()
SCIP_EXPRHDLR* SCIPexprGetHdlr | ( | SCIP_EXPR * | expr | ) |
gets the expression handler of an expression
This identifies the type of the expression (sum, variable, ...).
- Parameters
-
expr expression
Definition at line 3821 of file expr.c.
References SCIP_Expr::exprhdlr, and NULL.
Referenced by addTightEstimatorCut(), atomic_userexpr::atomic_userexpr(), computeEstimatorsTrig(), computeInitialCutsTrig(), constructExpr(), createAuxVar(), DECL_CURVCHECK(), detectNlhdlr(), enforceExpr(), enforceSP11(), eval(), exprIsNonSmooth(), forwardPropExpr(), hashExpr(), printExpr(), propagateLocks(), reversePropQueue(), SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRBWFWDIFF(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRESTIMATE(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_EXPRINITESTIMATES(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_EXPRPRINT(), SCIP_DECL_EXPRREVERSEPROP(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_HASHKEYEQ(), SCIP_DECL_HASHKEYVAL(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLRINITSEPA(), SCIP_DECL_NLHDLRREVERSEPROP(), SCIPcallExprEval(), SCIPcallExprEvalFwdiff(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPexprintCompile(), SCIPexprPrint(), SCIPgetIndexExprVaridx(), SCIPgetVarExprVar(), SCIPisExprAbs(), SCIPisExprCos(), SCIPisExprEntropy(), SCIPisExprErf(), SCIPisExprExp(), SCIPisExprLog(), SCIPisExprSignpower(), SCIPisExprSin(), SCIPisExprVaridx(), SCIPsetIndexExprVaridx(), and SCIPtightenExprIntervalNonlinear().
◆ SCIPexprGetData()
SCIP_EXPRDATA* SCIPexprGetData | ( | SCIP_EXPR * | expr | ) |
gets the expression data of an expression
- Parameters
-
expr expression
Definition at line 3831 of file expr.c.
References SCIP_Expr::exprdata, and NULL.
Referenced by SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRBWFWDIFF(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRCOPYDATA(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRESTIMATE(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPRFREEDATA(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_EXPRHASH(), SCIP_DECL_EXPRINITESTIMATES(), SCIP_DECL_EXPRINTEGRALITY(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_EXPRPRINT(), SCIP_DECL_EXPRREVERSEPROP(), SCIPappendExprSumExpr(), SCIPgetCoefExprProduct(), SCIPgetCoefsExprSum(), SCIPgetConstantExprSum(), SCIPgetExponentExprPow(), SCIPgetIndexExprVaridx(), SCIPgetValueExprValue(), SCIPgetVarExprVar(), SCIPmultiplyByConstantExprSum(), and SCIPsetConstantExprSum().
◆ SCIPexprSetData()
void SCIPexprSetData | ( | SCIP_EXPR * | expr, |
SCIP_EXPRDATA * | exprdata | ||
) |
sets the expression data of an expression
The pointer to possible old data is overwritten and the freedata-callback is not called before. This function is intended to be used by expression handler only.
- Parameters
-
expr expression exprdata expression data to be set (can be NULL)
Definition at line 3846 of file expr.c.
References SCIP_Expr::exprdata, SCIP_Expr::exprhdlr, and NULL.
Referenced by SCIP_DECL_EXPRFREEDATA(), and SCIPsetIndexExprVaridx().
◆ SCIPexprGetOwnerData()
SCIP_EXPR_OWNERDATA* SCIPexprGetOwnerData | ( | SCIP_EXPR * | expr | ) |
gets the data that the owner of an expression has stored in an expression
- Parameters
-
expr expression
Definition at line 3859 of file expr.c.
References NULL, and SCIP_Expr::ownerdata.
Referenced by addExprsViolScore(), addTightEstimatorCuts(), analyzeViolation(), canonicalizeConstraints(), catchVarEvent(), collectBranchingCandidates(), createAuxVar(), detectNlhdlr(), detectNlhdlrs(), dropVarEvent(), enforceConstraint(), enforceExpr(), forwardPropExpr(), freeAuxVar(), freeEnfoData(), getExprAbsAuxViolation(), getExprAbsOrigViolation(), initSepa(), isSingleLockedCand(), propagateLocks(), propConss(), propExprDomains(), registerBranchingCandidates(), reversePropQueue(), SCIP_DECL_CONSLOCK(), SCIP_DECL_EVENTEXEC(), SCIPaddExprsViolScoreNonlinear(), SCIPaddExprViolScoreNonlinear(), SCIPgetExprAuxVarNonlinear(), SCIPgetExprBoundsNonlinear(), SCIPgetExprEnfoDataNonlinear(), SCIPgetExprNAuxvarUsesNonlinear(), SCIPgetExprNEnfosNonlinear(), SCIPgetExprNLocksNegNonlinear(), SCIPgetExprNLocksPosNonlinear(), SCIPgetExprNPropUsesActivityNonlinear(), SCIPgetExprNSepaUsesActivityNonlinear(), SCIPgetExprPartialDiffGradientDirNonlinear(), SCIPgetExprPartialDiffNonlinear(), SCIPgetExprViolScoreNonlinear(), SCIPgetNlhdlrExprDataNonlinear(), SCIPmarkExprPropagateNonlinear(), SCIPregisterExprUsageNonlinear(), SCIPsetExprEnfoAuxValueNonlinear(), and SCIPtightenExprIntervalNonlinear().
◆ SCIPexprGetEvalValue()
gives the value from the last evaluation of an expression (or SCIP_INVALID if there was an eval error)
- See also
- SCIPevalExpr to evaluate the expression at a given solution.
- Parameters
-
expr expression
Definition at line 3872 of file expr.c.
References SCIP_Expr::evalvalue, and NULL.
Referenced by addTightEstimatorCut(), addTightEstimatorCuts(), analyzeViolation(), computeOffValues(), computeViolation(), createAuxVar(), enforceExpr(), estimateConvexSecant(), estimateGradient(), generateCut(), getConsRelViolation(), getExprAbsOrigViolation(), SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRBWFWDIFF(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_VERTEXPOLYFUN(), SCIPexprEvalGradient(), SCIPexprintEval(), SCIPnlrowGetSolActivity(), SCIPnlrowRecalcNLPActivity(), and SCIPnlrowRecalcPseudoActivity().
◆ SCIPexprGetEvalTag()
SCIP_Longint SCIPexprGetEvalTag | ( | SCIP_EXPR * | expr | ) |
gives the evaluation tag from the last evaluation, or 0
- See also
- SCIPevalExpr
- Parameters
-
expr expression
Definition at line 3885 of file expr.c.
References SCIP_Expr::evaltag, and NULL.
Referenced by addTightEstimatorCuts().
◆ SCIPexprGetDerivative()
returns the derivative stored in an expression (or SCIP_INVALID if there was an evaluation error)
- See also
- SCIPevalExprGradient
- Parameters
-
expr expression
Definition at line 3898 of file expr.c.
References SCIP_Expr::derivative, and NULL.
Referenced by computeGradient(), estimateGradient(), generateCut(), getConsRelViolation(), SCIPaddNlRowGradientBenderscutOpt(), and SCIPgetExprPartialDiffNonlinear().
◆ SCIPexprGetDot()
gives the value of directional derivative from the last evaluation of a directional derivative of expression (or SCIP_INVALID if there was an error)
- See also
- SCIPevalExprHessianDir
- Parameters
-
expr expression
Definition at line 3912 of file expr.c.
References SCIP_Expr::dot, and NULL.
Referenced by SCIP_DECL_EXPRBWFWDIFF(), and SCIP_DECL_EXPRFWDIFF().
◆ SCIPexprGetBardot()
gives the value of directional derivative from the last evaluation of a directional derivative of derivative of root (or SCIP_INVALID if there was an error)
- See also
- SCIPevalExprHessianDir
- Parameters
-
expr expression
Definition at line 3926 of file expr.c.
References SCIP_Expr::bardot, and NULL.
Referenced by SCIPgetExprPartialDiffGradientDirNonlinear().
◆ SCIPexprGetDiffTag()
SCIP_Longint SCIPexprGetDiffTag | ( | SCIP_EXPR * | expr | ) |
returns the difftag stored in an expression
can be used to check whether partial derivative value is valid
- See also
- SCIPevalExprGradient
- Parameters
-
expr expression
Definition at line 3941 of file expr.c.
References SCIP_Expr::difftag, and NULL.
Referenced by estimateGradient(), getConsRelViolation(), SCIPgetExprPartialDiffGradientDirNonlinear(), and SCIPgetExprPartialDiffNonlinear().
◆ SCIPexprGetActivity()
SCIP_INTERVAL SCIPexprGetActivity | ( | SCIP_EXPR * | expr | ) |
returns the activity that is currently stored for an expression
- See also
- SCIPevalExprActivity
- Parameters
-
expr expression
Definition at line 3954 of file expr.c.
References SCIP_Expr::activity, and NULL.
Referenced by analyzeViolation(), createAuxVar(), DECL_CURVCHECK(), detectSocQuadraticComplex(), detectSocQuadraticSimple(), enforceExpr(), estimateBivariateQuotient(), estimateUnivariateQuotient(), forwardPropExpr(), getFeasiblePointsBilinear(), intevalBilinear(), nlrowCalcActivityBounds(), presolveRedundantConss(), propConss(), propExprDomains(), reversePropagateLinearExpr(), reversePropBilinear(), reversePropQueue(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLRINITSEPA(), SCIP_DECL_NLHDLRINTEVAL(), SCIPgetExprBoundsNonlinear(), SCIPtightenExprIntervalNonlinear(), and tryFillNlhdlrExprDataQuad().
◆ SCIPexprGetActivityTag()
SCIP_Longint SCIPexprGetActivityTag | ( | SCIP_EXPR * | expr | ) |
returns the tag associated with the activity of the expression
It can depend on the owner of the expression how to interpret this tag. SCIPevalExprActivity() compares with stat->domchgcount
.
- See also
- SCIPevalExprActivity
- Parameters
-
expr expression
Definition at line 3970 of file expr.c.
References SCIP_Expr::activitytag, and NULL.
Referenced by catchVarEvents(), createAuxVar(), deinitSolve(), forwardPropExpr(), presolveRedundantConss(), SCIP_DECL_EXPR_OWNEREVALACTIVITY(), SCIP_DECL_NLHDLRREVERSEPROP(), SCIPgetExprBoundsNonlinear(), and SCIPtightenExprIntervalNonlinear().
◆ SCIPexprSetActivity()
void SCIPexprSetActivity | ( | SCIP_EXPR * | expr, |
SCIP_INTERVAL | activity, | ||
SCIP_Longint | activitytag | ||
) |
set the activity with tag for an expression
- Parameters
-
expr expression activity new activity activitytag tag associated with activity
Definition at line 3980 of file expr.c.
References SCIP_Expr::activity, SCIP_Expr::activitytag, and NULL.
Referenced by catchVarEvents(), forwardPropExpr(), and SCIP_DECL_EVENTEXEC().
◆ SCIPexprGetCurvature()
SCIP_EXPRCURV SCIPexprGetCurvature | ( | SCIP_EXPR * | expr | ) |
returns the curvature of an expression
- Note
- Call SCIPcomputeExprCurvature() before calling this function.
- Parameters
-
expr expression
Definition at line 3996 of file expr.c.
References SCIP_Expr::curvature, and NULL.
Referenced by constructExpr(), createNlhdlrExprData(), DECL_CURVCHECK(), estimateVertexPolyhedral(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLRINITSEPA(), and SCIPcomputeExprCurvature().
◆ SCIPexprSetCurvature()
void SCIPexprSetCurvature | ( | SCIP_EXPR * | expr, |
SCIP_EXPRCURV | curvature | ||
) |
sets the curvature of an expression
- Parameters
-
expr expression curvature curvature of the expression
Definition at line 4006 of file expr.c.
References SCIP_Expr::curvature, and NULL.
Referenced by createNlhdlrExprData(), DECL_CURVCHECK(), nlhdlrExprCreate(), SCIP_DECL_NLHDLRDETECT(), and SCIPcomputeExprCurvature().
◆ SCIPexprIsIntegral()
returns whether an expression is integral
- Parameters
-
expr expression
Definition at line 4017 of file expr.c.
References SCIP_Expr::isintegral, and NULL.
Referenced by createAuxVar(), forwardPropExpr(), presolveImplint(), SCIP_DECL_EXPRESTIMATE(), SCIP_DECL_EXPRINITESTIMATES(), SCIP_DECL_EXPRINTEGRALITY(), SCIP_DECL_NLHDLRESTIMATE(), and SCIPtightenExprIntervalNonlinear().
◆ SCIPexprSetIntegrality()
sets the integrality flag of an expression
- Parameters
-
expr expression isintegral integrality of the expression
Definition at line 4027 of file expr.c.
References SCIP_Expr::isintegral, and NULL.
Referenced by presolveImplint(), and SCIPcomputeExprIntegrality().
◆ SCIPexprGetQuadraticData()
void SCIPexprGetQuadraticData | ( | SCIP_EXPR * | expr, |
SCIP_Real * | constant, | ||
int * | nlinexprs, | ||
SCIP_EXPR *** | linexprs, | ||
SCIP_Real ** | lincoefs, | ||
int * | nquadexprs, | ||
int * | nbilinexprs, | ||
SCIP_Real ** | eigenvalues, | ||
SCIP_Real ** | eigenvectors | ||
) |
gives the coefficients and expressions that define a quadratic expression
It can return the constant part, the number, arguments, and coefficients of the purely linear part and the number of quadratic terms and bilinear terms. Note that for arguments that appear in the quadratic part, a linear coefficient is stored with the quadratic term. Use SCIPexprGetQuadraticQuadTerm() and SCIPexprGetQuadraticBilinTerm() to access the data for a quadratic or bilinear term.
It can also return the eigenvalues and the eigenvectors of the matrix \(Q\) when the quadratic is written as \(x^T Q x + b^T x + c^T y + d\), where \(c^T y\) defines the purely linear part. Note, however, that to have access to them one needs to call SCIPcomputeExprQuadraticCurvature() with storeeigeninfo=TRUE
. If the eigen information was not stored or it failed to be computed, eigenvalues
and eigenvectors
will be set to NULL.
This function returns pointers to internal data in linexprs and lincoefs. The user must not change this data.
- Attention
- SCIPcheckExprQuadratic() needs to be called first to check whether expression is quadratic and initialize the data of the quadratic representation.
- Parameters
-
expr quadratic expression constant buffer to store constant term, or NULL nlinexprs buffer to store number of expressions that appear linearly, or NULL linexprs buffer to store pointer to array of expressions that appear linearly, or NULL lincoefs buffer to store pointer to array of coefficients of expressions that appear linearly, or NULL nquadexprs buffer to store number of expressions in quadratic terms, or NULL nbilinexprs buffer to store number of bilinear expressions terms, or NULL eigenvalues buffer to store pointer to array of eigenvalues of Q, or NULL eigenvectors buffer to store pointer to array of eigenvectors of Q, or NULL
Definition at line 4057 of file expr.c.
References SCIP_QuadExpr::constant, SCIP_QuadExpr::eigenvalues, SCIP_QuadExpr::eigenvectors, SCIP_QuadExpr::lincoefs, SCIP_QuadExpr::linexprs, SCIP_QuadExpr::nbilinexprterms, SCIP_QuadExpr::nlinexprs, SCIP_QuadExpr::nquadexprs, NULL, and SCIP_Expr::quaddata.
Referenced by checkConsQuadraticProblem(), computeRestrictionToRay(), computeWRayLinear(), constructLPPos2ConsPosMap(), countBasicVars(), createMIP(), createTcliqueGraph(), DECL_CURVCHECK(), doSeachEcAggr(), findAndStoreEcAggregations(), findVertexAndGetRays(), generateIntercut(), intercutsComputeCommonQuantities(), isCandidate(), isPropagable(), isQuadConsViolated(), nlrowaggrCreate(), presolveAddKKTQuadBilinearTerms(), presolveAddKKTQuadLinearTerms(), presolveAddKKTQuadQuadraticTerms(), printRow(), processNlRow(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRENFO(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_NLHDLRFREEEXPRDATA(), SCIP_DECL_NLHDLRINTEVAL(), SCIP_DECL_NLHDLRREVERSEPROP(), SCIPevalExprQuadratic(), SCIPevalExprQuadraticAuxNonlinear(), SCIPprintExprQuadratic(), SCIPwriteMps(), searchEcAggrWithCliques(), storeAggrFromMIP(), storeDenseTableauRowsByColumns(), and updateMIP().
◆ SCIPexprGetQuadraticQuadTerm()
void SCIPexprGetQuadraticQuadTerm | ( | SCIP_EXPR * | quadexpr, |
int | termidx, | ||
SCIP_EXPR ** | expr, | ||
SCIP_Real * | lincoef, | ||
SCIP_Real * | sqrcoef, | ||
int * | nadjbilin, | ||
int ** | adjbilin, | ||
SCIP_EXPR ** | sqrexpr | ||
) |
gives the data of a quadratic expression term
For a term \(a \cdot \text{expr}^2 + b \cdot \text{expr} + \sum_i (c_i \cdot \text{expr} \cdot \text{otherexpr}_i)\), returns expr
, \(a\), \(b\), the number of summands, and indices of bilinear terms in the quadratic expressions bilinexprterms
.
This function returns pointers to internal data in adjbilin. The user must not change this data.
- Parameters
-
quadexpr quadratic expression termidx index of quadratic term expr buffer to store pointer to argument expression (the 'x') of this term, or NULL lincoef buffer to store linear coefficient of variable, or NULL sqrcoef buffer to store square coefficient of variable, or NULL nadjbilin buffer to store number of bilinear terms this variable is involved in, or NULL adjbilin buffer to store pointer to indices of associated bilinear terms, or NULL sqrexpr buffer to store pointer to square expression (the 'x^2') of this term or NULL if no square expression, or NULL
Definition at line 4104 of file expr.c.
References SCIP_QuadExpr_QuadTerm::adjbilin, SCIP_QuadExpr_QuadTerm::expr, SCIP_QuadExpr_QuadTerm::lincoef, SCIP_QuadExpr_QuadTerm::nadjbilin, NULL, SCIP_Expr::quaddata, SCIP_QuadExpr::quadexprterms, SCIP_QuadExpr_QuadTerm::sqrcoef, and SCIP_QuadExpr_QuadTerm::sqrexpr.
Referenced by constructLPPos2ConsPosMap(), countBasicVars(), createMIP(), createTcliqueGraph(), DECL_CURVCHECK(), doSeachEcAggr(), findVertexAndGetRays(), intercutsComputeCommonQuantities(), isCandidate(), isPropagable(), isPropagableTerm(), isQuadConsViolated(), nlrowaggrCreate(), presolveAddKKTQuadLinearTerms(), presolveAddKKTQuadQuadraticTerms(), printRow(), processNlRow(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_NLHDLRINTEVAL(), SCIP_DECL_NLHDLRREVERSEPROP(), SCIPevalExprQuadratic(), SCIPevalExprQuadraticAuxNonlinear(), SCIPprintExprQuadratic(), SCIPwriteMps(), searchEcAggrWithCliques(), storeAggrFromMIP(), storeDenseTableauRowsByColumns(), and updateMIP().
◆ SCIPexprGetQuadraticBilinTerm()
void SCIPexprGetQuadraticBilinTerm | ( | SCIP_EXPR * | expr, |
int | termidx, | ||
SCIP_EXPR ** | expr1, | ||
SCIP_EXPR ** | expr2, | ||
SCIP_Real * | coef, | ||
int * | pos2, | ||
SCIP_EXPR ** | prodexpr | ||
) |
gives the data of a bilinear expression term
For a term a*expr1*expr2, returns expr1, expr2, a, and the position of the quadratic expression term that uses expr2 in the quadratic expressions quadexprterms
.
- Parameters
-
expr quadratic expression termidx index of bilinear term expr1 buffer to store first factor, or NULL expr2 buffer to store second factor, or NULL coef buffer to coefficient, or NULL pos2 buffer to position of expr2 in quadexprterms array of quadratic expression, or NULL prodexpr buffer to store pointer to expression that is product if first and second factor, or NULL
Definition at line 4147 of file expr.c.
References SCIP_QuadExpr::bilinexprterms, SCIP_QuadExpr_BilinTerm::coef, SCIP_QuadExpr_BilinTerm::expr1, SCIP_QuadExpr_BilinTerm::expr2, NULL, SCIP_QuadExpr_BilinTerm::pos2, SCIP_QuadExpr_BilinTerm::prodexpr, and SCIP_Expr::quaddata.
Referenced by createMIP(), createTcliqueGraph(), isCandidate(), isQuadConsViolated(), nlrowaggrCreate(), presolveAddKKTQuadBilinearTerms(), printRow(), processNlRow(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_NLHDLRINTEVAL(), SCIP_DECL_NLHDLRREVERSEPROP(), SCIPevalExprQuadratic(), SCIPevalExprQuadraticAuxNonlinear(), SCIPprintExprQuadratic(), SCIPwriteMps(), searchEcAggrWithCliques(), storeAggrFromMIP(), and updateMIP().
◆ SCIPexprAreQuadraticExprsVariables()
returns whether all expressions that are used in a quadratic expression are variable expressions
- Returns
- TRUE iff all
linexprs
andquadexprterms[.].expr
are variable expressions
- Parameters
-
expr quadratic expression
Definition at line 4185 of file expr.c.
References SCIP_QuadExpr::allexprsarevars, NULL, and SCIP_Expr::quaddata.
Referenced by isCandidate(), printNonlinearCons(), processNlRow(), SCIP_DECL_NLHDLRDETECT(), SCIPcheckQuadraticNonlinear(), and SCIPwritePip().
◆ SCIPgetVarExprVar()
gets the variable of a variable expression
- Parameters
-
expr variable expression
Definition at line 407 of file expr_var.c.
References EXPRHDLR_NAME, NULL, SCIPexprGetData(), SCIPexprGetHdlr(), and SCIPexprhdlrGetName().
Referenced by addTightEstimatorCuts(), analyzeViolation(), buildQuadExprMatrix(), catchVarEvent(), catchVarEvents(), checkAndCollectQuadratic(), collectBranchingCandidates(), collectLeafs(), computeGradient(), computeOffValues(), computeSymmetryGroup(), createMIP(), createNlRow(), createTcliqueGraph(), detectSocNorm(), detectSocQuadraticSimple(), doSeachEcAggr(), dropVarEvent(), enforceConstraints(), estimateConvexSecant(), estimateGradient(), estimateVertexPolyhedral(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), findUnlockedLinearVar(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), generateCut(), getBilinearBinaryTerms(), getBinaryProductExpr(), getBinaryProductExprDo(), isBinaryProduct(), isCandidate(), isPackingCons(), isSingleLockedCand(), nlpAddNlRows(), nlpDelVarPos(), nlrowaggrCreate(), presolveAddKKTQuadBilinearTerms(), presolveAddKKTQuadLinearTerms(), presolveAddKKTQuadQuadraticTerms(), presolveImplint(), presolveRedundantConss(), presolveSingleLockedVars(), printExpr(), printRow(), printSignomial(), processNlRow(), propagateLocks(), readConstraints(), readObjective(), registerBranchingCandidates(), registerBranchingCandidatesAllUnfixed(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_CONSGETVARS(), SCIP_DECL_EXPR_MAPEXPR(), SCIP_DECL_EXPR_OWNERCREATE(), SCIP_DECL_EXPR_OWNERFREE(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRCOPYDATA(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_EXPRHASH(), SCIP_DECL_EXPRINTEGRALITY(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRPRINT(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRINITSEPA(), SCIP_DECL_VERTEXPOLYFUN(), SCIPaddNlRowGradientBenderscutOpt(), SCIPevalExprQuadratic(), SCIPexprComputeQuadraticCurvature(), SCIPexprDismantle(), SCIPgetExprAuxVarNonlinear(), SCIPisSOCNonlinear(), SCIPnlpGetVarsNonlinearity(), SCIPnlpHasContinuousNonlinearity(), SCIPwriteMps(), and storeVarExprs().
◆ SCIPgetValueExprValue()
gets the value of a constant value expression
- Parameters
-
expr sum expression
Definition at line 285 of file expr_value.c.
References NULL, and SCIPexprGetData().
Referenced by canonicalizeConstraints(), eval(), fillGraphByNonlinearConss(), nlrowSimplifyExpr(), AMPLProblemHandler::OnBinary(), AMPLProblemHandler::OnObj(), parseExpr(), presolveRedundantConss(), printSignomial(), readExpression(), SCIP_DECL_EXPRSIMPLIFY(), SCIPexprDismantle(), simplifyFactor(), and simplifyTerm().
◆ SCIPgetCoefsExprSum()
gets the coefficients of a summation expression
- Parameters
-
expr sum expression
Definition at line 1157 of file expr_sum.c.
References NULL, and SCIPexprGetData().
Referenced by buildQuadExprMatrix(), createNlRow(), DECL_CURVCHECK(), detectExpr(), detectSocNorm(), detectSocQuadraticSimple(), enforceSP12(), eval(), fillGraphByNonlinearConss(), findUnlockedLinearVar(), getFactorizedBinaryQuadraticExpr(), presolveImplint(), presolveSingleLockedVars(), printRowNl(), readConstraints(), readObjective(), scaleConsSides(), SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLREVALAUX(), SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), simplifyFactor(), simplifyTerm(), and transformExpr().
◆ SCIPgetConstantExprSum()
gets the constant of a summation expression
- Parameters
-
expr sum expression
Definition at line 1172 of file expr_sum.c.
References NULL, and SCIPexprGetData().
Referenced by createNlRow(), DECL_CURVCHECK(), detectExpr(), detectSocNorm(), detectSocQuadraticComplex(), detectSocQuadraticSimple(), enforceSP12(), eval(), fillGraphByNonlinearConss(), getFactorizedBinaryQuadraticExpr(), presolveImplint(), printRowNl(), readConstraints(), readObjective(), scaleConsSides(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLREVALAUX(), SCIPexprCheckQuadratic(), SCIPexprDismantle(), simplifyFactor(), simplifyTerm(), and transformExpr().
◆ SCIPgetCoefExprProduct()
gets the constant coefficient of a product expression
- Parameters
-
expr product expression
Definition at line 2146 of file expr_product.c.
References NULL, and SCIPexprGetData().
Referenced by DECL_CURVCHECK(), detectExpr(), eval(), getFeasiblePointsBilinear(), intevalBilinear(), isBinaryProduct(), printSignomial(), reversePropBilinear(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLREVALAUX(), SCIPexprCheckQuadratic(), SCIPexprDismantle(), and simplifyFactor().
◆ SCIPgetExponentExprPow()
gets the exponent of a power or signed power expression
- Parameters
-
expr expression
Definition at line 3343 of file expr_pow.c.
References NULL, and SCIPexprGetData().
Referenced by bilinearTermsInsertAll(), buildQuadExprMatrix(), checkAndCollectQuadratic(), DECL_CURVCHECK(), detectExpr(), detectMinors(), detectSocNorm(), detectSocQuadraticSimple(), eval(), evalSignPower(), isPackingCons(), mergeProductExprlist(), posintpower(), presolveSingleLockedVars(), printExpr(), printSignomial(), SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRBWFWDIFF(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRESTIMATE(), SCIP_DECL_EXPREVAL(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_EXPRINTEGRALITY(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_EXPRPRINT(), SCIP_DECL_EXPRREVERSEPROP(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_HASHKEYEQ(), SCIP_DECL_HASHKEYVAL(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLREVALAUX(), SCIPaddSquareSecant(), SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), and SCIPexprintCompile().
◆ SCIPexpriterIsInit()
SCIP_Bool SCIPexpriterIsInit | ( | SCIP_EXPRITER * | iterator | ) |
returns whether expression iterator is currently initialized
- Parameters
-
iterator expression iterator
Definition at line 475 of file expriter.c.
References SCIP_ExprIter::initialized, and NULL.
◆ SCIPexpriterInit()
SCIP_RETCODE SCIPexpriterInit | ( | SCIP_EXPRITER * | iterator, |
SCIP_EXPR * | expr, | ||
SCIP_EXPRITER_TYPE | type, | ||
SCIP_Bool | allowrevisit | ||
) |
initializes an expression iterator
- Note
- If
expr
is NULL, then iterator will be set into ended-state (SCIPexpriterIsEnd() is TRUE). Useful if following with SCIPexpriterRestartDFS().
If type is DFS, then stopstages
will be set to SCIP_EXPRITER_ENTEREXPR. Use SCIPexpriterSetStagesDFS
to change this.
- Parameters
-
iterator expression iterator expr expression of the iterator, can be NULL type type of expression iterator allowrevisit whether expression are allowed to be visited more than once
Definition at line 491 of file expriter.c.
References SCIP_ExprIter::curr, deinit(), SCIP_ExprIter::dfsstage, ensureStackSize(), SCIP_Stat::exprlastvisitedtag, SCIP_ExprIter::initialized, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, MINBFSSIZE, MINDFSSIZE, SCIP_Stat::nactiveexpriter, NULL, printBacktraces(), SCIP_ExprIter::queue, reverseTopologicalInsert(), SCIP_CALL, SCIP_EXPRITER_BFS, SCIP_EXPRITER_DFS, SCIP_EXPRITER_ENTEREXPR, SCIP_EXPRITER_MAXNACTIVE, SCIP_EXPRITER_RTOPOLOGIC, SCIP_MAXDEPTHLEVEL, SCIP_OKAY, SCIPerrorMessage, SCIPexpriterGetNext(), SCIPqueueClear(), SCIPqueueCreate(), SCIPqueueInsert(), SCIP_ExprIter::stat, SCIP_ExprIter::stopstages, storeBacktrace, SCIP_Stat::subscipdepth, TRUE, and SCIP_ExprIter::visitedtag.
Referenced by addExprViolScoresAuxVars(), addTightEstimatorCuts(), analyzeViolation(), bilinearTermsInsertAll(), canonicalizeConstraints(), collectBranchingCandidates(), collectLeafs(), computeGradient(), computeOffValues(), computeSymmetryGroup(), constructExpr(), createNlhdlrExprData(), deinitSolve(), detectMinors(), detectNlhdlrs(), enforceConstraints(), evalAndDiff(), exprIsNonSmooth(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), generateCut(), initSepa(), nlpAddNlRows(), nlpDelVarPos(), presolveBinaryProducts(), presolveSingleLockedVars(), printExpr(), processNlRow(), propagateLocks(), propConss(), propExprDomains(), registerBranchingCandidates(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_TABLEOUTPUT(), SCIPaddExprsViolScoreNonlinear(), SCIPaddNlRowGradientBenderscutOpt(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPcreateNlpiProblemFromNlRows(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprintCompile(), SCIPexprPrint(), SCIPexprPrintDot(), SCIPexprRelease(), SCIPexprSimplify(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPhashExpr(), SCIPmarkExprPropagateNonlinear(), SCIPnlpGetVarsNonlinearity(), SCIPnlpHasContinuousNonlinearity(), SCIPnlpiOracleDelVarSet(), SCIPnlpiOracleGetJacobianSparsity(), SCIPregisterExprUsageNonlinear(), SCIPreplaceCommonSubexpressions(), and updateVariableCounts().
◆ SCIPexpriterRestartDFS()
SCIP_EXPR* SCIPexpriterRestartDFS | ( | SCIP_EXPRITER * | iterator, |
SCIP_EXPR * | expr | ||
) |
restarts an already initialized expression iterator in DFS mode
The expression iterator will continue from the given expression, not revisiting expressions that this iterator has already been visited (if initialized with allowrevisit=FALSE
) and giving access to the same iterator specified expression data that may have been set already. Also the stop-stages are not reset.
If revisiting is forbidden and given expr has already been visited, then the iterator will behave as on the end of iteration (SCIPexpriterIsEnd() is TRUE). If the enterexpr stage is not one of the stop stages, then the iterator will be moved forward (SCIPexpriterGetNext() is called).
- Returns
- The current expression.
- Parameters
-
iterator expression iterator expr expression of the iterator
Definition at line 620 of file expriter.c.
References SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, SCIP_ExprIter::initialized, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, NULL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_ENTEREXPR, SCIPexpriterGetNext(), SCIP_ExprIter::stopstages, and SCIP_ExprIter::visitedtag.
Referenced by addTightEstimatorCuts(), analyzeViolation(), bilinearTermsInsertAll(), collectBranchingCandidates(), deinitSolve(), detectMinors(), detectNlhdlrs(), enforceConstraint(), forbidNonlinearVariablesMultiaggration(), hashExpr(), initSepa(), propExprDomains(), registerBranchingCandidates(), removeSingleLockedVars(), replaceBinaryProducts(), SCIPaddExprsViolScoreNonlinear(), SCIPnlpHasContinuousNonlinearity(), and SCIPnlpiOracleGetJacobianSparsity().
◆ SCIPexpriterSetStagesDFS()
void SCIPexpriterSetStagesDFS | ( | SCIP_EXPRITER * | iterator, |
SCIP_EXPRITER_STAGE | stopstages | ||
) |
specifies in which stages to stop a DFS iterator
Parameter stopstages
should be a bitwise OR of different SCIP_EXPRITER_STAGE values
If the current stage is not one of the stopstages
, then the iterator will be moved on.
- Parameters
-
iterator expression iterator stopstages the stages in which to stop when iterating via DFS
Definition at line 654 of file expriter.c.
References SCIP_ExprIter::dfsstage, NULL, SCIPexpriterGetNext(), and SCIP_ExprIter::stopstages.
Referenced by addTightEstimatorCuts(), bilinearTermsInsertAll(), collectLeafs(), computeSymmetryGroup(), constructExpr(), createNlhdlrExprData(), deinitSolve(), detectMinors(), evalAndDiff(), fillGraphByNonlinearConss(), forwardPropExpr(), presolveBinaryProducts(), presolveSingleLockedVars(), printExpr(), propagateLocks(), SCIP_DECL_CONSACTIVE(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprPrint(), SCIPexprRelease(), SCIPexprSimplify(), SCIPhashExpr(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexpriterGetCurrent()
SCIP_EXPR* SCIPexpriterGetCurrent | ( | SCIP_EXPRITER * | iterator | ) |
gets the current expression that the expression iterator points to
- Parameters
-
iterator expression iterator
Definition at line 673 of file expriter.c.
References SCIP_ExprIter::curr, and NULL.
Referenced by collectLeafs(), computeOffValues(), computeSymmetryGroup(), evalAndDiff(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), forwardPropExpr(), propagateLocks(), propConss(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_TABLEOUTPUT(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprintCompile(), SCIPexprRelease(), SCIPexprSimplify(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexpriterGetStageDFS()
SCIP_EXPRITER_STAGE SCIPexpriterGetStageDFS | ( | SCIP_EXPRITER * | iterator | ) |
gets the current stage that the expression iterator is in when using DFS
If the iterator has finished (SCIPexpriterIsEnd() is TRUE), then the stage is undefined.
- Parameters
-
iterator expression iterator
Definition at line 686 of file expriter.c.
References SCIP_ExprIter::dfsstage, SCIP_ExprIter::itertype, NULL, and SCIP_EXPRITER_DFS.
Referenced by computeSymmetryGroup(), fillGraphByNonlinearConss(), forwardPropExpr(), hashExpr(), printExpr(), propagateLocks(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprPrint(), SCIPexprRelease(), and SCIPexprSimplify().
◆ SCIPexpriterGetChildIdxDFS()
int SCIPexpriterGetChildIdxDFS | ( | SCIP_EXPRITER * | iterator | ) |
gets the index of the child that the expression iterator considers when in DFS mode and stage SCIP_EXPRITER_VISITINGCHILD or SCIP_EXPRITER_VISITEDCHILD
- Parameters
-
iterator expression iterator
Definition at line 697 of file expriter.c.
References SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, NULL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITEDCHILD, and SCIP_EXPRITER_VISITINGCHILD.
Referenced by collectLeafs(), printExpr(), propagateLocks(), replaceBinaryProducts(), SCIP_DECL_CONSACTIVE(), SCIPexprDismantle(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprPrint(), SCIPexprRelease(), SCIPexprSimplify(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexpriterGetChildExprDFS()
SCIP_EXPR* SCIPexpriterGetChildExprDFS | ( | SCIP_EXPRITER * | iterator | ) |
gets the child expression that the expression iterator considers when in DFS mode and stage SCIP_EXPRITER_VISITINGCHILD or SCIP_EXPRITER_VISITEDCHILD
- Parameters
-
iterator expression iterator
Definition at line 711 of file expriter.c.
References SCIP_Expr::children, SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, SCIP_Expr::nchildren, NULL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITEDCHILD, and SCIP_EXPRITER_VISITINGCHILD.
Referenced by collectLeafs(), constructExpr(), createNlhdlrExprData(), forwardPropExpr(), replaceBinaryProducts(), SCIP_DECL_CONSACTIVE(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprRelease(), SCIPexprSimplify(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexpriterGetParentDFS()
SCIP_EXPR* SCIPexpriterGetParentDFS | ( | SCIP_EXPRITER * | iterator | ) |
gives the parent of the current expression of an expression iteration if in DFS mode
- Returns
- the expression from which the current expression has been accessed
- Parameters
-
iterator expression iterator
Definition at line 730 of file expriter.c.
References SCIP_ExprIter::curr, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, NULL, and SCIP_EXPRITER_DFS.
Referenced by computeSymmetryGroup(), fillGraphByNonlinearConss(), printExpr(), and SCIPexprPrint().
◆ SCIPexpriterGetCurrentUserData()
SCIP_EXPRITER_USERDATA SCIPexpriterGetCurrentUserData | ( | SCIP_EXPRITER * | iterator | ) |
gives the iterator specific user data of the current expression
- Note
- The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
- Parameters
-
iterator expression iterator
Definition at line 746 of file expriter.c.
References SCIP_ExprIter::curr, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, and NULL.
Referenced by propagateLocks(), and SCIPexprCopy().
◆ SCIPexpriterGetChildUserDataDFS()
SCIP_EXPRITER_USERDATA SCIPexpriterGetChildUserDataDFS | ( | SCIP_EXPRITER * | iterator | ) |
gives the iterator specific user data of the current expressions current child
- Note
- The expression iterator mode must be in DFS mode and stage SCIP_EXPRITER_VISITINGCHILD or SCIP_EXPRITER_VISITEDCHILD
- Parameters
-
iterator expression iterator
Definition at line 761 of file expriter.c.
References SCIP_Expr::children, SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, SCIP_Expr::nchildren, NULL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITEDCHILD, and SCIP_EXPRITER_VISITINGCHILD.
Referenced by SCIPexprCopy(), and SCIPexprSimplify().
◆ SCIPexpriterGetExprUserData()
SCIP_EXPRITER_USERDATA SCIPexpriterGetExprUserData | ( | SCIP_EXPRITER * | iterator, |
SCIP_EXPR * | expr | ||
) |
gives the iterator specific user data of a given expression
- Note
- The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
- Parameters
-
iterator expression iterator expr expression for which to get the userdata of this iterator
Definition at line 780 of file expriter.c.
References SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, and NULL.
Referenced by hashExpr(), SCIP_DECL_HASHKEYVAL(), SCIPexprCopy(), SCIPexprSimplify(), and SCIPhashExpr().
◆ SCIPexpriterSetCurrentUserData()
void SCIPexpriterSetCurrentUserData | ( | SCIP_EXPRITER * | iterator, |
SCIP_EXPRITER_USERDATA | userdata | ||
) |
sets the iterator specific user data of the current expression for an expression iteration if in DFS mode
- Note
- The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
- Parameters
-
iterator expression iterator userdata data to be stored
Definition at line 796 of file expriter.c.
References SCIP_ExprIter::curr, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, and NULL.
Referenced by hashExpr(), propagateLocks(), SCIPexprCopy(), and SCIPexprSimplify().
◆ SCIPexpriterSetExprUserData()
void SCIPexpriterSetExprUserData | ( | SCIP_EXPRITER * | iterator, |
SCIP_EXPR * | expr, | ||
SCIP_EXPRITER_USERDATA | userdata | ||
) |
sets the iterator specific user data of a given expression
- Note
- The expression iterator mode must be DFS or another mode with allowrevisit=FALSE
- Parameters
-
iterator expression iterator expr expression where to set iterator data userdata data to be stored in current child
Definition at line 812 of file expriter.c.
References SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, and NULL.
◆ SCIPexpriterSetChildUserData()
void SCIPexpriterSetChildUserData | ( | SCIP_EXPRITER * | iterator, |
SCIP_EXPRITER_USERDATA | userdata | ||
) |
sets the iterator specific user data of the current expressions current child
- Note
- The expression iterator mode must be in DFS mode and stage SCIP_EXPRITER_VISITINGCHILD or SCIP_EXPRITER_VISITEDCHILD
- Parameters
-
iterator expression iterator userdata data to be stored in current child
Definition at line 828 of file expriter.c.
References SCIP_Expr::children, SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, SCIP_Expr::nchildren, NULL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITEDCHILD, and SCIP_EXPRITER_VISITINGCHILD.
Referenced by propagateLocks().
◆ SCIPexpriterGetNext()
SCIP_EXPR* SCIPexpriterGetNext | ( | SCIP_EXPRITER * | iterator | ) |
moves the iterator to the next expression according to the mode of the expression iterator
- Returns
- the next expression, if any, and NULL otherwise
- Parameters
-
iterator expression iterator
Definition at line 848 of file expriter.c.
References SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, doBfsNext(), doDfsNext(), doReverseTopologicalNext(), SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, NULL, SCIP_EXPRITER_BFS, SCIP_EXPRITER_DFS, SCIP_EXPRITER_MAXNACTIVE, SCIP_EXPRITER_RTOPOLOGIC, SCIP_ExprIter::stopstages, and SCIP_ExprIter::visitedtag.
Referenced by addExprViolScoresAuxVars(), addTightEstimatorCuts(), analyzeViolation(), bilinearTermsInsertAll(), canonicalizeConstraints(), collectBranchingCandidates(), collectLeafs(), computeGradient(), computeOffValues(), computeSymmetryGroup(), constructExpr(), createNlhdlrExprData(), deinitSolve(), detectMinors(), detectNlhdlrs(), enforceConstraint(), evalAndDiff(), exprIsNonSmooth(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), generateCut(), hashExpr(), initSepa(), nlpAddNlRows(), nlpDelVarPos(), printExpr(), processNlRow(), propagateLocks(), propConss(), propExprDomains(), registerBranchingCandidates(), removeSingleLockedVars(), replaceBinaryProducts(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_TABLEOUTPUT(), SCIPaddExprsViolScoreNonlinear(), SCIPaddNlRowGradientBenderscutOpt(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPcreateNlpiProblemFromNlRows(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprintCompile(), SCIPexpriterInit(), SCIPexpriterRestartDFS(), SCIPexpriterSetStagesDFS(), SCIPexpriterSkipDFS(), SCIPexprPrint(), SCIPexprPrintDot(), SCIPexprRelease(), SCIPexprSimplify(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPmarkExprPropagateNonlinear(), SCIPnlpGetVarsNonlinearity(), SCIPnlpHasContinuousNonlinearity(), SCIPnlpiOracleDelVarSet(), SCIPnlpiOracleGetJacobianSparsity(), SCIPregisterExprUsageNonlinear(), SCIPreplaceCommonSubexpressions(), and updateVariableCounts().
◆ SCIPexpriterSkipDFS()
SCIP_EXPR* SCIPexpriterSkipDFS | ( | SCIP_EXPRITER * | iterator | ) |
moves a DFS iterator to one of the next expressions
- If in SCIP_EXPRITER_ENTEREXPR stage, then all children of that expression will be skipped. If SCIP_EXPRITER_LEAVEEXPR is one of the
stopstages
, then it will be the next stage. Otherwise, the iterator will move further on (go to the parent, etc). - If in SCIP_EXPRITER_VISITINGCHILD stage, then the child that was going to be visited next will be skipped and the iterator will be moved on to the next child (if any).
- If in SCIP_EXPRITER_VISITEDCHILD stage, then all remaining children will be skipped and we move on to the SCIP_EXPRITER_LEAVEEXPR stage (if a stop stage, otherwise further on).
- It is not allowed to call this function when in SCIP_EXPRITER_LEAVEEXPR stage.
- Returns
- the next expression, if any, and NULL otherwise
- Parameters
-
iterator expression iterator
Definition at line 920 of file expriter.c.
References SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, doDfsNext(), SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, NULL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_ENTEREXPR, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITEDCHILD, SCIP_EXPRITER_VISITINGCHILD, SCIPABORT, SCIPerrorMessage, SCIPexpriterGetNext(), and SCIP_ExprIter::stopstages.
Referenced by constructExpr(), forwardPropExpr(), SCIPexprCopy(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprRelease(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexpriterIsEnd()
SCIP_Bool SCIPexpriterIsEnd | ( | SCIP_EXPRITER * | iterator | ) |
returns whether the iterator visited all expressions already
- Parameters
-
iterator expression iterator
Definition at line 959 of file expriter.c.
References SCIP_ExprIter::curr, and NULL.
Referenced by addExprViolScoresAuxVars(), addTightEstimatorCuts(), analyzeViolation(), bilinearTermsInsertAll(), canonicalizeConstraints(), collectBranchingCandidates(), collectLeafs(), computeGradient(), computeOffValues(), computeSymmetryGroup(), constructExpr(), createNlhdlrExprData(), deinitSolve(), detectMinors(), detectNlhdlrs(), enforceConstraint(), evalAndDiff(), exprIsNonSmooth(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), generateCut(), hashExpr(), initSepa(), nlpAddNlRows(), nlpDelVarPos(), printExpr(), processNlRow(), propagateLocks(), propConss(), propExprDomains(), registerBranchingCandidates(), removeSingleLockedVars(), replaceBinaryProducts(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_TABLEOUTPUT(), SCIPaddExprsViolScoreNonlinear(), SCIPaddNlRowGradientBenderscutOpt(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPcreateNlpiProblemFromNlRows(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprintCompile(), SCIPexprPrint(), SCIPexprPrintDot(), SCIPexprRelease(), SCIPexprSimplify(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPmarkExprPropagateNonlinear(), SCIPnlpGetVarsNonlinearity(), SCIPnlpHasContinuousNonlinearity(), SCIPnlpiOracleDelVarSet(), SCIPnlpiOracleGetJacobianSparsity(), SCIPregisterExprUsageNonlinear(), SCIPreplaceCommonSubexpressions(), and updateVariableCounts().
◆ SCIPexprcurvAdd()
SCIP_EXPRCURV SCIPexprcurvAdd | ( | SCIP_EXPRCURV | curv1, |
SCIP_EXPRCURV | curv2 | ||
) |
gives curvature for a sum of two functions with given curvature
- Parameters
-
curv1 curvature of first summand curv2 curvature of second summand
Definition at line 43 of file exprcurv.c.
◆ SCIPexprcurvNegate()
SCIP_EXPRCURV SCIPexprcurvNegate | ( | SCIP_EXPRCURV | curvature | ) |
gives the curvature for the negation of a function with given curvature
- Parameters
-
curvature curvature of function
Definition at line 52 of file exprcurv.c.
References SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIPABORT, and SCIPerrorMessage.
Referenced by SCIP_DECL_EXPRCURVATURE(), SCIPexprcurvMonomial(), SCIPexprcurvMonomialInv(), and SCIPexprcurvMultiply().
◆ SCIPexprcurvMultiply()
SCIP_EXPRCURV SCIPexprcurvMultiply | ( | SCIP_Real | factor, |
SCIP_EXPRCURV | curvature | ||
) |
gives curvature for a functions with given curvature multiplied by a constant factor
- Parameters
-
factor constant factor curvature curvature of other factor
Definition at line 78 of file exprcurv.c.
References SCIP_EXPRCURV_LINEAR, and SCIPexprcurvNegate().
Referenced by DECL_CURVCHECK(), SCIP_DECL_EXPRCURVATURE(), and SCIPexprcurvMonomial().
◆ SCIPexprcurvPower()
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
- Parameters
-
basebounds bounds on base function basecurv curvature of base function exponent exponent
Definition at line 91 of file exprcurv.c.
References EPSISINT, SCIP_Interval::inf, SCIP_Bool, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_Real, SCIPexprcurvPower(), SCIPintervalSetBounds(), and SCIP_Interval::sup.
Referenced by SCIPexprcurvMonomial(), and SCIPexprcurvPower().
◆ SCIPexprcurvPowerInv()
SCIP_EXPRCURV SCIPexprcurvPowerInv | ( | SCIP_INTERVAL | basebounds, |
SCIP_Real | exponent, | ||
SCIP_EXPRCURV | powercurv | ||
) |
gives required curvature for base so that base^exponent has given curvature under given bounds on base and constant exponent
returns curvature unknown if expected curvature cannot be obtained
- Parameters
-
basebounds bounds on base function exponent exponent, must not be 0 powercurv expected curvature for power
Definition at line 199 of file exprcurv.c.
References EPSISINT, SCIP_Interval::inf, SCIP_Bool, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_Real, SCIPexprcurvPowerInv(), SCIPintervalSetBounds(), and SCIP_Interval::sup.
Referenced by SCIP_DECL_EXPRCURVATURE(), SCIPexprcurvMonomialInv(), and SCIPexprcurvPowerInv().
◆ SCIPexprcurvMonomial()
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.
Exponents can also be negative or rational.
- Parameters
-
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 321 of file exprcurv.c.
References EPSGE, EPSISINT, EPSLE, FALSE, SCIP_Interval::inf, NULL, SCIP_Bool, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_Real, SCIPexprcurvMultiply(), SCIPexprcurvNegate(), SCIPexprcurvPower(), SCIP_Interval::sup, and TRUE.
◆ SCIPexprcurvMonomialInv()
SCIP_Bool SCIPexprcurvMonomialInv | ( | SCIP_EXPRCURV | monomialcurv, |
int | nfactors, | ||
SCIP_Real * | exponents, | ||
SCIP_INTERVAL * | factorbounds, | ||
SCIP_EXPRCURV * | factorcurv | ||
) |
for a monomial with given bounds for each factor, gives condition on the curvature of each factor, so that monomial has a requested curvature, if possible
- Returns
- whether
monomialcurv
can be achieved
- Parameters
-
monomialcurv desired curvature nfactors number of factors in monomial exponents exponents in monomial, or NULL if all 1.0 factorbounds bounds of each factor factorcurv buffer to store required curvature of each factor
Definition at line 447 of file exprcurv.c.
References EPSGE, EPSISINT, EPSLE, FALSE, SCIP_Interval::inf, NULL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_Real, SCIPexprcurvNegate(), SCIPexprcurvPowerInv(), SCIP_Interval::sup, and TRUE.
Referenced by DECL_CURVCHECK().
◆ SCIPexprcurvGetName()
const char* SCIPexprcurvGetName | ( | SCIP_EXPRCURV | curv | ) |
gives name as string for a curvature
- Parameters
-
curv curvature
Definition at line 576 of file exprcurv.c.
References curvnames, and SCIP_EXPRCURV_LINEAR.
Referenced by createNlhdlrExprData(), and DECL_CURVCHECK().
◆ SCIPcreateExpr()
SCIP_RETCODE SCIPcreateExpr | ( | SCIP * | scip, |
SCIP_EXPR ** | expr, | ||
SCIP_EXPRHDLR * | exprhdlr, | ||
SCIP_EXPRDATA * | exprdata, | ||
int | nchildren, | ||
SCIP_EXPR ** | children, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
creates and captures an expression with given expression data and children
- Parameters
-
scip SCIP data structure expr pointer where to store expression exprhdlr expression handler exprdata expression data (expression assumes ownership) nchildren number of children children children (can be NULL if nchildren is 0) ownercreatedata data to pass to ownercreate
Definition at line 964 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprCreate(), and Scip::set.
Referenced by SCIPcreateExpr2(), SCIPcreateExprAbs(), SCIPcreateExprCos(), SCIPcreateExprEntropy(), SCIPcreateExprErf(), SCIPcreateExprExp(), SCIPcreateExprLog(), SCIPcreateExprPow(), SCIPcreateExprProduct(), SCIPcreateExprSignpower(), SCIPcreateExprSin(), SCIPcreateExprSum(), SCIPcreateExprValue(), SCIPcreateExprVar(), and SCIPcreateExprVaridx().
◆ SCIPcreateExpr2()
SCIP_RETCODE SCIPcreateExpr2 | ( | SCIP * | scip, |
SCIP_EXPR ** | expr, | ||
SCIP_EXPRHDLR * | exprhdlr, | ||
SCIP_EXPRDATA * | exprdata, | ||
SCIP_EXPR * | child1, | ||
SCIP_EXPR * | child2, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
creates and captures an expression with given expression data and up to two children
- Parameters
-
scip SCIP data structure expr pointer where to store expression exprhdlr expression handler exprdata expression data child1 first child (can be NULL) child2 second child (can be NULL) ownercreatedata data to pass to ownercreate
Definition at line 985 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, and SCIPcreateExpr().
◆ SCIPcreateExprQuadratic()
SCIP_RETCODE SCIPcreateExprQuadratic | ( | SCIP * | scip, |
SCIP_EXPR ** | expr, | ||
int | nlinvars, | ||
SCIP_VAR ** | linvars, | ||
SCIP_Real * | lincoefs, | ||
int | nquadterms, | ||
SCIP_VAR ** | quadvars1, | ||
SCIP_VAR ** | quadvars2, | ||
SCIP_Real * | quadcoefs, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
creates and captures an expression representing a quadratic function
- Parameters
-
scip SCIP data structure expr pointer where to store expression nlinvars number of linear terms linvars array with variables in linear part lincoefs array with coefficients of variables in linear part nquadterms number of quadratic terms quadvars1 array with first variables in quadratic terms quadvars2 array with second variables in quadratic terms quadcoefs array with coefficients of quadratic terms ownercreatedata data to pass to ownercreate
Definition at line 1023 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPcreateExprPow(), SCIPcreateExprProduct(), SCIPcreateExprSum(), SCIPcreateExprVar(), SCIPfreeBufferArray, and SCIPreleaseExpr().
Referenced by createConstraint(), readExpression(), and SCIPcreateConsQuadraticNonlinear().
◆ SCIPcreateExprMonomial()
SCIP_RETCODE SCIPcreateExprMonomial | ( | SCIP * | scip, |
SCIP_EXPR ** | expr, | ||
int | nfactors, | ||
SCIP_VAR ** | vars, | ||
SCIP_Real * | exponents, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
creates and captures an expression representing a monomial
- Note
- In deviation from the actual definition of monomials, we also allow for negative and rational exponents. So this function actually creates an expression for a signomial that has exactly one term.
- Parameters
-
scip SCIP data structure expr pointer where to store expression nfactors number of factors in monomial vars variables in the monomial exponents exponent in each factor, or NULL if all 1.0 ownercreatedata data to pass to ownercreate
Definition at line 1131 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPcreateExprPow(), SCIPcreateExprProduct(), SCIPcreateExprValue(), SCIPcreateExprVar(), SCIPfreeBufferArray, and SCIPreleaseExpr().
Referenced by readPolynomial().
◆ SCIPappendExprChild()
SCIP_RETCODE SCIPappendExprChild | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_EXPR * | child | ||
) |
appends child to the children list of expr
- Attention
- Only use if you really know what you are doing. The expression handler of the expression needs to be able to handle an increase in the number of children.
- Parameters
-
scip SCIP data structure expr expression child expression to be appended
Definition at line 1220 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprAppendChild(), and Scip::set.
Referenced by DECL_CURVCHECK(), nlhdlrExprGrowChildren(), parseTerm(), SCIP_DECL_EXPRSIMPLIFY(), SCIPappendExprSumExpr(), and simplifyTerm().
◆ SCIPreplaceExprChild()
SCIP_RETCODE SCIPreplaceExprChild | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
int | childidx, | ||
SCIP_EXPR * | newchild | ||
) |
overwrites/replaces a child of an expressions
The old child is released and the newchild is captured, unless they are the same (=same pointer).
- Parameters
-
scip SCIP data structure expr expression which is going to replace a child childidx index of child being replaced newchild the new child
Definition at line 1238 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprReplaceChild(), Scip::set, and Scip::stat.
Referenced by collectLeafs(), replaceBinaryProducts(), SCIP_DECL_CONSACTIVE(), SCIPreplaceCommonSubexpressions(), and simplifyTerm().
◆ SCIPremoveExprChildren()
SCIP_RETCODE SCIPremoveExprChildren | ( | SCIP * | scip, |
SCIP_EXPR * | expr | ||
) |
remove all children of expr
- Attention
- Only use if you really know what you are doing. The expression handler of the expression needs to be able to handle the removal of all children.
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1257 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprRemoveChildren(), Scip::set, and Scip::stat.
Referenced by constructExpr().
◆ SCIPduplicateExpr()
SCIP_RETCODE SCIPduplicateExpr | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_EXPR ** | copyexpr, | ||
SCIP_DECL_EXPR_MAPEXPR((*mapexpr)) | , | ||
void * | mapexprdata, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
duplicates the given expression and its children
- Parameters
-
scip SCIP data structure expr original expression copyexpr buffer to store duplicate of expr mapexprdata data of expression mapping function ownercreatedata data to pass to ownercreate
Definition at line 1271 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprCopy(), Scip::set, and Scip::stat.
Referenced by createCons(), SCIP_DECL_CONSTRANS(), SCIP_DECL_EXPRSIMPLIFY(), SCIPaddExprNonlinear(), SCIPaddNlpiProblemNlRows(), SCIPchgExprNonlinear(), SCIPcreateNlpiProblemFromNlRows(), and SCIPwritePip().
◆ SCIPduplicateExprShallow()
SCIP_RETCODE SCIPduplicateExprShallow | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_EXPR ** | copyexpr, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
duplicates the given expression, but reuses its children
- Parameters
-
scip SCIP data structure expr original expression copyexpr buffer to store (shallow) duplicate of expr ownercreatedata data to pass to ownercreate
Definition at line 1291 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprDuplicateShallow(), and Scip::set.
Referenced by nlhdlrExprCreate().
◆ SCIPcopyExpr()
SCIP_RETCODE SCIPcopyExpr | ( | SCIP * | sourcescip, |
SCIP * | targetscip, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPR ** | copyexpr, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata, | ||
SCIP_HASHMAP * | varmap, | ||
SCIP_HASHMAP * | consmap, | ||
SCIP_Bool | global, | ||
SCIP_Bool * | valid | ||
) |
copies an expression including children to use in a (possibly different) SCIP instance
- Parameters
-
sourcescip source SCIP data structure targetscip target SCIP data structure expr original expression copyexpr buffer to store duplicate of expr ownercreatedata data to pass to ownercreate varmap a SCIP_HASHMAP mapping variables of the source SCIP to the corresponding variables of the target SCIP, or NULL consmap a hashmap to store the mapping of source constraints to the corresponding target constraints, or NULL global create a global or a local copy? valid pointer to store whether all checked or enforced constraints were validly copied
Definition at line 1308 of file scip_expr.c.
References COPY_MAPEXPR_DATA::consmap, COPY_MAPEXPR_DATA::global, Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprCopy(), Scip::set, Scip::stat, TRUE, COPY_MAPEXPR_DATA::valid, and COPY_MAPEXPR_DATA::varmap.
Referenced by SCIP_DECL_CONSCOPY().
◆ SCIPparseExpr()
SCIP_RETCODE SCIPparseExpr | ( | SCIP * | scip, |
SCIP_EXPR ** | expr, | ||
const char * | exprstr, | ||
const char ** | finalpos, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
creates an expression from a string
We specify the grammar that defines the syntax of an expression. Loosely speaking, a Base
will be any "block", a Factor
is a Base
to a power, a Term
is a product of Factors
and an Expression
is a sum of Terms
.
The actual definition:
Expression -> ["+" | "-"] Term { ("+" | "-" | "number *") ] Term } Term -> Factor { ("*" | "/" ) Factor } Factor -> Base [ "^" "number" | "^(" "number" ")" ] Base -> "number" | "<varname>" | "(" Expression ")" | Op "(" OpExpression ")
where [a|b]
means a
or b
or none, (a|b)
means a
or b
, {a}
means 0 or more a
.
Note that Op
and OpExpression
are undefined. Op
corresponds to the name of an expression handler and OpExpression
to whatever string the expression handler accepts (through its parse method).
- Parameters
-
scip SCIP data structure expr pointer to store the expr parsed exprstr string with the expr to parse finalpos buffer to store the position of exprstr where we finished reading, or NULL if not of interest ownercreatedata data to pass to ownercreate
Definition at line 1370 of file scip_expr.c.
References NULL, parseExpr(), SCIP_CALL, SCIPblkmem(), SCIPgetNVars(), SCIPhashmapCreate(), and SCIPhashmapFree().
Referenced by SCIP_DECL_CONSPARSE(), and SCIP_DECL_EXPRPARSE().
◆ SCIPcaptureExpr()
void SCIPcaptureExpr | ( | SCIP_EXPR * | expr | ) |
captures an expression (increments usage count)
- Parameters
-
expr expression to be captured
Definition at line 1399 of file scip_expr.c.
References SCIPexprCapture().
Referenced by createCons(), createConstraint(), createExprNode(), createExprVar(), enforceSP10(), exprdataCreate(), getBinaryProductExpr(), nlhdlrExprCreate(), readExpression(), scaleConsSides(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIPgetExprVarExprs(), and SCIPnlpiOracleChgExpr().
◆ SCIPreleaseExpr()
SCIP_RETCODE SCIPreleaseExpr | ( | SCIP * | scip, |
SCIP_EXPR ** | expr | ||
) |
releases an expression (decrements usage count and possibly frees expression)
- Parameters
-
scip SCIP data structure expr pointer to expression to be released
Definition at line 1407 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprRelease(), Scip::set, and Scip::stat.
Referenced by addNlrow(), addRegularScholtes(), AMPLProblemHandler::LinearExprHandler::AddTerm(), buildSimplifiedProduct(), canonicalizeConstraints(), checkSymmetriesAreSymmetries(), AMPLProblemHandler::cleanup(), collectLeafs(), computeOffValues(), constructExpr(), createConstraint(), createNlRow(), createSOCExpression(), enforceSP10(), enforceSP11(), enforceSP12(), exprdataFree(), freeConstraint(), freeExprNode(), freeVarExprs(), getBinaryProductExpr(), getFactorizedBinaryQuadraticExpr(), mergeProductExprlist(), nlhdlrExprGrowChildren(), AMPLProblemHandler::OnBinary(), AMPLProblemHandler::OnHeader(), AMPLProblemHandler::OnUnary(), parseBase(), parseExpr(), parseFactor(), parseTerm(), presolveBinaryProducts(), readConstraints(), readExpression(), readObjective(), readPolynomial(), replaceBinaryProducts(), scaleConsSides(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSDELETE(), SCIP_DECL_CONSINITSOL(), SCIP_DECL_CONSPARSE(), SCIP_DECL_CONSTRANS(), SCIP_DECL_EXPRPARSE(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRFREEEXPRDATA(), SCIP_DECL_READERREAD(), SCIPaddBilinTermQuadratic(), SCIPaddExprNonlinear(), SCIPaddLinearVarNonlinear(), SCIPaddNlpiProblemNlRows(), SCIPaddQuadVarQuadratic(), SCIPaddSquareCoefQuadratic(), SCIPchgExprNonlinear(), SCIPcreateConsBasicSignpowerNonlinear(), SCIPcreateConsBasicSOC(), SCIPcreateConsBasicSOCNonlinear(), SCIPcreateConsQuadraticNonlinear(), SCIPcreateConsSOC(), SCIPcreateExprMonomial(), SCIPcreateExprQuadratic(), SCIPcreateNlpiProblemFromNlRows(), SCIPhasExprCurvature(), SCIPnlpiOracleChgExpr(), SCIPnlpiOracleDelVarSet(), SCIPreplaceCommonSubexpressions(), SCIPwritePip(), setQuadraticObj(), setupProblem(), and simplifyTerm().
◆ SCIPisExprVar()
returns whether an expression is a variable expression
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1421 of file scip_expr.c.
References NULL, SCIPexprIsVar(), and Scip::set.
Referenced by analyzeViolation(), buildQuadExprMatrix(), catchVarEvent(), catchVarEvents(), checkAndCollectQuadratic(), collectLeafs(), computeGradient(), computeOffValues(), computeSymmetryGroup(), constructExpr(), createAuxVar(), createNlRow(), detectSocNorm(), detectSocQuadraticSimple(), doSeachEcAggr(), dropVarEvent(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), findUnlockedLinearVar(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), generateCut(), isBinaryProduct(), isCandidate(), isExprSignomial(), isPackingCons(), isSingleLockedCand(), nlrowaggrCreate(), presolveAddKKTQuadBilinearTerms(), presolveAddKKTQuadLinearTerms(), presolveAddKKTQuadQuadraticTerms(), presolveImplint(), presolveRedundantConss(), presolveSingleLockedVars(), printExpr(), printRow(), printSignomial(), processNlRow(), propagateLocks(), readConstraints(), readObjective(), removeSingleLockedVars(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_EVENTEXEC(), SCIP_DECL_EXPR_MAPEXPR(), SCIP_DECL_EXPR_OWNERCREATE(), SCIP_DECL_EXPR_OWNERFREE(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIPaddExprsViolScoreNonlinear(), SCIPaddExprViolScoreNonlinear(), SCIPaddNlRowGradientBenderscutOpt(), SCIPexprintCompile(), SCIPgetExprPartialDiffGradientDirNonlinear(), SCIPgetExprPartialDiffNonlinear(), SCIPisSOCNonlinear(), SCIPmarkExprPropagateNonlinear(), SCIPregisterExprUsageNonlinear(), and SCIPwriteMps().
◆ SCIPisExprValue()
returns whether an expression is a value expression
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1432 of file scip_expr.c.
References NULL, SCIPexprIsValue(), and Scip::set.
Referenced by canonicalizeConstraints(), computeSymmetryGroup(), constructExpr(), createAuxVar(), eval(), fillGraphByNonlinearConss(), isExprSignomial(), mergeProductExprlist(), AMPLProblemHandler::OnBinary(), AMPLProblemHandler::OnObj(), presolveRedundantConss(), printExpr(), printSignomial(), readExpression(), SCIP_DECL_EXPRBWDIFF(), SCIP_DECL_EXPRBWFWDIFF(), SCIP_DECL_EXPRFWDIFF(), SCIP_DECL_EXPRSIMPLIFY(), SCIPexprintCompile(), SCIPgetExprPartialDiffGradientDirNonlinear(), SCIPgetExprPartialDiffNonlinear(), simplifyFactor(), and simplifyTerm().
◆ SCIPisExprSum()
returns whether an expression is a sum expression
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1443 of file scip_expr.c.
References NULL, SCIPexprIsSum(), and Scip::set.
Referenced by addTightEstimatorCuts(), computeOffValues(), computeSymmetryGroup(), constructExpr(), createConstraint(), createNlRow(), DECL_CURVCHECK(), detectExpr(), detectSocNorm(), detectSocQuadraticComplex(), detectSocQuadraticSimple(), enforceSP12(), eval(), exprIsMultivarLinear(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), findUnlockedLinearVar(), forbidNonlinearVariablesMultiaggration(), getBilinearBinaryTerms(), getFactorizedBinaryQuadraticExpr(), isExprPolynomial(), isPackingCons(), presolveImplint(), presolveSingleLockedVars(), printExpr(), printRowNl(), scaleConsSides(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_NLHDLRINITSEPA(), SCIPaddExprNonlinear(), SCIPaddLinearVarNonlinear(), SCIPappendExprSumExpr(), SCIPexprintCompile(), simplifyFactor(), simplifyTerm(), and transformExpr().
◆ SCIPisExprProduct()
returns whether an expression is a product expression
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1454 of file scip_expr.c.
References NULL, SCIPexprIsProduct(), and Scip::set.
Referenced by bilinearTermsInsertAll(), buildQuadExprMatrix(), checkAndCollectQuadratic(), DECL_CURVCHECK(), detectExpr(), detectMinors(), detectSocQuadraticSimple(), eval(), getBinaryProductExprDo(), isBinaryProduct(), isExprSignomial(), isPackingCons(), presolveSingleLockedVars(), printExpr(), printSignomial(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLREVALAUX(), SCIPexprintCompile(), simplifyFactor(), and simplifyTerm().
◆ SCIPisExprPower()
returns whether an expression is a power expression
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1465 of file scip_expr.c.
References NULL, SCIPexprIsPower(), and Scip::set.
Referenced by bilinearTermsInsertAll(), buildQuadExprMatrix(), checkAndCollectQuadratic(), DECL_CURVCHECK(), detectExpr(), detectMinors(), detectSocNorm(), detectSocQuadraticSimple(), eval(), isExprSignomial(), isPackingCons(), mergeProductExprlist(), presolveSingleLockedVars(), printExpr(), printSignomial(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_HASHKEYEQ(), SCIP_DECL_HASHKEYVAL(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLREVALAUX(), and SCIPexprintCompile().
◆ SCIPprintExpr()
SCIP_RETCODE SCIPprintExpr | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
FILE * | file | ||
) |
print an expression as info-message
- Parameters
-
scip SCIP data structure expr expression to be printed file file to print to, or NULL for stdout
Definition at line 1476 of file scip_expr.c.
References Scip::mem, Scip::messagehdlr, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprPrint(), Scip::set, and Scip::stat.
Referenced by addTightEstimatorCuts(), analyzeViolation(), constructExpr(), createNlhdlrExprData(), DECL_CURVCHECK(), detectExpr(), detectSocNorm(), detectSocQuadraticComplex(), detectSocQuadraticSimple(), enforceConstraint(), enforceExpr(), enforceSP12(), estimateConvexSecant(), estimateGradient(), estimateVertexPolyhedral(), forwardPropExpr(), generateIntercut(), printFunction(), propagateBoundsLinExpr(), propagateBoundsQuadExpr(), readPolynomial(), reversePropQueue(), SCIP_DECL_CONSPRINT(), SCIP_DECL_EXPRINITESTIMATES(), SCIP_DECL_EXPRINTEVAL(), SCIP_DECL_EXPRREVERSEPROP(), SCIP_DECL_EXPRSIMPLIFY(), SCIP_DECL_NLHDLRDETECT(), SCIP_DECL_NLHDLRENFO(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLRINITSEPA(), SCIP_DECL_NLHDLRINTEVAL(), SCIPexprEvalActivity(), SCIPexprintGrad(), SCIPexprintHessian(), SCIPexprintHessianSparsity(), SCIPprintExprQuadratic(), SCIPtightenExprIntervalNonlinear(), and simplifyMultiplyChildren().
◆ SCIPprintExprDotInit()
SCIP_RETCODE SCIPprintExprDotInit | ( | SCIP * | scip, |
SCIP_EXPRPRINTDATA ** | printdata, | ||
FILE * | file, | ||
SCIP_EXPRPRINT_WHAT | whattoprint | ||
) |
initializes printing of expressions in dot format to a give FILE* pointer
- Parameters
-
scip SCIP data structure printdata buffer to store dot printing data file file to print to, or NULL for stdout whattoprint info on what to print for each expression
Definition at line 1491 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprPrintDotInit(), Scip::set, and Scip::stat.
Referenced by SCIPshowExpr().
◆ SCIPprintExprDotInit2()
SCIP_RETCODE SCIPprintExprDotInit2 | ( | SCIP * | scip, |
SCIP_EXPRPRINTDATA ** | printdata, | ||
const char * | filename, | ||
SCIP_EXPRPRINT_WHAT | whattoprint | ||
) |
initializes printing of expressions in dot format to a file with given filename
- Parameters
-
scip SCIP data structure printdata buffer to store dot printing data filename name of file to print to whattoprint info on what to print for each expression
Definition at line 1507 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprPrintDotInit2(), Scip::set, and Scip::stat.
◆ SCIPprintExprDot()
SCIP_RETCODE SCIPprintExprDot | ( | SCIP * | scip, |
SCIP_EXPRPRINTDATA * | printdata, | ||
SCIP_EXPR * | expr | ||
) |
main part of printing an expression in dot format
- Parameters
-
scip SCIP data structure printdata data as initialized by SCIPprintExprDotInit() expr expression to be printed
Definition at line 1523 of file scip_expr.c.
References Scip::messagehdlr, NULL, SCIP_CALL, SCIP_OKAY, SCIPexprPrintDot(), and Scip::set.
Referenced by SCIPshowExpr().
◆ SCIPprintExprDotFinal()
SCIP_RETCODE SCIPprintExprDotFinal | ( | SCIP * | scip, |
SCIP_EXPRPRINTDATA ** | printdata | ||
) |
finishes printing of expressions in dot format
- Parameters
-
scip SCIP data structure printdata buffer where dot printing data has been stored
Definition at line 1537 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprPrintDotFinal(), Scip::set, and Scip::stat.
Referenced by SCIPshowExpr().
◆ SCIPshowExpr()
SCIP_RETCODE SCIPshowExpr | ( | SCIP * | scip, |
SCIP_EXPR * | expr | ||
) |
shows a single expression by use of dot and gv
This function is meant for debugging purposes. It's signature is kept as simple as possible to make it easily callable from gdb, for example.
It prints the expression into a temporary file in dot format, then calls dot to create a postscript file, then calls ghostview (gv) to show the file. SCIP will hold until ghostscript is closed.
- Parameters
-
scip SCIP data structure expr expression to be printed
Definition at line 1559 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_ERROR, SCIP_EXPRPRINT_ALL, SCIP_FILECREATEERROR, SCIP_OKAY, SCIPerrorMessage, SCIPprintExprDot(), SCIPprintExprDotFinal(), and SCIPprintExprDotInit().
◆ SCIPdismantleExpr()
SCIP_RETCODE SCIPdismantleExpr | ( | SCIP * | scip, |
FILE * | file, | ||
SCIP_EXPR * | expr | ||
) |
prints structure of an expression a la Maple's dismantle
- Parameters
-
scip SCIP data structure file file to print to, or NULL for stdout expr expression to dismantle
Definition at line 1596 of file scip_expr.c.
References Scip::mem, Scip::messagehdlr, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprDismantle(), Scip::set, and Scip::stat.
Referenced by detectSocQuadraticComplex(), and SCIP_DECL_EXPRESTIMATE().
◆ SCIPevalExpr()
SCIP_RETCODE SCIPevalExpr | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_SOL * | sol, | ||
SCIP_Longint | soltag | ||
) |
evaluate an expression in a point
Iterates over expressions to also evaluate children, if necessary. Value can be received via SCIPexprGetEvalValue(). If an evaluation error (division by zero, ...) occurs, this value will be set to SCIP_INVALID.
If a nonzero soltag
is passed, then only (sub)expressions are reevaluated that have a different solution tag. If a soltag of 0 is passed, then subexpressions are always reevaluated. The tag is stored together with the value and can be received via SCIPexprGetEvalTag().
- Parameters
-
scip SCIP data structure expr expression to be evaluated sol solution to be evaluated soltag tag that uniquely identifies the solution (with its values), or 0.
Definition at line 1623 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprEval(), Scip::set, and Scip::stat.
Referenced by addTightEstimatorCuts(), computeOffValues(), computeViolation(), enforceExpr(), estimateConvexSecant(), initSepa(), SCIP_DECL_NLHDLREVALAUX(), SCIP_DECL_VERTEXPOLYFUN(), SCIPexprintEval(), and SCIPgetExprAbsOrigViolationNonlinear().
◆ SCIPgetExprNewSoltag()
SCIP_Longint SCIPgetExprNewSoltag | ( | SCIP * | scip | ) |
returns a previously unused solution tag for expression evaluation
- Parameters
-
scip SCIP data structure
Definition at line 1640 of file scip_expr.c.
References SCIP_Stat::exprlastsoltag, NULL, and Scip::stat.
Referenced by addTightEstimatorCuts(), consEnfo(), consSepa(), SCIP_DECL_CONSCHECK(), and SCIP_DECL_CONSENFOPS().
◆ SCIPevalExprGradient()
SCIP_RETCODE SCIPevalExprGradient | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_SOL * | sol, | ||
SCIP_Longint | soltag | ||
) |
evaluates gradient of an expression for a given point
Initiates an expression walk to also evaluate children, if necessary. Value can be received via SCIPgetExprPartialDiffNonlinear(). If an error (division by zero, ...) occurs, this value will be set to SCIP_INVALID.
- Parameters
-
scip SCIP data structure expr expression to be differentiated sol solution to be evaluated (NULL for the current LP solution) soltag tag that uniquely identifies the solution (with its values), or 0.
Definition at line 1656 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprEvalGradient(), Scip::set, and Scip::stat.
Referenced by computeGradient(), estimateGradient(), generateCut(), getConsRelViolation(), and SCIPaddNlRowGradientBenderscutOpt().
◆ SCIPevalExprHessianDir()
SCIP_RETCODE SCIPevalExprHessianDir | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_SOL * | sol, | ||
SCIP_Longint | soltag, | ||
SCIP_SOL * | direction | ||
) |
evaluates Hessian-vector product of an expression for a given point and direction
Evaluates children, if necessary. Value can be received via SCIPgetExprPartialDiffGradientDirNonlinear(). If an error (division by zero, ...) occurs, this value will be set to SCIP_INVALID.
- Parameters
-
scip SCIP data structure expr expression to be differentiated sol solution to be evaluated (NULL for the current LP solution) soltag tag that uniquely identifies the solution (with its values), or 0. direction direction
Definition at line 1678 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprEvalHessianDir(), Scip::set, and Scip::stat.
◆ SCIPevalExprActivity()
SCIP_RETCODE SCIPevalExprActivity | ( | SCIP * | scip, |
SCIP_EXPR * | expr | ||
) |
possibly reevaluates and then returns the activity of the expression
Reevaluate activity if currently stored is no longer uptodate (some bound was changed since last evaluation).
The owner of the expression may overwrite the methods used to evaluate the activity, including whether the local or global domain of variables is used. By default (no owner, or owner doesn't overwrite activity evaluation), the local domain of variables is used.
- Note
- If expression is set to be integral, then activities are tightened to integral values. Thus, ensure that the integrality information is valid (if set to TRUE; the default (FALSE) is always ok).
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1706 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprEvalActivity(), Scip::set, and Scip::stat.
Referenced by checkSubproblemConvexity(), DECL_CURVCHECK(), deinitSolve(), detectSocQuadraticComplex(), detectSocQuadraticSimple(), estimateBivariateQuotient(), estimateUnivariateQuotient(), initSepa(), SCIP_DECL_EXPRCURVATURE(), SCIP_DECL_EXPRMONOTONICITY(), SCIP_DECL_NLHDLRESTIMATE(), SCIP_DECL_NLHDLRINITSEPA(), SCIPregisterExprUsageNonlinear(), and tryFillNlhdlrExprDataQuad().
◆ SCIPcompareExpr()
compare expressions
- Returns
- -1, 0 or 1 if expr1 <, =, > expr2, respectively
- Note
- The given expressions are assumed to be simplified.
- Parameters
-
scip SCIP data structure expr1 first expression expr2 second expression
Definition at line 1723 of file scip_expr.c.
References NULL, SCIPexprCompare(), and Scip::set.
Referenced by checkSymmetriesAreSymmetries(), DECL_CURVCHECK(), enforceSP11(), mergeProductExprlist(), SCIP_DECL_EXPRCOMPARE(), SCIP_DECL_EXPRSIMPLIFY(), and SCIP_DECL_SORTINDCOMP().
◆ SCIPhashExpr()
SCIP_RETCODE SCIPhashExpr | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
unsigned int * | hashval | ||
) |
compute the hash value of an expression
- Parameters
-
scip SCIP data structure expr expression hashval pointer to store the hash value
Definition at line 1735 of file scip_expr.c.
References SCIP_Mem::buffer, FALSE, hashExpr(), Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_OKAY, SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetExprUserData(), SCIPexpriterInit(), SCIPexpriterSetStagesDFS(), Scip::set, Scip::stat, and SCIP_EXPRITER_USERDATA::uintval.
◆ SCIPsimplifyExpr()
SCIP_RETCODE SCIPsimplifyExpr | ( | SCIP * | scip, |
SCIP_EXPR * | rootexpr, | ||
SCIP_EXPR ** | simplified, | ||
SCIP_Bool * | changed, | ||
SCIP_Bool * | infeasible, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
simplifies an expression
This is largely inspired by Joel Cohen's Computer algebra and symbolic computation: Mathematical methods, in particular Chapter 3. The other fountain of inspiration are the simplifying methods of expr.c in SCIP 7.
Note: The things to keep in mind when adding simplification rules are the following. I will be using the product expressions (see expr_product.c) as an example. There are mainly 3 parts of the simplification process. You need to decide at which stage the simplification rule makes sense.
- Simplify each factor (simplifyFactor()): At this stage we got the children of the product expression. At this point, each child is simplified when viewed as a stand-alone expression, but not necessarily when viewed as child of a product expression. Rules like SP2, SP7, etc are enforced at this point.
- Multiply the factors (mergeProductExprlist()): At this point rules like SP4, SP5 and SP14 are enforced.
- Build the actual simplified product expression (buildSimplifiedProduct()): At this point rules like SP10, SP11, etc are enforced.
During steps 1 and 2 do not forget to set the flag changed
to TRUE when something actually changes.
- Definition of simplified expressions
An expression is simplified if it
- is a value expression
- is a var expression
- is a product expression such that
- SP1: every child is simplified
- SP2: no child is a product
- SP4: no two children are the same expression (those should be multiplied)
- SP5: the children are sorted [commutative rule]
- SP7: no child is a value
- SP8: its coefficient is 1.0 (otherwise should be written as sum)
- SP10: it has at least two children
- TODO?: at most one child is an
abs
- SP11: no two children are
expr*log(expr)
(TODO: we could handle more complicated stuff like \(xy\log(x) \to - y * \mathrm{entropy}(x)\), but I am not sure this should happen at the simplification level; similar for \((xy) \log(xy)\), which currently simplifies to \(xy \log(xy)\)) - SP12: if it has two children, then neither of them is a sum (expand sums)
- SP13: no child is a sum with a single term
- SP14: at most one child is an
exp
- is a power expression such that
- POW1: exponent is not 0
- POW2: exponent is not 1
- POW3: its child is not a value
- POW4: its child is simplified
- POW5: if exponent is integer, its child is not a product
- POW6: if exponent is integer, its child is not a sum with a single term ( \((2x)^2 \to 4x^2\))
- POW7: if exponent is 2, its child is not a sum (expand sums)
- POW8: its child is not a power unless \((x^n)^m\) with \(nm\) being integer and \(n\) or \(m\) fractional and \(n\) not being even integer
- POW9: its child is not a sum with a single term with a positive coefficient: \((25x)^{0.5} \to 5 x^{0.5}\)
- POW10: its child is not a binary variable: \(b^e, e > 0 \to b\); \(b^e, e < 0 \to b := 1\)
- POW11: its child is not an exponential: \(\exp(\text{expr})^e \to \exp(e\cdot\text{expr})\)
is a signedpower expression such that
- SPOW1: exponent is not 0
- SPOW2: exponent is not 1
- SPOW3: its child is not a value
- SPOW4: its child is simplified
- SPOW5: (TODO) do we want to distribute signpowers over products like we do for powers?
- SPOW6: exponent is not an odd integer: (signpow odd expr) -> (pow odd expr)
- SPOW8: if exponent is integer, its child is not a power
- SPOW9: its child is not a sum with a single term: \(\mathrm{signpow}(25x,0.5) \to 5\mathrm{signpow}(x,0.5)\)
- SPOW10: its child is not a binary variable: \(\mathrm{signpow}(b,e), e > 0 \to b\); \(\mathrm{signpow}(b,e), e < 0 \to b := 1\)
- SPOW11: its child is not an exponential: \(\mathrm{signpow}(\exp(\text{expr}),e) \to \exp(e\cdot\text{expr})\)
- TODO: what happens when child is another signed power?
- TODO: if child ≥ 0 -> transform to normal power; if child < 0 -> transform to - normal power
TODO: Some of these criteria are too restrictive for signed powers; for example, the exponent does not need to be an integer for signedpower to distribute over a product (SPOW5, SPOW6, SPOW8). Others can also be improved.
- is a sum expression such that
- SS1: every child is simplified
- SS2: no child is a sum
- SS3: no child is a value (values should go in the constant of the sum)
- SS4: no two children are the same expression (those should be summed up)
- SS5: the children are sorted [commutative rule]
- SS6: it has at least one child
- SS7: if it consists of a single child, then either constant is != 0.0 or coef != 1
- SS8: no child has coefficient 0
- SS9: if a child c is a product that has an exponential expression as one of its factors, then the coefficient of c is +/-1.0
- SS10: if a child c is an exponential, then the coefficient of c is +/-1.0
- it is a function with simplified arguments, but not all of them can be values
- TODO? a logarithm doesn't have a product as a child
- TODO? the exponent of an exponential is always 1
- Ordering Rules (see SCIPexprCompare())
- These rules define a total order on simplified expressions. There are two groups of rules, when comparing equal type expressions and different type expressions.
Equal type expressions:
- OR1: u,v value expressions: u < v ⇔ val(u) < val(v)
- OR2: u,v var expressions: u < v ⇔
SCIPvarGetIndex(var(u))
<SCIPvarGetIndex(var(v))
- OR3: u,v are both sum or product expression: < is a lexicographical order on the terms
- OR4: u,v are both pow: u < v ⇔ base(u) < base(v) or, base(u) = base(v) and expo(u) < expo(v)
- OR5: u,v are \(u = f(u_1, ..., u_n), v = f(v_1, ..., v_m)\): u < v ⇔ For the first k such that \(u_k \neq v_k\), \(u_k < v_k\), or if such a \(k\) doesn't exist, then \(n < m\).
Different type expressions:
- OR6: u value, v other: u < v always
- OR7: u sum, v var or func: u < v ⇔ u < 0+v; In other words, if \(u = \sum_{i=1}^n \alpha_i u_i\), then u < v ⇔ \(u_n\) < v or if \(u_n\) = v and \(\alpha_n\) < 1.
- OR8: u product, v pow, sum, var or func: u < v ⇔ u < 1*v; In other words, if \(u = \prod_{i=1}^n u_i\), then u < v ⇔ \(u_n\) < v. Note: since this applies only to simplified expressions, the form of the product is correct. Simplified products do not have constant coefficients.
- OR9: u pow, v sum, var or func: u < v ⇔ u < v^1
- OR10: u var, v func: u < v always
- OR11: u func, v other type of func: u < v ⇔ name(type(u)) < name(type(v))
- OR12: none of the rules apply: u < v ⇔ ! v < u
Examples:
- x < x^2 ?: x is var and x^2 power, so none applies (OR12). Hence, we try to answer x^2 < x ?: x^2 < x ⇔ x < x or if x = x and 2 < 1 ⇔ 2 < 1 ⇔ False. So x < x^2 is True.
- x < x^-1 –OR12→ ~(x^-1 < x) –OR9→ ~(x^-1 < x^1) –OR4→ ~(x < x or -1 < 1) → ~True → False
- x*y < x –OR8→ x*y < 1*x –OR3→ y < x –OR2→ False
- x*y < y –OR8→ x*y < 1*y –OR3→ y < x –OR2→ False
- Algorithm
The recursive version of the algorithm is
EXPR simplify(expr) for c in 1..expr->nchildren expr->children[c] = simplify(expr->children[c]) end return expr->exprhdlr->simplify(expr) end
Important: Whatever is returned by a simplify callback has to be simplified. Also, all children of the given expression are already simplified.
- Parameters
-
scip SCIP data structure rootexpr expression to be simplified simplified buffer to store simplified expression changed buffer to store if rootexpr actually changed infeasible buffer to store whether infeasibility has been detected ownercreatedata data to pass to ownercreate
Definition at line 1762 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprSimplify(), Scip::set, and Scip::stat.
Referenced by canonicalizeConstraints(), checkSymmetriesAreSymmetries(), SCIP_DECL_CONSACTIVE(), and SCIPwritePip().
◆ SCIPreplaceCommonSubexpressions()
SCIP_RETCODE SCIPreplaceCommonSubexpressions | ( | SCIP * | scip, |
SCIP_EXPR ** | exprs, | ||
int | nexprs, | ||
SCIP_Bool * | replacedroot | ||
) |
replaces common sub-expressions in a given expression graph by using a hash key for each expression
The algorithm consists of two steps:
- traverse through all given expressions and compute for each of them a (not necessarily unique) hash
- initialize an empty hash table and traverse through all expression; check for each of them if we can find a structural equivalent expression in the hash table; if yes we replace the expression by the expression inside the hash table, otherwise we add it to the hash table
- Note
- the hash keys of the expressions are used for the hashing inside the hash table; to compute if two expressions (with the same hash) are structurally the same we use the function SCIPexprCompare().
- Parameters
-
scip SCIP data structure exprs expressions (possibly replaced by equivalent on output) nexprs total number of expressions replacedroot buffer to store whether any root expression (expression in exprs) was replaced
Definition at line 1793 of file scip_expr.c.
References SCIP_Mem::buffer, FALSE, findEqualExpr(), hashExpr(), COMMONSUBEXPR_HASH_DATA::hashiterator, Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITINGCHILD, SCIP_OKAY, SCIPcreateExpriter(), SCIPdebugMsg, SCIPexprCapture(), SCIPexprCompare(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPexpriterSkipDFS(), SCIPmultihashCreate(), SCIPmultihashFree(), SCIPreleaseExpr(), SCIPreplaceExprChild(), Scip::set, COMMONSUBEXPR_HASH_DATA::set, and TRUE.
Referenced by canonicalizeConstraints(), and SCIP_DECL_CONSACTIVE().
◆ SCIPcomputeExprCurvature()
SCIP_RETCODE SCIPcomputeExprCurvature | ( | SCIP * | scip, |
SCIP_EXPR * | expr | ||
) |
computes the curvature of a given expression and all its subexpressions
- Note
- this function also evaluates all subexpressions w.r.t. current variable bounds
- this function relies on information from the curvature callback of expression handlers only, consider using function SCIPhasExprCurvature() of the convex-nlhdlr instead, as that uses more information to deduce convexity
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1908 of file scip_expr.c.
References FALSE, Scip::mem, NULL, SCIP_Mem::probmem, SCIP_Bool, SCIP_CALL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_LINEAR, SCIP_EXPRCURV_UNKNOWN, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_OKAY, SCIPallocBufferArray, SCIPcalcMemGrowSize(), SCIPexprGetChildren(), SCIPexprGetCurvature(), SCIPexprGetHdlr(), SCIPexprGetNChildren(), SCIPexprhdlrCurvatureExpr(), SCIPexprhdlrHasCurvature(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPexprSetCurvature(), SCIPfreeBufferArray, SCIPreallocBufferArray, Scip::set, and Scip::stat.
◆ SCIPcomputeExprIntegrality()
SCIP_RETCODE SCIPcomputeExprIntegrality | ( | SCIP * | scip, |
SCIP_EXPR * | expr | ||
) |
computes integrality information of a given expression and all its subexpressions
The integrality information can be accessed via SCIPexprIsIntegral().
- Parameters
-
scip SCIP data structure expr expression
Definition at line 1988 of file scip_expr.c.
References FALSE, Scip::mem, NULL, SCIP_Mem::probmem, SCIP_Bool, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprGetNChildren(), SCIPexprhdlrIntegralityExpr(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPexprSetIntegrality(), Scip::set, and Scip::stat.
Referenced by collectLeafs(), and detectNlhdlrs().
◆ SCIPgetExprNVars()
SCIP_RETCODE SCIPgetExprNVars | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
int * | nvars | ||
) |
returns the total number of variable expressions in an expression
The function counts variable expressions in common sub-expressions only once, but counts variables appearing in several variable expressions multiple times.
- Parameters
-
scip SCIP data structure expr expression nvars buffer to store the total number of variables
Definition at line 2031 of file scip_expr.c.
References FALSE, Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_OKAY, SCIPexprIsVar(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), Scip::set, and Scip::stat.
Referenced by SCIP_DECL_NLHDLRDETECT(), and storeVarExprs().
◆ SCIPgetExprVarExprs()
SCIP_RETCODE SCIPgetExprVarExprs | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_EXPR ** | varexprs, | ||
int * | nvarexprs | ||
) |
returns all variable expressions contained in a given expression
The array to store all variable expressions needs to be at least of size the number of unique variable expressions in the expression which is given by SCIPgetExprNVars().
If every variable is represented by only one variable expression (common subexpression have been removed) then SCIPgetExprNVars() can be bounded by SCIPgetNTotalVars(). If, in addition, non-active variables have been removed from the expression, e.g., by simplifying, then SCIPgetExprNVars() can be bounded by SCIPgetNVars().
- Note
- function captures variable expressions
- Parameters
-
scip SCIP data structure expr expression varexprs array to store all variable expressions nvarexprs buffer to store the total number of variable expressions
Definition at line 2069 of file scip_expr.c.
References FALSE, Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_OKAY, SCIPcaptureExpr(), SCIPexprIsVar(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), Scip::set, and Scip::stat.
Referenced by computeOffValues(), SCIP_DECL_NLHDLRDETECT(), and storeVarExprs().
◆ SCIP_DECL_EXPRPRINT()
SCIP_DECL_EXPRPRINT | ( | SCIPcallExprPrint | ) |
calls the print callback for an expression
- See also
- SCIP_DECL_EXPRPRINT
Definition at line 2113 of file scip_expr.c.
References Scip::messagehdlr, NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrPrintExpr(), and Scip::set.
◆ SCIP_DECL_EXPRCURVATURE()
SCIP_DECL_EXPRCURVATURE | ( | SCIPcallExprCurvature | ) |
calls the curvature callback for an expression
- See also
- SCIP_DECL_EXPRCURVATURE
Returns unknown curvature if callback not implemented.
Definition at line 2129 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrCurvatureExpr(), and Scip::set.
◆ SCIP_DECL_EXPRMONOTONICITY()
SCIP_DECL_EXPRMONOTONICITY | ( | SCIPcallExprMonotonicity | ) |
calls the monotonicity callback for an expression
- See also
- SCIP_DECL_EXPRMONOTONICITY
Returns unknown monotonicity if callback not implemented.
Definition at line 2144 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrMonotonicityExpr(), and Scip::set.
◆ SCIPcallExprEval()
SCIP_RETCODE SCIPcallExprEval | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_Real * | childrenvalues, | ||
SCIP_Real * | val | ||
) |
calls the eval callback for an expression with given values for children
Does not iterates over expressions, but requires values for children to be given. Value is not stored in expression, but returned in val
. If an evaluation error (division by zero, ...) occurs, this value will be set to SCIP_INVALID
.
- Parameters
-
scip SCIP data structure expr expression to be evaluated childrenvalues values for children val buffer to store evaluated value
Definition at line 2160 of file scip_expr.c.
References SCIP_Mem::buffer, Scip::mem, NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrEvalExpr(), and Scip::set.
Referenced by atomic_userexpr::atomic_userexpr(), and evalExprInAux().
◆ SCIPcallExprEvalFwdiff()
SCIP_RETCODE SCIPcallExprEvalFwdiff | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_Real * | childrenvalues, | ||
SCIP_Real * | direction, | ||
SCIP_Real * | val, | ||
SCIP_Real * | dot | ||
) |
calls the eval and fwdiff callback of an expression with given values for children
Does not iterates over expressions, but requires values for children and direction to be given.
Value is not stored in expression, but returned in val
. If an evaluation error (division by zero, ...) occurs, this value will be set to SCIP_INVALID
.
Direction is not stored in expression, but returned in dot
. If an differentiation error (division by zero, ...) occurs, this value will be set to SCIP_INVALID
.
- Parameters
-
scip SCIP data structure expr expression to be evaluated childrenvalues values for children direction direction in which to differentiate val buffer to store evaluated value dot buffer to store derivative value
Definition at line 2187 of file scip_expr.c.
References SCIP_Mem::buffer, Scip::mem, NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrEvalFwDiffExpr(), and Scip::set.
Referenced by atomic_userexpr::atomic_userexpr().
◆ SCIP_DECL_EXPRINTEVAL()
SCIP_DECL_EXPRINTEVAL | ( | SCIPcallExprInteval | ) |
calls the interval evaluation callback for an expression
- See also
- SCIP_DECL_EXPRINTEVAL
Returns entire interval if callback not implemented.
Definition at line 2211 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrIntEvalExpr(), and Scip::set.
◆ SCIP_DECL_EXPRESTIMATE()
SCIP_DECL_EXPRESTIMATE | ( | SCIPcallExprEstimate | ) |
calls the estimate callback for an expression
- See also
- SCIP_DECL_EXPRESTIMATE
Returns without success if callback not implemented.
Definition at line 2227 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrEstimateExpr(), and Scip::set.
◆ SCIP_DECL_EXPRINITESTIMATES()
SCIP_DECL_EXPRINITESTIMATES | ( | SCIPcallExprInitestimates | ) |
calls the initial estimators callback for an expression
- See also
- SCIP_DECL_EXPRINITESTIMATES
Returns no estimators if callback not implemented.
Definition at line 2244 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrInitEstimatesExpr(), and Scip::set.
◆ SCIP_DECL_EXPRSIMPLIFY()
SCIP_DECL_EXPRSIMPLIFY | ( | SCIPcallExprSimplify | ) |
calls the simplify callback for an expression
- See also
- SCIP_DECL_EXPRSIMPLIFY
Returns unmodified expression if simplify callback not implemented.
Does not simplify descendants (children, etc). Use SCIPsimplifyExpr() for that.
Definition at line 2262 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrSimplifyExpr(), and Scip::set.
◆ SCIP_DECL_EXPRREVERSEPROP()
SCIP_DECL_EXPRREVERSEPROP | ( | SCIPcallExprReverseprop | ) |
calls the reverse propagation callback for an expression
- See also
- SCIP_DECL_EXPRREVERSEPROP
Returns unmodified childrenbounds
if reverseprop callback not implemented.
calls the reverse propagation callback for an expression
- See also
- SCIP_DECL_EXPRREVERSEPROP
Returns unmodified childrenbounds if reverseprop callback not implemented.
Definition at line 2280 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrReversePropExpr(), and Scip::set.
◆ SCIPcreateExpriter()
SCIP_RETCODE SCIPcreateExpriter | ( | SCIP * | scip, |
SCIP_EXPRITER ** | iterator | ||
) |
creates an expression iterator
- Parameters
-
scip SCIP data structure iterator buffer to store expression iterator
Definition at line 2300 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexpriterCreate(), and Scip::stat.
Referenced by addExprViolScoresAuxVars(), addTightEstimatorCuts(), analyzeViolation(), bilinearTermsInsertAll(), canonicalizeConstraints(), collectBranchingCandidates(), collectLeafs(), computeOffValues(), computeSymmetryGroup(), constructExpr(), createNlhdlrExprData(), deinitSolve(), detectMinors(), detectNlhdlrs(), enforceConstraints(), exprIsNonSmooth(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), improvePoint(), initSepa(), presolveBinaryProducts(), presolveSingleLockedVars(), printExpr(), processNlRow(), propagateLocks(), propConss(), propExprDomains(), registerBranchingCandidates(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_TABLEOUTPUT(), SCIPaddExprsViolScoreNonlinear(), SCIPaddNlRowGradientBenderscutOpt(), SCIPcreateNlpiProblemFromNlRows(), SCIPexprintCompile(), SCIPmarkExprPropagateNonlinear(), SCIPnlpiOracleDelVarSet(), SCIPnlpiOracleGetJacobianSparsity(), SCIPregisterExprUsageNonlinear(), SCIPreplaceCommonSubexpressions(), separateCuts(), and updateVariableCounts().
◆ SCIPfreeExpriter()
void SCIPfreeExpriter | ( | SCIP_EXPRITER ** | iterator | ) |
frees an expression iterator
- Parameters
-
iterator pointer to the expression iterator
Definition at line 2314 of file scip_expr.c.
References SCIPexpriterFree().
Referenced by addExprViolScoresAuxVars(), addTightEstimatorCuts(), analyzeViolation(), bilinearTermsInsertAll(), canonicalizeConstraints(), collectBranchingCandidates(), collectLeafs(), computeOffValues(), computeSymmetryGroup(), constructExpr(), createNlhdlrExprData(), deinitSolve(), detectMinors(), detectNlhdlrs(), enforceConstraints(), exprIsNonSmooth(), exprIsSemicontinuous(), fillGraphByNonlinearConss(), forbidNonlinearVariablesMultiaggration(), forwardPropExpr(), improvePoint(), initSepa(), presolveBinaryProducts(), presolveSingleLockedVars(), printExpr(), processNlRow(), propagateLocks(), propConss(), propExprDomains(), registerBranchingCandidates(), SCIP_DECL_CONSACTIVE(), SCIP_DECL_TABLEOUTPUT(), SCIPaddExprsViolScoreNonlinear(), SCIPaddNlRowGradientBenderscutOpt(), SCIPcreateNlpiProblemFromNlRows(), SCIPexprintCompile(), SCIPmarkExprPropagateNonlinear(), SCIPnlpiOracleDelVarSet(), SCIPnlpiOracleGetJacobianSparsity(), SCIPregisterExprUsageNonlinear(), separateCuts(), and updateVariableCounts().
◆ SCIPcheckExprQuadratic()
SCIP_RETCODE SCIPcheckExprQuadratic | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_Bool * | isquadratic | ||
) |
checks whether an expression is quadratic
An expression is quadratic if it is either a square (of some expression), a product (of two expressions), or a sum of terms where at least one is a square or a product.
Use SCIPexprGetQuadraticData() to get data about the representation as quadratic.
- Parameters
-
scip SCIP data structure expr expression isquadratic buffer to store result
Definition at line 2340 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprCheckQuadratic(), and Scip::set.
Referenced by DECL_CURVCHECK(), isCandidate(), printNonlinearCons(), processNlRow(), SCIP_DECL_NLHDLRDETECT(), SCIPcheckQuadraticNonlinear(), and SCIPwritePip().
◆ SCIPfreeExprQuadratic()
frees information on quadratic representation of an expression
Before doing changes to an expression, it can be useful to call this function.
- Parameters
-
scip SCIP data structure expr expression
Definition at line 2358 of file scip_expr.c.
References Scip::mem, NULL, SCIP_Mem::probmem, and SCIPexprFreeQuadratic().
Referenced by deinitSolve().
◆ SCIPevalExprQuadratic()
evaluates quadratic term in a solution
- Note
- This requires that every expressiion used in the quadratic data is a variable expression.
evaluates quadratic term in a solution
- Note
- This requires that every expression used in the quadratic data is a variable expression.
- Parameters
-
scip SCIP data structure expr quadratic expression sol solution to evaluate, or NULL for LP solution
Definition at line 2373 of file scip_expr.c.
References NULL, SCIP_Real, SCIPexprGetQuadraticBilinTerm(), SCIPexprGetQuadraticData(), SCIPexprGetQuadraticQuadTerm(), SCIPexprIsVar(), SCIPgetSolVal(), SCIPgetVarExprVar(), and Scip::set.
◆ SCIPprintExprQuadratic()
SCIP_RETCODE SCIPprintExprQuadratic | ( | SCIP * | scip, |
SCIP_EXPR * | expr | ||
) |
prints quadratic expression
- Parameters
-
scip SCIP data structure expr quadratic expression
Definition at line 2433 of file scip_expr.c.
References NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPexprGetQuadraticBilinTerm(), SCIPexprGetQuadraticData(), SCIPexprGetQuadraticQuadTerm(), SCIPinfoMessage(), and SCIPprintExpr().
Referenced by SCIP_DECL_NLHDLRDETECT().
◆ SCIPcomputeExprQuadraticCurvature()
SCIP_RETCODE SCIPcomputeExprQuadraticCurvature | ( | SCIP * | scip, |
SCIP_EXPR * | expr, | ||
SCIP_EXPRCURV * | curv, | ||
SCIP_HASHMAP * | assumevarfixed, | ||
SCIP_Bool | storeeigeninfo | ||
) |
checks the curvature of the quadratic expression
For this, it builds the matrix Q of quadratic coefficients and computes its eigenvalues using LAPACK. If Q is
- semidefinite positive -> curv is set to convex,
- semidefinite negative -> curv is set to concave,
- otherwise -> curv is set to unknown.
If assumevarfixed
is given and some expressions in quadratic terms correspond to variables present in this hashmap, then the corresponding rows and columns are ignored in the matrix Q.
- Parameters
-
scip SCIP data structure expr quadratic expression curv pointer to store the curvature of quadratics assumevarfixed hashmap containing variables that should be assumed to be fixed, or NULL storeeigeninfo whether the eigenvalues and eigenvectors should be stored
Definition at line 2549 of file scip_expr.c.
References SCIP_Mem::buffer, Scip::mem, Scip::messagehdlr, NULL, SCIP_Mem::probmem, SCIP_CALL, SCIP_OKAY, SCIPexprComputeQuadraticCurvature(), and Scip::set.
Referenced by DECL_CURVCHECK(), and SCIP_DECL_NLHDLRDETECT().