gcg::VarClassifier Class Reference

Detailed Description

Definition at line 54 of file class_varclassifier.h.

#include <class_varclassifier.h>

Public Member Functions

 VarClassifier (SCIP *scip, const char *name, int nClasses, int nVars)
 
 VarClassifier (const VarClassifier *toCopy)
 
 ~VarClassifier ()
 
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)
 
VarClassifierreduceClasses (int maxNumberOfClasses)
 
void setClassDecompInfo (int classindex, VAR_DECOMPINFO decompInfo)
 
- Public Member Functions inherited from gcg::IndexClassifier
bool classifierIsDuplicateOfClassifier (IndexClassifier *otherClassifier)
 
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::IndexClassifier
 IndexClassifier (SCIP *scip, const char *name, int nClasses, int nIndices)
 
 IndexClassifier (const IndexClassifier *toCopy)
 
virtual ~IndexClassifier ()
 
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::IndexClassifier
SCIP * scip
 

Constructor & Destructor Documentation

gcg::VarClassifier::VarClassifier ( SCIP *  _scip,
const char *  givenName,
int  givenNClasses,
int  givenNVars 
)

constructor

Parameters
_scipscip data structure
givenNamename of classifier (will be copied)
givenNClassesinitial number of classes
givenNVarsnumber of variables to be classified

Definition at line 47 of file class_varclassifier.cpp.

Referenced by reduceClasses().

gcg::VarClassifier::VarClassifier ( const VarClassifier toCopy)

copy constructor

Parameters
toCopyVarClassifier to be copied

Definition at line 59 of file class_varclassifier.cpp.

gcg::VarClassifier::~VarClassifier ( )

destructor

Definition at line 66 of file class_varclassifier.cpp.

Member Function Documentation

int gcg::VarClassifier::addClass ( const char *  givenName,
const char *  givenDesc,
VAR_DECOMPINFO  givenDecompInfo 
)

creates a new class, returns index of the class

Parameters
givenNamename of the class (will be copied)
givenDescdescription of the class (will be copied)
givenDecompInfodecomposition code of the class

Definition at line 71 of file class_varclassifier.cpp.

References gcg::IndexClassifier::addClass(), and setClassDecompInfo().

Referenced by gcg::Seeedpool::translateSeeeds().

void gcg::VarClassifier::assignVarToClass ( int  givenVarindex,
int  givenClassindex 
)

assigns a variable to a class

Parameters
givenVarindexindex of the variable
givenClassindexindex of the class

Definition at line 80 of file class_varclassifier.cpp.

References gcg::IndexClassifier::assignIndexToClass().

Referenced by gcg::Seeedpool::createVarClassifierForObjValues(), gcg::Seeedpool::createVarClassifierForObjValueSigns(), reduceClasses(), and gcg::Seeedpool::translateSeeeds().

std::vector< std::vector< int > > gcg::VarClassifier::getAllSubsets ( bool  all,
bool  linking,
bool  master,
bool  block 
)

returns a vector containing all possible subsets of the chosen classindices

Parameters
alltrue, if ALL classes should be considered
linkingtrue, if LINKING classes should be considered
mastertrue, if MASTER classes should be considered
blocktrue, if BLOCK classes should be considered

Definition at line 86 of file class_varclassifier.cpp.

References gcg::ALL, gcg::BLOCK, gcg::IndexClassifier::getAllSubsets(), getClassDecompInfo(), gcg::IndexClassifier::getNClasses(), gcg::LINKING, and gcg::MASTER.

Referenced by DEC_DECL_PROPAGATESEEED().

VAR_DECOMPINFO gcg::VarClassifier::getClassDecompInfo ( int  givenClassindex)

returns the decomposition info of a class

returns the decomposition code of a class

Parameters
givenClassindexindex of class

Definition at line 102 of file class_varclassifier.cpp.

References gcg::ALL, gcg::BLOCK, gcg::IndexClassifier::getClassDecompInfo(), gcg::LINKING, and gcg::MASTER.

Referenced by DEC_DECL_PROPAGATEFROMTOOLBOX(), DEC_DECL_PROPAGATESEEED(), getAllSubsets(), reduceClasses(), and gcg::Seeedpool::translateSeeeds().

const char * gcg::VarClassifier::getClassNameOfVar ( int  givenVarindex)

returns the name of the class a variable is assigned to

Parameters
givenVarindexindex of variable

Definition at line 132 of file class_varclassifier.cpp.

References gcg::IndexClassifier::getClassNameOfIndex().

Referenced by DEC_DECL_PROPAGATEFROMTOOLBOX().

int gcg::VarClassifier::getClassOfVar ( int  givenVarindex)
int gcg::VarClassifier::getNVars ( )
std::vector< int > gcg::VarClassifier::getNVarsOfClasses ( )

returns a vector with the numbers of variables that are assigned to the classes

Definition at line 160 of file class_varclassifier.cpp.

References gcg::IndexClassifier::getNIndicesOfClasses().

Referenced by DEC_DECL_PROPAGATEFROMTOOLBOX(), and GCGwriteCls().

const int * gcg::VarClassifier::getVarsToClasses ( )

returns vector containing the assigned class of each variable

Definition at line 144 of file class_varclassifier.cpp.

References gcg::IndexClassifier::getIndicesToClasses().

bool gcg::VarClassifier::isVarClassified ( int  givenVarindex)

returns whether a variable is already assigned to a class

Parameters
givenVarindexindex of variable

Definition at line 167 of file class_varclassifier.cpp.

References gcg::IndexClassifier::isIndexClassified().

VarClassifier * gcg::VarClassifier::reduceClasses ( int  givenMaxNumber)

returns classifier 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 classifier with reduced number of classes

create new VarClassifier

reassign vars

set new class names and descriptions (enlarged class has index 0)

Parameters
givenMaxNumberupper bound

Definition at line 173 of file class_varclassifier.cpp.

References gcg::ALL, assignVarToClass(), getClassDecompInfo(), gcg::IndexClassifier::getClassDescription(), gcg::IndexClassifier::getClassName(), getClassOfVar(), gcg::IndexClassifier::getName(), gcg::IndexClassifier::getNClasses(), getNVars(), gcg::IndexClassifier::reduceClasses(), setClassDecompInfo(), gcg::IndexClassifier::setClassDescription(), gcg::IndexClassifier::setClassName(), and VarClassifier().

void gcg::VarClassifier::setClassDecompInfo ( int  givenClassindex,
VAR_DECOMPINFO  givenDecompInfo 
)

sets the decomposition code of a class

Parameters
givenClassindexindex of class
givenDecompInfodecomposition code of class

Definition at line 221 of file class_varclassifier.cpp.

References gcg::ALL, gcg::BLOCK, gcg::LINKING, gcg::MASTER, and gcg::IndexClassifier::setClassDecompInfo().

Referenced by addClass(), gcg::Seeedpool::createVarClassifierForObjValueSigns(), reduceClasses(), and gcg::Seeedpool::translateSeeeds().