Skip to content

Commit 53b4c3d

Browse files
committed
Merge remote-tracking branch 'origin/v10-minor'
2 parents 979aa05 + f8861e8 commit 53b4c3d

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
@@ -269,68 +269,79 @@ SCIP_RETCODE computeAutomorphisms(
269269
/* call sassy to reduce graph */
270270
sassy.reduce(G, &sassyglue);
271271

272-
/* create bliss graph */
273-
bliss::Graph blissgraph(0);
272+
if( G->get_sgraph()->v_size == 0 )
273+
{
274+
dejavu::big_number grp_sz = sassy.grp_sz;
275+
*log10groupsize = (SCIP_Real) log10l(grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
276+
}
277+
else
278+
{
279+
/* create bliss graph */
280+
bliss::Graph blissgraph(0);
274281

275-
/* convert sassy to bliss graph */
276-
convert_dejavu_to_bliss(G, &blissgraph);
282+
/* convert sassy to bliss graph */
283+
convert_dejavu_to_bliss(G, &blissgraph);
277284

278285
#ifdef SCIP_OUTPUT
279-
blissgraph.write_dot("debug.dot");
286+
blissgraph.write_dot("debug.dot");
280287
#endif
281288

282289
#ifdef SCIP_DISABLED_CODE
283-
char filename[SCIP_MAXSTRLEN];
284-
(void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s.dimacs", SCIPgetProbName(scip));
285-
FILE* fp = fopen(filename, "w");
286-
if ( fp )
287-
{
288-
blissgraph.write_dimacs(fp);
289-
fclose(fp);
290-
}
290+
char filename[SCIP_MAXSTRLEN];
291+
(void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "%s.dimacs", SCIPgetProbName(scip));
292+
FILE* fp = fopen(filename, "w");
293+
if ( fp )
294+
{
295+
blissgraph.write_dimacs(fp);
296+
fclose(fp);
297+
}
291298
#endif
292299

300+
/* compute automorphisms */
301+
bliss::Stats stats;
293302

294-
/* compute automorphisms */
295-
bliss::Stats stats;
296-
297-
/* Prefer splitting partition cells corresponding to variables over those corresponding
298-
* to inequalities. This is because we are only interested in the action
299-
* of the automorphism group on the variables, and we need a base for this action */
300-
blissgraph.set_splitting_heuristic(bliss::Graph::shs_f);
301-
/* disable component recursion as advised by Tommi Junttila from bliss */
302-
blissgraph.set_component_recursion(false);
303+
/* Prefer splitting partition cells corresponding to variables over those corresponding
304+
* to inequalities. This is because we are only interested in the action
305+
* of the automorphism group on the variables, and we need a base for this action */
306+
blissgraph.set_splitting_heuristic(bliss::Graph::shs_f);
307+
/* disable component recursion as advised by Tommi Junttila from bliss */
308+
blissgraph.set_component_recursion(false);
303309

304310
#if BLISS_VERSION_MAJOR >= 1 || BLISS_VERSION_MINOR >= 76
305-
/* lambda function to have access to data and terminate the search if maxgenerators are reached */
306-
auto term = [&]() {
307-
return (maxgenerators != 0 && data.nperms >= maxgenerators); /* check the number of generators that we have created so far */
308-
};
311+
/* lambda function to have access to data and terminate the search if maxgenerators are reached */
312+
auto term = [&]() {
313+
return (maxgenerators != 0 && data.nperms >= maxgenerators); /* check the number of generators that we have created so far */
314+
};
309315

310-
auto hook = [&](unsigned int n, const unsigned int* aut) {
311-
sassy.bliss_hook(n, aut);
312-
};
316+
auto hook = [&](unsigned int n, const unsigned int* aut) {
317+
sassy.bliss_hook(n, aut);
318+
};
313319

314-
/* start search */
315-
blissgraph.find_automorphisms(stats, hook, term);
320+
/* start search */
321+
blissgraph.find_automorphisms(stats, hook, term);
316322
#else
317323

318-
/* Older bliss versions do not allow to terminate with a limit on the number of generators unless patched. */
324+
/* Older bliss versions do not allow to terminate with a limit on the number of generators unless patched. */
319325
#ifdef BLISS_PATCH_PRESENT
320-
/* If patch is present, do not use a node limit, but set generator limit. This approach is not very accurate, since
321-
* it limits the generators considered in bliss and not the ones that we generate (the ones that work on the variable
322-
* set). */
323-
blissgraph.set_search_limits(0, (unsigned) maxgenerators);
326+
/* If patch is present, do not use a node limit, but set generator limit. This approach is not very accurate, since
327+
* it limits the generators considered in bliss and not the ones that we generate (the ones that work on the variable
328+
* set). */
329+
blissgraph.set_search_limits(0, (unsigned) maxgenerators);
324330
#endif
325331

326-
/* start search */
327-
blissgraph.find_automorphisms(stats, dejavu::preprocessor::bliss_hook, (void*) &sassy);
332+
/* start search */
333+
blissgraph.find_automorphisms(stats, dejavu::preprocessor::bliss_hook, (void*) &sassy);
328334
#endif
329-
*symcodetime = SCIPgetSolvingTime(scip) - oldtime;
330335

331336
#ifdef SCIP_OUTPUT
332-
(void) stats.print(stdout);
337+
(void) stats.print(stdout);
333338
#endif
339+
/* determine log10 of symmetry group size */
340+
dejavu::big_number grp_sz = sassy.grp_sz;
341+
*log10groupsize = (SCIP_Real) log10l(stats.get_group_size_approx() * grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
342+
}
343+
344+
*symcodetime = SCIPgetSolvingTime(scip) - oldtime;
334345

335346
/* prepare return values */
336347
if ( data.nperms > 0 )
@@ -349,10 +360,6 @@ SCIP_RETCODE computeAutomorphisms(
349360
*nmaxperms = 0;
350361
}
351362

352-
/* determine log10 of symmetry group size */
353-
dejavu::big_number grp_sz = sassy.grp_sz;
354-
*log10groupsize = (SCIP_Real) log10l(stats.get_group_size_approx() * grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
355-
356363
return SCIP_OKAY;
357364
}
358365

src/symmetry/compute_symmetry_sassy_nauty.cpp

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ SCIP_RETCODE computeAutomorphisms(
324324
*nperms = 0;
325325
*nmaxperms = 0;
326326
*perms = NULL;
327-
*log10groupsize = 0;
327+
*log10groupsize = 0.0;
328328
*symcodetime = 0.0;
329329

330330
/* init data */
@@ -357,50 +357,55 @@ SCIP_RETCODE computeAutomorphisms(
357357
/* call sassy to reduce graph */
358358
sassy.reduce(G, &sassyglue);
359359

360-
/* first, convert the graph */
361-
sparsegraph sg;
362-
DYNALLSTAT(int, lab, lab_sz);
363-
DYNALLSTAT(int, ptn, ptn_sz);
360+
if( G->get_sgraph()->v_size == 0 )
361+
{
362+
dejavu::big_number grp_sz = sassy.grp_sz;
363+
*log10groupsize = (SCIP_Real) log10l(grp_sz.mantissa * powl(10.0, (SCIP_Real) grp_sz.exponent));
364+
}
365+
else
366+
{
367+
/* first, convert the graph */
368+
sparsegraph sg;
369+
DYNALLSTAT(int, lab, lab_sz);
370+
DYNALLSTAT(int, ptn, ptn_sz);
364371

365372
#ifdef NAUTY
366-
convert_dejavu_to_nauty(G, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
367-
statsblk stats;
368-
DYNALLSTAT(int, orbits, orbits_sz);
369-
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
370-
DEFAULTOPTIONS_SPARSEGRAPH(options);
371-
/* init callback functions for nauty (accumulate the group generators found by nauty) */
372-
options.writeautoms = FALSE;
373-
options.userautomproc = dejavu::preprocessor::nauty_hook;
374-
options.defaultptn = FALSE; /* use color classes */
375-
if ( canterminateearly )
376-
options.usernodeproc = nautyterminationhook;
377-
*log10groupsize = 0.0;
378-
if(sg.nv > 0) {
373+
convert_dejavu_to_nauty(G, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
374+
assert( sg.nv > 0 );
375+
376+
statsblk stats;
377+
DYNALLSTAT(int, orbits, orbits_sz);
378+
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
379+
DEFAULTOPTIONS_SPARSEGRAPH(options);
380+
/* init callback functions for nauty (accumulate the group generators found by nauty) */
381+
options.writeautoms = FALSE;
382+
options.userautomproc = dejavu::preprocessor::nauty_hook;
383+
options.defaultptn = FALSE; /* use color classes */
384+
if ( canterminateearly )
385+
options.usernodeproc = nautyterminationhook;
379386
sparsenauty(&sg, lab, ptn, orbits, &options, &stats, NULL);
380387
dejavu::big_number grp_sz = sassy.grp_sz;
381388
*log10groupsize = log10(stats.grpsize1 * grp_sz.mantissa * pow(10.0, (SCIP_Real) (stats.grpsize2 + grp_sz.exponent)));
382-
}
383389
#else
384-
convert_dejavu_to_traces(&sassygraph, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
385-
TracesStats stats;
386-
DYNALLSTAT(int, orbits, orbits_sz);
387-
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
388-
DEFAULTOPTIONS_TRACES(options);
389-
/* init callback functions for traces (accumulate the group generators found by traces) */
390-
options.writeautoms = FALSE;
391-
options.userautomproc = dejavu::preprocessor::traces_hook;
392-
options.defaultptn = FALSE; /* use color classes */
393-
if(sg.nv > 0) {
390+
convert_dejavu_to_traces(&sassygraph, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
391+
TracesStats stats;
392+
DYNALLSTAT(int, orbits, orbits_sz);
393+
DYNALLOC1(int, orbits, orbits_sz, sg.nv, "malloc");
394+
DEFAULTOPTIONS_TRACES(options);
395+
/* init callback functions for traces (accumulate the group generators found by traces) */
396+
options.writeautoms = FALSE;
397+
options.userautomproc = dejavu::preprocessor::traces_hook;
398+
options.defaultptn = FALSE; /* use color classes */
394399
Traces(&sg, lab, ptn, orbits, &options, &stats, NULL);
395400
dejavu::big_number grp_sz = sassy.grp_sz;
396401
*log10groupsize = log10(stats.grpsize1 * grp_sz.mantissa * pow(10.0, (SCIP_Real) (stats.grpsize2 + grp_sz.exponent)));
397-
}
398402
#endif
399403

400-
/* clean up */
401-
DYNFREE(lab, lab_sz);
402-
DYNFREE(ptn, ptn_sz);
403-
SG_FREE(sg);
404+
/* clean up */
405+
DYNFREE(lab, lab_sz);
406+
DYNFREE(ptn, ptn_sz);
407+
SG_FREE(sg);
408+
}
404409

405410
*symcodetime = SCIPgetSolvingTime(scip) - oldtime;
406411

0 commit comments

Comments
 (0)