class_detprobdata.cpp
Go to the documentation of this file.
35 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
122 return ( SCIPisEQ(scip, SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var) ) && SCIPisEQ(scip, SCIPvarGetUbGlobal(var), 0. ) );
159 /* identify new and deleted rows and cols; and identify bijection between maintained variables */
237 SCIPverbMessage(this->scip, SCIP_VERBLEVEL_FULL, NULL, " transform partialdec %d \n", otherpartialdec->getID());
246 /* set all (which have representative in the orig partialdec) constraints according to their representatives in the orig partialdec */
295 newpartialdec->setDetectorFinishedOrig(otherpartialdec->getDetectorchain()[otherpartialdec->getNDetectors() - 1]);
312 nvars(SCIPgetNVars(givenScip)), nconss(SCIPgetNConss(givenScip)), nnonzeros(0), original(_originalProblem), candidatesNBlocks(0),
313 classificationtime(0.), nblockscandidatescalctime(0.), postprocessingtime(0.), translatingtime(0.)
498 SCIPverbMessage(scip, SCIP_VERBLEVEL_FULL, NULL, "added block number candidate: %d \n", candidate);
531 SCIPverbMessage(scip, SCIP_VERBLEVEL_HIGH, NULL, " Conspartition \"%s\" is not considered since it offers the same structure as \"%s\" conspartition\n", partition->getName(), equiv->getName() );
568 if( partialdec->isComplete() && partialdecIsNoDuplicateOfPartialdecs(partialdec, finishedpartialdecs, false) )
615 SCIPverbMessage(scip, SCIP_VERBLEVEL_HIGH, NULL, " Varpartition \"%s\" is not considered since it offers the same structure as \"%s\"\n", partition->getName(), equiv->getName() );
1086 return (!SCIPisInfinity(givenScip, x) && !SCIPisNegative(givenScip, x) && SCIPisIntegral(givenScip, x));
1146 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(givenscip), file, "The following %d candidates for the number of blocks are known: (candidate : number of votes) \n", (int) candidatesNBlocks.size() );
1150 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(givenscip), file, "%d : %d \n", candidatesNBlocks[i].first, candidatesNBlocks[i].second );
1152 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(givenscip), file, "%d : %s \n", candidatesNBlocks[i].first, "user given" );
1163 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "%d \n", (int) conspartitioncollection.size() );
1167 std::vector<std::vector<int> > conssofclasses = std::vector<std::vector<int> >(partition->getNClasses()) ;
1181 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "%s: %s\n", partition->getClassName(cl), partition->getClassDescription(cl) );
1189 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "%d \n", (int) varpartitioncollection.size() );
1193 std::vector<std::vector<int> > varsofclasses = std::vector<std::vector<int> >(partition->getNClasses()) ;
1207 SCIPmessageFPrintInfo(SCIPgetMessagehdlr(scip), file, "%s: %s\n", partition->getClassName(cl), partition->getClassDescription(cl) );
1220 std::sort(finishedpartialdecs.begin(), finishedpartialdecs.end(), [&](PARTIALDECOMP* a, PARTIALDECOMP* b) {return (a->getScore(sctype) > b->getScore(sctype)); });
1236 calcTranslationMapping( origdata, rowothertothis, rowthistoother, colothertothis, colthistoother, missingrowinthis );
1239 " calculated translation; number of missing constraints: %ld; number of other partialdecs: %ld \n", missingrowinthis.size(),
1242 getTranslatedPartialdecs( origpartialdecs, rowothertothis, rowthistoother, colothertothis, colthistoother, newpartialdecs );
1257 calcTranslationMapping( origdata, rowothertothis, rowthistoother, colothertothis, colthistoother, missingrowinthis );
1260 " calculated translation; number of missing constraints: %ld; number of other partialdecs: %ld \n", missingrowinthis.size(),
1263 getTranslatedPartialdecs( origdata->getOpenPartialdecs(), rowothertothis, rowthistoother, colothertothis, colthistoother, newpartialdecs );
1264 getTranslatedPartialdecs( origdata->getFinishedPartialdecs(), rowothertothis, rowthistoother, colothertothis, colthistoother, newpartialdecs );
void addClockTime(SCIP_Real clocktime)
adds detection time of one detector
Definition: class_partialdecomp.cpp:286
void setFinishedByFinisher(bool finished)
sets whether this partialdec was finished by a finishing detector
Definition: class_partialdecomp.cpp:5009
bool isConsSetppc(int consindexd)
is cons with specified index partitioning packing, or covering constraint?
Definition: class_detprobdata.cpp:991
int getNConss()
returns the number of variables considered in the detprobdata
Definition: class_detprobdata.cpp:796
int getNFinishedPartialdecs()
Definition: class_detprobdata.cpp:824
structure information for decomposition information in GCG projects
GCG interface methods.
void copyPartitionStatistics(const PARTIALDECOMP *otherpartialdec)
copies the given partialdec's partition statistics
Definition: class_partialdecomp.cpp:2784
std::vector< int >::const_iterator fixConsToMaster(std::vector< int >::const_iterator itr)
fixes a constraint to the master constraints
Definition: class_partialdecomp.cpp:4938
std::vector< int > & getConssForCons(int consIndex)
return array of constraint indices that have a common variable with the given constraint
Definition: class_detprobdata.cpp:706
void printPartitionInformation(FILE *file)
output method for json file writer to write partition candidate information
Definition: class_detprobdata.cpp:1157
void addDetectorChainInfo(const char *decinfo)
add information about the detector chain
Definition: class_partialdecomp.cpp:315
void setAncestorList(std::vector< int > &newlist)
Definition: class_partialdecomp.cpp:3608
SCIP_Bool isAssignedToOrigProb()
returns true if the matrix structure corresponds to the presolved problem
Definition: class_detprobdata.cpp:1098
void setNBlocks(int nblocks)
sets number of blocks, only increasing number allowed
Definition: class_partialdecomp.cpp:5025
void setFinishedByFinisherOrig(bool finished)
sets whether this partialdec was finished by a finishing detector in the original problem
Definition: class_partialdecomp.cpp:5017
std::vector< PARTIALDECOMP * > translatePartialdecs(DETPROBDATA *otherdata, std::vector< PARTIALDECOMP * > otherpartialdecs)
translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
Definition: class_detprobdata.cpp:1224
SCIP_Bool GCGgetConsIsCardinalityCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_misc.c:849
constraint handler for structure detection
Definition: class_conspartition.cpp:43
int getNAncestorPartialdecs()
returns size of ancestor partialdec data structure
Definition: class_detprobdata.cpp:784
void addPctConssToBorder(SCIP_Real pct)
adds percentage of constraints assigned to border
Definition: class_partialdecomp.cpp:358
bool isComplete()
Gets whether this partialdec is complete, i.e. it has no more open constraints and variables.
Definition: class_partialdecomp.cpp:4494
int GCGconshdlrDecompGetNBlockNumberCandidates(SCIP *scip)
returns the number of block candidates given by the user
Definition: cons_decomp.cpp:5305
Definition: class_conspartition.h:53
SCIP_RETCODE GCGconsGetVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars)
Definition: scip_misc.c:490
SCIP_Bool partialdecIsNoDuplicateOfPartialdecs(PARTIALDECOMP *comppartialdec, std::vector< PARTIALDECOMP * > const &partialdecs, bool sort)
check if partialdec is a duplicate of any given partialdecs
Definition: class_detprobdata.cpp:1117
void getSortedCandidatesNBlocks(std::vector< int > &candidates)
gets the candidates for number of blocks added by the user followed by the found ones sorted in desce...
Definition: class_detprobdata.cpp:886
private methods for working with decomp structures
SCIP_Bool isPartialdecDuplicateofFinished(PARTIALDECOMP *partialdec)
check if partialdec is a duplicate of an existing finished partialdec
Definition: class_detprobdata.cpp:1090
PARTIALDECOMP * getAncestorPartialdec(int partialdecindex)
returns a partialdec from ancestor partialdec data structure with given index
Definition: class_detprobdata.cpp:678
void setDetectorchain(std::vector< DEC_DETECTOR * > &givenDetectorChain)
sets the detectorchain with the given vector of detector pointers
Definition: class_partialdecomp.cpp:4974
void clearCurrentPartialdecs()
clears current partialdec data structure
Definition: class_detprobdata.cpp:629
void clearFinishedPartialdecs()
clears finished partialdec data structure
Definition: class_detprobdata.cpp:635
data structures for detectors
void addPctVarsFromFree(SCIP_Real pct)
adds percentage of closed variables
Definition: class_partialdecomp.cpp:366
Definition: class_varpartition.h:54
std::vector< int > & getConssForVar(int varIndex)
returns the constraint indices of the coefficient matrix for a variable
Definition: class_detprobdata.cpp:714
void addAncestorID(int ancestor)
Definition: class_partialdecomp.cpp:3616
various SCIP helper methods
void setUsergiven(USERGIVEN usergiven)
sets whether this partialdec is user given
Definition: class_partialdecomp.cpp:5063
void addPartialdecToAncestor(PARTIALDECOMP *partialdec)
adds a partialdec to ancestor partialdecs
Definition: class_detprobdata.cpp:538
std::vector< SCIP_VAR * > getOrigVarsFixedZero()
returns pointers to all orig vars that are fixed to zero
Definition: class_detprobdata.cpp:862
int getNOpenPartialdecs()
returns size of current (open) partialdec data structure
Definition: class_detprobdata.cpp:818
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
int getNNonzeros()
returns the number of nonzero entries in the coefficient matrix
Definition: class_detprobdata.cpp:836
bool addPartialdecToFinished(PARTIALDECOMP *partialdec)
adds a partialdec to finished partialdecs
Definition: class_detprobdata.cpp:563
PARTIALDECOMP * getFinishedPartialdec(int partialdecindex)
returns a partialdec from finished partialdec data structure
Definition: class_detprobdata.cpp:728
std::vector< std::pair< int, int > > candidatesNBlocks
Definition: class_detprobdata.h:142
std::vector< VarPartition * > getVarPartitions()
returns vector to stored variable partitions
Definition: class_detprobdata.cpp:949
std::vector< SCIP_Real > & getValsForCons(int consIndex)
returns the nonzero coefficients of the coefficient matrix for a constraint
Definition: class_detprobdata.cpp:931
void addPctVarsToBorder(SCIP_Real pct)
adds percentage of variables assigned to border
Definition: class_partialdecomp.cpp:382
void addPctConssToBlock(SCIP_Real pct)
adds percentage of constraints assigned to blocks
Definition: class_partialdecomp.cpp:350
miscellaneous methods for visualizations
int getNVars()
return the number of variables considered in the detprobdata
Definition: class_detprobdata.cpp:848
int GCGconshdlrDecompGetBlockNumberCandidate(SCIP *scip, int index)
returns block number user candidate with given index
Definition: cons_decomp.cpp:5164
void setStemsFromOrig(bool fromorig)
sets whether this partialdec stems from an orig problem partialdec
Definition: class_partialdecomp.cpp:5055
int getIndexForCons(SCIP_CONS *cons)
returns the constraint index related to a SCIP constraint
Definition: class_detprobdata.cpp:744
void addCandidatesNBlocksNVotes(int candidate, int nvotes)
adds a candidate for block number and counts how often a candidate is added
Definition: class_detprobdata.cpp:479
int getIndexForVar(SCIP_VAR *var)
returns the variable index related to a SCIP variable
Definition: class_detprobdata.cpp:776
int getNConsPartitions()
returns number of different constraint partitions
Definition: class_detprobdata.cpp:790
void freeTemporaryData()
frees temporary data that is only needed during the detection process
Definition: class_detprobdata.cpp:672
bool operator()(const std::pair< int, int > &left, const std::pair< int, int > &right)
Definition: class_detprobdata.cpp:105
int getNConssForCons(int consIndex)
returns the number of constraints for a given constraint
Definition: class_detprobdata.cpp:802
void createConssAdjacency()
create the constraint adjacency datastructure that is used (if created) for some methods to faster ac...
Definition: class_detprobdata.cpp:641
ConsPartition * getConsPartition(int partitionIndex)
returns pointer to a constraint partition
Definition: class_detprobdata.cpp:688
Definition: class_detprobdata.h:106
SCIP_RETCODE GCGconsGetVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int nvals)
Definition: scip_misc.c:621
void addVarPartition(VarPartition *partition)
adds a variable partition if it is no duplicate of an existing variable partition
Definition: class_detprobdata.cpp:589
void addNNewBlocks(int nnewblocks)
adds how many new blocks were introduced
Definition: class_partialdecomp.cpp:334
bool isConsCardinalityCons(int consindexd)
returns whether a constraint is a cardinality constraint, i.e. of the
Definition: class_detprobdata.cpp:971
bool checkConsistency()
Checks whether the assignments in the partialdec are consistent.
Definition: class_partialdecomp.cpp:1546
std::vector< PARTIALDECOMP * > & getFinishedPartialdecs()
gets all finished partialdecs
Definition: class_detprobdata.cpp:738
bool isConsSetpp(int consindexd)
is cons with specified indec partitioning, or packing covering constraint?
Definition: class_detprobdata.cpp:1035
void addPartialdecToFinishedUnchecked(PARTIALDECOMP *partialdec)
adds a partialdec to finished partialdecs without checking for duplicates, dev has to check this on h...
Definition: class_detprobdata.cpp:580
void GCGconshdlrDecompDeregisterPartialdecs(SCIP *scip, SCIP_Bool original)
deregisters partialdecs in the conshdlr
Definition: cons_decomp.cpp:5076
std::vector< SCIP_VAR * > getRelevantVars()
returns pointers to all problem vars that are not fixed to 0
Definition: class_detprobdata.cpp:874
SCIP_Bool isFiniteNonnegativeIntegral(SCIP *scip, SCIP_Real x)
is constraint ranged row, i.e., -inf < lhs < rhs < inf?
Definition: class_detprobdata.cpp:1079
VarPartition * getVarPartition(int partitionIndex)
returns pointer to a variable partition with given index
Definition: class_detprobdata.cpp:939
SCIP_Bool GCGgetConsIsSetppc(SCIP *scip, SCIP_CONS *cons, SCIP_SETPPCTYPE *setppctype)
Definition: scip_misc.c:763
SCIP_Bool isRangedRow(SCIP *scip, SCIP_Real lhs, SCIP_Real rhs)
is constraint ranged row, i.e., -inf < lhs < rhs < inf?
Definition: class_detprobdata.cpp:1104
SCIP_Real getScore(SCORETYPE type)
returns the score of the partialdec (depending on used scoretype)
Definition: class_partialdecomp.cpp:4025
void addPctConssFromFree(SCIP_Real pct)
adds percentage of closed constraints
Definition: class_partialdecomp.cpp:342
int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
Definition: class_detprobdata.cpp:854
SCIP_Bool isConssAdjInitialized()
determines whether or not the constraint-constraint adjacency data structure is initilized
Definition: class_detprobdata.cpp:985
std::vector< ConsPartition * > conspartitioncollection
Definition: class_detprobdata.h:144
SCIP_RETCODE isEqual(PARTIALDECOMP *otherpartialdec, SCIP_Bool *isequal, bool sortpartialdecs)
method to check whether this partialdec is equal to a given other partialdec (
Definition: class_partialdecomp.cpp:4539
Definition: class_detprobdata.cpp:103
void addPctVarsToBlock(SCIP_Real pct)
adds percentage of variables assigned to blocks
Definition: class_partialdecomp.cpp:374
SCORETYPE GCGconshdlrDecompGetScoretype(SCIP *scip)
Gets the currently selected scoretype.
Definition: cons_decomp.cpp:5601
GP file reader writing decompositions to gnuplot files.
std::vector< VarPartition * > varpartitioncollection
Definition: class_detprobdata.h:145
SCIP_Real getVal(int row, int col)
returns a coefficient from the coefficient matrix
Definition: class_detprobdata.cpp:916
int getNConssForVar(int varIndex)
returns the number of constraints for a given variable where the var has a nonzero entry in
Definition: class_detprobdata.cpp:810
std::vector< int > & getVarsForCons(int consIndex)
returns the variable indices of the coefficient matrix for a constraint
Definition: class_detprobdata.cpp:963
bool addPartialdecToOpen(PARTIALDECOMP *partialdec)
adds a partialdec to current partialdecs (data structure for partialdecs that are goin to processed i...
Definition: class_detprobdata.cpp:546
combine two hash function of objects of a pair to get a vaulue for the pair
Definition: class_detprobdata.h:89
void clearAncestorPartialdecs()
clears ancestor partialdec data structure,
Definition: class_detprobdata.cpp:623
void setDetectorFinishedOrig(DEC_DETECTOR *detectorID)
sets detector that finished the partialdec in the original problem
Definition: class_partialdecomp.cpp:5001
SCIP_VAR * getVar(int varIndex)
returns SCIP variable related to a variable index
Definition: class_detprobdata.cpp:955
void sortFinishedForScore()
sorts partialdecs in finished partialdecs data structure according to the current scoretype
Definition: class_detprobdata.cpp:1215
void addConsPartition(ConsPartition *partition)
adds a constraint partition if it is no duplicate of an existing constraint partition
Definition: class_detprobdata.cpp:505
class storing partialdecs and the problem matrix
SCIP_Bool varIsFixedToZero(SCIP *scip, SCIP_VAR *var)
Definition: class_detprobdata.cpp:117
void fixConsToBlock(int cons, int block)
adds a constraint to a block
Definition: class_partialdecomp.cpp:4894
std::vector< PARTIALDECOMP * > & getOpenPartialdecs()
determines all partialdecs from current (open) partialdec data structure
Definition: class_detprobdata.cpp:722
std::vector< SCIP_CONS * > getRelevantConss()
returns pointers to all constraints that are not marked as deleted or obsolete
Definition: class_detprobdata.cpp:868
int getNVarPartitions()
returns number of different variable partitions
Definition: class_detprobdata.cpp:842
public methods for working with decomposition structures
void printBlockcandidateInformation(SCIP *scip, FILE *file)
output method for json file writer to write block candidate information
Definition: class_detprobdata.cpp:1138