Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

functions for algebraic expressions

Author
Ksenia Bestuzheva
Benjamin Mueller
Felipe Serrano
Stefan Vigerske

Definition in file expr.c.

#include <assert.h>
#include <ctype.h>
#include "scip/expr.h"
#include "scip/struct_expr.h"
#include "scip/pub_misc.h"
#include "scip/clock.h"
#include "scip/set.h"
#include "scip/pub_var.h"
#include "scip/pub_message.h"
#include "scip/sol.h"
#include "scip/tree.h"
#include "scip/struct_set.h"
#include "scip/struct_stat.h"
#include "scip/lapack_calls.h"

Go to the source code of this file.

Functions

static SCIP_RETCODE freeExpr (BMS_BLKMEM *blkmem, SCIP_EXPR **expr)
 
static SCIP_RETCODE quadDetectProcessExpr (SCIP_EXPR *expr, SCIP_HASHMAP *seenexpr, int *nquadterms, int *nlinterms)
 
static SCIP_RETCODE quadDetectGetQuadexprterm (BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_HASHMAP *expr2idx, SCIP_HASHMAP *seenexpr, SCIP_QUADEXPR *quadexpr, SCIP_QUADEXPR_QUADTERM **quadexprterm)
 
static SCIP_RETCODE evalAndDiff (SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_SOL *sol, SCIP_Longint soltag, SCIP_SOL *direction)
 
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)
 
void SCIPexprhdlrSetCopyFreeHdlr (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYHDLR((*copyhdlr)), SCIP_DECL_EXPRFREEHDLR((*freehdlr)))
 
void SCIPexprhdlrSetCopyFreeData (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOPYDATA((*copydata)), SCIP_DECL_EXPRFREEDATA((*freedata)))
 
void SCIPexprhdlrSetPrint (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRPRINT((*print)))
 
void SCIPexprhdlrSetParse (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRPARSE((*parse)))
 
void SCIPexprhdlrSetCurvature (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCURVATURE((*curvature)))
 
void SCIPexprhdlrSetMonotonicity (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRMONOTONICITY((*monotonicity)))
 
void SCIPexprhdlrSetIntegrality (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINTEGRALITY((*integrality)))
 
void SCIPexprhdlrSetHash (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRHASH((*hash)))
 
void SCIPexprhdlrSetCompare (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRCOMPARE((*compare)))
 
void SCIPexprhdlrSetDiff (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRBWDIFF((*bwdiff)), SCIP_DECL_EXPRFWDIFF((*fwdiff)), SCIP_DECL_EXPRBWFWDIFF((*bwfwdiff)))
 
void SCIPexprhdlrSetIntEval (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINTEVAL((*inteval)))
 
void SCIPexprhdlrSetSimplify (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRSIMPLIFY((*simplify)))
 
void SCIPexprhdlrSetReverseProp (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRREVERSEPROP((*reverseprop)))
 
void SCIPexprhdlrSetGetSymdata (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRGETSYMDATA((*getsymdata)))
 
void SCIPexprhdlrSetEstimate (SCIP_EXPRHDLR *exprhdlr, SCIP_DECL_EXPRINITESTIMATES((*initestimates)), SCIP_DECL_EXPRESTIMATE((*estimate)))
 
const char * SCIPexprhdlrGetName (SCIP_EXPRHDLR *exprhdlr)
 
const char * SCIPexprhdlrGetDescription (SCIP_EXPRHDLR *exprhdlr)
 
