Skip to content

Commit f8861e8

Browse files
committed
Merge remote-tracking branch 'origin/v100-bugfix' into v10-minor
2 parents 0d0f03e + 8b572ac commit f8861e8

File tree

3 files changed

+91
-79
lines changed

3 files changed

+91
-79
lines changed

src/scip/nlpi_filtersqp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
3434

3535
#include <string.h>
36-
#if defined(_WIN32)
36+
#ifdef _WIN32
3737
#include <windows.h>
3838
#else
3939
#include <sys/time.h>

src/symmetry/compute_symmetry_sassy_bliss.cpp

Lines changed: 51 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -246,68 +246,79 @@ SCIP_RETCODE computeAutomorphisms(
246246
/* call sassy to reduce graph */
247247
sassy.reduce(G, &sassyglue);
248248

249-
/* create bliss graph */
250-
bliss::Graph blissgraph(0);
249+
if( G->get_sgraph()->v_size == 0 )
250+
{
251+
dejavu::big_number grp_sz = sassy.grp_sz;
252+
*log10groupsize = (SCIP_Real) log10l(grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
253+
}
254+
else
255+
{
256+
/* create bliss graph */
257+
bliss::Graph blissgraph(0);
251258

252-
/* convert sassy to bliss graph */
253-
convert_dejavu_to_bliss(G, &blissgraph);
259+
/* convert sassy to bliss graph */
260+
convert_dejavu_to_bliss(G, &blissgraph);
254261

255262
#ifdef SCIP_OUTPUT
256-
blissgraph.write_dot("debug.dot");
263+
blissgraph.write_dot("debug.dot");
257264
#endif
258265

259266
#ifdef SCIP_DISABLED_CODE
260-
char filename[SCIP_MAXSTRLEN];
261-
(void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s.dimacs", SCIPgetProbName(scip));
262-
FILE* fp = fopen(filename, "w");
263-
if ( fp )
264-
{
265-
blissgraph.write_dimacs(fp);
266-
fclose(fp);
267-
}
267+
char filename[SCIP_MAXSTRLEN];
268+
(void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s.dimacs", SCIPgetProbName(scip));
269+
FILE* fp = fopen(filename, "w");
270+
if ( fp )
271+
{
272+
blissgraph.write_dimacs(fp);
273+
fclose(fp);
274+
}
268275
#endif
269276

277+
/* compute automorphisms */
278+
bliss::Stats stats;
270279

271-
/* compute automorphisms */
272-
bliss::Stats stats;
273-
274-
/* Prefer splitting partition cells corresponding to variables over those corresponding
275-
* to inequalities. This is because we are only interested in the action
276-
* of the automorphism group on the variables, and we need a base for this action */
277-
blissgraph.set_splitting_heuristic(bliss::Graph::shs_f);
278-
/* disable component recursion as advised by Tommi Junttila from bliss */
279-
blissgraph.set_component_recursion(false);
280+
/* Prefer splitting partition cells corresponding to variables over those corresponding
281+
* to inequalities. This is because we are only interested in the action
282+
* of the automorphism group on the variables, and we need a base for this action */
283+
blissgraph.set_splitting_heuristic(bliss::Graph::shs_f);
284+
/* disable component recursion as advised by Tommi Junttila from bliss */
285+
blissgraph.set_component_recursion(false);
280286

281287
#if BLISS_VERSION_MAJOR >= 1 || BLISS_VERSION_MINOR >= 76
282-
/* lambda function to have access to data and terminate the search if maxgenerators are reached */
283-
auto term = [&]() {
284-
return (maxgenerators != 0 && data.nperms >= maxgenerators); /* check the number of generators that we have created so far */
285-
};
288+
/* lambda function to have access to data and terminate the search if maxgenerators are reached */
289+
auto term = [&]() {
290+
return (maxgenerators != 0 && data.nperms >= maxgenerators); /* check the number of generators that we have created so far */
291+
};
286292

287-
auto hook = [&](unsigned int n, const unsigned int* aut) {
288-
sassy.bliss_hook(n, aut);
289-
};
293+
auto hook = [&](unsigned int n, const unsigned int* aut) {
294+
sassy.bliss_hook(n, aut);
295+
};
290296

291-
/* start search */
292-
blissgraph.find_automorphisms(stats, hook, term);
297+
/* start search */
298+
blissgraph.find_automorphisms(stats, hook, term);
293299
#else
294300

295-
/* Older bliss versions do not allow to terminate with a limit on the number of generators unless patched. */
301+
/* Older bliss versions do not allow to terminate with a limit on the number of generators unless patched. */
296302
#ifdef BLISS_PATCH_PRESENT
297-
/* If patch is present, do not use a node limit, but set generator limit. This approach is not very accurate, since
298-
* it limits the generators considered in bliss and not the ones that we generate (the ones that work on the variable
299-
* set). */
300-
blissgraph.set_search_limits(0, (unsigned) maxgenerators);
303+
/* If patch is present, do not use a node limit, but set generator limit. This approach is not very accurate, since
304+
* it limits the generators considered in bliss and not the ones that we generate (the ones that work on the variable
305+
* set). */
306+
blissgraph.set_search_limits(0, (unsigned) maxgenerators);
301307
#endif
302308

303-
/* start search */
304-
blissgraph.find_automorphisms(stats, dejavu::preprocessor::bliss_hook, (void*) &sassy);
309+
/* start search */
310+
blissgraph.find_automorphisms(stats, dejavu::preprocessor::bliss_hook, (void*) &sassy);
305311
#endif
306-
*symcodetime = SCIPgetSolvingTime(scip) - oldtime;
307312

308313
#ifdef SCIP_OUTPUT
309-
(void) stats.print(stdout);
314+
(void) stats.print(stdout);
310315
#endif
316+
/* determine log10 of symmetry group size */
317+
dejavu::big_number grp_sz = sassy.grp_sz;
318+
*log10groupsize = (SCIP_Real) log10l(stats.get_group_size_approx() * grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
319+
}
320+
321+
*symcodetime = SCIPgetSolvingTime(scip) - oldtime;
311322

312323
/* prepare return values */
313324
if ( data.nperms > 0 )
@@ -326,10 +337,6 @@ SCIP_RETCODE computeAutomorphisms(
326337
*nmaxperms = 0;
327338
}
328339

329-
/* determine log10 of symmetry group size */
330-
dejavu::big_number grp_sz = sassy.grp_sz;
331-
*log10groupsize = (SCIP_Real) log10l(stats.get_group_size_approx() * grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
332-
333340
return SCIP_OKAY;
334341
}
335342

src/symmetry/compute_symmetry_sassy_nauty.cpp

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ SCIP_RETCODE computeAutomorphisms(
302302
*nperms = 0;
303303
*nmaxperms = 0;
304304
*perms = NULL;
305-
*log10groupsize = 0;
305+
*log10groupsize = 0.0;
306306
*symcodetime = 0.0;
307307

308308
/* init data */
@@ -334,50 +334,55 @@ SCIP_RETCODE computeAutomorphisms(
334334
/* call sassy to reduce graph */
335335
sassy.reduce(G, &sassyglue);
336336

337-
/* first, convert the graph */
338-
sparsegraph sg;
339-
DYNALLSTAT(int, lab, lab_sz);
340-
DYNALLSTAT(int, ptn, ptn_sz);
337+
if( G->get_sgraph()->v_size == 0 )
338+
{
339+
dejavu::big_number grp_sz = sassy.grp_sz;
340+
*log10groupsize = (SCIP_Real) log10l(grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
341+
}
342+
else
343+
{
344+
/* first, convert the graph */
345+
sparsegraph sg;
346+
DYNALLSTAT(int, lab, lab_sz);
347+
DYNALLSTAT(int, ptn, ptn_sz);
341348

342349
#ifdef NAUTY
343-
convert_dejavu_to_nauty(G, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
344-
statsblk stats;
345-
DYNALLSTAT(int, orbits, orbits_sz);
346-
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
347-
DEFAULTOPTIONS_SPARSEGRAPH(options);
348-
/* init callback functions for nauty (accumulate the group generators found by nauty) */
349-
options.writeautoms = FALSE;
350-
options.userautomproc = dejavu::preprocessor::nauty_hook;
351-
options.defaultptn = FALSE; /* use color classes */
352-
if ( canterminateearly )
353-
options.usernodeproc = nautyterminationhook;
354-
*log10groupsize = 0.0;
355-
if(sg.nv > 0) {
350+
convert_dejavu_to_nauty(G, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
351+
assert( sg.nv > 0 );
352+
353+
statsblk stats;
354+
DYNALLSTAT(int, orbits, orbits_sz);
355+
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
356+
DEFAULTOPTIONS_SPARSEGRAPH(options);
357+
/* init callback functions for nauty (accumulate the group generators found by nauty) */
358+
options.writeautoms = FALSE;
359+
options.userautomproc = dejavu::preprocessor::nauty_hook;
360+
options.defaultptn = FALSE; /* use color classes */
361+
if ( canterminateearly )
362+
options.usernodeproc = nautyterminationhook;
356363
sparsenauty(&sg, lab, ptn, orbits, &options, &stats, NULL);
357364
dejavu::big_number grp_sz = sassy.grp_sz;
358365
*log10groupsize = log10(stats.grpsize1 * grp_sz.mantissa * pow(10.0, (SCIP_Real) (stats.grpsize2 + grp_sz.exponent)));
359-
}
360366
#else
361-
convert_dejavu_to_traces(&sassygraph, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
362-
TracesStats stats;
363-
DYNALLSTAT(int, orbits, orbits_sz);
364-
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
365-
DEFAULTOPTIONS_TRACES(options);
366-
/* init callback functions for traces (accumulate the group generators found by traces) */
367-
options.writeautoms = FALSE;
368-
options.userautomproc = dejavu::preprocessor::traces_hook;
369-
options.defaultptn = FALSE; /* use color classes */
370-
if(sg.nv > 0) {
367+
convert_dejavu_to_traces(&sassygraph, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
368+
TracesStats stats;
369+
DYNALLSTAT(int, orbits, orbits_sz);
370+
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
371+
DEFAULTOPTIONS_TRACES(options);
372+
/* init callback functions for traces (accumulate the group generators found by traces) */
373+
options.writeautoms = FALSE;
374+
options.userautomproc = dejavu::preprocessor::traces_hook;
375+
options.defaultptn = FALSE; /* use color classes */
371376
Traces(&sg, lab, ptn, orbits, &options, &stats, NULL);
372377
dejavu::big_number grp_sz = sassy.grp_sz;
373378
*log10groupsize = log10(stats.grpsize1 * grp_sz.mantissa * pow(10.0, (SCIP_Real) (stats.grpsize2 + grp_sz.exponent)));
374-
}
375379
#endif
376380

377-
/* clean up */
378-
DYNFREE(lab, lab_sz);
379-
DYNFREE(ptn, ptn_sz);
380-
SG_FREE(sg);
381+
/* clean up */
382+
DYNFREE(lab, lab_sz);
383+
DYNFREE(ptn, ptn_sz);
384+
SG_FREE(sg);
385+
}
381386

382387
*symcodetime = SCIPgetSolvingTime(scip) - oldtime;
383388

0 commit comments

Comments
 (0)