symmetry_graph.c
Go to the documentation of this file.
31/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
42/** creates and initializes a symmetry detection graph with memory for the given number of nodes and edges
224 SCIP_CALL( SCIPcreateSymgraph(scip, origgraph->symtype, graph, origgraph->symvars, origgraph->nsymvars,
312 SCIP_CALL( SCIPaddSymgraphOpnode(scip, targetgraph, sourcegraph->ops[nodeinfopos[i]], &nodeidx) );
315 SCIP_CALL( SCIPaddSymgraphValnode(scip, targetgraph, sourcegraph->vals[nodeinfopos[i]], &nodeidx) );
437/** adds nodes and edges corresponding to the aggregation of a variable to a symmetry detection graph
439 * For permutation symmetries, the root node is connected with all variable nodes in the aggregation.
441 * For signed permutation symmetries, also edges connecting the root node and the negated variable
1157 return compareVarsFixedSignedPerm(NULL, vars[locind1], vars[locind2], isfixedvar[locind1], isfixedvar[locind2],
1332 if( (fixedtype & SYM_SPEC_INTEGER) && SCIPvarGetType(var) == SCIP_VARTYPE_INTEGER && !SCIPvarIsImpliedIntegral(var) )
1334 if( (fixedtype & SYM_SPEC_BINARY) && SCIPvarGetType(var) == SCIP_VARTYPE_BINARY && !SCIPvarIsImpliedIntegral(var) )
1336 if( (fixedtype & SYM_SPEC_REAL) && ( SCIPvarGetType(var) == SCIP_VARTYPE_CONTINUOUS || SCIPvarIsImpliedIntegral(var) ) )
1343 * Colors are detected by sorting different types of nodes (variables, operators, values, and constraint) and edges.
1344 * If two consecutive nodes of the same type differ (e.g., different variable type), they are assigned a new color.
1837/** Transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant.
1839 * For permutation symmetries, active variables as encoded in SCIP are used. For signed permutation symmetries,
1840 * active variables are shifted such that their domain is centered at 0 (if both their upper and lower bounds
1849 SCIP_Real** scalars, /**< pointer to scalars a_1, ..., a_n in linear sum a_1*x_1 + ... + a_n*x_n + c */
1870 SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, *nvars, constant, &requiredsize) );
1877 SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize) );
SCIP_Bool SCIPexprhdlrHasGetSymData(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:685
SCIP_RETCODE SCIPgetSymDataExpr(SCIP *scip, SCIP_EXPR *expr, SYM_EXPRDATA **symdata)
Definition: scip_expr.c:1817
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:97
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip_mem.h:99
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:111
SCIP_VARTYPE SCIPgetSymInferredVarType(SCIP_VAR *var)
Definition: symmetry.c:45
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip_numerics.c:475
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip_numerics.c:436
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip_numerics.c:449
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:18320
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize)
Definition: scip_var.c:2378
void SCIPsort(int *perm, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
Definition: misc.c:5581
SYM_NODETYPE SCIPgetSymgraphNodeType(SYM_GRAPH *graph, int nodeidx)
Definition: symmetry_graph.c:1693
SCIP_RETCODE SCIPaddSymgraphEdge(SCIP *scip, SYM_GRAPH *graph, int first, int second, SCIP_Bool hasval, SCIP_Real val)
Definition: symmetry_graph.c:785
SCIP_RETCODE SCIPfreeSymgraph(SCIP *scip, SYM_GRAPH **graph)
Definition: symmetry_graph.c:113
int SCIPgetSymgraphEdgeFirst(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1647
SCIP_RETCODE SCIPaddSymgraphOpnode(SCIP *scip, SYM_GRAPH *graph, int op, int *nodeidx)
Definition: symmetry_graph.c:533
int * SCIPgetSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
Definition: symmetry_graph.c:1823
SCIP_RETCODE SCIPgetSymActiveVariables(SCIP *scip, SYM_SYMTYPE symtype, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
Definition: symmetry_graph.c:1845
SCIP_Bool SCIPhasGraphUniqueEdgetype(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1772
int SCIPgetSymgraphVarnodeColor(SYM_GRAPH *graph, int nodeidx)
Definition: symmetry_graph.c:1671
SCIP_RETCODE SCIPaddSymgraphValnode(SCIP *scip, SYM_GRAPH *graph, SCIP_Real val, int *nodeidx)
Definition: symmetry_graph.c:574
SCIP_RETCODE SCIPcreateSymgraph(SCIP *scip, SYM_SYMTYPE symtype, SYM_GRAPH **graph, SCIP_VAR **symvars, int nsymvars, int nopnodes, int nvalnodes, int nconsnodes, int nedges)
Definition: symmetry_graph.c:46
int SCIPgetSymgraphVarnodeidx(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR *var)
Definition: symmetry_graph.c:663
SCIP_RETCODE SCIPcomputeSymgraphColors(SCIP *scip, SYM_GRAPH *graph, SYM_SPEC fixedtype)
Definition: symmetry_graph.c:1346
SYM_SYMTYPE SCIPgetSymgraphSymtype(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1587
SCIP_RETCODE SCIPcopySymgraphAsSubgraph(SCIP *scip, SYM_GRAPH *sourcegraph, SYM_GRAPH *targetgraph, SCIP_CONS *sourcecons, int *rootidx)
Definition: symmetry_graph.c:272
SCIP_RETCODE SCIPaddSymgraphConsnode(SCIP *scip, SYM_GRAPH *graph, SCIP_CONS *cons, SCIP_Real lhs, SCIP_Real rhs, int *nodeidx)
Definition: symmetry_graph.c:615
SCIP_RETCODE SCIPcreateSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
Definition: symmetry_graph.c:1785
int SCIPgetSymgraphEdgeSecond(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1659
int SCIPgetSymgraphNConsnodes(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1617
SCIP_RETCODE SCIPaddSymgraphVarAggregation(SCIP *scip, SYM_GRAPH *graph, int rootidx, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real constant)
Definition: symmetry_graph.c:445
int SCIPgetSymExprdataNConstants(SYM_EXPRDATA *symdata)
Definition: symmetry_graph.c:1932
SCIP_RETCODE SCIPupdateSymgraphRhs(SYM_GRAPH *graph, int nodeidx, SCIP_Real newrhs)
Definition: symmetry_graph.c:720
SCIP_RETCODE SCIPfreeSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
Definition: symmetry_graph.c:1805
SCIP_RETCODE SCIPupdateSymgraphLhs(SYM_GRAPH *graph, int nodeidx, SCIP_Real newlhs)
Definition: symmetry_graph.c:704
int SCIPgetSymgraphNegatedVarnodeidx(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR *var)
Definition: symmetry_graph.c:683
SCIP_Bool SCIPisSymgraphEdgeColored(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1731
SCIP_RETCODE SCIPfreeSymDataExpr(SCIP *scip, SYM_EXPRDATA **symdata)
Definition: symmetry_graph.c:1909
SCIP_VAR ** SCIPgetSymgraphVars(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1597
int SCIPgetSymgraphNodeColor(SYM_GRAPH *graph, int nodeidx)
Definition: symmetry_graph.c:1708
int SCIPgetSymgraphEdgeColor(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1746
SCIP_RETCODE SCIPextendPermsymDetectionGraphLinear(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_CONS *cons, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool *success)
Definition: symmetry_graph.c:376
SCIP_Real * SCIPgetSymExprdataConstants(SYM_EXPRDATA *symdata)
Definition: symmetry_graph.c:1942
SCIP_RETCODE SCIPclearSymgraph(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR **symvars, int nsymvars, SYM_SYMTYPE symtype)
Definition: symmetry_graph.c:153
SCIP_RETCODE SCIPcopySymgraph(SCIP *scip, SYM_GRAPH **graph, SYM_GRAPH *origgraph, int *perm, SYM_SPEC fixedtype)
Definition: symmetry_graph.c:203
SCIP_RETCODE SCIPfixSymgraphVarnode(SYM_GRAPH *graph, SCIP_VAR *var)
Definition: symmetry_graph.c:736
int SCIPgetSymgraphNVarcolors(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1759
SCIP_RETCODE SCIPgetCoefSymData(SCIP *scip, SCIP_EXPR *expr, SCIP_EXPR *parentexpr, SCIP_Real *coef, SCIP_Bool *success)
Definition: symmetry_graph.c:1952
internal miscellaneous methods
Definition: multiprecision.hpp:66
SCIP callable library.
Definition: struct_cons.h:47
Definition: struct_expr.h:106
Definition: struct_var.h:262
Definition: struct_symmetry.h:103
Definition: struct_symmetry.h:46
Definition: struct_scip.h:72
structs for symmetry computations
methods for handling symmetries
static SCIP_RETCODE ensureNodeArraysSize(SCIP *scip, SYM_GRAPH *graph, int addsize)
Definition: symmetry_graph.c:509
static SCIP_Bool isFixedVar(SCIP_VAR *var, SYM_SPEC fixedtype)
Definition: symmetry_graph.c:1325
static int compareVarsFixed(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Bool isfixed1, SCIP_Bool isfixed2)
Definition: symmetry_graph.c:903
static int compareVarsSignedPerm(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Bool isneg1, SCIP_Bool isneg2, SCIP_Real infinity)
Definition: symmetry_graph.c:964
static int compareVars(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2)
Definition: symmetry_graph.c:833
static SCIP_RETCODE ensureEdgeArraysSize(SCIP *scip, SYM_GRAPH *graph, int addsize)
Definition: symmetry_graph.c:760
static int compareConsnodes(SCIP *scip, SYM_GRAPH *graph, int ind1, int ind2)
Definition: symmetry_graph.c:1233
static int compareVarsFixedSignedPerm(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Bool isfixed1, SCIP_Bool isfixed2, SCIP_Bool isneg1, SCIP_Bool isneg2, SCIP_Real infinity)
Definition: symmetry_graph.c:1087
static SCIP_DECL_SORTINDCOMP(SYMsortVarnodesPermsym)
Definition: symmetry_graph.c:933
methods for dealing with symmetry detection graphs
type definitions for symmetry computations