GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
automorphism.cpp File Reference

Detailed Description

automorphism recognition of SCIPs

Author
Daniel Peters
Martin Bergner
Jonas Witt
Michael Bastubbe

Definition in file automorphism.cpp.

#include "symmetry/automorphism.h"
#include "symmetry/pub_automorphism.h"
#include "gcg/scip_misc.h"
#include "scip/scip.h"
#include "gcg/gcg.h"
#include "scip/cons_linear.h"
#include "gcg/class_partialdecomp.h"
#include "gcg/class_detprobdata.h"
#include "gcg/cons_decomp.hpp"
#include <cstring>

Go to the source code of this file.

Data Structures

struct  AUT_HOOK2

Functions

static void fhook (void *user_param, unsigned int N, const unsigned int *aut)
static SCIP_RETCODE allocMemoryNewDetection (SCIP *scip, gcg::DETPROBDATA *detprobdata, AUT_COLOR *colorinfo, int nconss, int nvars, int ncoeffs)
static SCIP_RETCODE freeMemory (SCIP *scip, AUT_COLOR *colorinfo)
static SCIP_RETCODE setuparraysnewdetection (SCIP *scip, gcg::DETPROBDATA *detprobdata, gcg::PARTIALDECOMP *partialdec, int nblocks, std::vector< int > blocks, AUT_COLOR *colorinfo, SCIP_RESULT *result)
static SCIP_RETCODE createGraphNewDetection (SCIP *scip, gcg::DETPROBDATA *detprobdata, gcg::PARTIALDECOMP *partialdec, std::vector< int > blocks, AUT_COLOR colorinfo, AUT_GRAPH *graph, int *pricingnodes, SCIP_RESULT *result)
SCIP_RETCODE cmpGraphPair (SCIP *scip, gcg::PARTIALDECOMP *partialdec, int block1, int block2, SCIP_RESULT *result, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, unsigned int searchnodelimit, unsigned int generatorlimit)
static int getSign (SCIP *scip, SCIP_Real val)
static int comp (SCIP *scip, SCIP_Real val1, SCIP_Real val2, SCIP_Bool onlysign)
static int comp (SCIP *scip, AUT_CONS *cons1, AUT_CONS *cons2, SCIP_Bool onlysign)
static int comp (SCIP *scip, AUT_VAR *var1, AUT_VAR *var2, SCIP_Bool onlysign)
static SCIP_DECL_SORTPTRCOMP (sortptrcons)
static SCIP_DECL_SORTPTRCOMP (sortptrconssign)
static SCIP_DECL_SORTPTRCOMP (sortptrvar)
static SCIP_DECL_SORTPTRCOMP (sortptrvarsign)
static SCIP_DECL_SORTPTRCOMP (sortptrval)
static SCIP_DECL_SORTPTRCOMP (sortptrvalsign)

Function Documentation

◆ fhook()

void fhook ( void * user_param,
unsigned int N,
const unsigned int * aut )
static

hook function to save the permutation of the graph; fhook() is called by metis for every generator, AUT_HOOK* hook stores a combined mapping in nodemapping that is filled generator-wise

Parameters
user_paramdata structure to save hashmaps with permutation
Nnumber of permutations
autarray of permutations

Definition at line 182 of file automorphism.cpp.

References assert(), AUT_HOOK2::blocks, c, AUT_HOOK2::detprobdata, fhook(), AUT_HOOK2::generatorlimit, AUT_HOOK2::getBool(), gcg::DETPROBDATA::getCons(), AUT_HOOK2::getConsHash(), gcg::PARTIALDECOMP::getConssForBlock(), AUT_HOOK2::getGraph(), gcg::PARTIALDECOMP::getNConssForBlock(), AUT_HOOK2::getNNodes(), gcg::PARTIALDECOMP::getNVarsForBlock(), gcg::DETPROBDATA::getScip(), gcg::DETPROBDATA::getVar(), AUT_HOOK2::getVarHash(), gcg::PARTIALDECOMP::getVarsForBlock(), i, j, AUT_HOOK2::ncalls, AUT_HOOK2::nodemap, nvars, AUT_HOOK2::partialdec, SCIPdebugMessage(), SCIPfreeBufferArray(), and AUT_HOOK2::setBool().

Referenced by cmpGraphPair(), and fhook().

◆ allocMemoryNewDetection()

SCIP_RETCODE allocMemoryNewDetection ( SCIP * scip,
gcg::DETPROBDATA * detprobdata,
AUT_COLOR * colorinfo,
int nconss,
int nvars,
int ncoeffs )
static

constructor for colorinfo arrays

