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 "scip/type_message.h"
#include "blockmemshell/memory.h"
Go to the source code of this file.
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
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 305 of file expr.c.
References assert(), BMSallocClearBlockMemory, BMSduplicateMemoryArray, eval(), NULL, SCIP_ALLOC, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_OKAY, and SCIPclockCreate().
Referenced by SCIPincludeExprhdlr().
SCIP_RETCODE SCIPexprhdlrFree | ( | SCIP_EXPRHDLR ** | exprhdlr, |
SCIP_SET * | set, | ||
BMS_BLKMEM * | blkmem ) |
frees expression handler
exprhdlr | pointer to expression handler to be freed |
set | global SCIP settings |
blkmem | block memory |
Definition at line 340 of file expr.c.
References BMSfreeBlockMemory, BMSfreeMemoryArray, BMSfreeMemoryArrayNull, SCIP_Exprhdlr::data, NULL, SCIP_CALL, SCIP_OKAY, and SCIPclockFree().
SCIP_RETCODE SCIPexprhdlrCopyInclude | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | targetset ) |
copies the given expression handler to a new scip
Definition at line 859 of file expr.c.
References assert(), NULL, SCIP_Set::scip, SCIP_CALL, SCIP_OKAY, SCIPexprhdlrGetName(), and SCIPsetDebugMsg.
Referenced by SCIPsetCopyPlugins().
void SCIPexprhdlrInit | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set ) |
initialization of expression handler (resets statistics)
exprhdlr | expression handler |
set | global SCIP settings |
Definition at line 884 of file expr.c.
References assert(), 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.
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.
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 917 of file expr.c.
References assert(), 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().
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.
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 986 of file expr.c.
References assert(), FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and SCIPexprhdlrGetName().
Referenced by parseBase().
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
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 1025 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, FALSE, NULL, SCIP_Bool, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIP_DECL_EXPRCURVATURE(), and SCIPcomputeExprCurvature().
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
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 1054 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, result, SCIP_CALL, SCIP_MONOTONE_UNKNOWN, and SCIP_OKAY.
Referenced by SCIP_DECL_EXPRMONOTONICITY().
SCIP_RETCODE SCIPexprhdlrIntegralityExpr | ( | SCIP_EXPRHDLR * | exprhdlr, |
SCIP_SET * | set, | ||
SCIP_EXPR * | expr, | ||
SCIP_Bool * | isintegral ) |
calls the integrality check callback of an expression handler
exprhdlr | expression handler |
set | global SCIP settings |
expr | expression to check integrality for |
isintegral | buffer to store whether expression is integral |
Definition at line 1083 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, FALSE, NULL, SCIP_Bool, SCIP_CALL, and SCIP_OKAY.
Referenced by SCIPcomputeExprIntegrality().
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.
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 1113 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, i, SCIP_Exprhdlr::name, SCIP_Expr::nchildren, NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, and SCIPcalcFibHash().
Referenced by hashExpr().
calls the compare callback of an expression handler
The method receives two expressions, expr1 and expr2, and returns
set | global SCIP settings |
expr1 | first expression in comparison |
expr2 | second expression in comparison |
Definition at line 1162 of file expr.c.
References assert(), SCIP_Expr::children, SCIP_Expr::exprhdlr, i, SCIP_Expr::nchildren, NULL, and SCIPexprCompare().
Referenced by SCIPexprCompare().
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.
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 1205 of file expr.c.
References assert(), BMSallocBufferMemoryArray, BMSfreeBufferMemoryArray, c, SCIP_Expr::children, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, SCIP_Expr::nchildren, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, SCIPisFinite, and sol.
Referenced by evalAndDiff(), SCIPcallExprEval(), and SCIPexprEval().
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.
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.
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 1272 of file expr.c.
References assert(), BMSallocBufferMemoryArray, BMSfreeBufferMemoryArray, c, 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().
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
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 1345 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIPisFinite.
Referenced by evalAndDiff(), and 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.
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 1386 of file expr.c.
References assert(), BMSallocBufferMemoryArray, BMSfreeBufferMemoryArray, c, 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(), SCIPisFinite, and sol.
Referenced by SCIPcallExprEvalFwdiff().
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
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 1489 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_INVALID, SCIP_OKAY, SCIP_Real, and SCIPisFinite.
Referenced by SCIPexprEvalHessianDir().
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
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 1525 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, SCIP_Exprhdlr::intevaltime, SCIP_Exprhdlr::nintevalcalls, NULL, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRINTEVAL(), and SCIPexprEvalActivity().
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
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 1556 of file expr.c.
References assert(), SCIP_Exprhdlr::estimatetime, SCIP_Expr::exprhdlr, FALSE, SCIP_Exprhdlr::nestimatecalls, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRESTIMATE().
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
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 1600 of file expr.c.
References assert(), SCIP_Exprhdlr::estimatetime, SCIP_Expr::exprhdlr, SCIP_Exprhdlr::nestimatecalls, NULL, SCIP_Bool, SCIP_CALL, SCIP_EXPR_MAXINITESTIMATES, SCIP_OKAY, SCIP_Real, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRINITESTIMATES().
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
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 1635 of file expr.c.
References assert(), 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().
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.
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 1680 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, FALSE, SCIP_Expr::nchildren, SCIP_Exprhdlr::ncutoffs, SCIP_Exprhdlr::npropcalls, NULL, SCIP_Exprhdlr::proptime, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPclockStart(), and SCIPclockStop().
Referenced by SCIP_DECL_EXPRREVERSEPROP().
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
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 1728 of file expr.c.
References assert(), BMSallocClearBlockMemory, BMSduplicateBlockMemoryArray, c, 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().
SCIP_RETCODE SCIPexprAppendChild | ( | SCIP_SET * | set, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr, | ||
SCIP_EXPR * | child ) |
appends child to the children list of expr
set | global SCIP settings |
blkmem | block memory |
expr | expression |
child | expression to be appended |
Definition at line 1785 of file expr.c.
References assert(), BMSreallocBlockMemoryArray, SCIP_Expr::children, SCIP_Expr::childrensize, SCIP_Expr::nchildren, NULL, SCIP_ALLOC, SCIP_OKAY, SCIPexprCapture(), and SCIPsetCalcMemGrowSize().
Referenced by SCIPappendExprChild(), and SCIPexprCopy().
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
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 1816 of file expr.c.
References assert(), SCIP_Expr::children, NULL, SCIP_CALL, SCIP_OKAY, SCIPexprCapture(), and SCIPexprRelease().
Referenced by SCIPexprSimplify(), and SCIPreplaceExprChild().
SCIP_RETCODE SCIPexprRemoveChildren | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr ) |
remove all children of expr
set | global SCIP settings |
stat | dynamic problem statistics |
blkmem | block memory |
expr | expression |
Definition at line 1846 of file expr.c.
References assert(), c, SCIP_Expr::children, SCIP_Expr::nchildren, NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprRelease().
Referenced by SCIPremoveExprChildren().
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
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.
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 1878 of file expr.c.
References assert(), 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().
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
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 2033 of file expr.c.
References assert(), SCIP_Expr::exprdata, SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprCreate().
Referenced by SCIPduplicateExprShallow().
void SCIPexprCapture | ( | SCIP_EXPR * | expr | ) |
captures an expression (increments usage count)
expr | expression |
Definition at line 2064 of file expr.c.
References assert(), NULL, and SCIP_Expr::nuses.
Referenced by parseBase(), SCIPcaptureExpr(), SCIPexprAppendChild(), SCIPexprCreate(), SCIPexprhdlrSimplifyExpr(), SCIPexprReplaceChild(), and SCIPreplaceCommonSubexpressions().
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)
set | global SCIP settings |
stat | dynamic problem statistics |
blkmem | block memory |
rootexpr | pointer to expression |
Definition at line 2074 of file expr.c.
References assert(), 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().
returns whether an expression is a variable expression
set | global SCIP settings |
expr | expression |
Definition at line 2206 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, and SCIP_Bool.
Referenced by nlpAddNlRows(), nlpDelVarPos(), SCIP_DECL_EXPR_MAPEXPR(), SCIPevalExprQuadratic(), SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprComputeQuadraticCurvature(), SCIPexprDismantle(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPisExprVar(), SCIPnlpGetVarsNonlinearity(), and SCIPnlpHasContinuousNonlinearity().
returns whether an expression is a value expression
set | global SCIP settings |
expr | expression |
Definition at line 2218 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, and SCIP_Bool.
Referenced by nlrowSimplifyExpr(), parseExpr(), SCIPexprCompare(), SCIPexprDismantle(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), and SCIPisExprValue().
returns whether an expression is a sum expression
set | global SCIP settings |
expr | expression |
Definition at line 2230 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, and SCIP_Bool.
Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), and SCIPisExprSum().
returns whether an expression is a product expression
set | global SCIP settings |
expr | expression |
Definition at line 2242 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, and SCIP_Bool.
Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), SCIPexprGetMonomialData(), and SCIPisExprProduct().
returns whether an expression is a power expression
set | global SCIP settings |
expr | expression |
Definition at line 2254 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, NULL, and SCIP_Bool.
Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), SCIPexprGetMonomialData(), and SCIPisExprPower().
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
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 2266 of file expr.c.
References assert(), 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().
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
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 2315 of file expr.c.
References assert(), BMSallocBlockMemory, FALSE, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPexpriterCreate(), and SCIPhashmapCreate().
Referenced by SCIPexprPrintDotInit2(), and SCIPprintExprDotInit().
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
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 2347 of file expr.c.
References assert(), NULL, SCIP_CALL_FINALLY, SCIP_FILECREATEERROR, SCIP_OKAY, SCIPerrorMessage, SCIPexprPrintDotInit(), and TRUE.
Referenced by SCIPprintExprDotInit2().
SCIP_RETCODE SCIPexprPrintDot | ( | SCIP_SET * | set, |
SCIP_MESSAGEHDLR * | messagehdlr, | ||
SCIP_EXPRPRINTDATA * | printdata, | ||
SCIP_EXPR * | expr ) |
main part of printing an expression in dot format
set | global SCIP settings |
messagehdlr | message handler |
printdata | data as initialized by SCIPprintExprDotInit() |
expr | expression to be printed |
Definition at line 2379 of file expr.c.
References assert(), c, 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_LONGINT_FORMAT, SCIP_OKAY, SCIP_Real, SCIPexprhdlrPrintExpr(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPhashmapInsert(), and SCIPsetFrac().
Referenced by SCIPprintExprDot().
SCIP_RETCODE SCIPexprPrintDotFinal | ( | SCIP_SET * | set, |
SCIP_STAT * | stat, | ||
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPRPRINTDATA ** | printdata ) |
finishes printing of expressions in dot format
set | global SCIP settings |
stat | dynamic problem statistics |
blkmem | block memory |
printdata | buffer where dot printing data has been stored |
Definition at line 2493 of file expr.c.
References assert(), BMSfreeBlockMemory, i, SCIP_Expr::nchildren, NULL, SCIP_OKAY, SCIPexpriterFree(), SCIPhashmapEntryGetOrigin(), SCIPhashmapFree(), SCIPhashmapGetEntry(), and SCIPhashmapGetNEntries().
Referenced by SCIPprintExprDotFinal().
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
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 2546 of file expr.c.
References assert(), depth, 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(), TRUE, and var.
Referenced by SCIPdismantleExpr().
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().
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 2654 of file expr.c.
References assert(), SCIP_Expr::evaltag, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITINGCHILD, SCIP_INVALID, SCIP_Longint, SCIP_OKAY, SCIPABORT, SCIPexprhdlrEvalExpr(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetNext(), SCIPexpriterGetStageDFS(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), SCIPexpriterSkipDFS(), sol, and TRUE.
Referenced by SCIPevalExpr(), SCIPexprEvalGradient(), SCIPnlrowGetSolActivity(), SCIPnlrowRecalcNLPActivity(), and SCIPnlrowRecalcPseudoActivity().
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.
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 2745 of file expr.c.
References assert(), 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(), sol, and TRUE.
Referenced by SCIPevalExprGradient().
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.
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 2844 of file expr.c.
References assert(), 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_Longint, SCIP_OKAY, SCIP_Real, SCIPexprhdlrBwDiffExpr(), SCIPexprhdlrBwFwDiffExpr(), SCIPexprIsValue(), SCIPexprIsVar(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetChildExprDFS(), SCIPexpriterGetChildIdxDFS(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), sol, and TRUE.
Referenced by SCIPevalExprHessianDir().
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.
set | global SCIP settings |
stat | dynamic problem statistics |
blkmem | block memory |
rootexpr | expression |
Definition at line 2950 of file expr.c.
References SCIP_Expr::activity, SCIP_Expr::activitytag, assert(), 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().
compare expressions
set | global SCIP settings |
expr1 | first expression |
expr2 | second expression |
Definition at line 3082 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().
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
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 3189 of file expr.c.
References assert(), SCIP_Expr::exprhdlr, FALSE, NULL, SCIP_EXPRITER_USERDATA::ptrval, SCIP_Bool, 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().
SCIP_RETCODE SCIPexprGetSymData | ( | SCIP_SET * | set, |
SCIP_EXPR * | expr, | ||
SYM_EXPRDATA ** | symdata ) |
retrieves symmetry information from an expression
method to retrieve symmetry information from an expression
set | global SCIP settings |
expr | expression from which information is retrieved |
symdata | buffer to store symmetry information |
Definition at line 3283 of file expr.c.
References assert(), NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprGetHdlr().
Referenced by SCIP_DECL_EXPRGETSYMDATA(), and SCIPgetSymDataExpr().
SCIP_RETCODE SCIPexpriterCreate | ( | SCIP_STAT * | stat, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPRITER ** | iterator ) |
creates an expression iterator
stat | dynamic problem statistics |
blkmem | block memory |
iterator | buffer to store expression iterator |
Definition at line 427 of file expriter.c.
References assert(), 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().
void SCIPexpriterFree | ( | SCIP_EXPRITER ** | iterator | ) |
frees an expression iterator
iterator | pointer to the expression iterator |
Definition at line 446 of file expriter.c.
References assert(), 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().
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.
set | global SCIP settings |
blkmem | block memory |
expr | expression |
isquadratic | buffer to store result |
Definition at line 3315 of file expr.c.
References SCIP_QuadExpr_QuadTerm::adjbilin, SCIP_QuadExpr::allexprsarevars, assert(), SCIP_QuadExpr::bilinexprterms, BMSallocBlockMemoryArray, BMSallocClearBlockMemory, BMSallocClearBlockMemoryArray, c, SCIP_QuadExpr_BilinTerm::coef, SCIP_QuadExpr::constant, SCIP_QuadExpr_QuadTerm::expr, SCIP_QuadExpr_BilinTerm::expr1, SCIP_QuadExpr_BilinTerm::expr2, FALSE, SCIP_QuadExpr_QuadTerm::lincoef, SCIP_QuadExpr::lincoefs, SCIP_QuadExpr::linexprs, SCIP_QuadExpr_QuadTerm::nadjbilin, SCIP_QuadExpr::nbilinexprterms, SCIP_QuadExpr::nlinexprs, SCIP_QuadExpr::nquadexprs, NULL, SCIP_QuadExpr_BilinTerm::pos2, SCIP_QuadExpr_BilinTerm::prodexpr, SCIP_Expr::quadchecked, SCIP_Expr::quaddata, quadDetectGetQuadexprterm(), quadDetectProcessExpr(), SCIP_QuadExpr::quadexprterms, SCIP_ALLOC, SCIP_Bool, 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().
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.
blkmem | block memory |
expr | expression |
Definition at line 3589 of file expr.c.
References SCIP_QuadExpr_QuadTerm::adjbilin, SCIP_QuadExpr_QuadTerm::adjbilinsize, assert(), SCIP_QuadExpr::bilinexprterms, BMSfreeBlockMemory, BMSfreeBlockMemoryArray, BMSfreeBlockMemoryArrayNull, SCIP_QuadExpr::eigenvalues, SCIP_QuadExpr::eigenvectors, FALSE, i, 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().
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
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.
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 3635 of file expr.c.
References assert(), 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, i, SCIP_QuadExpr_QuadTerm::nadjbilin, SCIP_QuadExpr::nbilinexprterms, SCIP_QuadExpr::nquadexprs, NULL, nvars, SCIP_Expr::quaddata, SCIP_QuadExpr::quadexprterms, SCIP_ALLOC, SCIP_Bool, SCIP_CALL, SCIP_EXPRCURV_CONCAVE, SCIP_EXPRCURV_CONVEX, SCIP_EXPRCURV_UNKNOWN, SCIP_OKAY, SCIP_Real, SCIP_VERBLEVEL_FULL, SCIPexprIsVar(), SCIPgetVarExprVar(), SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPhashmapInsert(), SCIPlapackComputeEigenvalues(), SCIPlapackIsAvailable(), SCIPmessageFPrintVerbInfo(), SCIPmessagePrintWarning(), SCIPsetIsNegative(), SCIPsetIsPositive(), SCIP_QuadExpr_QuadTerm::sqrcoef, and TRUE.
Referenced by SCIPcomputeExprQuadraticCurvature().
SCIP_RETCODE SCIPexprGetMonomialData | ( | SCIP_SET * | set, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPR * | expr, | ||
SCIP_Real * | coef, | ||
SCIP_Real * | exponents, | ||
SCIP_EXPR ** | factors ) |
returns a monomial representation of a product expression
The array to store all factor expressions needs to be of size the number of children in the expression which is given by SCIPexprGetNChildren().
Given a non-trivial monomial expression, the function finds its representation as \(cx^\alpha\), where \(c\) is a real coefficient, \(x\) is a vector of auxiliary or original variables (where some entries can be NULL is the auxiliary variable has not been created yet), and \(\alpha\) is a real vector of exponents.
A non-trivial monomial is a product of a least two expressions.
set | global SCIP settings |
blkmem | block memory |
expr | expression |
coef | coefficient \(c\) |
exponents | exponents \(\alpha\) |
factors | factor expressions \(x\) |
Definition at line 4261 of file expr.c.
References assert(), c, NULL, SCIP_OKAY, SCIP_Real, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPexprIsPower(), SCIPexprIsProduct(), SCIPgetCoefExprProduct(), and SCIPgetExponentExprPow().
Referenced by SCIPgetExprMonomialData().