66 nnodes = nopnodes + nvalnodes + nconsnodes;
82 (*graph)->maxnnodes =
nnodes;
83 (*graph)->nopnodes = 0;
84 (*graph)->maxnopnodes = nopnodes;
85 (*graph)->nvalnodes = 0;
86 (*graph)->maxnvalnodes = nvalnodes;
87 (*graph)->nconsnodes = 0;
88 (*graph)->maxnconsnodes = nconsnodes;
89 (*graph)->islocked =
FALSE;
91 (*graph)->maxnedges = nedges;
92 (*graph)->symvars = symvars;
93 (*graph)->nsymvars = nsymvars;
94 (*graph)->nvarcolors = -1;
95 (*graph)->uniqueedgetype =
FALSE;
96 (*graph)->symtype = symtype;
98 (*graph)->consnodeperm =
NULL;
101 (*graph)->varcolors =
NULL;
102 (*graph)->opcolors =
NULL;
103 (*graph)->valcolors =
NULL;
104 (*graph)->conscolors =
NULL;
105 (*graph)->edgecolors =
NULL;
123 switch( (*graph)->symtype )
193 origgraph->
lhs[nodeinfopos[
i]], origgraph->
rhs[nodeinfopos[
i]], &nodeidx) );
206 first = -perm[-first - 1] - 1;
208 second = -perm[-second - 1] - 1;
316 for( j = 0; j <
nvars; ++j )
323 for( j = 0; j <
nvars; ++j )
396 SCIPerrorMessage(
"Cannot add nodes to a graph for which colors have already been computed.\n");
437 SCIPerrorMessage(
"Cannot add nodes to a graph for which colors have already been computed.\n");
481 SCIPerrorMessage(
"Cannot add nodes to a graph for which colors have already been computed.\n");
526 assert(nodeidx != INT_MAX);
547 assert(nodeidx != INT_MAX);
649 SCIPerrorMessage(
"Cannot add edges to a graph for which colors have already been computed.\n");
757 if( (! isfixed1) && isfixed2 )
759 if( isfixed1 && (! isfixed2) )
780 SCIP_Bool* isfixedvar;
858 mid = (lb1 + ub1) / 2;
864 mid = (lb2 + ub2) / 2;
939 if( (! isfixed1) && isfixed2 )
941 if( isfixed1 && (! isfixed2) )
964 SCIP_Bool* isfixedvar;
968 SCIP_Bool isneg1 =
FALSE;
969 SCIP_Bool isneg2 =
FALSE;
983 if( locind1 >= nsymvars )
989 if( locind2 >= nsymvars )
1016 else if( op1 > op2 )
1034 vals = (
int*) dataptr;
1051 vals = (SCIP_Real*) dataptr;
1053 if( vals[ind1] < vals[ind2] )
1055 if( vals[ind1] > vals[ind2] )
1082 assert(0 <= ind1 && ind1 < graph->nconsnodes);
1083 assert(0 <= ind2 && ind2 < graph->nconsnodes);
1085 cons1 = graph->
conss[ind1];
1086 cons2 = graph->
conss[ind2];
1108 if( graph->
lhs[ind1] < graph->
lhs[ind2] )
1110 if( graph->
lhs[ind1] > graph->
lhs[ind2] )
1113 if( graph->
rhs[ind1] < graph->
rhs[ind2] )
1115 if( graph->
rhs[ind1] > graph->
rhs[ind2] )
1195 SCIP_Bool previsneg;
1196 SCIP_Bool thisisneg;
1246 if ( nusedvars > len )
1256 SCIPsort(perm, SYMsortVarnodesPermsym, (
void*) graph, nusedvars);
1258 graph->varcolors[perm[0]] = color;
1259 prevvar = graph->symvars[perm[0]];
1261 for(
i = 1;
i < nusedvars; ++
i )
1263 thisvar = graph->symvars[perm[
i]];
1268 graph->varcolors[perm[
i]] = color;
1271 graph->nvarcolors = color;
1276 SCIPsort(perm, SYMsortVarnodesSignedPermsym, (
void*) graph, nusedvars);
1278 graph->varcolors[perm[0]] = color;
1281 if( perm[0] < graph->nsymvars )
1284 prevvar = graph->symvars[perm[0]];
1289 prevvar = graph->symvars[perm[0] - graph->nsymvars];
1293 for(
i = 1;
i < nusedvars; ++
i )
1295 if( perm[
i] < graph->nsymvars )
1298 thisvar = graph->symvars[perm[
i]];
1303 thisvar = graph->symvars[perm[
i] - graph->nsymvars];
1306 if( graph->isfixedvar[
i % graph->nsymvars]
1310 graph->varcolors[perm[
i]] = color;
1312 previsneg = thisisneg;
1314 graph->nvarcolors = color;
1325 graph->
opcolors[perm[0]] = ++color;
1326 prevop = graph->
ops[perm[0]];
1330 thisop = graph->
ops[perm[
i]];
1346 prevval = graph->
vals[perm[0]];
1350 thisval = graph->
vals[perm[
i]];
1365 graph->conscolors[perm[0]] = ++color;
1367 for(
i = 1;
i < graph->nconsnodes; ++
i )
1372 graph->conscolors[perm[
i]] = color;
1385 for(
i = 0;
i < graph->nedges; ++
i )
1386 graph->edgecolors[perm[
i]] = -1;
1391 graph->edgecolors[perm[0]] = ++color;
1392 prevval = graph->edgevals[perm[0]];
1394 for(
i = 1;
i < graph->nedges; ++
i )
1396 thisval = graph->edgevals[perm[
i]];
1405 graph->edgecolors[perm[
i]] = color;
1410 if(
i == graph->nedges && graph->edgecolors[perm[0]] == graph->edgecolors[perm[
i-1]] )
1411 graph->uniqueedgetype =
TRUE;
1414 for( ;
i < graph->nedges; ++
i )
1415 graph->edgecolors[perm[
i]] = -1;
1494 assert(0 <= edgeidx && edgeidx < graph->nedges);
1506 assert(0 <= edgeidx && edgeidx < graph->nedges);
1523 assert(0 <= nodeidx && nodeidx < graph->nsymvars);
1527 assert(0 <= nodeidx && nodeidx < 2 * graph->nsymvars);
1578 assert(0 <= edgeidx && edgeidx < graph->nedges);
1593 assert(0 <= edgeidx && edgeidx < graph->nedges);
1692 SCIP_Real* constant,
1693 SCIP_Bool transformed
1713 if( requiredsize > *
nvars )
1724 for( v = 0; v < *
nvars; ++v )
1734 for (v = 0; v < *
nvars; ++v)
1742 *constant += (*scalars)[v] * (ub + lb) / 2;
1758 if( (*symdata)->nconstants > 0 )
1762 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_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 SCIPgetProbvarLinearSum(SCIP *scip, SCIP_VAR **vars, SCIP_Real *scalars, int *nvars, int varssize, SCIP_Real *constant, int *requiredsize, SCIP_Bool mergemultiples)
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetProbindex(SCIP_VAR *var)
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 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 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
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
#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