unsigned int SCIPexprhdlrGetPrecedence (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_EXPRHDLRDATASCIPexprhdlrGetData (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasPrint (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasBwdiff (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasFwdiff (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasIntEval (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasEstimate (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasInitEstimates (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasSimplify (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasCurvature (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasMonotonicity (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasReverseProp (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Bool SCIPexprhdlrHasGetSymData (SCIP_EXPRHDLR *exprhdlr)
 
 SCIP_DECL_SORTPTRCOMP (SCIPexprhdlrComp)
 
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 Handler Statistics
unsigned int SCIPexprhdlrGetNCreated (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Longint SCIPexprhdlrGetNIntevalCalls (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Real SCIPexprhdlrGetIntevalTime (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Longint SCIPexprhdlrGetNReversepropCalls (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Real SCIPexprhdlrGetReversepropTime (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Longint SCIPexprhdlrGetNCutoffs (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Longint SCIPexprhdlrGetNDomainReductions (SCIP_EXPRHDLR *exprhdlr)
 
void SCIPexprhdlrIncrementNDomainReductions (SCIP_EXPRHDLR *exprhdlr, int nreductions)
 
SCIP_Longint SCIPexprhdlrGetNEstimateCalls (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Real SCIPexprhdlrGetEstimateTime (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Longint SCIPexprhdlrGetNBranchings (SCIP_EXPRHDLR *exprhdlr)
 
void SCIPexprhdlrIncrementNBranchings (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Longint SCIPexprhdlrGetNSimplifyCalls (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Real SCIPexprhdlrGetSimplifyTime (SCIP_EXPRHDLR *exprhdlr)
 
SCIP_Longint SCIPexprhdlrGetNSimplifications (SCIP_EXPRHDLR *exprhdlr)
 
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 **rootexpr)
 
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)
 
SCIP_RETCODE SCIPexprGetSymData (SCIP_SET *set, SCIP_EXPR *expr, SYM_EXPRDATA **symdata)
 
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)
 
int SCIPexprGetNUses (SCIP_EXPR *expr)
 
int SCIPexprGetNChildren (SCIP_EXPR *expr)
 
SCIP_EXPR ** SCIPexprGetChildren (SCIP_EXPR *expr)
 
SCIP_EXPRHDLRSCIPexprGetHdlr (SCIP_EXPR *expr)
 
SCIP_EXPRDATASCIPexprGetData (SCIP_EXPR *expr)
 
void SCIPexprSetData (SCIP_EXPR *expr, SCIP_EXPRDATA *exprdata)
 
SCIP_EXPR_OWNERDATASCIPexprGetOwnerData (SCIP_EXPR *expr)
 
SCIP_Real SCIPexprGetEvalValue (SCIP_EXPR *expr)
 
SCIP_Longint SCIPexprGetEvalTag (SCIP_EXPR *expr)
 
SCIP_Real SCIPexprGetDerivative (SCIP_EXPR *expr)
 
SCIP_Real SCIPexprGetDot (SCIP_EXPR *expr)
 
SCIP_Real SCIPexprGetBardot (SCIP_EXPR *expr)
 
SCIP_Longint SCIPexprGetDiffTag (SCIP_EXPR *expr)
 
SCIP_INTERVAL SCIPexprGetActivity (SCIP_EXPR *expr)
 
SCIP_Longint SCIPexprGetActivityTag (SCIP_EXPR *expr)
 
void SCIPexprSetActivity (SCIP_EXPR *expr, SCIP_INTERVAL activity, SCIP_Longint activitytag)
 
SCIP_EXPRCURV SCIPexprGetCurvature (SCIP_EXPR *expr)
 
void SCIPexprSetCurvature (SCIP_EXPR *expr, SCIP_EXPRCURV curvature)
 
SCIP_Bool SCIPexprIsIntegral (SCIP_EXPR *expr)
 
void SCIPexprSetIntegrality (SCIP_EXPR *expr, SCIP_Bool isintegral)
 
void SCIPexprGetQuadraticData (SCIP_EXPR *expr, SCIP_Real *constant, int *nlinexprs, SCIP_EXPR ***linexprs, SCIP_Real **lincoefs, int *nquadexprs, int *nbilinexprs, SCIP_Real **eigenvalues, SCIP_Real **eigenvectors)
 
void SCIPexprGetQuadraticQuadTerm (SCIP_EXPR *quadexpr, int termidx, SCIP_EXPR **expr, SCIP_Real *lincoef, SCIP_Real *sqrcoef, int *nadjbilin, int **adjbilin, SCIP_EXPR **sqrexpr)
 
void SCIPexprGetQuadraticBilinTerm (SCIP_EXPR *expr, int termidx, SCIP_EXPR **expr1, SCIP_EXPR **expr2, SCIP_Real *coef, int *pos2, SCIP_EXPR **prodexpr)
 
SCIP_Bool SCIPexprAreQuadraticExprsVariables (SCIP_EXPR *expr)
 
SCIP_RETCODE SCIPexprGetMonomialData (SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_EXPR *expr, SCIP_Real *coef, SCIP_Real *exponents, SCIP_EXPR **factors)
 

Function Documentation

◆ freeExpr()

static SCIP_RETCODE freeExpr ( BMS_BLKMEM blkmem,
SCIP_EXPR **  expr 
)
static

frees an expression

Parameters
blkmemblock memory
exprpointer to free the expression

Definition at line 74 of file expr.c.

References BMSfreeBlockMemory, BMSfreeBlockMemoryArrayNull, NULL, and SCIP_OKAY.

Referenced by SCIPexprRelease().

◆ quadDetectProcessExpr()

static SCIP_RETCODE quadDetectProcessExpr ( SCIP_EXPR expr,
SCIP_HASHMAP seenexpr,
int *  nquadterms,
int *  nlinterms 
)
static

first time seen quadratically and seen before linearly –> –nlinterms; assign 2; ++nquadterms not seen before linearly –> assing 1; ++nquadterms

seen before –> assign += 1

Parameters
exprthe expression
seenexprhash map
nquadtermsnumber of quadratic terms
nlintermsnumber of linear terms

Definition at line 105 of file expr.c.

References SCIP_CALL, SCIP_OKAY, SCIPhashmapExists(), SCIPhashmapGetImageInt(), SCIPhashmapInsertInt(), and SCIPhashmapSetImageInt().

Referenced by SCIPexprCheckQuadratic().

◆ quadDetectGetQuadexprterm()

static SCIP_RETCODE quadDetectGetQuadexprterm ( BMS_BLKMEM blkmem,
SCIP_EXPR expr,
SCIP_HASHMAP expr2idx,
SCIP_HASHMAP seenexpr,
SCIP_QUADEXPR quadexpr,
SCIP_QUADEXPR_QUADTERM **  quadexprterm 
)
static

returns a quadexprterm that contains the expr

it either finds one that already exists or creates a new one

Parameters
blkmemblock memory
exprthe expression
expr2idxmap: expr to index in quadexpr->quadexprterms
seenexprmap: expr to number of times it was seen
quadexprdata of quadratic representation of expression
quadexprtermbuffer to store quadexprterm

Definition at line 145 of file expr.c.

References BMSallocBlockMemoryArray, SCIP_QuadExpr::nquadexprs, NULL, SCIP_QuadExpr::quadexprterms, SCIP_ALLOC, SCIP_CALL, SCIP_OKAY, SCIPhashmapExists(), SCIPhashmapGetImageInt(), and SCIPhashmapInsertInt().

Referenced by SCIPexprCheckQuadratic().

◆ evalAndDiff()

static SCIP_RETCODE evalAndDiff ( SCIP_SET set,
SCIP_STAT stat,
BMS_BLKMEM blkmem,
SCIP_EXPR expr,
SCIP_SOL sol,
SCIP_Longint  soltag,
SCIP_SOL direction 
)
static

evaluate and forward-differentiate expression

also initializes derivative and bardot to 0.0

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.
directiondirection for directional derivative

Definition at line 188 of file expr.c.

References SCIP_Expr::bardot, SCIP_Expr::derivative, SCIP_Expr::difftag, SCIP_Expr::dot, SCIP_Expr::evaltag, SCIP_Expr::evalvalue, SCIP_Expr::exprhdlr, SCIP_Stat::exprlastdifftag, NULL, SCIP_CALL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_LEAVEEXPR, SCIP_INVALID, SCIP_OKAY, SCIPexprhdlrEvalExpr(), SCIPexprhdlrFwDiffExpr(), SCIPexpriterCreate(), SCIPexpriterFree(), SCIPexpriterGetCurrent(), SCIPexpriterGetNext(), SCIPexpriterInit(), SCIPexpriterIsEnd(), SCIPexpriterSetStagesDFS(), and TRUE.

Referenced by SCIPexprEvalHessianDir().

◆ 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 305 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 340 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 859 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 917 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 986 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 1025 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 1054 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 1083 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 1113 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 1162 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 1205 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 1272 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 1345 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 1386 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 1489 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 1525 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 1556 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 1600 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 1635 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 1680 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 1728 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 1785 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 1816 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 1846 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 1878 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 2033 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 2064 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 2218 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 2230 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 2242 of file expr.c.

References SCIP_Expr::exprhdlr, and NULL.

Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), SCIPexprGetMonomialData(), 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 2254 of file expr.c.

References SCIP_Expr::exprhdlr, and NULL.

Referenced by SCIPexprCheckQuadratic(), SCIPexprCompare(), SCIPexprDismantle(), SCIPexprGetMonomialData(), 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 2266 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 2315 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 2347 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 2493 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 2654 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 2745 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 2844 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 2950 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 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().

◆ 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 3189 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().

◆ SCIPexprGetSymData()

SCIP_RETCODE SCIPexprGetSymData ( SCIP_SET set,
SCIP_EXPR expr,
SYM_EXPRDATA **  symdata 
)

method to retrieve symmetry information from an expression

See also
SCIPgetSymDataExpr
Parameters
setglobal SCIP settings
exprexpression from which information is retrieved
symdatabuffer to store symmetry information

Definition at line 3283 of file expr.c.

References NULL, SCIP_CALL, SCIP_OKAY, and SCIPexprGetHdlr().

Referenced by SCIP_DECL_EXPRGETSYMDATA(), and SCIPgetSymDataExpr().

◆ 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 3315 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 3629 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, SCIPexprIsVar(), SCIPgetVarExprVar(), SCIPhashmapCreate(), SCIPhashmapExists(), SCIPhashmapFree(), SCIPhashmapGetImage(), SCIPhashmapInsert(), SCIPlapackComputeEigenvalues(), SCIPlapackIsAvailable(), SCIPmessageFPrintVerbInfo(), SCIPmessagePrintWarning(), SCIPsetIsNegative(), SCIPsetIsPositive(), SCIP_QuadExpr_QuadTerm::sqrcoef, and TRUE.

Referenced by SCIPcomputeExprQuadraticCurvature().

◆ SCIPexprGetMonomialData()

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.

Parameters
setglobal SCIP settings
blkmemblock memory
exprexpression
coefcoefficient \(c\)
exponentsexponents \(\alpha\)
factorsfactor expressions \(x\)

Definition at line 4255 of file expr.c.

References NULL, SCIP_OKAY, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPexprIsPower(), SCIPexprIsProduct(), SCIPgetCoefExprProduct(), and SCIPgetExponentExprPow().

Referenced by SCIPgetExprMonomialData().