Scippy

SCIP

Solving Constraint Integer Programs

Detailed Description

functions for iterating over algebraic expressions

Author
Benjamin Mueller
Stefan Vigerske

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)
 

Functions

static void printBacktraces (int subscipdepth)
 
static void deinit (SCIP_EXPRITER *iterator)
 
static SCIP_RETCODE ensureStackSize (SCIP_EXPRITER *iterator, int size)
 
static void reverseTopologicalInsert (SCIP_EXPRITER *iterator, SCIP_EXPR *expr)
 
static SCIP_EXPRdoReverseTopologicalNext (SCIP_EXPRITER *iterator)
 
static SCIP_EXPRdoBfsNext (SCIP_EXPRITER *iterator)
 
static SCIP_EXPRdoDfsNext (SCIP_EXPRITER *iterator)
 
SCIP_RETCODE SCIPexpriterCreate (SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_EXPRITER **iterator)
 
void SCIPexpriterFree (SCIP_EXPRITER **iterator)
 
SCIP_Bool SCIPexpriterIsInit (SCIP_EXPRITER *iterator)
 
SCIP_RETCODE SCIPexpriterInit (SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_TYPE type, SCIP_Bool allowrevisit)
 
SCIP_EXPRSCIPexpriterRestartDFS (SCIP_EXPRITER *iterator, SCIP_EXPR *expr)
 
void SCIPexpriterSetStagesDFS (SCIP_EXPRITER *iterator, SCIP_EXPRITER_STAGE stopstages)
 
SCIP_EXPRSCIPexpriterGetCurrent (SCIP_EXPRITER *iterator)
 
SCIP_EXPRITER_STAGE SCIPexpriterGetStageDFS (SCIP_EXPRITER *iterator)
 
int SCIPexpriterGetChildIdxDFS (SCIP_EXPRITER *iterator)
 
SCIP_EXPRSCIPexpriterGetChildExprDFS (SCIP_EXPRITER *iterator)
 
SCIP_EXPRSCIPexpriterGetParentDFS (SCIP_EXPRITER *iterator)
 
SCIP_EXPRITER_USERDATA SCIPexpriterGetCurrentUserData (SCIP_EXPRITER *iterator)
 
SCIP_EXPRITER_USERDATA SCIPexpriterGetChildUserDataDFS (SCIP_EXPRITER *iterator)
 
SCIP_EXPRITER_USERDATA SCIPexpriterGetExprUserData (SCIP_EXPRITER *iterator, SCIP_EXPR *expr)
 
void SCIPexpriterSetCurrentUserData (SCIP_EXPRITER *iterator, SCIP_EXPRITER_USERDATA userdata)
 
void SCIPexpriterSetExprUserData (SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_USERDATA userdata)
 
void SCIPexpriterSetChildUserData (SCIP_EXPRITER *iterator, SCIP_EXPRITER_USERDATA userdata)
 
SCIP_EXPRSCIPexpriterGetNext (SCIP_EXPRITER *iterator)
 
SCIP_EXPRSCIPexpriterSkipDFS (SCIP_EXPRITER *iterator)
 
SCIP_Bool SCIPexpriterIsEnd (SCIP_EXPRITER *iterator)
 

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 void printBacktraces ( int  subscipdepth)
static
Parameters
subscipdepthcurrent subscip depth

Definition at line 134 of file expriter.c.

References SCIPerrorMessage.

Referenced by SCIPexpriterInit().

◆ deinit()

◆ ensureStackSize()

static SCIP_RETCODE ensureStackSize ( SCIP_EXPRITER iterator,
int  size 
)
static

ensures minimum stack size of iterator's data

Parameters
iteratorexpression iterator
sizeminimum 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 void reverseTopologicalInsert ( SCIP_EXPRITER iterator,
SCIP_EXPR expr 
)
static

adds an expression to the DFS stack

Parameters
iteratorexpression iterator
exprexpression

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 SCIP_EXPR * doReverseTopologicalNext ( SCIP_EXPRITER iterator)
static

moves to the next expression according to a reverse topological order

Parameters
iteratorexpression 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 SCIP_EXPR * doBfsNext ( SCIP_EXPRITER iterator)
static

◆ doDfsNext()

◆ SCIPexpriterCreate()

◆ SCIPexpriterFree()