35#include <bliss/defs.hh>
36#include <bliss/graph.hh>
40#pragma GCC diagnostic ignored "-Wshadow"
41#pragma GCC diagnostic ignored "-Wunused-variable"
42#pragma GCC diagnostic ignored "-Wsign-compare"
43#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
48# pragma warning(disable: 4189)
49# pragma warning(disable: 4267)
50# pragma warning(disable: 4388)
51# pragma warning(disable: 4456)
52# pragma warning(disable: 4430)
55#include <sassy/preprocessor.h>
56#include <sassy/tools/bliss_converter.h>
59#pragma GCC diagnostic warning "-Wunused-but-set-variable"
60#pragma GCC diagnostic warning "-Wsign-compare"
61#pragma GCC diagnostic warning "-Wunused-variable"
62#pragma GCC diagnostic warning "-Wshadow"
119 bool isIdentity =
true;
138 for (
int j = 0; j < permlen; ++j)
140 if ( (
int) aut[j] != j )
152 for (
int j = 0; j < permlen; ++j)
191#ifdef BLISS_PATCH_PRESENT
192 return "bliss " BLISS_VERSION
"p";
194 return "bliss " BLISS_VERSION;
201 return "Computing Graph Automorphisms by T. Junttila and P. Kaski (users.aalto.fi/~tjunttil/bliss)";
205#define XSTR(x) STR(x)
210 return "sassy " XSTR(SASSY_VERSION_MAJOR)
"." XSTR(SASSY_VERSION_MINOR);
216 return "Symmetry preprocessor by Markus Anders (github.com/markusa4/sassy)";
224 sassy::static_graph* G,
231 SCIP_Real* log10groupsize,
232 SCIP_Bool restricttovars,
233 SCIP_Real* symcodetime
240 assert( maxgenerators >= 0 );
268 sassy::preprocessor sassy;
271 sassy::configstruct sconfig;
272 sconfig.CONFIG_PREP_DEACT_PROBE =
true;
273 sassy.configure(&sconfig);
276 sassy::sassy_hook sassyglue = [&](
int n,
const int* p,
int nsupp,
const int* suppa) {
277 sassyhook((
void*)&data, n, p, nsupp, suppa);
281 sassy.reduce(G, &sassyglue);
284 bliss::Graph blissgraph(0);
287 convert_sassy_to_bliss(G, &blissgraph);
290 blissgraph.write_dot(
"debug.dot");
293#ifdef SCIP_DISABLED_CODE
296 FILE* fp = fopen(filename,
"w");
299 blissgraph.write_dimacs(fp);
311 blissgraph.set_splitting_heuristic(bliss::Graph::shs_f);
313 blissgraph.set_component_recursion(
false);
315#if BLISS_VERSION_MAJOR >= 1 || BLISS_VERSION_MINOR >= 76
321 auto hook = [&](
unsigned int n,
const unsigned int* aut) {
322 sassy.bliss_hook(n, aut);
326 blissgraph.find_automorphisms(stats, hook, term);
330#ifdef BLISS_PATCH_PRESENT
338 blissgraph.find_automorphisms(stats, sassy::preprocessor::bliss_hook, (
void*) &sassy);
343 (void) stats.print(stdout);
364 *log10groupsize = (
SCIP_Real) log10l(stats.get_group_size_approx());
377 SCIP_Real* log10groupsize,
378 SCIP_Real* symcodetime
381 SCIP_Bool success =
FALSE;
400 sassy::static_graph sassygraph;
424 SCIP_Real symcodetime = 0.0;
425 SCIP_Real log10groupsize;
429 sassy::static_graph sassygraph;
444 for (
int p = 0; p <
nperms && ! success; ++p)
446 for (
int i = 0;
i < nnodesfromG1; ++
i)
448 if (
perms[p][
i] >= nnodesfromG1 )
456 for (
int p = 0; p <
nperms; ++p)
SCIP_RETCODE SYMbuildSassyGraph(SCIP *scip, sassy::static_graph *sassygraph, SYM_GRAPH *graph, SCIP_Bool *success)
SCIP_RETCODE SYMbuildSassyGraphCheck(SCIP *scip, sassy::static_graph *sassygraph, SYM_GRAPH *G1, SYM_GRAPH *G2, int *nnodes, int *nnodesfromG1, SCIP_Bool *success)
methods to build sassy graph for symmetry detection
interface for symmetry computations
SCIP_Bool SYMcheckGraphsAreIdentical(SCIP *scip, SYM_SYMTYPE symtype, SYM_GRAPH *G1, SYM_GRAPH *G2)
const char * SYMsymmetryGetName(void)
static SCIP_RETCODE computeAutomorphisms(SCIP *scip, SYM_SYMTYPE symtype, sassy::static_graph *G, int nsymvars, int maxgenerators, int ***perms, int *nperms, int *nmaxperms, SCIP_Real *log10groupsize, SCIP_Bool restricttovars, SCIP_Real *symcodetime)
const char * SYMsymmetryGetAddName(void)
SCIP_RETCODE SYMcomputeSymmetryGenerators(SCIP *scip, int maxgenerators, SYM_GRAPH *graph, int *nperms, int *nmaxperms, int ***perms, SCIP_Real *log10groupsize, SCIP_Real *symcodetime)
SCIP_Bool SYMcanComputeSymmetry(void)
const char * SYMsymmetryGetDesc(void)
static void sassyhook(void *user_param, int n, const int *aut, int nsupp, const int *suppa)
const char * SYMsymmetryGetAddDesc(void)
Constraint handler for linear constraints in their most general form, .
constraint handler for nonlinear constraints specified by algebraic expressions
#define SCIP_CALL_ABORT(x)
private functions to work with algebraic expressions
power and signed power expression handlers
variable expression handler
const char * SCIPgetProbName(SCIP *scip)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
SYM_SYMTYPE SCIPgetSymgraphSymtype(SYM_GRAPH *graph)
int SCIPgetSymgraphNVars(SYM_GRAPH *graph)
assert(minobj< SCIPgetCutoffbound(scip))
public methods for memory management
methods for dealing with symmetry detection graphs
enum SCIP_Retcode SCIP_RETCODE
enum SYM_Symtype SYM_SYMTYPE