Scippy

GCG

Branch-and-Price & Column Generation for Everyone

Detailed Description

Definition at line 52 of file class_indexpartition.h.

#include <class_indexpartition.h>

Public Member Functions

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)
 

Protected Member Functions

 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

GCG * gcg
 

Constructor & Destructor Documentation

◆ IndexPartition() [1/2]

gcg::IndexPartition::IndexPartition ( GCG *  gcgstruct,
const char *  givenName,
int  givenNClasses,
int  givenNIndices 
)
protected

constructor

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

Definition at line 54 of file class_indexpartition.cpp.

◆ IndexPartition() [2/2]

gcg::IndexPartition::IndexPartition ( const IndexPartition *  toCopy)
protected

copy constructor

Parameters
toCopyIndexPartition to be copied

Definition at line 68 of file class_indexpartition.cpp.

References gcg, and NULL.

◆ ~IndexPartition()

gcg::IndexPartition::~IndexPartition ( )
protectedvirtual

destructor

Definition at line 88 of file class_indexpartition.cpp.

Member Function Documentation

◆ addClass()

int gcg::IndexPartition::addClass ( const char *  givenName,
const char *  givenDesc 
)
protected

creates a new class, returns index of the class

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

Definition at line 93 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::addClass(), and gcg::VarPartition::addClass().

◆ assignIndexToClass()

void gcg::IndexPartition::assignIndexToClass ( int  givenIndex,
int  givenClassindex 
)
protected

assigns an index to a class

Parameters
givenIndexindex to be assigned
givenClassindexindex of the class

Definition at line 111 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::assignConsToClass(), and gcg::VarPartition::assignVarToClass().

◆ getAllSubsets()

std::vector< std::vector< int > > gcg::IndexPartition::getAllSubsets ( std::vector< int > &  givenClassindices)
protected

returns a vector containing all possible subsets of the given classindices

Parameters
givenClassindicesclassindices to be considered

Definition at line 165 of file class_indexpartition.cpp.

Referenced by gcg::VarPartition::getAllSubsets(), and gcg::ConsPartition::getAllSubsets().

◆ getClassDecompInfo()

int gcg::IndexPartition::getClassDecompInfo ( int  givenClassindex)
protected

returns the decomposition info of the a class

Parameters
givenClassindexindex of the class

Definition at line 185 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::getClassDecompInfo(), and gcg::VarPartition::getClassDecompInfo().

◆ getClassNameOfIndex()

const char * gcg::IndexPartition::getClassNameOfIndex ( int  givenIndex)
protected

returns the name of the class an index is assigned to

Definition at line 209 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::getClassNameOfCons(), and gcg::VarPartition::getClassNameOfVar().

◆ getClassOfIndex()

int gcg::IndexPartition::getClassOfIndex ( int  givenIndex)
protected

returns the index of the class an index is assigned to

Definition at line 219 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::getClassOfCons(), gcg::VarPartition::getClassOfVar(), and isDuplicateOf().

◆ getIndicesToClasses()

std::vector< int > & gcg::IndexPartition::getIndicesToClasses ( )
protected

returns vector containing the assigned class of each index

Definition at line 227 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::getConssToClasses(), and gcg::VarPartition::getVarsToClasses().

◆ getNIndices()

int gcg::IndexPartition::getNIndices ( )
protected

returns the number of indices

Definition at line 247 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::getNConss(), gcg::VarPartition::getNVars(), and isDuplicateOf().

◆ getNIndicesOfClasses()

std::vector< int > gcg::IndexPartition::getNIndicesOfClasses ( )
protected

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

Definition at line 253 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::getNConssOfClasses(), and gcg::VarPartition::getNVarsOfClasses().

◆ isIndexClassified()

bool gcg::IndexPartition::isIndexClassified ( int  givenIndex)
protected

returns whether an index is already assigned to a class

Definition at line 269 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::isConsClassified(), isDuplicateOf(), and gcg::VarPartition::isVarClassified().

◆ setClassDecompInfo()

void gcg::IndexPartition::setClassDecompInfo ( int  givenClassindex,
int  givenDecompInfo 
)
protected

sets the decomposition info of the a class

Parameters
givenClassindexindex of the class
givenDecompInfodecomposition info

Definition at line 358 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::setClassDecompInfo(), and gcg::VarPartition::setClassDecompInfo().

◆ isDuplicateOf()

bool gcg::IndexPartition::isDuplicateOf ( IndexPartition *  otherPartition)

returns true if the other partition has an equivalent index structure, meaning that the partition of the set of constraints is the same ignoring the concrete classindices, classnames, etc.

Parameters
otherPartitionother partition to be checked

Definition at line 121 of file class_indexpartition.cpp.

References getClassOfIndex(), getNClasses(), getNIndices(), and isIndexClassified().

◆ getClassDescription()

const char * gcg::IndexPartition::getClassDescription ( int  givenClassindex)

returns the information text of a class

Parameters
givenClassindexindex of class

Definition at line 193 of file class_indexpartition.cpp.

Referenced by gcg::ConsPartition::reduceClasses(), and gcg::VarPartition::reduceClasses().

◆ getClassName()

const char * gcg::IndexPartition::getClassName ( int  givenClassindex)

returns the name of a class

Parameters
givenClassindexindex of class

Definition at line 201 of file class_indexpartition.cpp.

Referenced by GCG_DECL_PROPAGATEPARTIALDEC(), gcg::ConsPartition::reduceClasses(), and gcg::VarPartition::reduceClasses().

◆ getName()

◆ getNClasses()

◆ reduceClasses()

std::vector< int > gcg::IndexPartition::reduceClasses ( int  givenMaxNumber)

returns a class index mapping for creating a new partition the enlarged class is always the class with index 0 returns empty vector if the current number of classes is lower than an upper bound or greater than 2*(upper bound)

returns a class index mapping for creating a new partition

Parameters
givenMaxNumberupper bound

Definition at line 277 of file class_indexpartition.cpp.

References getNClasses().

Referenced by gcg::ConsPartition::reduceClasses(), and gcg::VarPartition::reduceClasses().

◆ removeEmptyClasses()

int gcg::IndexPartition::removeEmptyClasses ( )

removes all classes which do not have any assigned index (classindices may change) returns number of removed classes

removes all classes which do not have any assigned indices (classindices may change) returns number of removed classes

Definition at line 314 of file class_indexpartition.cpp.

Referenced by GCG_DECL_CONSCLASSIFY(), and GCG_DECL_VARCLASSIFY().

◆ setClassDescription()

void gcg::IndexPartition::setClassDescription ( int  givenClassindex,
const char *  givenDesc 
)

sets the information text of a class

Parameters
givenClassindexindex of class
givenDescdescription of class (will be copied)

Definition at line 366 of file class_indexpartition.cpp.

Referenced by GCG_DECL_CONSCLASSIFY(), GCG_DECL_VARCLASSIFY(), gcg::ConsPartition::reduceClasses(), and gcg::VarPartition::reduceClasses().

◆ setClassName()

void gcg::IndexPartition::setClassName ( int  givenClassindex,
const char *  givenName 
)

sets the name of a class

Parameters
givenClassindexindex of class
givenNamename of class (will be copied)

Definition at line 374 of file class_indexpartition.cpp.

Referenced by GCG_DECL_CONSCLASSIFY(), GCG_DECL_VARCLASSIFY(), gcg::ConsPartition::reduceClasses(), and gcg::VarPartition::reduceClasses().

Field Documentation

◆ gcg

GCG* gcg::IndexPartition::gcg
protected

GCG data structure

Definition at line 56 of file class_indexpartition.h.

Referenced by IndexPartition().