compute_symmetry_bliss.cpp
Go to the documentation of this file.
23 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
68 * Compare the types of two operators according to their name, level and, in case of power, exponent.
110 SCIPhashKeyValString(NULL, static_cast<void*>(const_cast<char*>(SCIPexprhdlrGetName(SCIPexprGetHdlr(k->expr))))));
204 /* make sure we do not generate more that maxgenerators many permutations, if the limit in bliss is not available */
246 if ( SCIPreallocBlockMemoryArray(data->scip, &data->perms, data->nmaxperms, newsize) != SCIP_OKAY )
255 /** Creates the nodes in the graph that correspond to variables. Each variable type gets a unique color
292 /* this is not exactly true, since we skip auxvars, but it doesn't matter if some colors are not used at all */
306 * Each different variable, rhs, matrix coefficient gets a different color that is attached to the corresponding entries.
308 * @pre This method assumes that the nodes corresponding to permutation variables are already in the graph and that
349 * That is, given several variable nodes which are incident to one constraint node by the same color,
358 /* "colored" edges based on all matrix coefficients - loop through ordered matrix coefficients */
370 /* We pass through the matrix coeficients, grouped by color, i.e., different coefficients. If the coeffients appear
371 * in the same row or column, it suffices to only generate a single node (depending on groupByConstraints). We store
372 * this node in the array internodes. In order to avoid reinitialization, we store the node number with increasing
373 * numbers for each color. The smallest number for the current color is stored in firstcolornodenumber. */
389 assert( 0 <= matrixdata->matvaridx[idx] && matrixdata->matvaridx[idx] < matrixdata->npermvars );
393 assert( matrixdata->npermvars <= rhsnode && rhsnode < matrixdata->npermvars + matrixdata->nrhscoef );
456 * - Each coefficient of a sum expression gets its own node connected to the node of the corresponding child.
457 * - Each constraint (with lhs and (!) rhs) gets its own node connected to the corresponding node of the root expression.
459 * @note: In contrast to the linear part, lhs and rhs are treated together here, so that each unique combination of lhs
460 * and rhs gets its own node. This makes the implementation a lot simpler with the small downside, that different
467 * Each different constraint (sides), sum-expression coefficient, constant and operator type gets a
470 * @pre This method assumes that the nodes corresponding to permutation variables are already in the graph and that
525 SCIP_CALL( SCIPhashtableCreate(&consttypemap, SCIPblkmem(scip), constarraysize, SYMhashGetKeyConsttype,
527 SCIP_CALL( SCIPhashtableCreate(&sumcoefmap, SCIPblkmem(scip), coefarraysize, SYMhashGetKeyConsttype,
529 SCIP_CALL( SCIPhashtableCreate(&rhstypemap, SCIPblkmem(scip), rhsarraysize, SYMhashGetKeyRhstype,
559 for (SCIP_EXPR* expr = SCIPexpriterGetCurrent(it); !SCIPexpriterIsEnd(it); expr = SCIPexpriterGetNext(it)) /*lint !e441*/ /*lint !e440*/
575 /* check whether the variable is active; if not, then replace the inactive variable by its aggregation
576 * or its fixed value; note that this step is equivalent as representing an inactive variable as sum
599 SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, vals, &varsize, varsize, &constant, &requiredsize, TRUE) );
606 SCIP_CALL( SCIPgetProbvarLinearSum(scip, vars, vals, &varsize, requiredsize, &constant, &requiredsize, TRUE) );
613 /* create nodes for all aggregation variables and coefficients and connect them to the parent node */
754 /* if this is the root expression, add the constraint side node (will be parent of expression node) */
792 /* in all cases apart from variable expressions, the new node is added with the corresponding color */
817 /* iterate over children from last to first, such that visitednodes array is in correct order */
898 /* when leaving an expression, the nodes that are not needed anymore are erased from the respective arrays */
905 /* When leaving the child of a sum expression, we have to pop again to get rid of the intermediate nodes
982 return "Computing Graph Automorphism Groups by T. Junttila and P. Kaski (www.tcs.hut.fi/Software/bliss/)";
992 int* nmaxperms, /**< pointer to store maximal number of permutations (needed for freeing storage) */
1027 SCIP_CALL( fillGraphByLinearConss(scip, &G, matrixdata, nnodes, nedges, nusedcolors, success) );
1031 SCIPverbMessage(scip, SCIP_VERBLEVEL_MINIMAL, 0, "Graph construction failed during linear part.\n");
1036 SCIP_CALL( fillGraphByNonlinearConss(scip, &G, exprdata, nnodes, nedges, nusedcolors, success) );
1040 SCIPverbMessage(scip, SCIP_VERBLEVEL_MINIMAL, 0, "Graph construction failed during non-linear part.\n");
1078 /* lambda function to have access to stats and terminate the search if maxgenerators are reached */
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip_mem.h:90
SCIP_RETCODE SCIPexpriterInit(SCIP_EXPRITER *iterator, SCIP_EXPR *expr, SCIP_EXPRITER_TYPE type, SCIP_Bool allowrevisit)
Definition: expriter.c:491
Definition: struct_symmetry.h:54
static SCIP_RETCODE fillGraphByNonlinearConss(SCIP *scip, bliss::Graph *G, SYM_EXPRDATA *exprdata, int &nnodes, int &nedges, int &nusedcolors, SCIP_Bool &success)
Definition: compute_symmetry_bliss.cpp:474
Definition: struct_scip.h:59
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2487
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:877
SCIP_EXPR * SCIPexpriterGetParentDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:730
static SCIP_DECL_HASHKEYEQ(SYMhashKeyEQOptype)
Definition: compute_symmetry_bliss.cpp:71
static SCIP_DECL_HASHKEYVAL(SYMhashKeyValOptype)
Definition: compute_symmetry_bliss.cpp:97
Definition: struct_var.h:198
static SCIP_RETCODE fillGraphByLinearConss(SCIP *scip, bliss::Graph *G, SYM_MATRIXDATA *matrixdata, int &nnodes, int &nedges, int &nusedcolors, SCIP_Bool &success)
Definition: compute_symmetry_bliss.cpp:312
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4547
private functions to work with algebraic expressions
Definition: struct_symmetry.h:46
Definition: struct_symmetry.h:61
SCIP_Bool SYMcanComputeSymmetry(void)
Definition: compute_symmetry_bliss.cpp:950
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip_numerics.c:438
variable expression handler
SCIP_EXPR * SCIPexpriterGetCurrent(SCIP_EXPRITER *iterator)
Definition: expriter.c:673
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition: misc.c:2236
interface for symmetry computations
static void blisshook(void *user_param, unsigned int n, const unsigned int *aut)
Definition: compute_symmetry_bliss.cpp:190
SCIP_RETCODE SYMcomputeSymmetryGenerators(SCIP *scip, int maxgenerators, SYM_MATRIXDATA *matrixdata, SYM_EXPRDATA *exprdata, int *nperms, int *nmaxperms, int ***perms, SCIP_Real *log10groupsize)
Definition: compute_symmetry_bliss.cpp:986
Definition: struct_cons.h:37
Definition: struct_cons.h:117
Definition: type_expr.h:691
static SCIP_RETCODE createVariableNodes(SCIP *scip, bliss::Graph *G, SYM_MATRIXDATA *matrixdata, int &nnodes, const int &nedges, int &nusedcolors)
Definition: compute_symmetry_bliss.cpp:260
static SCIP_DECL_HASHGETKEY(SYMhashGetKeyOptype)
Definition: compute_symmetry_bliss.cpp:61
SCIP_EXPR * SCIPgetExprNonlinear(SCIP_CONS *cons)
Definition: cons_nonlinear.c:12249
power and signed power expression handlers
Definition: type_retcode.h:33
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
Definition: scip_var.c:1735
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:216
Definition: struct_expr.h:193
Definition: graph_load.c:93
SCIP_RETCODE SCIPcreateExpriter(SCIP *scip, SCIP_EXPRITER **iterator)
Definition: scip_expr.c:2300
Definition: struct_expr.h:95
constraint handler for nonlinear constraints specified by algebraic expressions
Definition: type_message.h:43
SCIP_EXPR * SCIPexpriterGetNext(SCIP_EXPRITER *iterator)
Definition: expriter.c:848
Constraint handler for linear constraints in their most general form, .
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition: misc.c:2548
void SCIPexpriterSetStagesDFS(SCIP_EXPRITER *iterator, SCIP_EXPRITER_STAGE stopstages)
Definition: expriter.c:654
Definition: struct_misc.h:80
SCIP_EXPRITER_STAGE SCIPexpriterGetStageDFS(SCIP_EXPRITER *iterator)
Definition: expriter.c:686
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2599
Definition: struct_symmetry.h:69
sum expression handler
Definition: compute_symmetry_bliss.cpp:47
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:102
Definition: objbenders.h:33
Definition: struct_symmetry.h:92