symmetry_graph.c
Go to the documentation of this file.
31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
40 /** creates and initializes a symmetry detection graph with memory for the given number of nodes and edges
172 SCIP_CALL( SCIPcreateSymgraph(scip, origgraph->symtype, graph, origgraph->symvars, origgraph->nsymvars,
287 /** adds nodes and edges corresponding to the aggregation of a variable to a symmetry detection graph
289 * For permutation symmetries, the root node is connected with all variable nodes in the aggregation.
291 * For signed permutation symmetries, also edges connecting the root node and the negated variable
1006 return compareVarsFixedSignedPerm(NULL, vars[locind1], vars[locind2], isfixedvar[locind1], isfixedvar[locind2],
1186 (SCIPvarGetType(var) == SCIP_VARTYPE_CONTINUOUS || SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT) )
1193 * Colors are detected by sorting different types of nodes (variables, operators, values, and constraint) and edges.
1194 * If two consecutive nodes of the same type differ (e.g., different variable type), they are assigned a new color.
1689 /** Transforms given variables, scalars, and constant to the corresponding active variables, scalars, and constant.
1691 * For permutation symmetries, active variables as encoded in SCIP are used. For signed permutation symmetries,
1692 * active variables are shifted such that their domain is centered at 0 (if both their upper and lower bounds
1701 SCIP_Real** scalars, /**< pointer to scalars a_1, ..., a_n in linear sum a_1*x_1 + ... + a_n*x_n + c */
1722 SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, *nvars, constant, &requiredsize, TRUE) );
1729 SCIP_CALL( SCIPgetProbvarLinearSum(scip, *vars, *scalars, nvars, requiredsize, constant, &requiredsize, TRUE) );
static SCIP_DECL_SORTINDCOMP(SYMsortVarnodesPermsym)
Definition: symmetry_graph.c:776
SCIP_RETCODE SCIPgetCoefSymData(SCIP *scip, SCIP_EXPR *expr, SCIP_EXPR *parentexpr, SCIP_Real *coef, SCIP_Bool *success)
Definition: symmetry_graph.c:1804
static int compareVarsFixed(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Bool isfixed1, SCIP_Bool isfixed2)
Definition: symmetry_graph.c:746
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip_mem.h:99
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:936
Definition: type_symmetry.h:70
Definition: struct_scip.h:69
SCIP_RETCODE SCIPfreeSymgraph(SCIP *scip, SYM_GRAPH **graph)
Definition: symmetry_graph.c:111
int SCIPgetSymgraphNodeColor(SYM_GRAPH *graph, int nodeidx)
Definition: symmetry_graph.c:1560
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:97
Definition: struct_var.h:207
SCIP_RETCODE SCIPcomputeSymgraphColors(SCIP *scip, SYM_GRAPH *graph, SYM_SPEC fixedtype)
Definition: symmetry_graph.c:1196
Definition: type_symmetry.h:62
int SCIPgetSymgraphVarnodeidx(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR *var)
Definition: symmetry_graph.c:512
Definition: struct_symmetry.h:102
Definition: type_var.h:62
static int compareVars(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2)
Definition: symmetry_graph.c:682
SCIP_RETCODE SCIPupdateSymgraphRhs(SYM_GRAPH *graph, int nodeidx, SCIP_Real newrhs)
Definition: symmetry_graph.c:569
SCIP_Bool SCIPhasGraphUniqueEdgetype(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1624
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip_numerics.c:445
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:294
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:44
SCIP_VAR ** SCIPgetSymgraphVars(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1449
Definition: type_symmetry.h:72
SCIP_Real * SCIPgetSymExprdataConstants(SYM_EXPRDATA *symdata)
Definition: symmetry_graph.c:1794
methods for dealing with symmetry detection graphs
int SCIPgetSymgraphEdgeFirst(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1499
Definition: struct_cons.h:46
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip_numerics.c:458
SCIP_RETCODE SCIPcreateSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
Definition: symmetry_graph.c:1637
static int compareConsnodes(SCIP *scip, SYM_GRAPH *graph, int ind1, int ind2)
Definition: symmetry_graph.c:1082
SCIP_Bool SCIPisSymgraphEdgeColored(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1583
SCIP_Bool SCIPexprhdlrHasGetSymData(SCIP_EXPRHDLR *exprhdlr)
Definition: expr.c:685
internal miscellaneous methods
structs for symmetry computations
SCIP_RETCODE SCIPupdateSymgraphLhs(SYM_GRAPH *graph, int nodeidx, SCIP_Real newlhs)
Definition: symmetry_graph.c:553
Definition: type_symmetry.h:61
Definition: type_retcode.h:42
SYM_SYMTYPE SCIPgetSymgraphSymtype(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1439
SCIP_RETCODE SCIPcopySymgraph(SCIP *scip, SYM_GRAPH **graph, SYM_GRAPH *origgraph, int *perm, SYM_SPEC fixedtype)
Definition: symmetry_graph.c:151
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:1737
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:226
int SCIPgetSymgraphNegatedVarnodeidx(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR *var)
Definition: symmetry_graph.c:532
Definition: type_retcode.h:43
Definition: struct_expr.h:105
static SCIP_RETCODE ensureEdgeArraysSize(SCIP *scip, SYM_GRAPH *graph, int addsize)
Definition: symmetry_graph.c:609
SCIP_RETCODE SCIPfreeSymDataExpr(SCIP *scip, SYM_EXPRDATA **symdata)
Definition: symmetry_graph.c:1761
Definition: type_var.h:64
static SCIP_RETCODE ensureNodeArraysSize(SCIP *scip, SYM_GRAPH *graph, int addsize)
Definition: symmetry_graph.c:358
Definition: type_var.h:63
SCIP_RETCODE SCIPgetSymDataExpr(SCIP *scip, SCIP_EXPR *expr, SYM_EXPRDATA **symdata)
Definition: scip_expr.c:1792
SCIP_RETCODE SCIPaddSymgraphOpnode(SCIP *scip, SYM_GRAPH *graph, int op, int *nodeidx)
Definition: symmetry_graph.c:382
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:12775
int SCIPgetSymgraphEdgeColor(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1598
void SCIPsort(int *perm, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
Definition: misc.c:5538
type definitions for symmetry computations
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip_numerics.c:484
static int compareVarsSignedPerm(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Bool isneg1, SCIP_Bool isneg2, SCIP_Real infinity)
Definition: symmetry_graph.c:807
SCIP_RETCODE SCIPfixSymgraphVarnode(SYM_GRAPH *graph, SCIP_VAR *var)
Definition: symmetry_graph.c:585
Definition: type_symmetry.h:71
int SCIPgetSymgraphNConsnodes(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1469
SCIP_RETCODE SCIPaddSymgraphConsnode(SCIP *scip, SYM_GRAPH *graph, SCIP_CONS *cons, SCIP_Real lhs, SCIP_Real rhs, int *nodeidx)
Definition: symmetry_graph.c:464
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:1697
SCIP_RETCODE SCIPfreeSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
Definition: symmetry_graph.c:1657
SCIP_RETCODE SCIPaddSymgraphValnode(SCIP *scip, SYM_GRAPH *graph, SCIP_Real val, int *nodeidx)
Definition: symmetry_graph.c:423
Definition: type_symmetry.h:69
Definition: struct_symmetry.h:45
int SCIPgetSymExprdataNConstants(SYM_EXPRDATA *symdata)
Definition: symmetry_graph.c:1784
static SCIP_Bool isFixedVar(SCIP_VAR *var, SYM_SPEC fixedtype)
Definition: symmetry_graph.c:1174
SYM_NODETYPE SCIPgetSymgraphNodeType(SYM_GRAPH *graph, int nodeidx)
Definition: symmetry_graph.c:1545
int * SCIPgetSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
Definition: symmetry_graph.c:1675
SCIP_RETCODE SCIPaddSymgraphEdge(SCIP *scip, SYM_GRAPH *graph, int first, int second, SCIP_Bool hasval, SCIP_Real val)
Definition: symmetry_graph.c:634
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:111
int SCIPgetSymgraphNVarcolors(SYM_GRAPH *graph)
Definition: symmetry_graph.c:1611
Definition: objbenders.h:43
int SCIPgetSymgraphVarnodeColor(SYM_GRAPH *graph, int nodeidx)
Definition: symmetry_graph.c:1523
int SCIPgetSymgraphEdgeSecond(SYM_GRAPH *graph, int edgeidx)
Definition: symmetry_graph.c:1511
SCIP callable library.
Definition: type_var.h:71