Loading...
Searching...
No Matches
class_detprobdata.h
Go to the documentation of this file.
38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
106 * 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
117 std::vector<PARTIALDECOMP*> ancestorpartialdecs; /**< old partialdecs that were previously used */
119 std::vector<SCIP_CONS*> relevantconss; /**< stores all constraints that are not marked as deleted or obsolete */
121 std::vector<std::vector<int>> varsforconss; /**< stores for every constraint the indices of variables
123 std::vector<std::vector<double>> valsforconss; /**< stores for every constraint the coefficients of
126 std::vector<std::vector<int>> conssforvars; /**< stores for every variable the indices of constraints
130 unordered_map<SCIP_CONS*, int> constoindex; /**< maps SCIP_CONS* to the corresponding internal index */
131 unordered_map<SCIP_VAR*, int> vartoindex; /**< maps SCIP_VAR* to the corresponding internal index */
133 unordered_map<std::pair<int, int>, SCIP_Real, pair_hash> valsMap; /**< maps an entry of the matrix to its
136 std::vector<SCIP_VAR*> origfixedtozerovars; /**< collection of SCIP_VAR* that are fixed to zero in transformed problem*/
146 std::vector<std::pair<int, int>> candidatesNBlocks; /**< candidate for the number of blocks, second int indicates how often a candidate was added */
148 std::vector<ConsPartition*> conspartitioncollection; /**< collection of different constraint class distributions */
149 std::vector<VarPartition*> varpartitioncollection; /**< collection of different variable class distributions */
151 SCIP_Real classificationtime; /**< time that was consumed by the classification of the constraint and variables classifiers */
152 SCIP_Real nblockscandidatescalctime; /**< time that was used to calulate the candidates of te block number */
154 SCIP_Real translatingtime; /**< time that was spent by transforming partialdecs between presolved and orig problem */
182 SCIP_Bool translatesymmetry /**< translate symmetry information (the old/original information must be valid for each translated partialdec!) */
231 * @brief adds a partialdec to current partialdecs (data structure for partialdecs that are goin to processed in the propagation rounds)
233 * @returns TRUE if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)
242 * @param partialdec pointer of partialdec that is going to be added to the finished partialdecs (data structure to carry finished decompositions)
243 * @returns TRUE if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)
252 * @brief adds a partialdec to finished partialdecs without checking for duplicates, dev has to check this on his own
253 * @param partialdec pointer of partialdec that is going to be added unchecked to the finished partialdecs (data structure to carry finished decompositions)
293 * @brief create the constraint adjacency datastructure that is used (if created) for some methods to faster access the constarints that have variables in common
333 * @brief return array of constraint indices that have a common variable with the given constraint
334 * @return return vector of constraint indices that have a common variable with the given constraint
452 * @brief returns the number of constraints for a given variable where the var has a nonzero entry in
540 * @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
541 * @param candidates will contain the candidates for number of blocks sorted in descending order by how often a candidate was added
603 * @brief returns whether a constraint is a cardinality constraint, i.e. of the \f$\sum_{i} x_i = b\f$
613 * @brief determines whether or not the constraint-constraint adjacency data structure is initilized
709 * @brief sorts partialdecs in finished partialdecs data structure according to the current scoretype
715 * @brief translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
748 gcg::PARTIALDECOMP* workonpartialdec; /**< partialdec (aka partial decomposition) to be propagted in next detector call */
749 gcg::PARTIALDECOMP** newpartialdecs; /**< array of new partialdecs to filled by the detetcor methods */
SCIP_VAR ** x
class representing a partition of a set of constraints
class storing (potentially incomplete) decompositions
class representing a partition of a set of variables
Definition class_conspartition.h:60
Definition class_detprobdata.h:110
GCG_EXPORT void addPartialdecToAncestor(PARTIALDECOMP *partialdec)
adds a partialdec to ancestor partialdecs
Definition class_detprobdata.cpp:586
GCG_EXPORT bool addPartialdecToOpen(PARTIALDECOMP *partialdec)
adds a partialdec to current partialdecs (data structure for partialdecs that are goin to processed i...
Definition class_detprobdata.cpp:594
GCG_EXPORT ConsPartition * getConsPartition(int partitionIndex)
returns pointer to a constraint partition
Definition class_detprobdata.cpp:736
GCG_EXPORT std::vector< int > & getConssForVar(int varIndex)
returns the constraint indices of the coefficient matrix for a variable
Definition class_detprobdata.cpp:762
GCG_EXPORT int getIndexForCons(SCIP_CONS *cons)
returns the constraint index related to a SCIP constraint
Definition class_detprobdata.cpp:792
GCG_EXPORT std::vector< SCIP_Real > & getValsForCons(int consIndex)
returns the nonzero coefficients of the coefficient matrix for a constraint
Definition class_detprobdata.cpp:991
GCG_EXPORT int getNConssForCons(int consIndex)
returns the number of constraints for a given constraint
Definition class_detprobdata.cpp:856
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 std::vector< SCIP_VAR * > getOrigVarsFixedZero()
returns pointers to all orig vars that are fixed to zero
Definition class_detprobdata.cpp:916
GCG_EXPORT int getNVarsForCons(int consIndex)
returns the number of variables for a given constraint
Definition class_detprobdata.cpp:908
GCG_EXPORT SCIP_Bool isPartialdecDuplicateofFinished(PARTIALDECOMP *partialdec)
check if partialdec is a duplicate of an existing finished partialdec
Definition class_detprobdata.cpp:1147
GCG_EXPORT PARTIALDECOMP * getFinishedPartialdec(int partialdecindex)
returns a partialdec from finished partialdec data structure
Definition class_detprobdata.cpp:776
GCG_EXPORT int getNNonzeros()
returns the number of nonzero entries in the coefficient matrix
Definition class_detprobdata.cpp:890
GCG_EXPORT bool isConsCardinalityCons(int consindexd)
returns whether a constraint is a cardinality constraint, i.e. of the
Definition class_detprobdata.cpp:1031
GCG_EXPORT SCIP_Bool isRangedRow(SCIP_Real lhs, SCIP_Real rhs)
is constraint ranged row, i.e., -inf < lhs < rhs < inf?
Definition class_detprobdata.cpp:1161
GCG_EXPORT int getNVars()
return the number of variables considered in the detprobdata
Definition class_detprobdata.cpp:902
SCIP_Real nblockscandidatescalctime
Definition class_detprobdata.h:152
GCG_EXPORT void freeTemporaryData()
frees temporary data that is only needed during the detection process
Definition class_detprobdata.cpp:720
GCG_EXPORT bool isConsSetppc(int consindexd)
is cons with specified index partitioning packing, or covering constraint?
Definition class_detprobdata.cpp:1051
GCG_EXPORT 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:946
GCG_EXPORT 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:864
GCG_EXPORT std::vector< int > & getConssForCons(int consIndex)
return array of constraint indices that have a common variable with the given constraint
Definition class_detprobdata.cpp:754
GCG_EXPORT void addVarPartition(VarPartition *partition)
adds a variable partition if it is no duplicate of an existing variable partition
Definition class_detprobdata.cpp:637
GCG_EXPORT 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:628
GCG_EXPORT PARTIALDECOMP * getAncestorPartialdec(int partialdecindex)
returns a partialdec from ancestor partialdec data structure with given index
Definition class_detprobdata.cpp:726
GCG_EXPORT int getNPartialdecs()
Definition class_detprobdata.cpp:884
GCG_EXPORT SCIP_VAR * getVar(int varIndex)
returns SCIP variable related to a variable index
Definition class_detprobdata.cpp:1015
GCG_EXPORT SCIP_Bool isFiniteNonnegativeIntegral(SCIP_Real x)
is constraint ranged row, i.e., -inf < lhs < rhs < inf?
Definition class_detprobdata.cpp:1139
GCG_EXPORT void printBlockcandidateInformation(FILE *file)
output method for json file writer to write block candidate information
Definition class_detprobdata.cpp:1194
GCG_EXPORT GCG * getGcg()
returns the corresponding gcg data structure
Definition class_detprobdata.cpp:940
GCG_EXPORT DETPROBDATA(GCG *gcgstruct, SCIP_Bool _originalProblem)
constructor
Definition class_detprobdata.cpp:355
GCG_EXPORT std::vector< SCIP_CONS * > getRelevantConss()
returns pointers to all constraints that are not marked as deleted or obsolete
Definition class_detprobdata.cpp:922
GCG_EXPORT VarPartition * getVarPartition(int partitionIndex)
returns pointer to a variable partition with given index
Definition class_detprobdata.cpp:999
GCG_EXPORT std::vector< PARTIALDECOMP * > & getFinishedPartialdecs()
gets all finished partialdecs
Definition class_detprobdata.cpp:786
std::vector< std::pair< int, int > > candidatesNBlocks
Definition class_detprobdata.h:146
GCG_EXPORT void createConssAdjacency()
create the constraint adjacency datastructure that is used (if created) for some methods to faster ac...
Definition class_detprobdata.cpp:689
GCG_EXPORT bool addPartialdecToFinished(PARTIALDECOMP *partialdec)
adds a partialdec to finished partialdecs
Definition class_detprobdata.cpp:611
GCG_EXPORT void clearAncestorPartialdecs()
clears ancestor partialdec data structure,
Definition class_detprobdata.cpp:671
GCG_EXPORT SCIP_Bool isConssAdjInitialized()
determines whether or not the constraint-constraint adjacency data structure is initilized
Definition class_detprobdata.cpp:1045
GCG_EXPORT int getNFinishedPartialdecs()
Definition class_detprobdata.cpp:878
GCG_EXPORT SCIP_Real getVal(int row, int col)
returns a coefficient from the coefficient matrix
Definition class_detprobdata.cpp:976
GCG_EXPORT int getNOpenPartialdecs()
returns size of current (open) partialdec data structure
Definition class_detprobdata.cpp:872
GCG_EXPORT int getIndexForVar(SCIP_VAR *var)
returns the variable index related to a SCIP variable
Definition class_detprobdata.cpp:829
GCG_EXPORT void sortFinishedForScore()
sorts partialdecs in finished partialdecs data structure according to the current scoretype
Definition class_detprobdata.cpp:1270
GCG_EXPORT void printPartitionInformation(FILE *file)
output method for json file writer to write partition candidate information
Definition class_detprobdata.cpp:1212
GCG_EXPORT int getNAncestorPartialdecs()
returns size of ancestor partialdec data structure
Definition class_detprobdata.cpp:838
GCG_EXPORT std::vector< PARTIALDECOMP * > translatePartialdecs(DETPROBDATA *otherdata, std::vector< PARTIALDECOMP * > otherpartialdecs, SCIP_Bool translateSymmetry)
translates partialdecs if the index structure of the problem has changed, e.g. due to presolving
Definition class_detprobdata.cpp:1280
GCG_EXPORT bool isConsSetpp(int consindexd)
is cons with specified indec partitioning, or packing covering constraint?
Definition class_detprobdata.cpp:1095
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 void addCandidatesNBlocksNVotes(int candidate, int nvotes)
adds a candidate for block number and counts how often a candidate is added
Definition class_detprobdata.cpp:527
GCG_EXPORT int getNVarPartitions()
returns number of different variable partitions
Definition class_detprobdata.cpp:896
GCG_EXPORT int getNConsPartitions()
returns number of different constraint partitions
Definition class_detprobdata.cpp:844
std::vector< ConsPartition * > conspartitioncollection
Definition class_detprobdata.h:148
std::vector< VarPartition * > varpartitioncollection
Definition class_detprobdata.h:149
GCG_EXPORT void clearFinishedPartialdecs()
clears finished partialdec data structure
Definition class_detprobdata.cpp:683
GCG_EXPORT void addConsPartition(ConsPartition *partition)
adds a constraint partition if it is no duplicate of an existing constraint partition
Definition class_detprobdata.cpp:553
GCG_EXPORT std::vector< PARTIALDECOMP * > & getOpenPartialdecs()
determines all partialdecs from current (open) partialdec data structure
Definition class_detprobdata.cpp:770
GCG_EXPORT std::vector< SCIP_VAR * > getRelevantVars()
returns pointers to all problem vars that are not fixed to 0
Definition class_detprobdata.cpp:928
GCG_EXPORT SCIP_CONS * getCons(int consIndex)
returns the SCIP constraint related to a constraint index
Definition class_detprobdata.cpp:746
GCG_EXPORT 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:1173
GCG_EXPORT std::vector< VarPartition * > getVarPartitions()
returns vector to stored variable partitions
Definition class_detprobdata.cpp:1009
GCG_EXPORT SCIP_Bool isAssignedToOrigProb()
returns true if the matrix structure corresponds to the presolved problem
Definition class_detprobdata.cpp:1155
GCG_EXPORT void clearCurrentPartialdecs()
clears current partialdec data structure
Definition class_detprobdata.cpp:677
Definition class_varpartition.h:61
#define SCIP_Bool
#define SCIP_Real
GCG interface methods.
Definition class_conspartition.cpp:44
interface data structure for the detector calling methods
Definition class_detprobdata.h:746
gcg::PARTIALDECOMP ** newpartialdecs
Definition class_detprobdata.h:749
gcg::PARTIALDECOMP * workonpartialdec
Definition class_detprobdata.h:748
gcg::DETPROBDATA * detprobdata
Definition class_detprobdata.h:747
combine two hash function of objects of a pair to get a vaulue for the pair
Definition class_detprobdata.h:92
std::size_t operator()(const std::pair< T1, T2 > &p) const
Definition class_detprobdata.h:94
struct SCIP_Cons SCIP_CONS
struct Scip SCIP
struct SCIP_Var SCIP_VAR