Scippy

SCIP

Solving Constraint Integer Programs

expr.h File Reference

Detailed Description

private functions to work with algebraic expressions

Author
Ksenia Bestuzheva
Benjamin Mueller
Felipe Serrano
Stefan Vigerske

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.

Functions

Expression Handler Methods
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)
 
SCIP_RETCODE SCIPexprhdlrFree (SCIP_EXPRHDLR **exprhdlr, SCIP_SET *set, BMS_BLKMEM *blkmem)
 
SCIP_RETCODE SCIPexprhdlrCopyInclude (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *targetset)
 
void SCIPexprhdlrInit (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set)
 
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)
 
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)
 
SCIP_RETCODE SCIPexprhdlrCurvatureExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, SCIP_EXPRCURV exprcurvature, SCIP_Bool *success, SCIP_EXPRCURV *childcurv)
 
SCIP_RETCODE SCIPexprhdlrMonotonicityExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, int childidx, SCIP_MONOTONE *result)
 
SCIP_RETCODE SCIPexprhdlrIntegralityExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, SCIP_Bool *isintegral)
 
SCIP_RETCODE SCIPexprhdlrHashExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, unsigned int *hashkey, unsigned int *childrenhashes)
 
int SCIPexprhdlrCompareExpr (SCIP_SET *set, SCIP_EXPR *expr1, SCIP_EXPR *expr2)
 
SCIP_RETCODE SCIPexprhdlrEvalExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, BMS_BUFMEM *bufmem, SCIP_EXPR *expr, SCIP_Real *val, SCIP_Real *childrenvals, SCIP_SOL *sol)
 
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)
 
SCIP_RETCODE SCIPexprhdlrFwDiffExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, SCIP_Real *dot, SCIP_SOL *direction)
 
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)
 
SCIP_RETCODE SCIPexprhdlrBwFwDiffExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, int childidx, SCIP_Real *bardot, SCIP_SOL *direction)
 
SCIP_RETCODE SCIPexprhdlrIntEvalExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, SCIP_INTERVAL *interval, SCIP_DECL_EXPR_INTEVALVAR((*intevalvar)), void *intevalvardata)
 
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)
 
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)
 
SCIP_RETCODE SCIPexprhdlrSimplifyExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, SCIP_EXPR **simplifiedexpr, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
 
SCIP_RETCODE SCIPexprhdlrReversePropExpr (SCIP_EXPRHDLR *exprhdlr, SCIP_SET *set, SCIP_EXPR *expr, SCIP_INTERVAL bounds, SCIP_INTERVAL *childrenbounds, SCIP_Bool *infeasible)
 
Expression Methods
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)
 
SCIP_RETCODE SCIPexprAppendChild (SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR *child)
 
SCIP_RETCODE SCIPexprReplaceChild (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR *expr, int childidx, SCIP_EXPR *newchild)
 
SCIP_RETCODE SCIPexprRemoveChildren (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR *expr)
 
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)
 
SCIP_RETCODE SCIPexprDuplicateShallow (SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_EXPR **copyexpr, SCIP_DECL_EXPR_OWNERCREATE((*ownercreate)), void *ownercreatedata)
 
