Skip to content

Commit 5bc0f94

Browse files
committed
Merge remote-tracking branch 'origin/v10-minor'
2 parents 52961d2 + b52b09a commit 5bc0f94

File tree

4 files changed

+28
-78
lines changed

4 files changed

+28
-78
lines changed

CHANGELOG

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,14 @@ Build system
479479

480480
- added experimental target to run cppcheck
481481

482+
### Changed Parameters
483+
484+
- removed parameters propagating/symmetry/{nautymaxncells,nautymaxnnodes}
485+
486+
### New Parameters
487+
488+
- added parameter propagating/symmetry/maxlevel to terminate Nauty early especially before its search tree depth overflows the call stack memory
489+
482490
Miscellaneous
483491
-------------
484492

src/scip/prop_symmetry.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,8 @@
203203
/* other defines */
204204
#define MAXGENNUMERATOR 64000000 /**< determine maximal number of generators by dividing this number by the number of variables */
205205
#define COMPRESSNVARSLB 25000 /**< lower bound on the number of variables above which compression could be performed */
206-
#define DEFAULT_NAUTYMAXNCELLS 100000 /**< terminate symmetry detection using Nauty when number of cells in color refinment is at least this number
207-
* (avoids segfaults due to Nauty for large graphs) */
208-
#define DEFAULT_NAUTYMAXNNODES 10000000 /**< terminate symmetry detection using Nauty when its search tree has at least this number of nodes */
209-
/*@todo investigate why the Nauty works well for some large instances (miplib2010/mspp16.mps) but not for PB instances (e.g., normalized-celar6-sub0_wcsp.wbo) */
210-
206+
#define DEFAULT_NAUTYMAXLEVEL 10000 /**< terminate symmetry detection using Nauty when depth level of Nauty's search tree exceeds this number
207+
* (avoids call stack overflows in Nauty for deep graphs) */
211208

212209
/* macros for getting activeness of symmetry handling methods */
213210
#define ISSYMRETOPESACTIVE(x) (((unsigned) x & SYM_HANDLETYPE_SYMBREAK) != 0)
@@ -8403,14 +8400,9 @@ SCIP_RETCODE SCIPincludePropSymmetry(
84038400
if ( strncmp(SYMsymmetryGetName(), "Nauty", 5) == 0 )
84048401
{
84058402
SCIP_CALL( SCIPaddIntParam(scip,
8406-
"propagating/" PROP_NAME "/nautymaxncells",
8407-
"terminate symmetry detection using Nauty when number of cells in color refinment is at least this number",
8408-
NULL, TRUE, DEFAULT_NAUTYMAXNCELLS, 0, INT_MAX, NULL, NULL) );
8409-
8410-
SCIP_CALL( SCIPaddIntParam(scip,
8411-
"propagating/" PROP_NAME "/nautymaxnnodes",
8412-
"terminate symmetry detection using Nauty when its search tree has at least this number of nodes",
8413-
NULL, TRUE, DEFAULT_NAUTYMAXNNODES, 0, INT_MAX, NULL, NULL) );
8403+
"propagating/" PROP_NAME "/nautymaxlevel",
8404+
"terminate symmetry detection using Nauty when depth level of Nauty's search tree exceeds this number (-1: unlimited)",
8405+
NULL, TRUE, DEFAULT_NAUTYMAXLEVEL, -1, INT_MAX, NULL, NULL) );
84148406
}
84158407

84168408
/* possibly add description */

src/symmetry/compute_symmetry_nauty.c

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ struct NAUTY_Data
7373
int maxgenerators; /**< maximal number of generators to be constructed (= 0 if unlimited) */
7474
int nnodessdg; /**< number of non-variable nodes in symmetry detection graph */
7575
SYM_GROUPTYPE symgrouptype; /**< type of symmetry group for which generators are computed */
76-
int ntreenodes; /**< number of nodes visited in nauty's search tree */
77-
int maxncells; /**< maximum number of cells in nauty's search tree */
78-
int maxnnodes; /**< maximum number of nodes in nauty's search tree */
76+
int maxlevel; /**< maximum depth level of nauty's search tree (-1: unlimited) */
7977
};
8078
typedef struct NAUTY_Data NAUTY_DATA;
8179

@@ -213,35 +211,15 @@ void nautyterminationhook(
213211
int n /**< number of nodes in the graph */
214212
)
215213
{ /* lint --e{715} */
216-
SCIP_Bool terminate = FALSE;
217-
data_.ntreenodes++;
218-
219-
/* add some iteration limit to avoid spending too much time in nauty */
220-
if ( numcells >= data_.maxncells )
221-
{
222-
terminate = TRUE;
223-
SCIPverbMessage(data_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
224-
"symmetry computation terminated early, because number of cells %d in Nauty exceeds limit of %d\n",
225-
numcells, data_.maxncells);
226-
SCIPverbMessage(data_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
227-
"for running full symmetry detection, increase value of parameter propagating/symmetry/nautymaxncells\n");
228-
}
229-
else if ( data_.ntreenodes >= data_.maxnnodes )
214+
/* add level limit to work around call stack overflow in nauty */
215+
if ( level > data_.maxlevel && data_.maxlevel >= 0 )
230216
{
231-
terminate = TRUE;
232217
SCIPverbMessage(data_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
233-
"symmetry computation terminated early, because number of"
234-
" nodes %d in Nauty's search tree exceeds limit of %d\n", data_.ntreenodes, data_.maxnnodes);
218+
"symmetry computation terminated early because Nauty level limit %d is exceeded\n",
219+
data_.maxlevel);
235220
SCIPverbMessage(data_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
236-
"for running full symmetry detection, increase value of"
237-
" parameter propagating/symmetry/nautymaxnnodes\n");
238-
}
239-
240-
if ( terminate )
241-
{
242-
/* request a kill from nauty */
221+
"for running full symmetry detection, increase value of parameter propagating/symmetry/nautymaxlevel\n");
243222
nauty_kill_request = 1;
244-
return;
245223
}
246224
}
247225

