automorphism.cpp
Go to the documentation of this file.
38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
63 gcg::DETPROBDATA* detprobdata; /**< problem information the automorphism should be searched for */
176 SCIP_CALL_ABORT( SCIPallocMemoryArray(scip, &(this->conssperm), detprobdata->getNConss() ) ); /*lint !e666*/
179/** hook function to save the permutation of the graph; fhook() is called by metis for every generator,
223 // SCIPdebugMessage("Looking for a permutation from [0,%u] bijective to [%u:%u] (N=%u) \n", n/2-1, n/2, n-1, N);
252 // SCIPdebugMessage("Master %u -> %u not the identity, no decomposition possible!\n", i, aut[i]);
381 gcg::DETPROBDATA* detprobdata, /**< detprobdata corresponing to presolved or unpresolved problem */
382 gcg::PARTIALDECOMP* partialdec, /**< partial decomp the symmetry for two blocks is checked for */
410 SCIPdebugMessage("Handling block %i (id %d %d x %d)\n", b, block, partialdec->getNConssForBlock(blocks[b]), partialdec->getNVarsForBlock(blocks[b]));
454 //save the properties of variables of the constraints in a struct array and in a sorted pointer array
588 nnodes = nblocks * (nnonemptyconss + nvars + nconsvarpairs + nmasterconsnzs) + partialdec->getNMasterconss();
684 graph->addEdge(nnodesoffset[b] + nconss + nvars + z, nnodesoffset[b]+nconss + partialdec->getVarProbindexForBlock(varid, block) );
685 SCIPdebugMessage("nz: c <%s> (id: %d, color: %d) -> nz (id: %d) (value: %f, color: %d) -> var <%s> (id: %d, color: %d) \n",
718// SCIPdebugMessage("Var <%s> belongs to a different block (%d)\n", SCIPvarGetName(detprobdata->getVar(varid) ), block);
733 SCIPdebugMessage("master nz for var <%s> (id: %d) (value: %f, color: %d)\n", SCIPvarGetName(var), currentnode, val, color);
810 coefnodeindex = nnodesoffset[bid] + nvars + nconss + pricingnonzeros[bid] + mastercoefindex[bid];
821 SCIPdebugMessage("ma: c <%s> (id: %d, color: %d) -> nz (id: %d) (value: <%.6f> , color: %d) -> pricingvar <%s> (id: %d, color: %d)\n",
827 graph->addEdge(coefnodeindex, nnodesoffset[bid] + nconss + partialdec->getVarProbindexForBlock(varid, blockid));
884 SCIP_CALL( allocMemoryNewDetection(scip, detprobdata, &colorinfo, nconss*2+partialdec->getNMasterconss(), nvars*2, ncoeffs*2 + partialdec->getNCoeffsForMaster() ) );
885 SCIP_CALL( setuparraysnewdetection(scip, detprobdata, partialdec, 2, blocks, &colorinfo, result) );
889 SCIP_CALL( createGraphNewDetection(scip, detprobdata, partialdec, blocks, colorinfo, &graph, &pricingnodes, result) );
891 ptrhook = new AUT_HOOK2(varmap, consmap, (unsigned int) pricingnodes, &graph, partialdec, &blocks);
897 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL , NULL, "finished calling bliss: number of reporting function calls (=number of generators): %d \n", ptrhook->ncalls);
965 if( comp(scip, GCGconsGetRhs(scip, cons1->getCons()), GCGconsGetRhs(scip, cons2->getCons()), onlysign) != 0 )
966 return comp(scip, GCGconsGetRhs(scip, cons1->getCons()), GCGconsGetRhs(scip, cons2->getCons()), onlysign);
967 assert(SCIPisEQ(scip, GCGconsGetRhs(scip, cons1->getCons()), GCGconsGetRhs(scip, cons2->getCons())) || onlysign);
969 if( comp(scip, GCGconsGetLhs(scip, cons1->getCons()), GCGconsGetLhs(scip, cons2->getCons()), onlysign) != 0 )
970 return comp(scip, GCGconsGetLhs(scip, cons1->getCons()), GCGconsGetLhs(scip, cons2->getCons()), onlysign);
971 assert(SCIPisEQ(scip, GCGconsGetLhs(scip, cons1->getCons()), GCGconsGetLhs(scip, cons2->getCons())) || onlysign);
973 if( comp(scip, GCGconsGetNVars(scip, cons1->getCons()), GCGconsGetNVars(scip, cons2->getCons()), FALSE) != 0 )
974 return comp(scip, GCGconsGetNVars(scip, cons1->getCons()), GCGconsGetNVars(scip, cons2->getCons()), FALSE);
975 assert(SCIPisEQ(scip, GCGconsGetNVars(scip, cons1->getCons()), GCGconsGetNVars(scip, cons2->getCons())));
977 return strcmp(SCIPconshdlrGetName(SCIPconsGetHdlr(cons1->getCons())), SCIPconshdlrGetName(SCIPconsGetHdlr(cons2->getCons())));
1005 assert(SCIPisEQ(scip, SCIPvarGetUbGlobal(origvar1), SCIPvarGetUbGlobal(origvar2)) || onlysign);
1009 assert(SCIPisEQ(scip, SCIPvarGetLbGlobal(origvar1), SCIPvarGetLbGlobal(origvar2)) || onlysign);
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)
Definition: automorphism.cpp:845
static void fhook(void *user_param, unsigned int N, const unsigned int *aut)
Definition: automorphism.cpp:182
static SCIP_RETCODE freeMemory(SCIP *scip, AUT_COLOR *colorinfo)
Definition: automorphism.cpp:350
static SCIP_RETCODE setuparraysnewdetection(SCIP *scip, gcg::DETPROBDATA *detprobdata, gcg::PARTIALDECOMP *partialdec, int nblocks, std::vector< int > blocks, AUT_COLOR *colorinfo, SCIP_RESULT *result)
Definition: automorphism.cpp:379
static SCIP_RETCODE allocMemoryNewDetection(SCIP *scip, gcg::DETPROBDATA *detprobdata, AUT_COLOR *colorinfo, int nconss, int nvars, int ncoeffs)
Definition: automorphism.cpp:331
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)
Definition: automorphism.cpp:521
static int comp(SCIP *scip, SCIP_Real val1, SCIP_Real val2, SCIP_Bool onlysign)
Definition: automorphism.cpp:926
automorphism recognition of SCIPs
SCIP_VAR ** b
class storing partialdecs and the problem matrix
class storing (potentially incomplete) decompositions
Definition: class_detprobdata.h:110
GCG_EXPORT int getNConss()
returns the number of variables considered in the detprobdata
Definition: class_detprobdata.cpp:850
GCG_EXPORT SCIP * getScip()
returns the corresponding scip data structure
Definition: class_detprobdata.cpp:934
GCG_EXPORT int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
Definition: class_detprobdata.cpp:908
GCG_EXPORT SCIP_VAR * getVar(int varIndex)
returns SCIP variable related to a variable index
Definition: class_detprobdata.cpp:1015
GCG_EXPORT SCIP_Real getVal(int row, int col)
returns a coefficient from the coefficient matrix
Definition: class_detprobdata.cpp:976
GCG_EXPORT std::vector< int > & getVarsForCons(int consIndex)
returns the variable indices of the coefficient matrix for a constraint
Definition: class_detprobdata.cpp:1023
GCG_EXPORT SCIP_CONS * getCons(int consIndex)
returns the SCIP constraint related to a constraint index
Definition: class_detprobdata.cpp:746
GCG_EXPORT int getNMasterconss()
Gets size of the vector containing master conss.
Definition: class_partialdecomp.cpp:4481
GCG_EXPORT int getNCoeffsForBlock(int blockid)
Gets the number of nonzero coeffs in a certain block.
Definition: class_partialdecomp.cpp:4298
GCG_EXPORT int getVarProbindexForBlock(int varid, int block)
Gets the index of a variable in the vector returned by PARTIALDECOMP::getVarsForBlock.
Definition: class_partialdecomp.cpp:4780
GCG_EXPORT std::vector< int > & getMasterconss()
Gets array containing all master conss indices.
Definition: class_partialdecomp.cpp:4286
GCG_EXPORT std::vector< int > & getConssForBlock(int block)
returns array containing constraints assigned to a block
Definition: class_partialdecomp.cpp:3968
GCG_EXPORT DETPROBDATA * getDetprobdata()
Gets the corresponding detprobdata.
Definition: class_partialdecomp.cpp:4725
int getNVarsOfBlockInMasterCons(int masterconsindex, int block)
returns the number of block vars contained in a master constraint
Definition: class_partialdecomp.cpp:5919
GCG_EXPORT int getNVarsForBlock(int block)
Gets size of the vector containing vars assigned to a block.
Definition: class_partialdecomp.cpp:4537
GCG_EXPORT int getNCoeffsForMaster()
Definition: class_partialdecomp.cpp:4309
GCG_EXPORT int getNConssForBlock(int block)
Gets size of the vector containing conss assigned to a block.
Definition: class_partialdecomp.cpp:4432
GCG_EXPORT bool isVarBlockvarOfBlock(int var, int block)
Checks whether the var is assigned to the block.
Definition: class_partialdecomp.cpp:4997
GCG_EXPORT std::vector< int > & getVarsForBlock(int block)
Gets array containing vars of a block.
Definition: class_partialdecomp.cpp:4771
C++ interface of cons_decomp.
#define SCIP_Bool
#define SCIP_Real
#define ABS(x)
#define SCIP_CALL_ABORT(x)
#define SCIP_CALL(x)
#define TRUE
#define FALSE
#define nnodes
GCG interface methods.
SCIP_VAR * GCGpricingVarGetOriginalVar(SCIP_VAR *var)
Definition: gcgvar.c:590
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
#define SCIPfreeMemoryArrayNull(scip, ptr)
#define SCIPreallocMemoryArray(scip, ptr, newnum)
#define SCIPallocMemoryArray(scip, ptr, num)
int SCIPcalcMemGrowSize(SCIP *scip, int num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPfreeMemoryArray(scip, ptr)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_Bool SCIPsortedvecFindPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *val, int len, int *pos)
void SCIPsortedvecInsertPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void *keyval, int *len, int *pos)
#define NULL
#define BMSclearMemoryArray(ptr, num)
helper functions for automorphism detection
#define SCIPdebugMessage
various SCIP helper methods
Definition: automorphism.cpp:55
AUT_HOOK2(SCIP_HASHMAP *varmap_, SCIP_HASHMAP *consmap_, unsigned int n_, AUT_GRAPH *graph_, gcg::PARTIALDECOMP *partialdec_, std::vector< int > *blocks_)
Definition: automorphism.cpp:150
SCIP_VERBLEVEL_FULL
SCIP_DIDNOTFIND
SCIP_SUCCESS
enum SCIP_Result SCIP_RESULT
SCIP_OKAY
enum SCIP_Retcode SCIP_RETCODE