Scippy

GCG

Branch-and-Price & Column Generation for Everyone

gcg::VarPartition Class Reference

Detailed Description

Definition at line 60 of file class_varpartition.h.

#include <class_varpartition.h>

Public Member Functions

GCG_EXPORT VarPartition (GCG *gcgstruct, const char *name, int nClasses, int nVars)
 
GCG_EXPORT VarPartition (const VarPartition *toCopy)
 
GCG_EXPORT ~VarPartition ()
 
GCG_EXPORT int addClass (const char *name, const char *desc, VAR_DECOMPINFO decompInfo)
 
GCG_EXPORT void assignVarToClass (int varindex, int classindex)
 
GCG_EXPORT std::vector< std::vector< int > > getAllSubsets (bool all, bool linking, bool master, bool block)
 
GCG_EXPORT VAR_DECOMPINFO getClassDecompInfo (int classindex)
 
GCG_EXPORT const char * getClassNameOfVar (int varindex)
 
GCG_EXPORT int getClassOfVar (int varindex)
 
GCG_EXPORT const int * getVarsToClasses ()
 
GCG_EXPORT int getNVars ()
 
GCG_EXPORT std::vector< int > getNVarsOfClasses ()
 
GCG_EXPORT bool isVarClassified (int varindex)
 
GCG_EXPORT VarPartition * reduceClasses (int maxNumberOfClasses)
 
GCG_EXPORT void setClassDecompInfo (int classindex, VAR_DECOMPINFO decompInfo)
 
- Public Member Functions inherited from gcg::IndexPartition
GCG_EXPORT bool isDuplicateOf (IndexPartition *otherPartition)
 
GCG_EXPORT const char * getClassDescription (int classindex)
 
GCG_EXPORT const char * getClassName (int classindex)
 
GCG_EXPORT const char * getName ()
 
GCG_EXPORT int getNClasses ()
 
GCG_EXPORT std::vector< int > reduceClasses (int maxNumberOfClasses)
 
GCG_EXPORT int removeEmptyClasses ()
 
GCG_EXPORT void setClassDescription (int classindex, const char *desc)
 
GCG_EXPORT void setClassName (int classindex, const char *name)
 

Additional Inherited Members

- Protected Member Functions inherited from gcg::IndexPartition
 IndexPartition (GCG *gcgstruct, 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
GCG * gcg
 

Constructor & Destructor Documentation

◆ VarPartition() [1/2]

gcg::VarPartition::VarPartition ( GCG *  gcgstruct,
const char *  givenName,
int  givenNClasses,
int  givenNVars 
)

constructor

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

Definition at line 48 of file class_varpartition.cpp.

Referenced by reduceClasses().

◆ VarPartition() [2/2]

gcg::VarPartition::VarPartition ( const VarPartition *  toCopy)

copy constructor

Parameters
toCopyVarPartition to be copied

Definition at line 60 of file class_varpartition.cpp.

◆ ~VarPartition()

gcg::VarPartition::~VarPartition ( )

destructor

Definition at line 67 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
givenNamename of the class (will be copied)
givenDescdescription of the class (will be copied)
givenDecompInfodecomposition code of the class

Definition at line 72 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
givenVarindexindex of the variable
givenClassindexindex of the class

Definition at line 81 of file class_varpartition.cpp.

References gcg::IndexPartition::assignIndexToClass().

Referenced by GCG_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
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 87 of file class_varpartition.cpp.

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

Referenced by GCG_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
givenClassindexindex of class

Definition at line 103 of file class_varpartition.cpp.

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

Referenced by GCG_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
givenVarindexindex of variable

Definition at line 134 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
givenVarindexindex of variable

Definition at line 140 of file class_varpartition.cpp.

References gcg::IndexPartition::getClassOfIndex().

Referenced by GCG_DECL_PROPAGATEPARTIALDEC(), and reduceClasses().

◆ getVarsToClasses()

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

returns vector containing the assigned class of each variable

Definition at line 146 of file class_varpartition.cpp.

References gcg::IndexPartition::getIndicesToClasses(), and NULL.

◆ getNVars()

int gcg::VarPartition::getNVars ( )

returns the number of variables

Definition at line 156 of file class_varpartition.cpp.

References gcg::IndexPartition::getNIndices().

Referenced by GCG_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 162 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
givenVarindexindex of variable

Definition at line 169 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
givenMaxNumberupper bound

Definition at line 175 of file class_varpartition.cpp.

References gcg::ALL, assignVarToClass(), getClassDecompInfo(), gcg::IndexPartition::getClassDescription(), gcg::IndexPartition::getClassName(), getClassOfVar(), gcg::IndexPartition::getName(), gcg::IndexPartition::getNClasses(), getNVars(), NULL, gcg::IndexPartition::reduceClasses(), 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
givenClassindexindex of class
givenDecompInfodecomposition code of class

Definition at line 222 of file class_varpartition.cpp.

References gcg::ALL, gcg::MASTER, and gcg::IndexPartition::setClassDecompInfo().

Referenced by addClass(), GCG_DECL_VARCLASSIFY(), and reduceClasses().