Parameters
scipSCIP data structure
detprobdataSCIP data structure
colorinfostruct to save intermediate information
nconssnumber of constraints
nvarsnumber of variables
ncoeffsnumber of coefficients

Definition at line 331 of file automorphism.cpp.

References allocMemoryNewDetection(), nvars, and SCIP_CALL().

Referenced by allocMemoryNewDetection(), and cmpGraphPair().

◆ freeMemory()

SCIP_RETCODE freeMemory ( SCIP * scip,
AUT_COLOR * colorinfo )
static

destructor for colorinfoarrays

Parameters
scipSCIP data structure
colorinfostruct to save intermediate information

Definition at line 350 of file automorphism.cpp.

References freeMemory(), and i.

◆ setuparraysnewdetection()

SCIP_RETCODE setuparraysnewdetection ( SCIP * scip,
gcg::DETPROBDATA * detprobdata,
gcg::PARTIALDECOMP * partialdec,
int nblocks,
std::vector< int > blocks,
AUT_COLOR * colorinfo,
SCIP_RESULT * result )
static

set up a help structure for graph creation for new detection loop

Parameters
scipSCIP data structure
detprobdatadetprobdata corresponing to presolved or unpresolved problem
partialdecpartial decomp the symmetry for two blocks is checked for
nblocksnumber of blocks the symmetry should be checked for
blocksvectors of block indices the symmetry be checked for
colorinfodata structure to save intermediate data
resultresult pointer to indicate success or failure

Definition at line 379 of file automorphism.cpp.

References assert(), gcg::DETPROBDATA::getCons(), gcg::PARTIALDECOMP::getConssForBlock(), gcg::PARTIALDECOMP::getMasterconss(), gcg::PARTIALDECOMP::getNConssForBlock(), gcg::PARTIALDECOMP::getNMasterconss(), gcg::PARTIALDECOMP::getNVarsForBlock(), gcg::DETPROBDATA::getNVarsForCons(), gcg::DETPROBDATA::getVal(), gcg::DETPROBDATA::getVar(), gcg::PARTIALDECOMP::getVarsForBlock(), gcg::DETPROBDATA::getVarsForCons(), i, j, nvars, result, SCIP_CALL(), SCIPdebugMessage(), setuparraysnewdetection(), and var.

Referenced by cmpGraphPair(), and setuparraysnewdetection().

◆ createGraphNewDetection()

SCIP_RETCODE createGraphNewDetection ( SCIP * scip,
gcg::DETPROBDATA * detprobdata,
gcg::PARTIALDECOMP * partialdec,
std::vector< int > blocks,
AUT_COLOR colorinfo,
AUT_GRAPH * graph,
int * pricingnodes,
SCIP_RESULT * result )
static

create a graph out of an array of scips

experimental

Parameters
scipSCIP data structure
detprobdatadetection process information and data
partialdecpartial decomposition
blocksvectors of block indices the symmetry be checked for
colorinfodata structure to save intermediate data
graphgraph needed for discovering isomorphism
pricingnodesnumber of pricing nodes without master
resultresult pointer to indicate success or failure

Definition at line 521 of file automorphism.cpp.

References assert(), createGraphNewDetection(), gcg::DETPROBDATA::getCons(), gcg::PARTIALDECOMP::getConssForBlock(), gcg::PARTIALDECOMP::getMasterconss(), gcg::PARTIALDECOMP::getNConssForBlock(), gcg::PARTIALDECOMP::getNMasterconss(), gcg::PARTIALDECOMP::getNVarsForBlock(), gcg::DETPROBDATA::getNVarsForCons(), gcg::PARTIALDECOMP::getNVarsOfBlockInMasterCons(), gcg::DETPROBDATA::getScip(), gcg::DETPROBDATA::getVal(), gcg::DETPROBDATA::getVar(), gcg::PARTIALDECOMP::getVarProbindexForBlock(), gcg::PARTIALDECOMP::getVarsForBlock(), gcg::DETPROBDATA::getVarsForCons(), i, gcg::PARTIALDECOMP::isVarBlockvarOfBlock(), j, nnodes, nvars, result, SCIP_CALL(), SCIPdebugMessage(), SCIPfreeBufferArray(), and var.

Referenced by cmpGraphPair(), and createGraphNewDetection().

◆ cmpGraphPair()

SCIP_RETCODE cmpGraphPair ( SCIP * scip,
gcg::PARTIALDECOMP * partialdec,
int block1,
int block2,
SCIP_RESULT * result,
SCIP_HASHMAP * varmap,
SCIP_HASHMAP * consmap,
unsigned int searchnodelimit,
unsigned int generatorlimit )

compare two graphs w.r.t. automorphism

