class_detprobdata.h
Go to the documentation of this file.
37 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
104 * class to manage the detection process and data for one coefficient matrix of a MIP, usually there is one detprobdata for the original and one detprobdata for the presolved problem
113 std::vector<PARTIALDECOMP*> ancestorpartialdecs; /**< old partialdecs that were previously used */
115 std::vector<SCIP_CONS*> relevantconss; /**< stores all constraints that are not marked as deleted or obsolete */
117 std::vector<std::vector<int>> varsforconss; /**< stores for every constraint the indices of variables
119 std::vector<std::vector<double>> valsforconss; /**< stores for every constraint the coefficients of
122 std::vector<std::vector<int>> conssforvars; /**< stores for every variable the indices of constraints
126 unordered_map<SCIP_CONS*, int> constoindex; /**< maps SCIP_CONS* to the corresponding internal index */
127 unordered_map<SCIP_VAR*, int> vartoindex; /**< maps SCIP_VAR* to the corresponding internal index */
129 unordered_map<std::pair<int, int>, SCIP_Real, pair_hash> valsMap; /**< maps an entry of the matrix to its
132 std::vector<SCIP_VAR*> origfixedtozerovars; /**< collection of SCIP_VAR* that are fixed to zero in transformed problem*/
142 std::vector<std::pair<int, int>> candidatesNBlocks; /**< candidate for the number of blocks, second int indicates how often a candidate was added */
144 std::vector<ConsPartition*> conspartitioncollection; /**< collection of different constraint class distributions */
145 std::vector<VarPartition*> varpartitioncollection; /**< collection of different variable class distributions */
147 SCIP_Real classificationtime; /**< time that was consumed by the classification of the constraint and variables classifiers */
148 SCIP_Real nblockscandidatescalctime; /**< time that was used to calulate the candidates of te block number */
150 SCIP_Real translatingtime; /**< time that was spent by transforming partialdecs between presolved and orig problem */
221 * @brief adds a partialdec to current partialdecs (data structure for partialdecs that are goin to processed in the propagation rounds)
223 * @returns TRUE if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)
231 * @param partialdec pointer of partialdec that is going to be added to the finished partialdecs (data structure to carry finished decompositions)
232 * @returns TRUE if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)
240 * @brief adds a partialdec to finished partialdecs without checking for duplicates, dev has to check this on his own
241 * @param partialdec pointer of partialdec that is going to be added unchecked to the finished partialdecs (data structure to carry finished decompositions)
276 * @brief create the constraint adjacency datastructure that is used (if created) for some methods to faster access the constarints that have variables in common
311 * @brief return array of constraint indices that have a common variable with the given constraint
312 * @return return vector of constraint indices that have a common variable with the given constraint
411 * @brief returns the number of constraints for a given variable where the var has a nonzero entry in
487 * @brief gets the candidates for number of blocks added by the user followed by the found ones sorted in descending order by how often a candidate was proposed
488 * @param candidates will contain the candidates for number of blocks sorted in descending order by how often a candidate was added
543 * @brief returns whether a constraint is a cardinality constraint, i.e. of the \f$\sum_{i} x_i = b\f$
552 * @brief determines whether or not the constraint-constraint adjacency data structure is initilized
641 * @brief sorts partialdecs in finished partialdecs data structure according to the current scoretype
646 * @brief translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
655 * @brief translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
675 gcg::PARTIALDECOMP* workonpartialdec; /**< partialdec (aka partial decomposition) to be propagted in next detector call */
676 gcg::PARTIALDECOMP** newpartialdecs; /**< array of new partialdecs to filled by the detetcor methods */
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
GCG interface methods.
class representing a partition of a set of variables
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
SCIP_Bool isAssignedToOrigProb()
returns true if the matrix structure corresponds to the presolved problem
Definition: class_detprobdata.cpp:1098
std::size_t operator()(const std::pair< T1, T2 > &p) const
Definition: class_detprobdata.h:92
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
Definition: class_conspartition.cpp:43
int getNAncestorPartialdecs()
returns size of ancestor partialdec data structure
Definition: class_detprobdata.cpp:784
SCIP_Real nblockscandidatescalctime
Definition: class_detprobdata.h:148
class representing a partition of a set of constraints
Definition: class_conspartition.h:53
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
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 clearCurrentPartialdecs()
clears current partialdec data structure
Definition: class_detprobdata.cpp:629
void clearFinishedPartialdecs()
clears finished partialdec data structure
Definition: class_detprobdata.cpp:635
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 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
int getNVars()
return the number of variables considered in the detprobdata
Definition: class_detprobdata.cpp:848
interface data structure for the detector calling methods
Definition: class_detprobdata.h:672
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
int getNConssForCons(int consIndex)
returns the number of constraints for a given constraint
Definition: class_detprobdata.cpp:802
gcg::DETPROBDATA * detprobdata
Definition: class_detprobdata.h:674
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
void addVarPartition(VarPartition *partition)
adds a variable partition if it is no duplicate of an existing variable partition
Definition: class_detprobdata.cpp:589
bool isConsCardinalityCons(int consindexd)
returns whether a constraint is a cardinality constraint, i.e. of the
Definition: class_detprobdata.cpp:971
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
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
gcg::PARTIALDECOMP ** newpartialdecs
Definition: class_detprobdata.h:676
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
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
class storing (potentially incomplete) decompositions
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
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
gcg::PARTIALDECOMP * workonpartialdec
Definition: class_detprobdata.h:675
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
void printBlockcandidateInformation(SCIP *scip, FILE *file)
output method for json file writer to write block candidate information
Definition: class_detprobdata.cpp:1138