Detailed Description
private functions to work with algebraic expressions
Definition in file expr.h.
#include "scip/pub_expr.h"
#include "scip/type_set.h"
#include "scip/type_stat.h"
#include "scip/type_clock.h"
#include "blockmemshell/memory.h"
Go to the source code of this file.
Function Documentation
◆ SCIPexprhdlrCreate()
SCIP_RETCODE SCIPexprhdlrCreate | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPRHDLR ** | exprhdlr, | ||
const char * | name, | ||
const char * | desc, | ||
unsigned int | precedence, | ||
SCIP_DECL_EXPREVAL((*eval)) | , | ||
SCIP_EXPRHDLRDATA * | data | ||
) |
create expression handler
- Parameters
-
blkmem block memory exprhdlr buffer where to store created expression handler name name of expression handler (must not be NULL) desc description of expression handler (can be NULL) precedence precedence of expression operation (used for printing) data data of expression handler (can be NULL)
Definition at line 303 of file expr.c.
References BMSallocClearBlockMemory, BMSduplicateMemoryArray, eval(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_OKAY, and SCIPclockCreate().
Referenced by SCIPincludeExprhdlr().
◆ SCIPexprhdlrFree()
SCIP_RETCODE SCIPexprhdlrFree | ( | SCIP_EXPRHDLR ** | exprhdlr, |
SCIP_SET * | set, | ||
BMS_BLKMEM * | blkmem | ||
) |
frees expression handler
- Parameters
-
exprhdlr pointer to expression handler to be freed set global SCIP settings blkmem block memory
Definition at line 338 of file expr.c.
References BMSfreeBlockMemory, BMSfreeMemoryArray, BMSfreeMemoryArrayNull, SCIP_Exprhdlr::data, NULL, SCIP_CALL, SCIP_OKAY, and SCIPclockFree().
◆ SCIPexprhdlrCopyInclude()
SCIP_RETCODE SCIPexprhdlrCopyInclude | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | targetset | ||
) |
copies the given expression handler to a new scip
- Parameters
-
exprhdlr expression handler targetset SCIP_SET of SCIP to copy to
Definition at line 836 of file expr.c.
References NULL, SCIP_Set::scip, SCIP_CALL, SCIP_OKAY, SCIPexprhdlrGetName(), and SCIPsetDebugMsg.
Referenced by SCIPsetCopyPlugins().
◆ SCIPexprhdlrInit()
void SCIPexprhdlrInit | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set | ||
) |
initialization of expression handler (resets statistics)
- Parameters
-
exprhdlr expression handler set global SCIP settings
Definition at line 861 of file expr.c.
References SCIP_Exprhdlr::estimatetime, SCIP_Exprhdlr::intevaltime, SCIP_Exprhdlr::nbranchscores, SCIP_Exprhdlr::ncreated, SCIP_Exprhdlr::ncutoffs, SCIP_Exprhdlr::ndomreds, SCIP_Exprhdlr::nestimatecalls, SCIP_Exprhdlr::nintevalcalls, SCIP_Exprhdlr::npropcalls, SCIP_Exprhdlr::nsimplified, SCIP_Exprhdlr::nsimplifycalls, NULL, SCIP_Exprhdlr::proptime, SCIPclockReset(), and SCIP_Exprhdlr::simplifytime.
Referenced by SCIPsetInitPlugins().
◆ SCIPexprhdlrPrintExpr()
SCIP_RETCODE SCIPexprhdlrPrintExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRITER_STAGE | stage, | ||
int | currentchild, | ||
unsigned int | parentprecedence, | ||
FILE * | file | ||
) |
calls the print callback of an expression handler
The method prints an expression. It is called while iterating over the expression graph at different stages.
- See also
- SCIP_DECL_EXPRPRINT
- Parameters
-
exprhdlr expression handler set global SCIP settings messagehdlr message handler expr expression stage stage of expression iteration currentchild index of current child if in stage visitingchild or visitedchild parentprecedence precedence of parent file the file to print to
Definition at line 894 of file expr.c.
References SCIP_Expr::exprhdlr, SCIP_Expr::nchildren, NULL, SCIP_CALL, SCIP_EXPRITER_ENTEREXPR, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITEDCHILD, SCIP_EXPRITER_VISITINGCHILD, SCIP_OKAY, SCIPexprhdlrGetName(), SCIPexprhdlrHasPrint(), and SCIPmessageFPrintInfo().
Referenced by SCIP_DECL_EXPRPRINT(), SCIPexprPrint(), and SCIPexprPrintDot().
◆ SCIPexprhdlrParseExpr()
SCIP_RETCODE SCIPexprhdlrParseExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
const char * | string, | ||
const char ** | endstring, | ||
SCIP_EXPR ** | expr, | ||
SCIP_Bool * | success, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
calls the parse callback of an expression handler
The method parses an expression. It should be called when parsing an expression and an operator with the expr handler name is found.
- See also
- SCIP_DECL_EXPRPARSE
- Parameters
-
exprhdlr expression handler set global SCIP settings string string containing expression to be parse endstring buffer to store the position of string after parsing expr buffer to store the parsed expression success buffer to store whether the parsing was successful or not ownercreatedata data to pass to ownercreate
Definition at line 963 of file expr.c.
References FALSE, NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and SCIPexprhdlrGetName().
Referenced by parseBase().
◆ SCIPexprhdlrCurvatureExpr()
SCIP_RETCODE SCIPexprhdlrCurvatureExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRCURV | exprcurvature, | ||
SCIP_Bool * | success, | ||
SCIP_EXPRCURV * | childcurv | ||
) |
calls the curvature check callback of an expression handler
- See also
- SCIP_DECL_EXPRCURVATURE
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to check the curvature for exprcurvature desired curvature of this expression success buffer to store whether the desired curvature be obtained childcurv array to store required curvature for each child
Definition at line 1002 of file expr.c.
References SCIP_Expr::exprhdlr, FALSE, NULL, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIP_DECL_EXPRCURVATURE(), and SCIPcomputeExprCurvature().
◆ SCIPexprhdlrMonotonicityExpr()
SCIP_RETCODE SCIPexprhdlrMonotonicityExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
int | childidx, | ||
SCIP_MONOTONE * | result | ||
) |
calls the monotonicity check callback of an expression handler
- See also
- SCIP_DECL_EXPRMONOTONICITY
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to check the monotonicity for childidx index of the considered child expression result buffer to store the monotonicity
Definition at line 1031 of file expr.c.
References SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_MONOTONE_UNKNOWN, and SCIP_OKAY.
Referenced by SCIP_DECL_EXPRMONOTONICITY().
◆ SCIPexprhdlrIntegralityExpr()
SCIP_RETCODE SCIPexprhdlrIntegralityExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_Bool * | isintegral | ||
) |
calls the integrality check callback of an expression handler
- See also
- SCIP_DECL_EXPRINTEGRALITY
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to check integrality for isintegral buffer to store whether expression is integral
Definition at line 1060 of file expr.c.
References SCIP_Expr::exprhdlr, FALSE, NULL, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIPcomputeExprIntegrality().
◆ SCIPexprhdlrHashExpr()
SCIP_RETCODE SCIPexprhdlrHashExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
unsigned int * | hashkey, | ||
unsigned int * | childrenhashes | ||
) |
calls the hash callback of an expression handler
The method hashes an expression by taking the hashes of its children into account.
- See also
- SCIP_DECL_EXPRHASH
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to be hashed hashkey buffer to store the hash value childrenhashes array with hash values of children
Definition at line 1090 of file expr.c.
References SCIP_Expr::exprhdlr, SCIP_Exprhdlr::name, SCIP_Expr::nchildren, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, and SCIPcalcFibHash().
Referenced by hashExpr().
◆ SCIPexprhdlrCompareExpr()
calls the compare callback of an expression handler
The method receives two expressions, expr1 and expr2, and returns
- -1 if expr1 < expr2,
- 0 if expr1 = expr2,
- 1 if expr1 > expr2.
- See also
- SCIP_DECL_EXPRCOMPARE
- Parameters
-
set global SCIP settings expr1 first expression in comparison expr2 second expression in comparison
Definition at line 1139 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::exprhdlr, SCIP_Expr::nchildren, NULL, and SCIPexprCompare().
Referenced by SCIPexprCompare().
◆ SCIPexprhdlrEvalExpr()
SCIP_RETCODE SCIPexprhdlrEvalExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
BMS_BUFMEM * | bufmem, | ||
SCIP_EXPR * | expr, | ||
SCIP_Real * | val, | ||
SCIP_Real * | childrenvals, | ||
SCIP_SOL * | sol | ||
) |
calls the evaluation callback of an expression handler
The method evaluates an expression by taking the values of its children into account.
Further, allows to evaluate w.r.t. given expression and children values instead of those stored in children expressions.
- See also
- SCIP_DECL_EXPREVAL
- Parameters
-
exprhdlr expression handler set global SCIP settings bufmem buffer memory, can be NULL if childrenvals is NULL expr expression to be evaluated val buffer to store value of expression childrenvals values for children, or NULL if values stored in children should be used sol solution that is evaluated (can be NULL)
Definition at line 1182 of file expr.c.
References BMSallocBufferMemoryArray, BMSfreeBufferMemoryArray, SCIP_Expr::children, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, SCIP_Expr::nchildren, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIPisFinite.
Referenced by evalAndDiff(), SCIPcallExprEval(), and SCIPexprEval().
◆ SCIPexprhdlrBwDiffExpr()
SCIP_RETCODE SCIPexprhdlrBwDiffExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
BMS_BUFMEM * | bufmem, | ||
SCIP_EXPR * | expr, | ||
int | childidx, | ||
SCIP_Real * | derivative, | ||
SCIP_Real * | childrenvals, | ||
SCIP_Real | exprval | ||
) |
calls the backward derivative evaluation callback of an expression handler
The method should compute the partial derivative of expr w.r.t its child at childidx. That is, it returns
\[ \frac{\partial \text{expr}}{\partial \text{child}_{\text{childidx}}} \]
Further, allows to differentiate w.r.t. given expression and children values instead of those stored in children expressions.
- See also
- SCIP_DECL_EXPRBWDIFF
- Parameters
-
exprhdlr expression handler set global SCIP settings bufmem buffer memory, can be NULL if childrenvals is NULL expr expression to be differentiated childidx index of the child derivative buffer to store the partial derivative w.r.t. the i-th children childrenvals values for children, or NULL if values stored in children should be used exprval value for expression, used only if childrenvals is not NULL
Definition at line 1249 of file expr.c.
References BMSallocBufferMemoryArray, BMSfreeBufferMemoryArray, SCIP_Expr::children, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, SCIP_Expr::nchildren, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIPisFinite.
Referenced by SCIPexprEvalGradient(), and SCIPexprEvalHessianDir().
◆ SCIPexprhdlrFwDiffExpr()
SCIP_RETCODE SCIPexprhdlrFwDiffExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_Real * | dot, | ||
SCIP_SOL * | direction | ||
) |
calls the forward differentiation callback of an expression handler
- See also
- SCIP_DECL_EXPRFWDIFF
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to be differentiated dot buffer to store derivative value direction direction of the derivative (useful only for var expressions)
Definition at line 1322 of file expr.c.
References SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, and SCIPisFinite.
Referenced by evalAndDiff(), and SCIPexprhdlrEvalFwDiffExpr().
◆ SCIPexprhdlrEvalFwDiffExpr()
SCIP_RETCODE SCIPexprhdlrEvalFwDiffExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
BMS_BUFMEM * | bufmem, | ||
SCIP_EXPR * | expr, | ||
SCIP_Real * | val, | ||
SCIP_Real * | dot, | ||
SCIP_Real * | childrenvals, | ||
SCIP_SOL * | sol, | ||
SCIP_Real * | childrendirs, | ||
SCIP_SOL * | direction | ||
) |
calls the evaluation and forward-differentiation callback of an expression handler
The method evaluates an expression by taking the values of its children into account. The method differentiates an expression by taking the values and directional derivatives of its children into account.
Further, allows to evaluate and differentiate w.r.t. given values for children instead of those stored in children expressions.
It probably doesn't make sense to call this function for a variable-expression if sol and/or direction are not given.
- Parameters
-
exprhdlr expression handler set global SCIP settings bufmem buffer memory, can be NULL if childrenvals is NULL expr expression to be evaluated val buffer to store value of expression dot buffer to store derivative value childrenvals values for children, or NULL if values stored in children should be used sol solution that is evaluated (can be NULL) childrendirs directional derivatives for children, or NULL if dot-values stored in children should be used direction direction of the derivative (useful only for var expressions, can be NULL if childrendirs is given)
Definition at line 1363 of file expr.c.
References BMSallocBufferMemoryArray, BMSfreeBufferMemoryArray, SCIP_Expr::children, SCIP_Expr::dot, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, SCIP_Expr::nchildren, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPexprhdlrFwDiffExpr(), and SCIPisFinite.
Referenced by SCIPcallExprEvalFwdiff().
◆ SCIPexprhdlrBwFwDiffExpr()
SCIP_RETCODE SCIPexprhdlrBwFwDiffExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
int | childidx, | ||
SCIP_Real * | bardot, | ||
SCIP_SOL * | direction | ||
) |
calls the evaluation callback for Hessian directions (backward over forward) of an expression handler
- See also
- SCIP_DECL_EXPRBWFWDIFF
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to be differentiated childidx index of the child bardot buffer to store derivative value direction direction of the derivative (useful only for var expressions)
Definition at line 1466 of file expr.c.
References SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, and SCIPisFinite.
Referenced by SCIPexprEvalHessianDir().
◆ SCIPexprhdlrIntEvalExpr()
SCIP_RETCODE SCIPexprhdlrIntEvalExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_INTERVAL * | interval, | ||
SCIP_DECL_EXPR_INTEVALVAR((*intevalvar)) | , | ||
void * | intevalvardata | ||
) |
calls the interval evaluation callback of an expression handler
- See also
- SCIP_DECL_EXPRINTEVAL
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to be evaluated interval buffer where to store interval intevalvardata data to be passed to intevalvar callback
Definition at line 1502 of file expr.c.
References SCIP_Expr::exprhdlr, SCIP_Exprhdlr::intevaltime, SCIP_Exprhdlr::nintevalcalls, NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRINTEVAL(), and SCIPexprEvalActivity().
◆ SCIPexprhdlrEstimateExpr()
SCIP_RETCODE SCIPexprhdlrEstimateExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_INTERVAL * | localbounds, | ||
SCIP_INTERVAL * | globalbounds, | ||
SCIP_Real * | refpoint, | ||
SCIP_Bool | overestimate, | ||
SCIP_Real | targetvalue, | ||
SCIP_Real * | coefs, | ||
SCIP_Real * | constant, | ||
SCIP_Bool * | islocal, | ||
SCIP_Bool * | success, | ||
SCIP_Bool * | branchcand | ||
) |
calls the estimator callback of an expression handler
- See also
- SCIP_DECL_EXPRESTIMATE
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to be estimated localbounds current bounds for children globalbounds global bounds for children refpoint children values for the reference point where to estimate overestimate whether the expression needs to be over- or underestimated targetvalue a value that the estimator shall exceed, can be +/-infinity coefs array to store coefficients of estimator constant buffer to store constant part of estimator islocal buffer to store whether estimator is valid locally only success buffer to indicate whether an estimator could be computed branchcand array to indicate which children (not) to consider for branching
Definition at line 1533 of file expr.c.
References SCIP_Exprhdlr::estimatetime, SCIP_Expr::exprhdlr, FALSE, SCIP_Exprhdlr::nestimatecalls, NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRESTIMATE().
◆ SCIPexprhdlrInitEstimatesExpr()
SCIP_RETCODE SCIPexprhdlrInitEstimatesExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_INTERVAL * | bounds, | ||
SCIP_Bool | overestimate, | ||
SCIP_Real * | coefs[SCIP_EXPR_MAXINITESTIMATES], | ||
SCIP_Real | constant[SCIP_EXPR_MAXINITESTIMATES], | ||
int * | nreturned | ||
) |
calls the intitial estimators callback of an expression handler
- See also
- SCIP_DECL_EXPRINITESTIMATES
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to be estimated bounds bounds for children overestimate whether the expression shall be overestimated or underestimated coefs buffer to store coefficients of computed estimators constant buffer to store constant of computed estimators nreturned buffer to store number of estimators that have been computed
Definition at line 1577 of file expr.c.
References SCIP_Exprhdlr::estimatetime, SCIP_Expr::exprhdlr, SCIP_Exprhdlr::nestimatecalls, NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRINITESTIMATES().
◆ SCIPexprhdlrSimplifyExpr()
SCIP_RETCODE SCIPexprhdlrSimplifyExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPR ** | simplifiedexpr, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
calls the simplification callback of an expression handler
- See also
- SCIP_DECL_EXPRSIMPLIFY
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to simplify simplifiedexpr buffer to store the simplified expression ownercreatedata data to pass to ownercreate
Definition at line 1612 of file expr.c.
References SCIP_Expr::exprhdlr, SCIP_Exprhdlr::nsimplified, SCIP_Exprhdlr::nsimplifycalls, NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), SCIPclockStop(), SCIPexprCapture(), and SCIP_Exprhdlr::simplifytime.
Referenced by SCIP_DECL_EXPRSIMPLIFY(), and SCIPexprSimplify().
◆ SCIPexprhdlrReversePropExpr()
SCIP_RETCODE SCIPexprhdlrReversePropExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_INTERVAL | bounds, | ||
SCIP_INTERVAL * | childrenbounds, | ||
SCIP_Bool * | infeasible | ||
) |
calls the reverse propagation callback of an expression handler
The method propagates given bounds over the children of an expression.
- See also
- SCIP_DECL_EXPRREVERSEPROP
- Parameters
-
exprhdlr expression handler set global SCIP settings expr expression to propagate bounds the bounds on the expression that should be propagated childrenbounds array to store computed bounds for children, initialized with current activity infeasible buffer to store whether a children bounds were propagated to an empty interval
Definition at line 1657 of file expr.c.
References SCIP_Expr::exprhdlr, FALSE, SCIP_Expr::nchildren, SCIP_Exprhdlr::ncutoffs, SCIP_Exprhdlr::npropcalls, NULL, SCIP_Exprhdlr::proptime, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRREVERSEPROP().
◆ SCIPexprCreate()
SCIP_RETCODE SCIPexprCreate | ( | SCIP_SET * | set, |
BMS_BLKMEM * | blkmem, | ||
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
-
set global SCIP settings blkmem block memory 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 1705 of file expr.c.
References BMSallocClearBlockMemory, BMSduplicateBlockMemoryArray, SCIP_Exprhdlr::ncreated, NULL, SCIP_Expr::ownerdata, SCIP_ALLOC, SCIP_CALL, SCIP_EXPRCURV_UNKNOWN, SCIP_INTERVAL_INFINITY, SCIP_OKAY, SCIPexprCapture(), and SCIPintervalSetEntire().
Referenced by SCIPcreateExpr(), SCIPexprCopy(), and SCIPexprDuplicateShallow().
◆ SCIPexprAppendChild()
SCIP_RETCODE SCIPexprAppendChild | ( | SCIP_SET * | set, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPR * | child | ||
) |
appends child to the children list of expr
- Parameters
-
set global SCIP settings blkmem block memory expr expression child expression to be appended
Definition at line 1762 of file expr.c.
References BMSreallocBlockMemoryArray, SCIP_Expr::children, SCIP_Expr::childrensize, SCIP_Expr::nchildren, NULL, SCIP_ALLOC, SCIP_OKAY, SCIPexprCapture(), and SCIPsetCalcMemGrowSize().
Referenced by SCIPappendExprChild(), and SCIPexprCopy().
◆ SCIPexprReplaceChild()
SCIP_RETCODE SCIPexprReplaceChild | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr, | ||
int | childidx, | ||
SCIP_EXPR * | newchild | ||
) |
overwrites/replaces a child of an expressions
- Note
- the old child is released and the newchild is captured, unless they are the same (=same pointer)
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory expr expression where a child is going to be replaced childidx index of child being replaced newchild the new child
Definition at line 1793 of file expr.c.
References SCIP_Expr::children, NULL, SCIP_CALL, SCIP_OKAY, SCIPexprCapture(), and SCIPexprRelease().
Referenced by SCIPexprSimplify(), and SCIPreplaceExprChild().
◆ SCIPexprRemoveChildren()
SCIP_RETCODE SCIPexprRemoveChildren | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr | ||
) |
remove all children of expr
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory expr expression
Definition at line 1823 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::nchildren, NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprRelease().
Referenced by SCIPremoveExprChildren().
◆ SCIPexprCopy()
SCIP_RETCODE SCIPexprCopy | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_SET * | targetset, | ||
SCIP_STAT * | targetstat, | ||
BMS_BLKMEM * | targetblkmem, | ||
SCIP_EXPR * | sourceexpr, | ||
SCIP_EXPR ** | targetexpr, | ||
SCIP_DECL_EXPR_MAPEXPR((*mapexpr)) | , | ||
void * | mapexprdata, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
copies an expression including subexpressions
- Note
- If copying fails due to an expression handler not being available in the targetscip, then *targetexpr will be set to NULL.
For all or some expressions, a mapping to an existing expression can be specified via the mapexpr callback. The mapped expression (including its children) will not be copied in this case and its ownerdata will not be touched. If, however, the mapexpr callback returns NULL for the targetexpr, then the expr will be copied in the usual way.
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory targetset global SCIP settings data structure where target expression will live targetstat dynamic problem statistics in target SCIP targetblkmem block memory in target SCIP sourceexpr expression to be copied targetexpr buffer to store pointer to copy of source expression mapexprdata data of expression mapping function ownercreatedata data to pass to ownercreate
Definition at line 1855 of file expr.c.
References SCIP_Expr::exprdata, SCIP_Expr::exprhdlr, SCIP_Exprhdlr::name, NULL, SCIP_EXPRITER_USERDATA::ptrval, SCIP_Set::scip, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_ENTEREXPR, SCIP_EXPRITER_VISITEDCHILD, SCIP_OKAY, SCIPABORT, SCIPexprAppendChild(), SCIPexprCreate(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildUserDataDFS(), SCIPexpriterGetCurrentUserData(), SCIPexpriterGetExprUserData(), SCIPexpriterGetNext(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetCurrentUserData(), SCIPexpriterSetStagesDFS(), SCIPexpriterSkipDFS(), SCIPexprRelease(), SCIPsetFindExprhdlr(), and TRUE.
Referenced by nlpFlushNlRowAdditions(), nlrowExprChanged(), SCIPcopyExpr(), SCIPduplicateExpr(), SCIPnlrowChgExpr(), and SCIPnlrowCreate().
◆ SCIPexprDuplicateShallow()
SCIP_RETCODE SCIPexprDuplicateShallow | ( | SCIP_SET * | set, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPR ** | copyexpr, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
duplicates the given expression without its children
- Parameters
-
set global SCIP settings blkmem block memory expr original expression copyexpr buffer to store (shallow) duplicate of expr ownercreatedata data to pass to ownercreate
Definition at line 2010 of file expr.c.
References SCIP_Expr::exprdata, SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprCreate().
Referenced by SCIPduplicateExprShallow().
◆ SCIPexprCapture()
void SCIPexprCapture | ( | SCIP_EXPR * | expr | ) |
captures an expression (increments usage count)
- Parameters
-
expr expression
Definition at line 2041 of file expr.c.
References NULL, and SCIP_Expr::nuses.
Referenced by parseBase(), SCIPcaptureExpr(), SCIPexprAppendChild(), SCIPexprCreate(), SCIPexprhdlrSimplifyExpr(), SCIPexprReplaceChild(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexprRelease()
SCIP_RETCODE SCIPexprRelease | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR ** | rootexpr | ||
) |
releases an expression (decrements usage count and possibly frees expression)
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory rootexpr pointer to expression
Definition at line 2051 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::exprdata, SCIP_Expr::exprhdlr, freeExpr(), NULL, SCIP_Expr::nuses, SCIP_Expr::ownerdata, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITEDCHILD, SCIP_EXPRITER_VISITINGCHILD, SCIP_OKAY, SCIPABORT, SCIPexprFreeQuadratic(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPexpriterSkipDFS(), SCIPexprRelease(), and TRUE.
Referenced by nlpFlushNlRowAdditions(), nlrowExprChanged(), nlrowSimplifyExpr(), SCIPexprCopy(), SCIPexprRelease(), SCIPexprRemoveChildren(), SCIPexprReplaceChild(), SCIPexprSimplify(), SCIPnlrowChgExpr(), SCIPnlrowRelease(), and SCIPreleaseExpr().
◆ SCIPexprIsVar()
returns whether an expression is a variable expression
- Parameters
-
set global SCIP settings expr expression
Definition at line 2183 of file expr.c.
References SCIP_Expr::exprhdlr, and NULL.
Referenced by nlpAddNlRows(), nlpDelVarPos(), SCIP_DECL_EXPR_MAPEXPR(), SCIPevalExprQuadratic(), SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprComputeQuadraticCurvature(), SCIPexprDismantle(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPisExprVar(), SCIPnlpGetVarsNonlinearity(), and SCIPnlpHasContinuousNonlinearity().
◆ SCIPexprIsValue()
returns whether an expression is a value expression
- Parameters
-
set global SCIP settings expr expression
Definition at line 2195 of file expr.c.
References SCIP_Expr::exprhdlr, and NULL.
Referenced by nlrowSimplifyExpr(), parseExpr(), SCIPexprCompare(), SCIPexprDismantle(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), and SCIPisExprValue().
◆ SCIPexprIsSum()
returns whether an expression is a sum expression
- Parameters
-
set global SCIP settings expr expression
Definition at line 2207 of file expr.c.
References SCIP_Expr::exprhdlr, and NULL.
Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), and SCIPisExprSum().
◆ SCIPexprIsProduct()
returns whether an expression is a product expression
- Parameters
-
set global SCIP settings expr expression
Definition at line 2219 of file expr.c.
References SCIP_Expr::exprhdlr, and NULL.
Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), and SCIPisExprProduct().
◆ SCIPexprIsPower()
returns whether an expression is a power expression
- Parameters
-
set global SCIP settings expr expression
Definition at line 2231 of file expr.c.
References SCIP_Expr::exprhdlr, and NULL.
Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), and SCIPisExprPower().
◆ SCIPexprPrint()
SCIP_RETCODE SCIPexprPrint | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_MESSAGEHDLR * | messagehdlr, | ||
FILE * | file, | ||
SCIP_EXPR * | expr | ||
) |
print an expression as info-message
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory messagehdlr message handler file file to print to, or NULL for stdout expr expression to be printed
Definition at line 2243 of file expr.c.
References SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_EXPRITER_ALLSTAGES, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITEDCHILD, SCIP_EXPRITER_VISITINGCHILD, SCIP_OKAY, SCIPexprGetHdlr(), SCIPexprhdlrGetPrecedence(), SCIPexprhdlrPrintExpr(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetNext(), SCIPexpriterGetParentDFS(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), and TRUE.
Referenced by SCIPnlrowPrint(), and SCIPprintExpr().
◆ SCIPexprPrintDotInit()
SCIP_RETCODE SCIPexprPrintDotInit | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPRPRINTDATA ** | printdata, | ||
FILE * | file, | ||
SCIP_EXPRPRINT_WHAT | whattoprint | ||
) |
initializes printing of expressions in dot format to a give FILE* pointer
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory 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 2292 of file expr.c.
References BMSallocBlockMemory, FALSE, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPexpriterCreate(), and SCIPhashmapCreate().
Referenced by SCIPexprPrintDotInit2(), and SCIPprintExprDotInit().
◆ SCIPexprPrintDotInit2()
SCIP_RETCODE SCIPexprPrintDotInit2 | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPRPRINTDATA ** | printdata, | ||
const char * | filename, | ||
SCIP_EXPRPRINT_WHAT | whattoprint | ||
) |
initializes printing of expressions in dot format to a file with given filename
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory 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 2324 of file expr.c.
References NULL, SCIP_CALL_FINALLY, SCIP_FILECREATEERROR, SCIP_OKAY, SCIPerrorMessage, SCIPexprPrintDotInit(), and TRUE.
Referenced by SCIPprintExprDotInit2().
◆ SCIPexprPrintDot()
SCIP_RETCODE SCIPexprPrintDot | ( | SCIP_SET * | set, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_EXPRPRINTDATA * | printdata, | ||
SCIP_EXPR * | expr | ||
) |
main part of printing an expression in dot format
- Parameters
-
set global SCIP settings messagehdlr message handler printdata data as initialized by SCIPprintExprDotInit() expr expression to be printed
Definition at line 2356 of file expr.c.
References SCIP_Expr::exprhdlr, FALSE, SCIP_Exprhdlr::name, SCIP_Expr::nchildren, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_ENTEREXPR, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITEDCHILD, SCIP_EXPRITER_VISITINGCHILD, SCIP_EXPRPRINT_ACTIVITY, SCIP_EXPRPRINT_ACTIVITYTAG, SCIP_EXPRPRINT_EVALTAG, SCIP_EXPRPRINT_EVALVALUE, SCIP_EXPRPRINT_EXPRHDLR, SCIP_EXPRPRINT_EXPRSTRING, SCIP_EXPRPRINT_NUSES, SCIP_EXPRPRINT_OWNER, SCIP_OKAY, SCIP_Real, SCIPexprhdlrPrintExpr(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPhashmapInsert(), and SCIPsetFrac().
Referenced by SCIPprintExprDot().
◆ SCIPexprPrintDotFinal()
SCIP_RETCODE SCIPexprPrintDotFinal | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPRPRINTDATA ** | printdata | ||
) |
finishes printing of expressions in dot format
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory printdata buffer where dot printing data has been stored
Definition at line 2470 of file expr.c.
References BMSfreeBlockMemory, SCIP_Expr::nchildren, NULL, SCIP_OKAY, SCIPexpriterFree(), SCIPhashmapEntryGetOrigin(), SCIPhashmapFree(), SCIPhashmapGetEntry(), and SCIPhashmapGetNEntries().
Referenced by SCIPprintExprDotFinal().
◆ SCIPexprDismantle()
SCIP_RETCODE SCIPexprDismantle | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_MESSAGEHDLR * | messagehdlr, | ||
FILE * | file, | ||
SCIP_EXPR * | expr | ||
) |
prints structure of an expression a la Maple's dismantle
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory messagehdlr message handler file file to print to, or NULL for stdout expr expression to dismantle
Definition at line 2523 of file expr.c.
References SCIP_Expr::exprhdlr, SCIP_Exprhdlr::name, NULL, SCIP_Expr::ownerdata, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_ENTEREXPR, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITINGCHILD, SCIP_OKAY, SCIPABORT, SCIPexprIsPower(), SCIPexprIsProduct(), SCIPexprIsSum(), SCIPexprIsValue(), SCIPexprIsVar(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetNext(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPgetCoefExprProduct(), SCIPgetCoefsExprSum(), SCIPgetConstantExprSum(), SCIPgetExponentExprPow(), SCIPgetValueExprValue(), SCIPgetVarExprVar(), SCIPmessageFPrintInfo(), SCIPvarGetLbLocal(), SCIPvarGetName(), SCIPvarGetUbLocal(), and TRUE.
Referenced by SCIPdismantleExpr().
◆ SCIPexprEval()
SCIP_RETCODE SCIPexprEval | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
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
-
set global SCIP settings stat dynamic problem statistics blkmem block memory 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 2631 of file expr.c.
References SCIP_Expr::evaltag, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITINGCHILD, SCIP_INVALID, SCIP_OKAY, SCIPABORT, SCIPexprhdlrEvalExpr(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetNext(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPexpriterSkipDFS(), and TRUE.
Referenced by SCIPevalExpr(), SCIPexprEvalGradient(), SCIPnlrowGetSolActivity(), SCIPnlrowRecalcNLPActivity(), and SCIPnlrowRecalcPseudoActivity().
◆ SCIPexprEvalGradient()
SCIP_RETCODE SCIPexprEvalGradient | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | rootexpr, | ||
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
-
set global SCIP settings stat dynamic problem statistics blkmem block memory rootexpr expression to be evaluated 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 2722 of file expr.c.
References SCIP_Expr::derivative, SCIP_Expr::difftag, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, SCIP_Stat::exprlastdifftag, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITINGCHILD, SCIP_INVALID, SCIP_Longint, SCIP_OKAY, SCIP_Real, SCIPexprEval(), SCIPexprGetEvalValue(), SCIPexprhdlrBwDiffExpr(), SCIPexprIsValue(), SCIPexprIsVar(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), and TRUE.
Referenced by SCIPevalExprGradient().
◆ SCIPexprEvalHessianDir()
SCIP_RETCODE SCIPexprEvalHessianDir | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | rootexpr, | ||
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
-
set global SCIP settings stat dynamic problem statistics blkmem block memory rootexpr expression to be evaluated 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 2821 of file expr.c.
References SCIP_Expr::bardot, SCIP_Expr::derivative, SCIP_Expr::dot, evalAndDiff(), SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_VISITINGCHILD, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPexprhdlrBwDiffExpr(), SCIPexprhdlrBwFwDiffExpr(), SCIPexprIsValue(), SCIPexprIsVar(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), and TRUE.
Referenced by SCIPevalExprHessianDir().
◆ SCIPexprEvalActivity()
SCIP_RETCODE SCIPexprEvalActivity | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | rootexpr | ||
) |
possibly reevaluates and then returns the activity of the expression
Reevaluate activity if currently stored is no longer uptodate. If the expr owner provided a evalactivity-callback, then call this. Otherwise, loop over descendants and compare activitytag with stat's domchgcount, i.e., whether some bound was changed since last evaluation, to check whether exprhdlrs INTEVAL should be called.
- 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
-
set global SCIP settings stat dynamic problem statistics blkmem block memory rootexpr expression
Definition at line 2927 of file expr.c.
References SCIP_Expr::activity, SCIP_Expr::activitytag, SCIP_Stat::domchgcount, NULL, SCIP_Expr::ownerdata, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITINGCHILD, SCIP_INTERVAL_INFINITY, SCIP_OKAY, SCIPABORT, SCIPexprhdlrIntEvalExpr(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPexpriterSkipDFS(), SCIPintervalSetEmpty(), SCIPintervalSetEntire(), SCIPprintExpr(), SCIPsetCeil(), SCIPsetDebugMsg, SCIPsetDebugMsgPrint, SCIPsetFloor(), SCIPsetIsInfinity(), and TRUE.
Referenced by nlrowCalcActivityBounds(), and SCIPevalExprActivity().
◆ SCIPexprCompare()
compare expressions
- Returns
- -1, 0 or 1 if expr1 <, =, > expr2, respectively
- Note
- The given expressions are assumed to be simplified.
- Parameters
-
set global SCIP settings expr1 first expression expr2 second expression
Definition at line 3059 of file expr.c.
References SCIP_Expr::children, SCIP_Expr::exprhdlr, SCIP_Expr::nchildren, SCIPexprCompare(), SCIPexprhdlrCompareExpr(), SCIPexprhdlrGetName(), SCIPexprIsPower(), SCIPexprIsProduct(), SCIPexprIsSum(), SCIPexprIsValue(), SCIPexprIsVar(), SCIPgetCoefsExprSum(), and SCIPgetExponentExprPow().
Referenced by findEqualExpr(), SCIP_DECL_HASHKEYEQ(), SCIPcompareExpr(), SCIPexprCompare(), SCIPexprhdlrCompareExpr(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexprSimplify()
SCIP_RETCODE SCIPexprSimplify | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | rootexpr, | ||
SCIP_EXPR ** | simplified, | ||
SCIP_Bool * | changed, | ||
SCIP_Bool * | infeasible, | ||
SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)) | , | ||
void * | ownercreatedata | ||
) |
simplifies an expression
- See also
- SCIPsimplifyExpr
- Parameters
-
set global SCIP settings stat dynamic problem statistics blkmem block memory 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 3166 of file expr.c.
References SCIP_Expr::exprhdlr, FALSE, NULL, SCIP_EXPRITER_USERDATA::ptrval, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITEDCHILD, SCIP_OKAY, SCIPABORT, SCIPexprhdlrSimplifyExpr(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetChildUserDataDFS(), SCIPexpriterGetCurrent(), SCIPexpriterGetExprUserData(), SCIPexpriterGetNext(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetCurrentUserData(), SCIPexpriterSetStagesDFS(), SCIPexprRelease(), SCIPexprReplaceChild(), and TRUE.
Referenced by nlrowSimplifyExpr(), SCIPnlrowChgExpr(), and SCIPsimplifyExpr().
◆ SCIPexpriterCreate()
SCIP_RETCODE SCIPexpriterCreate | ( | SCIP_STAT * | stat, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPRITER ** | iterator | ||
) |
creates an expression iterator
- Parameters
-
stat dynamic problem statistics blkmem block memory iterator buffer to store expression iterator
Definition at line 426 of file expriter.c.
References BMSallocClearBlockMemory, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by evalAndDiff(), nlpAddNlRows(), nlpDelVarPos(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPcreateExpriter(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprPrint(), SCIPexprPrintDotInit(), SCIPexprRelease(), SCIPexprSimplify(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPhashExpr(), SCIPnlpGetVarsNonlinearity(), and SCIPnlpHasContinuousNonlinearity().
◆ SCIPexpriterFree()
void SCIPexpriterFree | ( | SCIP_EXPRITER ** | iterator | ) |
frees an expression iterator
- Parameters
-
iterator pointer to the expression iterator
Definition at line 445 of file expriter.c.
References BMSfreeBlockMemory, deinit(), and NULL.
Referenced by evalAndDiff(), nlpAddNlRows(), nlpDelVarPos(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprPrint(), SCIPexprPrintDotFinal(), SCIPexprRelease(), SCIPexprSimplify(), SCIPfreeExpriter(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPhashExpr(), SCIPnlpGetVarsNonlinearity(), SCIPnlpHasContinuousNonlinearity(), and SCIPreplaceCommonSubexpressions().
◆ SCIPexprCheckQuadratic()
SCIP_RETCODE SCIPexprCheckQuadratic | ( | SCIP_SET * | set, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr, | ||
SCIP_Bool * | isquadratic | ||
) |
checks whether an expression is quadratic
An expression is quadratic if it is either a power expression with exponent 2.0, a product of two expressions, or a sum of terms where at least one is a square or a product of two.
Use SCIPexprGetQuadraticData to get data about the representation as quadratic.
- Parameters
-
set global SCIP settings blkmem block memory expr expression isquadratic buffer to store result
Definition at line 3263 of file expr.c.
References SCIP_QuadExpr_QuadTerm::adjbilin, SCIP_QuadExpr::allexprsarevars, SCIP_QuadExpr::bilinexprterms, BMSallocBlockMemoryArray, BMSallocClearBlockMemory, BMSallocClearBlockMemoryArray, SCIP_QuadExpr_BilinTerm::coef, SCIP_QuadExpr_QuadTerm::expr, SCIP_QuadExpr_BilinTerm::expr1, SCIP_QuadExpr_BilinTerm::expr2, FALSE, SCIP_QuadExpr_QuadTerm::lincoef, SCIP_QuadExpr_QuadTerm::nadjbilin, NULL, SCIP_QuadExpr_BilinTerm::pos2, SCIP_QuadExpr_BilinTerm::prodexpr, SCIP_Expr::quadchecked, SCIP_Expr::quaddata, quadDetectGetQuadexprterm(), quadDetectProcessExpr(), SCIP_QuadExpr::quadexprterms, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPexprIsPower(), SCIPexprIsProduct(), SCIPexprIsSum(), SCIPexprIsVar(), SCIPgetCoefExprProduct(), SCIPgetCoefsExprSum(), SCIPgetConstantExprSum(), SCIPgetExponentExprPow(), SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImageInt(), SCIPhashmapInsertInt(), SCIPhashmapSetImageInt(), SCIPsetDebugMsg, SCIP_QuadExpr_QuadTerm::sqrcoef, SCIP_QuadExpr_QuadTerm::sqrexpr, and TRUE.
Referenced by SCIPcheckExprQuadratic().
◆ SCIPexprFreeQuadratic()
void SCIPexprFreeQuadratic | ( | BMS_BLKMEM * | blkmem, |
SCIP_EXPR * | expr | ||
) |
frees information on quadratic representation of an expression
Reverts SCIPexprCheckQuadratic(). Before doing changes to an expression, it can be useful to call this function.
- Parameters
-
blkmem block memory expr expression
Definition at line 3531 of file expr.c.
References SCIP_QuadExpr_QuadTerm::adjbilin, SCIP_QuadExpr_QuadTerm::adjbilinsize, SCIP_QuadExpr::bilinexprterms, BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, SCIP_QuadExpr::eigenvalues, SCIP_QuadExpr::eigenvectors, FALSE, SCIP_QuadExpr::lincoefs, SCIP_QuadExpr::linexprs, SCIP_QuadExpr::nbilinexprterms, SCIP_QuadExpr::nlinexprs, SCIP_QuadExpr::nquadexprs, NULL, SCIP_Expr::quadchecked, SCIP_Expr::quaddata, and SCIP_QuadExpr::quadexprterms.
Referenced by SCIPexprRelease(), and SCIPfreeExprQuadratic().
◆ SCIPexprComputeQuadraticCurvature()
SCIP_RETCODE SCIPexprComputeQuadraticCurvature | ( | SCIP_SET * | set, |
BMS_BLKMEM * | blkmem, | ||
BMS_BUFMEM * | bufmem, | ||
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPRCURV * | curv, | ||
SCIP_HASHMAP * | assumevarfixed, | ||
SCIP_Bool | storeeigeninfo | ||
) |
Checks the curvature of the quadratic function stored in quaddata
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
-
set global SCIP settings blkmem block memory bufmem buffer memory messagehdlr message handler 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 3576 of file expr.c.
References SCIP_QuadExpr::bilinexprterms, BMSallocBlockMemoryArray, BMSallocBufferMemoryArray, BMSallocClearBlockMemoryArray, BMSallocClearBufferMemoryArray, BMSfreeBufferMemoryArray, SCIP_QuadExpr_BilinTerm::coef, SCIP_QuadExpr::curvature, SCIP_QuadExpr::curvaturechecked, SCIP_QuadExpr::eigeninfostored, SCIP_QuadExpr::eigenvalues, SCIP_QuadExpr::eigenvectors, SCIP_QuadExpr_QuadTerm::expr, SCIP_QuadExpr_BilinTerm::expr1, SCIP_QuadExpr_BilinTerm::expr2, FALSE, SCIP_QuadExpr_QuadTerm::nadjbilin, SCIP_QuadExpr::nbilinexprterms, SCIP_QuadExpr::nquadexprs, NULL, SCIP_Expr::quaddata, SCIP_QuadExpr::quadexprterms, SCIP_ALLOC, SCIP_CALL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, SCIP_Real, SCIP_VERBLEVEL_FULL, SCIPcallLapackDsyevIpopt(), SCIPexprIsVar(), SCIPgetVarExprVar(), SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPhashmapInsert(), SCIPisIpoptAvailableIpopt(), SCIPmessageFPrintVerbInfo(), SCIPmessagePrintWarning(), SCIPsetIsNegative(), SCIPsetIsPositive(), SCIP_QuadExpr_QuadTerm::sqrcoef, and TRUE.
Referenced by SCIPcomputeExprQuadraticCurvature().