Parameters
scipSCIP data structure
partialdecpartialdec the graphs should be compared for
block1index of first pricing prob
block2index of second pricing prob
resultresult pointer to indicate success or failure
varmaphashmap to save permutation of variables
consmaphashmap to save permutation of constraints
searchnodelimitsearch node limit
generatorlimitgenerator limit

Definition at line 845 of file automorphism.cpp.

References allocMemoryNewDetection(), assert(), AUT_HOOK2::AUT_HOOK2(), cmpGraphPair(), createGraphNewDetection(), fhook(), freeMemory(), AUT_HOOK2::generatorlimit, AUT_HOOK2::getBool(), gcg::PARTIALDECOMP::getDetprobdata(), gcg::PARTIALDECOMP::getNCoeffsForBlock(), gcg::PARTIALDECOMP::getNCoeffsForMaster(), gcg::PARTIALDECOMP::getNConssForBlock(), gcg::PARTIALDECOMP::getNMasterconss(), gcg::PARTIALDECOMP::getNVarsForBlock(), AUT_HOOK2::ncalls, nvars, result, SCIP_CALL(), SCIPdebugMessage(), and setuparraysnewdetection().

Referenced by cmpGraphPair().

◆ getSign()

int getSign ( SCIP * scip,
SCIP_Real val )
static
Parameters
scipSCIP data structure
valvalue

Definition at line 911 of file automorphism.cpp.

References getSign().

Referenced by comp(), and getSign().

◆ comp() [1/3]

int comp ( SCIP * scip,
SCIP_Real val1,
SCIP_Real val2,
SCIP_Bool onlysign )
static

compare two values of two scips

Parameters
scipSCIP data structure
val1value 1 to compare
val2value 2 to compare
onlysignuse sign of values instead of values?

Definition at line 926 of file automorphism.cpp.

References comp(), and getSign().

Referenced by comp(), comp(), comp(), SCIP_DECL_SORTPTRCOMP(), SCIP_DECL_SORTPTRCOMP(), SCIP_DECL_SORTPTRCOMP(), SCIP_DECL_SORTPTRCOMP(), SCIP_DECL_SORTPTRCOMP(), and SCIP_DECL_SORTPTRCOMP().

◆ comp() [2/3]

int comp ( SCIP * scip,
AUT_CONS * cons1,
AUT_CONS * cons2,
SCIP_Bool onlysign )
static

compare two constraints of two scips

Parameters
scipSCIP data structure
cons1constraint 1 to compare
cons2constraint 2 to compare
onlysignuse sign of values instead of values?

Definition at line 958 of file automorphism.cpp.

References assert(), comp(), GCGconsGetLhs(), GCGconsGetNVars(), and GCGconsGetRhs().

◆ comp() [3/3]

int comp ( SCIP * scip,
AUT_VAR * var1,
AUT_VAR * var2,
SCIP_Bool onlysign )
static

compare two variables of two scips

Parameters
scipSCIP data structure
var1variable 1 to compare
var2variable 2 to compare
onlysignuse sign of values instead of values?

Definition at line 983 of file automorphism.cpp.

References assert(), comp(), GCGpricingVarGetOriginalVar(), and GCGvarIsPricing().

◆ SCIP_DECL_SORTPTRCOMP() [1/6]

SCIP_DECL_SORTPTRCOMP ( sortptrcons )
static

SCIP interface method for sorting the constraints

Definition at line 1024 of file automorphism.cpp.

References comp().

◆ SCIP_DECL_SORTPTRCOMP() [2/6]

SCIP_DECL_SORTPTRCOMP ( sortptrconssign )
static

SCIP interface method for sorting the constraints

Definition at line 1033 of file automorphism.cpp.

References comp().

◆ SCIP_DECL_SORTPTRCOMP() [3/6]

SCIP_DECL_SORTPTRCOMP ( sortptrvar )
static

SCIP interface method for sorting the variables

Definition at line 1042 of file automorphism.cpp.

References comp().

◆ SCIP_DECL_SORTPTRCOMP() [4/6]

SCIP_DECL_SORTPTRCOMP ( sortptrvarsign )
static

SCIP interface method for sorting the variables

Definition at line 1051 of file automorphism.cpp.

References comp().

◆ SCIP_DECL_SORTPTRCOMP() [5/6]

SCIP_DECL_SORTPTRCOMP ( sortptrval )
static

SCIP interface method for sorting the constraint coefficients

Definition at line 1060 of file automorphism.cpp.

References comp().

◆ SCIP_DECL_SORTPTRCOMP() [6/6]

SCIP_DECL_SORTPTRCOMP ( sortptrvalsign )
static

SCIP interface method for sorting the constraint coefficients

Definition at line 1069 of file automorphism.cpp.

References comp().