68 nnodes = nopnodes + nvalnodes + nconsnodes;
84 (*graph)->maxnnodes =
nnodes;
85 (*graph)->nopnodes = 0;
86 (*graph)->maxnopnodes = nopnodes;
87 (*graph)->nvalnodes = 0;
88 (*graph)->maxnvalnodes = nvalnodes;
89 (*graph)->nconsnodes = 0;
90 (*graph)->maxnconsnodes = nconsnodes;
91 (*graph)->islocked =
FALSE;
93 (*graph)->maxnedges = nedges;
94 (*graph)->symvars = symvars;
95 (*graph)->nsymvars = nsymvars;
96 (*graph)->nvarcolors = -1;
97 (*graph)->uniqueedgetype =
FALSE;
98 (*graph)->symtype = symtype;
100 (*graph)->consnodeperm =
NULL;
103 (*graph)->varcolors =
NULL;
104 (*graph)->opcolors =
NULL;
105 (*graph)->valcolors =
NULL;
106 (*graph)->conscolors =
NULL;
107 (*graph)->edgecolors =
NULL;
125 switch( (*graph)->symtype )
245 origgraph->
lhs[nodeinfopos[
i]], origgraph->
rhs[nodeinfopos[
i]], &nodeidx) );
258 first = -perm[-first - 1] - 1;
260 second = -perm[-second - 1] - 1;
320 sourcegraph->
lhs[nodeinfopos[
i]], sourcegraph->
rhs[nodeinfopos[
i]], &nodeidx) );
322 if( sourcegraph->
conss[nodeinfopos[
i]] == sourcecons )
339 nodemap[
i] = nodeidx;
350 for(
i = 0;
i < sourcegraph->
nedges; ++
i )
357 first = nodemap[first];
359 second = nodemap[second];
467 for( j = 0; j <
nvars; ++j )
474 for( j = 0; j <
nvars; ++j )
547 SCIPerrorMessage(
"Cannot add nodes to a graph for which colors have already been computed.\n");
588 SCIPerrorMessage(
"Cannot add nodes to a graph for which colors have already been computed.\n");
632 SCIPerrorMessage(
"Cannot add nodes to a graph for which colors have already been computed.\n");
677 assert(nodeidx != INT_MAX);
698 assert(nodeidx != INT_MAX);
800 SCIPerrorMessage(
"Cannot add edges to a graph for which colors have already been computed.\n");
914 if( (! isfixed1) && isfixed2 )
916 if( isfixed1 && (! isfixed2) )
1020 mid = (lb1 + ub1) / 2;
1026 mid = (lb2 + ub2) / 2;
1101 if( (! isfixed1) && isfixed2 )
1103 if( isfixed1 && (! isfixed2) )
1145 if( locind1 >= nsymvars )
1148 locind1 -= nsymvars;
1151 if( locind2 >= nsymvars )
1154 locind2 -= nsymvars;
1178 else if( op1 > op2 )
1196 vals = (
int*) dataptr;
1215 if( vals[ind1] < vals[ind2] )
1217 if( vals[ind1] > vals[ind2] )
1244 assert(0 <= ind1 && ind1 < graph->nconsnodes);
1245 assert(0 <= ind2 && ind2 < graph->nconsnodes);
1247 cons1 = graph->
conss[ind1];
1248 cons2 = graph->
conss[ind2];
1270 if( graph->
lhs[ind1] < graph->
lhs[ind2] )
1272 if( graph->
lhs[ind1] > graph->
lhs[ind2] )
1275 if( graph->
rhs[ind1] < graph->
rhs[ind2] )
1277 if( graph->
rhs[ind1] > graph->
rhs[ind2] )
1407 if ( nusedvars > len )
1417 SCIPsort(perm, SYMsortVarnodesPermsym, (
void*) graph, nusedvars);
1419 graph->varcolors[perm[0]] = color;
1420 prevvar = graph->symvars[perm[0]];
1422 for(
i = 1;
i < nusedvars; ++
i )
1424 thisvar = graph->symvars[perm[
i]];
1429 graph->varcolors[perm[
i]] = color;
1432 graph->nvarcolors = color;
1437 SCIPsort(perm, SYMsortVarnodesSignedPermsym, (
void*) graph, nusedvars);
1439 graph->varcolors[perm[0]] = color;
1442 if( perm[0] < graph->nsymvars )
1445 prevvar = graph->symvars[perm[0]];
1450 prevvar = graph->symvars[perm[0] - graph->nsymvars];
1454 for(
i = 1;
i < nusedvars; ++
i )
1456 if( perm[
i] < graph->nsymvars )
1459 thisvar = graph->symvars[perm[
i]];
1464 thisvar = graph->symvars[perm[
i] - graph->nsymvars];
1467 if( graph->isfixedvar[
i % graph->nsymvars]
1471 graph->varcolors[perm[
i]] = color;
1473 previsneg = thisisneg;
1475 graph->nvarcolors = color;
1486 graph->
opcolors[perm[0]] = ++color;
1487 prevop = graph->
ops[perm[0]];
1491 thisop = graph->
ops[perm[
i]];
1507 prevval = graph->
vals[perm[0]];
1511 thisval = graph->
vals[perm[
i]];
1526 graph->conscolors[perm[0]] = ++color;
1528 for(
i = 1;
i < graph->nconsnodes; ++
i )
1533 graph->conscolors[perm[
i]] = color;
1544 SCIPisEQ(
scip, graph->edgevals[perm[0]], graph->edgevals[perm[graph->nedges - 1]]) )
1547 graph->uniqueedgetype =
TRUE;
1548 for(
i = 0;
i < graph->nedges; ++
i )
1549 graph->edgecolors[
i] = -1;
1554 graph->edgecolors[perm[0]] = ++color;
1555 prevval = graph->edgevals[perm[0]];
1557 for(
i = 1;
i < graph->nedges; ++
i )
1559 thisval = graph->edgevals[perm[
i]];
1568 graph->edgecolors[perm[
i]] = color;
1573 for( ;
i < graph->nedges; ++
i )
1574 graph->edgecolors[perm[
i]] = -1;
1653 assert(0 <= edgeidx && edgeidx < graph->nedges);
1665 assert(0 <= edgeidx && edgeidx < graph->nedges);
1682 assert(0 <= nodeidx && nodeidx < graph->nsymvars);
1686 assert(0 <= nodeidx && nodeidx < 2 * graph->nsymvars);
1737 assert(0 <= edgeidx && edgeidx < graph->nedges);
1752 assert(0 <= edgeidx && edgeidx < graph->nedges);
1872 if( requiredsize > *
nvars )
1883 for( v = 0; v < *
nvars; ++v )
1893 for (v = 0; v < *
nvars; ++v)
1901 *constant += (*scalars)[v] * (ub + lb) / 2;
1917 if( (*symdata)->nconstants > 0 )
1921 if( (*symdata)->ncoefficients > 0 )
#define SCIP_CALL_ABORT(x)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_Bool SCIPexprhdlrHasGetSymData(SCIP_EXPRHDLR *exprhdlr)
SCIP_RETCODE SCIPgetSymDataExpr(SCIP *scip, SCIP_EXPR *expr, SYM_EXPRDATA **symdata)
SCIP_EXPRHDLR * SCIPexprGetHdlr(SCIP_EXPR *expr)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPreallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_VARTYPE SCIPgetSymInferredVarType(SCIP_VAR *var)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_Bool SCIPvarIsImpliedIntegral(SCIP_VAR *var)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
SCIP_RETCODE SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
void SCIPsort(int *perm, SCIP_DECL_SORTINDCOMP((*indcomp)), void *dataptr, int len)
SYM_NODETYPE SCIPgetSymgraphNodeType(SYM_GRAPH *graph, int nodeidx)
SCIP_RETCODE SCIPaddSymgraphEdge(SCIP *scip, SYM_GRAPH *graph, int first, int second, SCIP_Bool hasval, SCIP_Real val)
SCIP_RETCODE SCIPfreeSymgraph(SCIP *scip, SYM_GRAPH **graph)
int SCIPgetSymgraphEdgeFirst(SYM_GRAPH *graph, int edgeidx)
SCIP_RETCODE SCIPaddSymgraphOpnode(SCIP *scip, SYM_GRAPH *graph, int op, int *nodeidx)
int * SCIPgetSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
SCIP_RETCODE SCIPgetSymActiveVariables(SCIP *scip, SYM_SYMTYPE symtype, SCIP_VAR ***vars, SCIP_Real **scalars, int *nvars, SCIP_Real *constant, SCIP_Bool transformed)
SCIP_Bool SCIPhasGraphUniqueEdgetype(SYM_GRAPH *graph)
int SCIPgetSymgraphVarnodeColor(SYM_GRAPH *graph, int nodeidx)
SCIP_RETCODE SCIPaddSymgraphValnode(SCIP *scip, SYM_GRAPH *graph, SCIP_Real val, int *nodeidx)
SCIP_RETCODE SCIPcreateSymgraph(SCIP *scip, SYM_SYMTYPE symtype, SYM_GRAPH **graph, SCIP_VAR **symvars, int nsymvars, int nopnodes, int nvalnodes, int nconsnodes, int nedges)
int SCIPgetSymgraphNEdges(SYM_GRAPH *graph)
int SCIPgetSymgraphVarnodeidx(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR *var)
SCIP_RETCODE SCIPcomputeSymgraphColors(SCIP *scip, SYM_GRAPH *graph, SYM_SPEC fixedtype)
SYM_SYMTYPE SCIPgetSymgraphSymtype(SYM_GRAPH *graph)
SCIP_RETCODE SCIPcopySymgraphAsSubgraph(SCIP *scip, SYM_GRAPH *sourcegraph, SYM_GRAPH *targetgraph, SCIP_CONS *sourcecons, int *rootidx)
SCIP_RETCODE SCIPaddSymgraphConsnode(SCIP *scip, SYM_GRAPH *graph, SCIP_CONS *cons, SCIP_Real lhs, SCIP_Real rhs, int *nodeidx)
SCIP_RETCODE SCIPcreateSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
int SCIPgetSymgraphEdgeSecond(SYM_GRAPH *graph, int edgeidx)
int SCIPgetSymgraphNConsnodes(SYM_GRAPH *graph)
SCIP_RETCODE SCIPaddSymgraphVarAggregation(SCIP *scip, SYM_GRAPH *graph, int rootidx, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Real constant)
int SCIPgetSymExprdataNConstants(SYM_EXPRDATA *symdata)
SCIP_RETCODE SCIPupdateSymgraphRhs(SYM_GRAPH *graph, int nodeidx, SCIP_Real newrhs)
SCIP_RETCODE SCIPfreeSymgraphConsnodeperm(SCIP *scip, SYM_GRAPH *graph)
SCIP_RETCODE SCIPupdateSymgraphLhs(SYM_GRAPH *graph, int nodeidx, SCIP_Real newlhs)
int SCIPgetSymgraphNVars(SYM_GRAPH *graph)
int SCIPgetSymgraphNegatedVarnodeidx(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR *var)
SCIP_Bool SCIPisSymgraphEdgeColored(SYM_GRAPH *graph, int edgeidx)
SCIP_RETCODE SCIPfreeSymDataExpr(SCIP *scip, SYM_EXPRDATA **symdata)
SCIP_VAR ** SCIPgetSymgraphVars(SYM_GRAPH *graph)
int SCIPgetSymgraphNodeColor(SYM_GRAPH *graph, int nodeidx)
int SCIPgetSymgraphEdgeColor(SYM_GRAPH *graph, int edgeidx)
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)
int SCIPgetSymgraphNNodes(SYM_GRAPH *graph)
SCIP_Real * SCIPgetSymExprdataConstants(SYM_EXPRDATA *symdata)
SCIP_RETCODE SCIPclearSymgraph(SCIP *scip, SYM_GRAPH *graph, SCIP_VAR **symvars, int nsymvars, SYM_SYMTYPE symtype)
SCIP_RETCODE SCIPcopySymgraph(SCIP *scip, SYM_GRAPH **graph, SYM_GRAPH *origgraph, int *perm, SYM_SPEC fixedtype)
SCIP_RETCODE SCIPfixSymgraphVarnode(SYM_GRAPH *graph, SCIP_VAR *var)
int SCIPgetSymgraphNVarcolors(SYM_GRAPH *graph)
SCIP_RETCODE SCIPgetCoefSymData(SCIP *scip, SCIP_EXPR *expr, SCIP_EXPR *parentexpr, SCIP_Real *coef, SCIP_Bool *success)
assert(minobj< SCIPgetCutoffbound(scip))
static const SCIP_Real scalars[]
internal miscellaneous methods
structs for symmetry computations
methods for handling symmetries
static SCIP_RETCODE ensureNodeArraysSize(SCIP *scip, SYM_GRAPH *graph, int addsize)
static SCIP_Bool isFixedVar(SCIP_VAR *var, SYM_SPEC fixedtype)
static int compareOps(int op1, int op2)
static int compareVarsFixed(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Bool isfixed1, SCIP_Bool isfixed2)
static int compareVarsSignedPerm(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2, SCIP_Bool isneg1, SCIP_Bool isneg2, SCIP_Real infinity)
static int compareVars(SCIP *scip, SCIP_VAR *var1, SCIP_VAR *var2)
static SCIP_RETCODE ensureEdgeArraysSize(SCIP *scip, SYM_GRAPH *graph, int addsize)
static int compareConsnodes(SCIP *scip, SYM_GRAPH *graph, int ind1, int ind2)
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)
methods for dealing with symmetry detection graphs
struct SCIP_Cons SCIP_CONS
struct SYM_Graph SYM_GRAPH
struct SCIP_Expr SCIP_EXPR
struct SYM_ExprData SYM_EXPRDATA
#define SCIP_DECL_SORTINDCOMP(x)
enum SCIP_Retcode SCIP_RETCODE
type definitions for symmetry computations
enum SYM_Symtype SYM_SYMTYPE
enum SYM_Nodetype SYM_NODETYPE
@ SCIP_VARTYPE_CONTINUOUS
enum SCIP_Vartype SCIP_VARTYPE