@@ -1400,9 +1378,7 @@ SCIP_RETCODE computeSymmetryGenerators(
14001378
data_.symtype = SCIPgetSymgraphSymtype(symgraph);
14011379
data_.nnodessdg = SCIPgetSymgraphNNodes(symgraph);
14021380
data_.symgrouptype = symgrouptype;
1403-
data_.ntreenodes = 0;
1404-
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxncells", &data_.maxncells) );
1405-
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxnnodes", &data_.maxnnodes) );
1381+
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxlevel", &data_.maxlevel) );
14061382

14071383
/* call nauty/traces */
14081384
#ifdef NAUTY
@@ -1628,9 +1604,7 @@ SCIP_Bool SYMcheckGraphsAreIdentical(
16281604
data_.symtype = symtype;
16291605
data_.symgrouptype = SYM_GROUPTYPE_SDG;
16301606
data_.nnodessdg = SCIPgetSymgraphNNodes(G1);
1631-
data_.ntreenodes = 0;
1632-
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxncells", &data_.maxncells) ); /*lint !e641*//*lint !e732*/
1633-
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxnnodes", &data_.maxnnodes) ); /*lint !e641*//*lint !e732*/
1607+
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxlevel", &data_.maxlevel) ); /*lint !e641*//*lint !e732*/
16341608

16351609
/* call nauty/traces */
16361610
#ifdef NAUTY

src/symmetry/compute_symmetry_sassy_nauty.cpp

Lines changed: 7 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ struct SYMMETRY_Data
9797
struct NAUTY_Data
9898
{
9999
SCIP* scip; /**< SCIP pointer */
100-
int ntreenodes; /**< number of nodes visitied in nauty's search tree */
101-
int maxncells; /**< maximum number of cells in nauty's search tree */
102-
int maxnnodes; /**< maximum number of nodes in nauty's search tree */
100+
int maxlevel; /**< maximum depth level of nauty's search tree (-1: unlimited) */
103101
};
104102

105103
/** static data for nauty callback */
@@ -233,35 +231,15 @@ void nautyterminationhook(
233231
int n /**< number of nodes in the graph */
234232
)
235233
{ /* lint --e{715} */
236-
SCIP_Bool terminate = FALSE;
237-
nautydata_.ntreenodes++;
238-
239-
/* add some iteration limit to avoid spending too much time in nauty */
240-
if ( numcells >= nautydata_.maxncells )
241-
{
242-
terminate = TRUE;
243-
SCIPverbMessage(nautydata_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
244-
"symmetry computation terminated early, because number of cells %d in Nauty exceeds limit of %d\n",
245-
numcells, nautydata_.maxncells);
246-
SCIPverbMessage(nautydata_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
247-
"for running full symmetry detection, increase value of parameter propagating/symmetry/nautymaxncells\n");
248-
}
249-
else if ( nautydata_.ntreenodes >= nautydata_.maxnnodes )
234+
/* add level limit to work around call stack overflow in nauty */
235+
if ( level > nautydata_.maxlevel && nautydata_.maxlevel >= 0 )
250236
{
251-
terminate = TRUE;
252237
SCIPverbMessage(nautydata_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
253-
"symmetry computation terminated early, because number of"
254-
" nodes %d in Nauty's search tree exceeds limit of %d\n", nautydata_.ntreenodes, nautydata_.maxnnodes);
238+
"symmetry computation terminated early because Nauty level limit %d is exceeded\n",
239+
nautydata_.maxlevel);
255240
SCIPverbMessage(nautydata_.scip, SCIP_VERBLEVEL_MINIMAL, NULL,
256-
"for running full symmetry detection, increase value of"
257-
" parameter propagating/symmetry/nautymaxnnodes\n");
258-
}
259-
260-
if ( terminate )
261-
{
262-
/* request a kill from nauty */
241+
"for running full symmetry detection, increase value of parameter propagating/symmetry/nautymaxlevel\n");
263242
nauty_kill_request = 1;
264-
return;
265243
}
266244
}
267245

@@ -363,9 +341,7 @@ SCIP_RETCODE computeAutomorphisms(
363341

364342
#ifdef NAUTY
365343
nautydata_.scip = scip;
366-
nautydata_.ntreenodes = 0;
367-
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxncells", &nautydata_.maxncells) );
368-
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxnnodes", &nautydata_.maxnnodes) );
344+
SCIP_CALL( SCIPgetIntParam(scip, "propagating/symmetry/nautymaxlevel", &nautydata_.maxlevel) );
369345
#endif
370346

371347
oldtime = SCIPgetSolvingTime(scip);

0 commit comments

Comments
 (0)