hyperrowcolgraph_def.h
Go to the documentation of this file.
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
67 * The function will create an node for every constraint, every variable and every nonzero entry of the matrix.
68 * One side of the bipartite graph are the nonzero entries (nodes), the constraints and variables are on the other side (hyperedges).
108 SCIPdebugMessage("Weight for cons <%s> is %d\n", SCIPconsGetName(conss[i-this->nvars]), weight);
133 /** @todo skip all variables that have a zero coeffient or where all coefficients add to zero */
154 SCIPdebugMessage("Cons <%s> (%d), var <%s> (%d), nonzero %d\n", SCIPconsGetName(conss[i]), i, SCIPvarGetName(var), varIndex, this->nnonzeroes);
182 vector<bool> varsBool(partialdec->getNVars(), false); /**< true, if the var will be part of the graph */
183 vector<bool> conssBool(partialdec->getNConss(), false); /**< true, if the cons will be part of the graph */
258 SCIPdebugMessage("Cons <%s> (%d), var <%s> (%d), nonzero %d\n", SCIPconsGetName(detprobdata->getCons(oldConsId)), i,
262 SCIP_CALL( this->graph.addEdge(oldToNewVarIndex[oldVarId], this->nvars+this->nconss+this->nnonzeroes) );
263 SCIP_CALL( this->graph.addEdge(this->nvars+oldToNewConsIndex[oldConsId], this->nvars+this->nconss+this->nnonzeroes) );
288 SCIPinfoMessage(this->scip_, file, "%d %d %d\n", this->nvars+this->nconss, this->nnonzeroes+this->dummynodes, edgeweights ? 1 :0);
426 /* first, make sure that there are constraints in every block, otherwise the hole thing is useless */
439 SCIP_CALL( DECfilloutDecompFromConstoblock(this->scip_, *decomp, constoblock, nblocks, FALSE) );
484 SCIP_CALL( SCIPhashmapInsert(constoblock, (void*) (size_t)detprobdata->getIndexForCons(conss[i]), (void*) (size_t) (nblocks+1)) );
489 SCIP_CALL( SCIPhashmapInsert(constoblock, (void*) (size_t) detprobdata->getIndexForCons(conss[i]), (void*) (size_t) (block +1)) );
494 /* first, make sure that there are constraints in every block, otherwise the whole thing is useless */
572 vector<bool> conssBool(oldpartialdec->getNConss(), false); /**< true, if the cons will be part of the graph */
612 SCIP_CALL( SCIPhashmapInsert(constoblock, (void*) (size_t) conssForGraph[i], (void*) (size_t) (nblocks+1)) );
617 SCIP_CALL( SCIPhashmapInsert(constoblock, (void*) (size_t) conssForGraph[i], (void*) (size_t) (block +1)) );
int getNOpenvars()
Gets size of vector containing variables not assigned yet.
Definition: class_partialdecomp.cpp:4198
Definition: struct_decomp.h:51
A hypergraph with row and column nodes.
SCIP_Bool isAssignedToOrigProb()
returns true if the matrix structure corresponds to the presolved problem
Definition: class_detprobdata.cpp:1098
Definition: class_conspartition.cpp:43
virtual SCIP_RETCODE readPartition(const char *filename)
Definition: hyperrowcolgraph_def.h:651
Definition: weights.h:41
std::vector< int > getConsNonzeroNodes(int i)
Definition: hyperrowcolgraph_def.h:357
virtual SCIP_RETCODE writeToFile(int fd, SCIP_Bool writeweights)
Definition: hyperrowcolgraph_def.h:278
various SCIP helper methods
static SCIP_RETCODE partition(SCIP *scip, SCIP_VAR **J, int *Jsize, SCIP_Longint *priority, SCIP_VAR **F, int Fsize, SCIP_VAR **origvar, SCIP_Real *median)
Definition: branch_generic.c:832
SCIP_CONS * getCons(int consIndex)
returns the SCIP constraint related to a constraint index
Definition: class_detprobdata.cpp:698
virtual SCIP_RETCODE createDecompFromPartition(DEC_DECOMP **decomp)
Definition: hyperrowcolgraph_def.h:385
virtual std::vector< int > getHyperedgeNodes(int i)
Definition: hyperrowcolgraph_def.h:343
virtual SCIP_RETCODE createPartialdecFromPartition(PARTIALDECOMP **firstpartialdec, PARTIALDECOMP **secondpartialdec, DETPROBDATA *detprobdata)
Definition: hyperrowcolgraph_def.h:451
int getIndexForCons(SCIP_CONS *cons)
returns the constraint index related to a SCIP constraint
Definition: class_detprobdata.cpp:744
SCIP_RETCODE DECfilloutDecompFromConstoblock(SCIP *scip, DEC_DECOMP *decomp, SCIP_HASHMAP *constoblock, int nblocks, SCIP_Bool staircase)
Definition: decomp.c:1455
const int * getOpenconss()
Gets array containing constraints not assigned yet.
Definition: class_partialdecomp.cpp:4247
Definition: class_detprobdata.h:106
Definition: matrixgraph.h:54
virtual SCIP_RETCODE createFromPartialMatrix(DETPROBDATA *detprobdata, PARTIALDECOMP *partialdec)
Definition: hyperrowcolgraph_def.h:171
std::vector< int > getVarNonzeroNodes(int i)
Definition: hyperrowcolgraph_def.h:371
Definition: hyperrowcolgraph_def.h:312
int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
Definition: class_detprobdata.cpp:854
int getNOpenconss()
Gets size of vector containing constraints not assigned yet.
Definition: class_partialdecomp.cpp:4192
HyperrowcolGraph(SCIP *scip, Weights w)
Definition: hyperrowcolgraph_def.h:48
SCIP_RETCODE DECdecompCreate(SCIP *scip, DEC_DECOMP **decdecomp)
Definition: decomp.c:471
class storing (potentially incomplete) decompositions
virtual ~HyperrowcolGraph()
Definition: hyperrowcolgraph_def.h:58
std::vector< int > & getVarsForCons(int consIndex)
returns the variable indices of the coefficient matrix for a constraint
Definition: class_detprobdata.cpp:963
virtual std::vector< int > getNeighbors(int i)
Definition: hyperrowcolgraph_def.h:320
SCIP_RETCODE createFromMatrix(SCIP_CONS **conss, SCIP_VAR **vars, int nconss, int nvars)
Definition: hyperrowcolgraph_def.h:74
const int * getOpenvars()
Gets array containing variables not assigned yet.
Definition: class_partialdecomp.cpp:4259
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