void SCIPexprCapture (SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPexprRelease (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
 
SCIP_Bool SCIPexprIsVar (SCIP_SET *set, SCIP_EXPR *expr)
 
SCIP_Bool SCIPexprIsValue (SCIP_SET *set, SCIP_EXPR *expr)
 
SCIP_Bool SCIPexprIsSum (SCIP_SET *set, SCIP_EXPR *expr)
 
SCIP_Bool SCIPexprIsProduct (SCIP_SET *set, SCIP_EXPR *expr)
 
SCIP_Bool SCIPexprIsPower (SCIP_SET *set, SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPexprPrint (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPexprPrintDotInit (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPRPRINTDATA **printdata, FILE *file, SCIP_EXPRPRINT_WHAT whattoprint)
 
SCIP_RETCODE SCIPexprPrintDotInit2 (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPRPRINTDATA **printdata, const char *filename, SCIP_EXPRPRINT_WHAT whattoprint)
 
SCIP_RETCODE SCIPexprPrintDot (SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, SCIP_EXPRPRINTDATA *printdata, SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPexprPrintDotFinal (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPRPRINTDATA **printdata)
 
SCIP_RETCODE SCIPexprDismantle (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_MESSAGEHDLR *messagehdlr, FILE *file, SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPexprEval (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_SOL *sol, SCIP_Longint soltag)
 
SCIP_RETCODE SCIPexprEvalGradient (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR *rootexpr, SCIP_SOL *sol, SCIP_Longint soltag)
 
SCIP_RETCODE SCIPexprEvalHessianDir (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR *rootexpr, SCIP_SOL *sol, SCIP_Longint soltag, SCIP_SOL *direction)
 
SCIP_RETCODE SCIPexprEvalActivity (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR *rootexpr)
 
int SCIPexprCompare (SCIP_SET *set, SCIP_EXPR *expr1, SCIP_EXPR *expr2)
 
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)
 
Expression Iterator Methods
SCIP_RETCODE SCIPexpriterCreate (SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPRITER **iterator)
 
void SCIPexpriterFree (SCIP_EXPRITER **iterator)
 
Quadratic expression functions
SCIP_RETCODE SCIPexprCheckQuadratic (SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Bool *isquadratic)
 
void SCIPexprFreeQuadratic (BMS_BLKMEM *blkmem, SCIP_EXPR *expr)
 
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)
 

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
blkmemblock memory
exprhdlrbuffer where to store created expression handler
namename of expression handler (must not be NULL)
descdescription of expression handler (can be NULL)
precedenceprecedence of expression operation (used for printing)
datadata 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
exprhdlrpointer to expression handler to be freed
setglobal SCIP settings
blkmemblock 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
exprhdlrexpression handler
targetsetSCIP_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()

◆ 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
exprhdlrexpression handler
setglobal SCIP settings
messagehdlrmessage handler
exprexpression
stagestage of expression iteration
currentchildindex of current child if in stage visitingchild or visitedchild
parentprecedenceprecedence of parent
filethe 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
exprhdlrexpression handler
setglobal SCIP settings
stringstring containing expression to be parse
endstringbuffer to store the position of string after parsing
exprbuffer to store the parsed expression
successbuffer to store whether the parsing was successful or not
ownercreatedatadata 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to check the curvature for
exprcurvaturedesired curvature of this expression
successbuffer to store whether the desired curvature be obtained
childcurvarray 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to check the monotonicity for
childidxindex of the considered child expression
resultbuffer 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to check integrality for
isintegralbuffer 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to be hashed
hashkeybuffer to store the hash value
childrenhashesarray 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()

int SCIPexprhdlrCompareExpr ( SCIP_SET set,
SCIP_EXPR expr1,
SCIP_EXPR expr2 
)

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
setglobal SCIP settings
expr1first expression in comparison
expr2second 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
exprhdlrexpression handler
setglobal SCIP settings
bufmembuffer memory, can be NULL if childrenvals is NULL
exprexpression to be evaluated
valbuffer to store value of expression
childrenvalsvalues for children, or NULL if values stored in children should be used
solsolution 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
exprhdlrexpression handler
setglobal SCIP settings
bufmembuffer memory, can be NULL if childrenvals is NULL
exprexpression to be differentiated
childidxindex of the child
derivativebuffer to store the partial derivative w.r.t. the i-th children
childrenvalsvalues for children, or NULL if values stored in children should be used
exprvalvalue 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to be differentiated
dotbuffer to store derivative value
directiondirection 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.

See also
SCIP_DECL_EXPREVAL
SCIP_DECL_EXPRFWDIFF
Parameters
exprhdlrexpression handler
setglobal SCIP settings
bufmembuffer memory, can be NULL if childrenvals is NULL
exprexpression to be evaluated
valbuffer to store value of expression
dotbuffer to store derivative value
childrenvalsvalues for children, or NULL if values stored in children should be used
solsolution that is evaluated (can be NULL)
childrendirsdirectional derivatives for children, or NULL if dot-values stored in children should be used
directiondirection 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to be differentiated
childidxindex of the child
bardotbuffer to store derivative value
directiondirection 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to be evaluated
intervalbuffer where to store interval
intevalvardatadata 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to be estimated
localboundscurrent bounds for children
globalboundsglobal bounds for children
refpointchildren values for the reference point where to estimate
overestimatewhether the expression needs to be over- or underestimated
targetvaluea value that the estimator shall exceed, can be +/-infinity
coefsarray to store coefficients of estimator
constantbuffer to store constant part of estimator
islocalbuffer to store whether estimator is valid locally only
successbuffer to indicate whether an estimator could be computed
branchcandarray 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to be estimated
boundsbounds for children
overestimatewhether the expression shall be overestimated or underestimated
coefsbuffer to store coefficients of computed estimators
constantbuffer to store constant of computed estimators
nreturnedbuffer 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to simplify
simplifiedexprbuffer to store the simplified expression
ownercreatedatadata 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
exprhdlrexpression handler
setglobal SCIP settings
exprexpression to propagate
boundsthe bounds on the expression that should be propagated
childrenboundsarray to store computed bounds for children, initialized with current activity
infeasiblebuffer 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
setglobal SCIP settings
blkmemblock memory
exprpointer where to store expression
exprhdlrexpression handler
exprdataexpression data (expression assumes ownership)
nchildrennumber of children
childrenchildren (can be NULL if nchildren is 0)
ownercreatedatadata 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
setglobal SCIP settings
blkmemblock memory
exprexpression
childexpression 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
exprexpression where a child is going to be replaced
childidxindex of child being replaced
newchildthe 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
exprexpression

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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
targetsetglobal SCIP settings data structure where target expression will live
targetstatdynamic problem statistics in target SCIP
targetblkmemblock memory in target SCIP
sourceexprexpression to be copied
targetexprbuffer to store pointer to copy of source expression
mapexprdatadata of expression mapping function
ownercreatedatadata 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
setglobal SCIP settings
blkmemblock memory
exproriginal expression
copyexprbuffer to store (shallow) duplicate of expr
ownercreatedatadata 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
exprexpression

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()

◆ SCIPexprIsVar()

◆ SCIPexprIsValue()

SCIP_Bool SCIPexprIsValue ( SCIP_SET set,
SCIP_EXPR expr 
)

returns whether an expression is a value expression

Parameters
setglobal SCIP settings
exprexpression

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()

SCIP_Bool SCIPexprIsSum ( SCIP_SET set,
SCIP_EXPR expr 
)

returns whether an expression is a sum expression

Parameters
setglobal SCIP settings
exprexpression

Definition at line 2207 of file expr.c.

References SCIP_Expr::exprhdlr, and NULL.

Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), and SCIPisExprSum().

◆ SCIPexprIsProduct()

SCIP_Bool SCIPexprIsProduct ( SCIP_SET set,
SCIP_EXPR expr 
)

returns whether an expression is a product expression

Parameters
setglobal SCIP settings
exprexpression

Definition at line 2219 of file expr.c.

References SCIP_Expr::exprhdlr, and NULL.

Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), and SCIPisExprProduct().

◆ SCIPexprIsPower()

SCIP_Bool SCIPexprIsPower ( SCIP_SET set,
SCIP_EXPR expr 
)

returns whether an expression is a power expression

Parameters
setglobal SCIP settings
exprexpression

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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
messagehdlrmessage handler
filefile to print to, or NULL for stdout
exprexpression 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
printdatabuffer to store dot printing data
filefile to print to, or NULL for stdout
whattoprintinfo 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
printdatabuffer to store dot printing data
filenamename of file to print to
whattoprintinfo 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()

◆ SCIPexprPrintDotFinal()

SCIP_RETCODE SCIPexprPrintDotFinal ( SCIP_SET set,
SCIP_STAT stat,
BMS_BLKMEM blkmem,
SCIP_EXPRPRINTDATA **  printdata 
)

finishes printing of expressions in dot format

Parameters
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
printdatabuffer 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()

◆ 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
exprexpression to be evaluated
solsolution to be evaluated
soltagtag 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
rootexprexpression to be evaluated
solsolution to be evaluated (NULL for the current LP solution)
soltagtag 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
rootexprexpression to be evaluated
solsolution to be evaluated (NULL for the current LP solution)
soltagtag that uniquely identifies the solution (with its values), or 0.
directiondirection

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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
rootexprexpression

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()

int SCIPexprCompare ( SCIP_SET set,
SCIP_EXPR expr1,
SCIP_EXPR expr2 
)

compare expressions

Returns
-1, 0 or 1 if expr1 <, =, > expr2, respectively
Note
The given expressions are assumed to be simplified.
Parameters
setglobal SCIP settings
expr1first expression
expr2second 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
setglobal SCIP settings
statdynamic problem statistics
blkmemblock memory
rootexprexpression to be simplified
simplifiedbuffer to store simplified expression
changedbuffer to store if rootexpr actually changed
infeasiblebuffer to store whether infeasibility has been detected
ownercreatedatadata 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()

◆ SCIPexpriterFree()

◆ 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
setglobal SCIP settings
blkmemblock memory
exprexpression
isquadraticbuffer 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 
)

◆ 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
setglobal SCIP settings
blkmemblock memory
bufmembuffer memory
messagehdlrmessage handler
exprquadratic expression
curvpointer to store the curvature of quadratics
assumevarfixedhashmap containing variables that should be assumed to be fixed, or NULL
storeeigeninfowhether 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().