41#include "nauty/nauty.h"
42#include "nauty/nausparse.h"
44#include "nauty/traces.h"
49#pragma GCC diagnostic ignored "-Wshadow"
50#pragma GCC diagnostic ignored "-Wunused-variable"
51#pragma GCC diagnostic ignored "-Wsign-compare"
52#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
57# pragma warning(disable: 4189)
58# pragma warning(disable: 4388)
59# pragma warning(disable: 4456)
60# pragma warning(disable: 4430)
63#include <sassy/preprocessor.h>
65#include "sassy/tools/nauty_converter.h"
67#include "sassy/tools/traces_converter.h"
71#pragma GCC diagnostic warning "-Wunused-but-set-variable"
72#pragma GCC diagnostic warning "-Wsign-compare"
73#pragma GCC diagnostic warning "-Wunused-variable"
74#pragma GCC diagnostic warning "-Wshadow"
131 bool isIdentity =
true;
150 for (
int j = 0; j < permlen; ++j)
152 if ( (
int) aut[j] != j )
164 for (
int j = 0; j < permlen; ++j)
208 (void)
SCIPsnprintf(
nautyname, (
int)
sizeof(
nautyname),
"Nauty %d.%d.%d", NAUTYVERSIONID/10000, (NAUTYVERSIONID%10000)/1000, (NAUTYVERSIONID%1000)/10);
210 (void)
SCIPsnprintf(
nautyname, (
int)
sizeof(
nautyname),
"Traces %d.%d.%d", NAUTYVERSIONID/10000, (NAUTYVERSIONID%10000)/1000, (NAUTYVERSIONID%1000)/10);
219 return "Computing Graph Automorphism Groups by Brendan D. McKay (users.cecs.anu.edu.au/~bdm/nauty)";
221 return "Computing Graph Automorphism Groups by Adolfo Piperno (pallini.di.uniroma1.it)";
226#define XSTR(x) STR(x)
231 return "sassy " XSTR(SASSY_VERSION_MAJOR)
"." XSTR(SASSY_VERSION_MINOR);
237 return "Symmetry preprocessor by Markus Anders (github.com/markusa4/sassy)";
245 sassy::static_graph* G,
252 SCIP_Real* log10groupsize,
253 SCIP_Bool restricttovars,
254 SCIP_Real* symcodetime
261 assert( maxgenerators >= 0 );
289 sassy::preprocessor sassy;
292 sassy::configstruct sconfig;
293 sconfig.CONFIG_PREP_DEACT_PROBE =
true;
294 sassy.configure(&sconfig);
297 sassy::sassy_hook sassyglue = [&](
int n,
const int* p,
int nsupp,
const int* suppa) {
298 sassyhook((
void*)&data, n, p, nsupp, suppa);
302 sassy.reduce(G, &sassyglue);
306 DYNALLSTAT(
int, lab, lab_sz);
307 DYNALLSTAT(
int, ptn, ptn_sz);
310 convert_sassy_to_nauty(G, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
312 DYNALLSTAT(
int, orbits, orbits_sz);
313 DYNALLOC1(
int, orbits, orbits_sz, sg.nv,
"malloc");
314 DEFAULTOPTIONS_SPARSEGRAPH(options);
316 options.writeautoms =
FALSE;
317 options.userautomproc = sassy::preprocessor::nauty_hook;
318 options.defaultptn =
FALSE;
319 *log10groupsize = 0.0;
321 sparsenauty(&sg, lab, ptn, orbits, &options, &stats,
NULL);
322 *log10groupsize = (
SCIP_Real) stats.grpsize2;
325 convert_sassy_to_traces(&sassygraph, &sg, &lab, &lab_sz, &ptn, &ptn_sz);
327 DYNALLSTAT(
int, orbits, orbits_sz);
328 DYNALLOC1(
int, orbits, orbits_sz, sg.nv,
"malloc");
329 DEFAULTOPTIONS_TRACES(options);
331 options.writeautoms =
FALSE;
332 options.userautomproc = sassy::preprocessor::traces_hook;
333 options.defaultptn =
FALSE;
335 Traces(&sg, lab, ptn, orbits, &options, &stats,
NULL);
340 DYNFREE(lab, lab_sz);
341 DYNFREE(ptn, ptn_sz);
374 SCIP_Real* log10groupsize,
375 SCIP_Real* symcodetime
378 SCIP_Bool success =
FALSE;
397 sassy::static_graph sassygraph;
421 SCIP_Real symcodetime = 0.0;
422 SCIP_Real log10groupsize;
426 sassy::static_graph sassygraph;
441 for (
int p = 0; p <
nperms && ! success; ++p)
443 for (
int i = 0;
i < nnodesfromG1; ++
i)
445 if (
perms[p][
i] >= nnodesfromG1 )
453 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_Bool SYMcanComputeSymmetry(void)
const char * SYMsymmetryGetDesc(void)
static TLS_ATTR char nautyname[20]
static void sassyhook(void *user_param, int n, const int *aut, int nsupp, const int *suppa)
const char * SYMsymmetryGetAddDesc(void)
SCIP_RETCODE SYMcomputeSymmetryGenerators(SCIP *scip, int maxgenerators, SYM_GRAPH *symgraph, int *nperms, int *nmaxperms, int ***perms, SCIP_Real *log10groupsize, SCIP_Real *symcodetime)
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
#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)
SYM_SYMTYPE SCIPgetSymgraphSymtype(SYM_GRAPH *graph)
int SCIPgetSymgraphNVars(SYM_GRAPH *graph)
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
int SCIPsnprintf(char *t, int len, const char *s,...)
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