Skip to content

Commit 066d3bf

Browse files
author
Christopher Hojny
committed
Merge branch '3877-shrink-symmetry-detection-graph' into 'master'
Resolve "Shrink symmetry detection graph" Closes #3877 See merge request integer/scip!3778
2 parents 8f458b0 + 1c7405c commit 066d3bf

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

CHANGELOG

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Performance improvements
3939
------------------------
4040

4141
- reimplemented SCIPvarGetActiveRepresentatives() by using dense arrays to avoid repeated resorting.
42+
- simplified symmetry detection graphs in case all edges have the same color
4243

4344
Examples and applications
4445
-------------------------

src/scip/symmetry_graph.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -1539,12 +1539,14 @@ SCIP_RETCODE SCIPcomputeSymgraphColors(
15391539
{
15401540
SCIPsort(perm, SYMsortEdges, (void*) graph, graph->nedges);
15411541

1542-
/* check whether edges are colored; due to sorting, only check first edge */
1543-
if( SCIPisInfinity(scip, graph->edgevals[perm[0]]) )
1542+
/* check for uncolored or uniformly colored edges, which is easy due to sorting */
1543+
if( SCIPisInfinity(scip, graph->edgevals[perm[0]]) ||
1544+
SCIPisEQ(scip, graph->edgevals[perm[0]], graph->edgevals[perm[graph->nedges - 1]]) )
15441545
{
1545-
/* all edges are uncolored */
1546+
/* when all edges are uncolored or uniformly colored, we can ignore edge colors */
1547+
graph->uniqueedgetype = TRUE;
15461548
for( i = 0; i < graph->nedges; ++i )
1547-
graph->edgecolors[perm[i]] = -1;
1549+
graph->edgecolors[i] = -1;
15481550
}
15491551
else
15501552
{
@@ -1567,10 +1569,6 @@ SCIP_RETCODE SCIPcomputeSymgraphColors(
15671569
prevval = thisval;
15681570
}
15691571

1570-
/* check whether all edges are equivalent */
1571-
if( i == graph->nedges && graph->edgecolors[perm[0]] == graph->edgecolors[perm[i-1]] )
1572-
graph->uniqueedgetype = TRUE;
1573-
15741572
/* assign uncolored edges color -1 */
15751573
for( ; i < graph->nedges; ++i )
15761574
graph->edgecolors[perm[i]] = -1;

0 commit comments

Comments
 (0)