Detailed Description
functions for iterating over algebraic expressions
Definition in file expriter.c.
#include <assert.h>
#include "scip/expr.h"
#include "scip/pub_misc.h"
#include "scip/pub_message.h"
#include "scip/struct_expr.h"
#include "scip/struct_stat.h"
Go to the source code of this file.
Macros | |
#define | MINDFSSIZE 16 |
#define | MINBFSSIZE 16 |
#define | storeBacktrace(subscipdepth, iterpos) |
Macro Definition Documentation
◆ MINDFSSIZE
#define MINDFSSIZE 16 |
minimum stack size for DFS
Definition at line 45 of file expriter.c.
◆ MINBFSSIZE
#define MINBFSSIZE 16 |
minimum queue size for BFS
Definition at line 46 of file expriter.c.
◆ storeBacktrace
#define storeBacktrace | ( | subscipdepth, | |
iterpos | |||
) |
Definition at line 130 of file expriter.c.
Function Documentation
◆ printBacktraces()
|
static |
- Parameters
-
subscipdepth current subscip depth
Definition at line 134 of file expriter.c.
References SCIPerrorMessage.
Referenced by SCIPexpriterInit().
◆ deinit()
|
static |
- Parameters
-
iterator expression iterator
Definition at line 144 of file expriter.c.
References SCIP_ExprIter::blkmem, BMSfreeBlockMemoryArray, SCIP_ExprIter::dfsexprs, SCIP_ExprIter::dfsnvisited, SCIP_ExprIter::dfssize, SCIP_ExprIter::initialized, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, SCIP_Stat::nactiveexpriter, NULL, SCIP_ExprIter::queue, SCIP_EXPRITER_BFS, SCIP_EXPRITER_DFS, SCIP_EXPRITER_RTOPOLOGIC, SCIPqueueFree(), and SCIP_ExprIter::stat.
Referenced by SCIPexpriterFree(), and SCIPexpriterInit().
◆ ensureStackSize()
|
static |
ensures minimum stack size of iterator's data
- Parameters
-
iterator expression iterator size minimum requires size
Definition at line 195 of file expriter.c.
References SCIP_ExprIter::blkmem, BMSreallocBlockMemoryArray, SCIP_ExprIter::dfsexprs, SCIP_ExprIter::dfsnvisited, SCIP_ExprIter::dfssize, SCIP_ExprIter::itertype, NULL, SCIP_ALLOC, SCIP_EXPRITER_RTOPOLOGIC, and SCIP_OKAY.
Referenced by reverseTopologicalInsert(), and SCIPexpriterInit().
◆ reverseTopologicalInsert()
|
static |
adds an expression to the DFS stack
- Parameters
-
iterator expression iterator expr expression
Definition at line 219 of file expriter.c.
References SCIP_ExprIter::dfsexprs, SCIP_ExprIter::dfsnexprs, SCIP_ExprIter::dfsnvisited, ensureStackSize(), NULL, and SCIP_CALL_ABORT.
Referenced by doReverseTopologicalNext(), and SCIPexpriterInit().
◆ doReverseTopologicalNext()
|
static |
moves to the next expression according to a reverse topological order
- Parameters
-
iterator expression iterator
Definition at line 235 of file expriter.c.
References SCIP_ExprIter::dfsexprs, SCIP_ExprIter::dfsnexprs, SCIP_ExprIter::dfsnvisited, SCIP_ExprIter::itertype, NULL, reverseTopologicalInsert(), SCIP_EXPRITER_RTOPOLOGIC, SCIPexprGetChildren(), and SCIPexprGetNChildren().
Referenced by SCIPexpriterGetNext().
◆ doBfsNext()
|
static |
moves to the next expression according to the BFS rule
- Parameters
-
iterator expression iterator
Definition at line 287 of file expriter.c.
References SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, NULL, SCIP_ExprIter::queue, SCIP_CALL_ABORT, SCIP_EXPRITER_BFS, SCIP_EXPRITER_MAXNACTIVE, SCIPexprGetChildren(), SCIPexprGetNChildren(), SCIPqueueInsert(), SCIPqueueIsEmpty(), SCIPqueueRemove(), and SCIP_ExprIter::visitedtag.
Referenced by SCIPexpriterGetNext().
◆ doDfsNext()
|
static |
moves to the next expression according to the DFS rule
- Parameters
-
iterator expression iterator
Definition at line 338 of file expriter.c.
References SCIP_Expr::children, SCIP_ExprIter::curr, SCIP_ExprIter::dfsstage, SCIP_Expr::iterdata, SCIP_ExprIter::iterindex, SCIP_ExprIter::itertype, SCIP_Expr::nchildren, NULL, SCIP_EXPRITER_DFS, SCIP_EXPRITER_ENTEREXPR, SCIP_EXPRITER_LEAVEEXPR, SCIP_EXPRITER_VISITEDCHILD, SCIP_EXPRITER_VISITINGCHILD, SCIPABORT, and SCIP_ExprIter::visitedtag.
Referenced by SCIPexpriterGetNext(), and SCIPexpriterSkipDFS().
◆ SCIPexpriterCreate()
SCIP_RETCODE SCIPexpriterCreate | ( | SCIP_STAT * | stat, |
BMS_BLKMEM * | blkmem, | ||
SCIP_EXPRITER ** | iterator | ||
) |
creates an expression iterator
- Parameters
-
stat dynamic problem statistics blkmem block memory iterator buffer to store expression iterator
Definition at line 427 of file expriter.c.
References BMSallocClearBlockMemory, NULL, SCIP_ALLOC, and SCIP_OKAY.
Referenced by evalAndDiff(), nlpAddNlRows(), nlpDelVarPos(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPcreateExpriter(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprPrint(), SCIPexprPrintDotInit(), SCIPexprRelease(), SCIPexprSimplify(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPhashExpr(), SCIPnlpGetVarsNonlinearity(), and SCIPnlpHasContinuousNonlinearity().
◆ SCIPexpriterFree()
void SCIPexpriterFree | ( | SCIP_EXPRITER ** | iterator | ) |
frees an expression iterator
- Parameters
-
iterator pointer to the expression iterator
Definition at line 446 of file expriter.c.
References BMSfreeBlockMemory, deinit(), and NULL.
Referenced by evalAndDiff(), nlpAddNlRows(), nlpDelVarPos(), SCIPcomputeExprCurvature(), SCIPcomputeExprIntegrality(), SCIPexprCopy(), SCIPexprDismantle(), SCIPexprEval(), SCIPexprEvalActivity(), SCIPexprEvalGradient(), SCIPexprEvalHessianDir(), SCIPexprPrint(), SCIPexprPrintDotFinal(), SCIPexprRelease(), SCIPexprSimplify(), SCIPfreeExpriter(), SCIPgetExprNVars(), SCIPgetExprVarExprs(), SCIPhashExpr(), SCIPnlpGetVarsNonlinearity(), SCIPnlpHasContinuousNonlinearity(), and SCIPreplaceCommonSubexpressions().