Skip to content

Commit

Permalink
Merge branch 'fix_bliss_maxgenerator_check' into 'v90-bugfix'
Browse files Browse the repository at this point in the history
fix limits on number of generators

See merge request integer/scip!3305
  • Loading branch information
Christopher Hojny committed Jan 30, 2024
2 parents 4b019ae + e7d9d22 commit 976cf0b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Features
- when parsing nonlinear constraints from CIP files, the * after the number in a term is now optional if followed by a variable,
i.e., instead of 3*<x>*<y>, now also 3<x>*<y> can be read, but 3<x><y> is not supported;
this allows to read some CIP files that were written with SCIP < 8
- when running bliss, we now limit the number of actually created generators and not the ones considered by bliss

Performance improvements
------------------------
Expand Down
21 changes: 11 additions & 10 deletions src/symmetry/compute_symmetry_bliss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,29 +345,30 @@ SCIP_RETCODE computeAutomorphisms(
/* disable component recursion as advised by Tommi Junttila from bliss */
G->set_component_recursion(false);

/* do not use a node limit, but set generator limit */
#ifdef BLISS_PATCH_PRESENT
G->set_search_limits(0, (unsigned) maxgenerators);
#endif

oldtime = SCIPgetSolvingTime(scip);
#if BLISS_VERSION_MAJOR >= 1 || BLISS_VERSION_MINOR >= 76
/* lambda function to have access to data and pass it to the blisshook above */
auto reportglue = [&](unsigned int n, const unsigned int* aut) {
blisshook((void*)&data, n, aut);
};

/* lambda function to have access to stats and terminate the search if maxgenerators are reached */
long unsigned int terminatesearch = INT_MAX;
if ( maxgenerators != 0 )
terminatesearch = (long unsigned int) maxgenerators;
/* lambda function to have access to data and terminate the search if maxgenerators are reached */
auto term = [&]() {
return (stats.get_nof_generators() >= terminatesearch);
return (maxgenerators != 0 && data.nperms >= maxgenerators); /* check the number of generators that we have created so far */
};

/* start search */
G->find_automorphisms(stats, reportglue, term);
#else

/* Older bliss versions do not allow to terminate with a limit on the number of generators unless patched. */
#ifdef BLISS_PATCH_PRESENT
/* If patch is present, do not use a node limit, but set generator limit. This approach is not very accurate, since
* it limits the generators considered in bliss and not the ones that we generate (the ones that work on the variable
* set). */
G->set_search_limits(0, (unsigned) maxgenerators);
#endif

/* start search */
G->find_automorphisms(stats, blisshook, (void*) &data);
#endif
Expand Down
21 changes: 11 additions & 10 deletions src/symmetry/compute_symmetry_sassy_bliss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,10 @@ SCIP_RETCODE computeAutomorphisms(
/* disable component recursion as advised by Tommi Junttila from bliss */
blissgraph.set_component_recursion(false);

/* do not use a node limit, but set generator limit */
#ifdef BLISS_PATCH_PRESENT
blissgraph.set_search_limits(0, (unsigned) maxgenerators);
#endif

#if BLISS_VERSION_MAJOR >= 1 || BLISS_VERSION_MINOR >= 76
/* lambda function to have access to stats and terminate the search if maxgenerators are reached */
long unsigned int terminatesearch = INT_MAX;
if ( maxgenerators != 0 )
terminatesearch = (long unsigned int) maxgenerators;
/* lambda function to have access to data and terminate the search if maxgenerators are reached */
auto term = [&]() {
return (stats.get_nof_generators() >= terminatesearch);
return (maxgenerators != 0 && data.nperms >= maxgenerators); /* check the number of generators that we have created so far */
};

auto hook = [&](unsigned int n, const unsigned int* aut) {
Expand All @@ -333,6 +325,15 @@ SCIP_RETCODE computeAutomorphisms(
/* start search */
blissgraph.find_automorphisms(stats, hook, term);
#else

/* Older bliss versions do not allow to terminate with a limit on the number of generators unless patched. */
#ifdef BLISS_PATCH_PRESENT
/* If patch is present, do not use a node limit, but set generator limit. This approach is not very accurate, since
* it limits the generators considered in bliss and not the ones that we generate (the ones that work on the variable
* set). */
G->set_search_limits(0, (unsigned) maxgenerators);
#endif

/* start search */
blissgraph.find_automorphisms(stats, sassy::preprocessor::bliss_hook, (void*) &sassy);
#endif
Expand Down

0 comments on commit 976cf0b

Please sign in to comment.