Detailed Description
Definition at line 54 of file class_varpartition.h.
#include <class_varpartition.h>
Public Member Functions | |
VarPartition (SCIP *scip, const char *name, int nClasses, int nVars) | |
VarPartition (const VarPartition *toCopy) | |
~VarPartition () | |
int | addClass (const char *name, const char *desc, VAR_DECOMPINFO decompInfo) |
void | assignVarToClass (int varindex, int classindex) |
std::vector< std::vector< int > > | getAllSubsets (bool all, bool linking, bool master, bool block) |
VAR_DECOMPINFO | getClassDecompInfo (int classindex) |
const char * | getClassNameOfVar (int varindex) |
int | getClassOfVar (int varindex) |
const int * | getVarsToClasses () |
int | getNVars () |
std::vector< int > | getNVarsOfClasses () |
bool | isVarClassified (int varindex) |
VarPartition * | reduceClasses (int maxNumberOfClasses) |
void | setClassDecompInfo (int classindex, VAR_DECOMPINFO decompInfo) |
Public Member Functions inherited from gcg::IndexPartition | |
bool | isDuplicateOf (IndexPartition *otherPartition) |
const char * | getClassDescription (int classindex) |
const char * | getClassName (int classindex) |
const char * | getName () |
int | getNClasses () |
std::vector< int > | reduceClasses (int maxNumberOfClasses) |
int | removeEmptyClasses () |
void | setClassDescription (int classindex, const char *desc) |
void | setClassName (int classindex, const char *name) |
Additional Inherited Members | |
Protected Member Functions inherited from gcg::IndexPartition | |
IndexPartition (SCIP *scip, const char *name, int nClasses, int nIndices) | |
IndexPartition (const IndexPartition *toCopy) | |
virtual | ~IndexPartition () |
int | addClass (const char *name, const char *desc) |
void | assignIndexToClass (int index, int classindex) |
std::vector< std::vector< int > > | getAllSubsets (std::vector< int > &classindices) |
int | getClassDecompInfo (int classindex) |
const char * | getClassNameOfIndex (int index) |
int | getClassOfIndex (int index) |
std::vector< int > & | getIndicesToClasses () |
int | getNIndices () |
std::vector< int > | getNIndicesOfClasses () |
bool | isIndexClassified (int index) |
void | setClassDecompInfo (int classindex, int decompInfo) |
Protected Attributes inherited from gcg::IndexPartition | |
SCIP * | scip |
Constructor & Destructor Documentation
◆ VarPartition() [1/2]
gcg::VarPartition::VarPartition | ( | SCIP * | _scip, |
const char * | givenName, | ||
int | givenNClasses, | ||
int | givenNVars | ||
) |
constructor
- Parameters
-
_scip scip data structure givenName name of partition (will be copied) givenNClasses initial number of classes givenNVars number of variables to be classified
Definition at line 47 of file class_varpartition.cpp.
Referenced by reduceClasses().
◆ VarPartition() [2/2]
gcg::VarPartition::VarPartition | ( | const VarPartition * | toCopy | ) |
copy constructor
- Parameters
-
toCopy VarPartition to be copied
Definition at line 59 of file class_varpartition.cpp.
◆ ~VarPartition()
gcg::VarPartition::~VarPartition | ( | ) |
destructor
Definition at line 66 of file class_varpartition.cpp.
Member Function Documentation
◆ addClass()
int gcg::VarPartition::addClass | ( | const char * | givenName, |
const char * | givenDesc, | ||
VAR_DECOMPINFO | givenDecompInfo | ||
) |
creates a new class, returns index of the class
- Parameters
-
givenName name of the class (will be copied) givenDesc description of the class (will be copied) givenDecompInfo decomposition code of the class
Definition at line 71 of file class_varpartition.cpp.
References gcg::IndexPartition::addClass(), and setClassDecompInfo().
◆ assignVarToClass()
void gcg::VarPartition::assignVarToClass | ( | int | givenVarindex, |
int | givenClassindex | ||
) |
assigns a variable to a class
- Parameters
-
givenVarindex index of the variable givenClassindex index of the class
Definition at line 80 of file class_varpartition.cpp.
References gcg::IndexPartition::assignIndexToClass().
Referenced by DEC_DECL_VARCLASSIFY(), and reduceClasses().
◆ getAllSubsets()
std::vector< std::vector< int > > gcg::VarPartition::getAllSubsets | ( | bool | all, |
bool | linking, | ||
bool | master, | ||
bool | block | ||
) |
returns a vector containing all possible subsets of the chosen classindices
- Parameters
-
all true, if ALL classes should be considered linking true, if LINKING classes should be considered master true, if MASTER classes should be considered block true, if BLOCK classes should be considered
Definition at line 86 of file class_varpartition.cpp.
References gcg::ALL, gcg::BLOCK, gcg::IndexPartition::getAllSubsets(), getClassDecompInfo(), gcg::IndexPartition::getNClasses(), gcg::LINKING, and gcg::MASTER.
Referenced by DEC_DECL_PROPAGATEPARTIALDEC().
◆ getClassDecompInfo()
VAR_DECOMPINFO gcg::VarPartition::getClassDecompInfo | ( | int | givenClassindex | ) |
returns the decomposition info of a class
returns the decomposition code of a class
- Parameters
-
givenClassindex index of class
Definition at line 102 of file class_varpartition.cpp.
References gcg::ALL, gcg::BLOCK, gcg::IndexPartition::getClassDecompInfo(), gcg::LINKING, and gcg::MASTER.
Referenced by DEC_DECL_PROPAGATEPARTIALDEC(), getAllSubsets(), and reduceClasses().
◆ getClassNameOfVar()
const char * gcg::VarPartition::getClassNameOfVar | ( | int | givenVarindex | ) |
returns the name of the class a variable is assigned to
- Parameters
-
givenVarindex index of variable
Definition at line 133 of file class_varpartition.cpp.
References gcg::IndexPartition::getClassNameOfIndex().
◆ getClassOfVar()
int gcg::VarPartition::getClassOfVar | ( | int | givenVarindex | ) |
returns the index of the class a variable is assigned to
- Parameters
-
givenVarindex index of variable
Definition at line 139 of file class_varpartition.cpp.
References gcg::IndexPartition::getClassOfIndex().
Referenced by DEC_DECL_PROPAGATEPARTIALDEC(), and reduceClasses().
◆ getVarsToClasses()
const int * gcg::VarPartition::getVarsToClasses | ( | ) |
returns vector containing the assigned class of each variable
Definition at line 145 of file class_varpartition.cpp.
References gcg::IndexPartition::getIndicesToClasses().
◆ getNVars()
int gcg::VarPartition::getNVars | ( | ) |
returns the number of variables
Definition at line 155 of file class_varpartition.cpp.
References gcg::IndexPartition::getNIndices().
Referenced by DEC_DECL_VARCLASSIFY(), and reduceClasses().
◆ getNVarsOfClasses()
std::vector< int > gcg::VarPartition::getNVarsOfClasses | ( | ) |
returns a vector with the numbers of variables that are assigned to the classes
Definition at line 161 of file class_varpartition.cpp.
References gcg::IndexPartition::getNIndicesOfClasses().
◆ isVarClassified()
bool gcg::VarPartition::isVarClassified | ( | int | givenVarindex | ) |
returns whether a variable is already assigned to a class
- Parameters
-
givenVarindex index of variable
Definition at line 168 of file class_varpartition.cpp.
References gcg::IndexPartition::isIndexClassified().
◆ reduceClasses()
VarPartition * gcg::VarPartition::reduceClasses | ( | int | givenMaxNumber | ) |
returns partition with reduced number of classes if the current number of classes is greater than an upper bound and lower than 2*(upper bound) (returns NULL otherwise)
returns partition with reduced number of classes
- Parameters
-
givenMaxNumber upper bound
Definition at line 174 of file class_varpartition.cpp.
References gcg::ALL, assignVarToClass(), getClassDecompInfo(), gcg::IndexPartition::getClassDescription(), gcg::IndexPartition::getClassName(), getClassOfVar(), gcg::IndexPartition::getName(), gcg::IndexPartition::getNClasses(), getNVars(), gcg::IndexPartition::reduceClasses(), gcg::IndexPartition::scip, setClassDecompInfo(), gcg::IndexPartition::setClassDescription(), gcg::IndexPartition::setClassName(), and VarPartition().
Referenced by reduceVarclasses().
◆ setClassDecompInfo()
void gcg::VarPartition::setClassDecompInfo | ( | int | givenClassindex, |
VAR_DECOMPINFO | givenDecompInfo | ||
) |
sets the decomposition code of a class
- Parameters
-
givenClassindex index of class givenDecompInfo decomposition code of class
Definition at line 221 of file class_varpartition.cpp.
References gcg::ALL, gcg::BLOCK, gcg::LINKING, gcg::MASTER, and gcg::IndexPartition::setClassDecompInfo().
Referenced by addClass(), DEC_DECL_VARCLASSIFY(), and reduceClasses().