bliss_automorph.cpp
Go to the documentation of this file.
37 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
63 gcg::DETPROBDATA* detprobdata; /**< problem information the automorphism should be searched for */
128 SCIP_CALL_ABORT( SCIPallocMemoryArray(givenscip, &(this->conssperm), detprobdata->getNConss() ) ); /*lint !e666*/
198 /** hook function to save the permutation of the graph; fhook() is called by metis for every generator,
243 // SCIPdebugMessage("Looking for a permutation from [0,%u] bijective to [%u:%u] (N=%u) \n", n/2-1, n/2, n-1, N);
272 // SCIPdebugMessage("Master %u -> %u not the identity, no decomposition possible!\n", i, aut[i]);
443 SCIP_CALL(SCIPreallocMemoryArray(scip, &colorinfo->ptrarraycoefs, (size_t) colorinfo->lencoefsarray + ((size_t) nconss * nvars)));
445 SCIP_CALL( SCIPreallocMemoryArray(scip, &colorinfo->ptrarrayvars, (size_t) colorinfo->lenvarsarray + nvars));
446 SCIP_CALL( SCIPreallocMemoryArray(scip, &colorinfo->ptrarrayconss, (size_t) colorinfo->lenconssarray + nconss));
530 ncurvars = GCGconsGetNVars(scip, conss[i]); //SCIP_CALL( SCIPhashmapCreate(&varmap, SCIPblkmem(origscip), SCIPgetNVars(scip1)+1) );
547 //save the properties of variables of the constraints in a struct array and in a sorted pointer array
631 gcg::DETPROBDATA* detprobdata, /**< detprobdata corresponing to presolved or unpresolved problem */
632 gcg::PARTIALDECOMP* partialdec, /**< partial decomp the symmetry for two blocks is checked for */
660 SCIPdebugMessage("Handling block %i (id %d %d x %d)\n", b, block, partialdec->getNConssForBlock(blocks[b]), partialdec->getNVarsForBlock(blocks[b]));
704 //save the properties of variables of the constraints in a struct array and in a sorted pointer array
777 AUT_COLOR colorinfo, /**< data structure to save coloring information for conss, vars, and coeffs*/
869 int varcolor = colorinfo.get( AUT_VAR(scip, curvars[j] )) + colorinfo.getLenCons(); /*lint !e864 */
880 h->add_edge((unsigned int) nnodesoffset[s] + i, (unsigned int) nnodesoffset[s] + nconss + nvars + z);
881 h->add_edge((unsigned int) nnodesoffset[s] + nconss + nvars + z, (unsigned int) nnodesoffset[s]+nconss + curvar);
882 SCIPdebugMessage("nz: c <%s> (id: %d, color: %d) -> nz (id: %d) (value: %f, color: %d) -> var <%s> (id: %d, color: %d) \n",
921 // SCIPdebugMessage("Var <%s> belongs to a different block (%d)\n", SCIPvarGetName(curvars[j]), block);
932 SCIPdebugMessage("master nz for var <%s> (id: %d) (value: %f, color: %d)\n", SCIPvarGetName(curvars[j]), nnodes, curvals[j], color);
989 // SCIPdebugMessage("Var <%s> belongs to a different block (%d)\n", SCIPvarGetName(curvars[j]), block);
999 int coefnodeindex = nnodesoffset[ind] + SCIPgetNVars(pricingscip) + SCIPgetNConss(pricingscip) + pricingnonzeros[ind] + mastercoefindex[ind];
1010 SCIPdebugMessage("ma: c <%s> (id: %d, color: %d) -> nz (id: %d) (value: <%.6f> , color: %d) -> pricingvar <%s> (id: %d, color: %d)\n",
1016 h->add_edge((unsigned int) coefnodeindex, (unsigned int) nnodesoffset[ind] + SCIPgetNConss(pricingscip) + SCIPvarGetProbindex(pricingvar));
1175 h->add_edge((unsigned int) nnodesoffset[b] + i, (unsigned int) nnodesoffset[b] + nconss + nvars + z);
1176 h->add_edge((unsigned int) nnodesoffset[b] + nconss + nvars + z, (unsigned int) nnodesoffset[b]+nconss + partialdec->getVarProbindexForBlock(varid, block) );
1177 SCIPdebugMessage("nz: c <%s> (id: %d, color: %d) -> nz (id: %d) (value: %f, color: %d) -> var <%s> (id: %d, color: %d) \n",
1210 // SCIPdebugMessage("Var <%s> belongs to a different block (%d)\n", SCIPvarGetName(detprobdata->getVar(varid) ), block);
1225 SCIPdebugMessage("master nz for var <%s> (id: %d) (value: %f, color: %d)\n", SCIPvarGetName(var), nnodes, val, color);
1301 coefnodeindex = nnodesoffset[bid] + nvars + nconss + pricingnonzeros[bid] + mastercoefindex[bid];
1312 SCIPdebugMessage("ma: c <%s> (id: %d, color: %d) -> nz (id: %d) (value: <%.6f> , color: %d) -> pricingvar <%s> (id: %d, color: %d)\n",
1318 h->add_edge((unsigned int) coefnodeindex, (unsigned int) nnodesoffset[bid] + nconss + partialdec->getVarProbindexForBlock(varid, blockid) );
1366 SCIP_CALL( createGraph(origscip, scips, nscips, pricingindices, colorinfo, &graph, &pricingnodes, result) );
1375 SCIPverbMessage(origscip, SCIP_VERBLEVEL_FULL , NULL, "finished calling bliss: number of reporting function calls (=number of generators): %d \n", ptrhook->ncalls);
1429 SCIP_CALL( allocMemoryNewDetection(scip, detprobdata, &colorinfo, nconss*2+partialdec->getNMasterconss(), nvars*2, ncoeffs*2 + partialdec->getNCoeffsForMaster() ) );
1430 SCIP_CALL( setuparraysnewdetection(scip, detprobdata, partialdec, 2, blocks, &colorinfo, result) );
1432 SCIP_CALL( createGraphNewDetection(scip, detprobdata, partialdec, 2, blocks, colorinfo, &graph, &pricingnodes, result) );
1443 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL , NULL, "finished calling bliss: number of reporting function calls (=number of generators): %d \n", ptrhook->ncalls);
int getNConss()
returns the number of variables considered in the detprobdata
Definition: class_detprobdata.cpp:796
static SCIP_RETCODE allocMemory(SCIP *scip, AUT_COLOR *colorinfo, int nconss, int nvars)
Definition: bliss_automorph.cpp:402
Definition: bliss_automorph.cpp:54
GCG interface methods.
std::vector< int > & getVarsForBlock(int block)
Gets array containing vars of a block.
Definition: class_partialdecomp.cpp:4470
static SCIP_RETCODE createGraphNewDetection(SCIP *scip, gcg::DETPROBDATA *detprobdata, gcg::PARTIALDECOMP *partialdec, int nblocks, std::vector< int > blocks, AUT_COLOR colorinfo, bliss::Graph *graph, int *pricingnodes, SCIP_RESULT *result)
Definition: bliss_automorph.cpp:1032
AUT_HOOK2(SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool aut, unsigned int n, SCIP **scips)
Definition: bliss_automorph.cpp:172
void setNewDetectionStuff(gcg::DETPROBDATA *detprobdata, gcg::PARTIALDECOMP *partialdec, std::vector< int > *blocks)
Definition: bliss_automorph.cpp:118
int getNCoeffsForMaster()
Definition: class_partialdecomp.cpp:4015
int getVarProbindexForBlock(int varid, int block)
Gets index in variables array of a block for a variable.
Definition: class_partialdecomp.cpp:4479
bool isVarBlockvarOfBlock(int var, int block)
Checks whether the var is assigned to the block.
Definition: class_partialdecomp.cpp:4683
std::vector< int > & getMasterconss()
Gets array containing all master conss indices.
Definition: class_partialdecomp.cpp:3992
SCIP_RETCODE GCGconsGetVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars)
Definition: scip_misc.c:490
DETPROBDATA * GCGconshdlrDecompGetDetprobdataOrig(SCIP *scip)
help method to access detprobdata for unpresolved problem
Definition: cons_decomp.cpp:5249
int getNVarsForBlock(int block)
Gets size of the vector containing vars assigned to a block.
Definition: class_partialdecomp.cpp:4226
SCIP_VAR * GCGoriginalVarGetPricingVar(SCIP_VAR *var)
Definition: gcgvar.c:216
various SCIP helper methods
int getNConssForBlock(int block)
Gets size of the vector containing conss assigned to a block.
Definition: class_partialdecomp.cpp:4121
SCIP_CONS * getCons(int consIndex)
returns the SCIP constraint related to a constraint index
Definition: class_detprobdata.cpp:698
static SCIP_RETCODE allocMemoryNewDetection(SCIP *scip, gcg::DETPROBDATA *detprobdata, AUT_COLOR *colorinfo, int nconss, int nvars, int ncoeffs)
Definition: bliss_automorph.cpp:417
static SCIP_RETCODE testScipVars(SCIP *scip1, SCIP *scip2, SCIP_RESULT *result)
Definition: bliss_automorph.cpp:371
C++ interface of cons_decomp.
static SCIP_RETCODE freeMemory(SCIP *scip, AUT_COLOR *colorinfo)
Definition: bliss_automorph.cpp:453
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: bliss_automorph.cpp:629
Definition: class_detprobdata.h:106
static SCIP_RETCODE reallocMemory(SCIP *scip, AUT_COLOR *colorinfo, int nconss, int nvars)
Definition: bliss_automorph.cpp:436
SCIP_RETCODE GCGconsGetVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int nvals)
Definition: scip_misc.c:621
int getNCoeffsForBlock(int blockid)
Gets the number of nonzero coeffs in a certain block.
Definition: class_partialdecomp.cpp:4004
automorphism recognition of SCIPs
std::vector< int > & getConssForBlock(int block)
returns array containing constraints assigned to a block
Definition: class_partialdecomp.cpp:3693
int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
Definition: class_detprobdata.cpp:854
helper functions for automorphism detection
static SCIP_RETCODE testScipCons(SCIP *scip1, SCIP *scip2, SCIP_RESULT *result)
Definition: bliss_automorph.cpp:387
DETPROBDATA * GCGconshdlrDecompGetDetprobdataPresolved(SCIP *scip)
help method to access detprobdata for transformed problem
Definition: cons_decomp.cpp:5263
class storing (potentially incomplete) decompositions
static void fhook(void *user_param, unsigned int N, const unsigned int *aut)
Definition: bliss_automorph.cpp:201
SCIP_Real getVal(int row, int col)
returns a coefficient from the coefficient matrix
Definition: class_detprobdata.cpp:916
SCIP_RETCODE cmpGraphPair(SCIP *origscip, SCIP *scip1, SCIP *scip2, int prob1, int prob2, SCIP_RESULT *result, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, unsigned int searchnodelimit, unsigned int generatorlimit)
Definition: bliss_automorph.cpp:1334
std::vector< int > & getVarsForCons(int consIndex)
returns the variable indices of the coefficient matrix for a constraint
Definition: class_detprobdata.cpp:963
int getNMasterconss()
Gets size of the vector containing master conss.
Definition: class_partialdecomp.cpp:4170
bool isAssignedToOrigProb()
Gets whether the partialdec is from the presolved problem.
Definition: class_partialdecomp.cpp:4533
SCIP_VAR * getVar(int varIndex)
returns SCIP variable related to a variable index
Definition: class_detprobdata.cpp:955
class storing partialdecs and the problem matrix
static SCIP_RETCODE createGraph(SCIP *origscip, SCIP **scips, int nscips, int *pricingindices, AUT_COLOR colorinfo, bliss::Graph *graph, int *pricingnodes, SCIP_RESULT *result)
Definition: bliss_automorph.cpp:772
static SCIP_RETCODE setuparrays(SCIP *origscip, SCIP **scips, int nscips, AUT_COLOR *colorinfo, SCIP_RESULT *result)
Definition: bliss_automorph.cpp:481