Scippy

GCG

Branch-and-Price & Column Generation for Everyone

gcg::ConsPartition Class Reference

Detailed Description

Definition at line 53 of file class_conspartition.h.

#include <class_conspartition.h>

Public Member Functions

 ConsPartition (SCIP *scip, const char *name, int nClasses, int nConss)
 
 ConsPartition (const ConsPartition *toCopy)
 
 ~ConsPartition ()
 
int addClass (const char *name, const char *desc, CONS_DECOMPINFO decompInfo)
 
void assignConsToClass (int consindex, int classindex)
 
std::vector< std::vector< int > > getAllSubsets (bool both, bool only_master, bool only_pricing)
 
CONS_DECOMPINFO getClassDecompInfo (int classindex)
 
const char * getClassNameOfCons (int consindex)
 
int getClassOfCons (int consindex)
 
const int * getConssToClasses ()
 
int getNConss ()
 
std::vector< int > getNConssOfClasses ()
 
bool isConsClassified (int consindex)
 
ConsPartitionreduceClasses (int maxNumberOfClasses)
 
void setClassDecompInfo (int classindex, CONS_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

◆ ConsPartition() [1/2]

gcg::ConsPartition::ConsPartition ( SCIP *  _scip,
const char *  givenName,
int  givenNClasses,
int  givenNCons 
)

constructor

Parameters
_scipscip data structure
givenNamename of partition (will be copied)
givenNClassesinitial number of classes
givenNConsnumber of constraints to be classified

Definition at line 47 of file class_conspartition.cpp.

Referenced by reduceClasses().

◆ ConsPartition() [2/2]

gcg::ConsPartition::ConsPartition ( const ConsPartition toCopy)

copy constructor

Parameters
toCopyConsPartition to be copied

Definition at line 59 of file class_conspartition.cpp.

◆ ~ConsPartition()

gcg::ConsPartition::~ConsPartition ( )

destructor

Definition at line 66 of file class_conspartition.cpp.

Member Function Documentation

◆ addClass()

int gcg::ConsPartition::addClass ( const char *  givenName,
const char *  givenDesc,
CONS_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_conspartition.cpp.

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

Referenced by DEC_DECL_CONSCLASSIFY().

◆ assignConsToClass()

void gcg::ConsPartition::assignConsToClass ( int  givenConsindex,
int  givenClassindex 
)

assigns a constraint to a class

Parameters
givenConsindexindex of the constraint
givenClassindexindex of the class

Definition at line 80 of file class_conspartition.cpp.

References gcg::IndexPartition::assignIndexToClass().

Referenced by DEC_DECL_CONSCLASSIFY(), and reduceClasses().

◆ getAllSubsets()

std::vector< std::vector< int > > gcg::ConsPartition::getAllSubsets ( bool  both,
bool  only_master,
bool  only_pricing 
)

returns a vector containing all possible subsets of the chosen classindices

Parameters
bothtrue, if BOTH classes should be considered
only_mastertrue, if ONLY_MASTER classes should be considered
only_pricingtrue, if ONLY_PRICING classes should be considered

Definition at line 86 of file class_conspartition.cpp.

References gcg::BOTH, gcg::IndexPartition::getAllSubsets(), getClassDecompInfo(), gcg::IndexPartition::getNClasses(), gcg::ONLY_MASTER, and gcg::ONLY_PRICING.

Referenced by DEC_DECL_PROPAGATEPARTIALDEC().

◆ getClassDecompInfo()

CONS_DECOMPINFO gcg::ConsPartition::getClassDecompInfo ( int  givenClassindex)

returns the decomposition info of a class

returns the decomposition code of a class

Parameters
givenClassindexindex of class

Definition at line 99 of file class_conspartition.cpp.

References gcg::BOTH, gcg::IndexPartition::getClassDecompInfo(), gcg::ONLY_MASTER, and gcg::ONLY_PRICING.

Referenced by DEC_DECL_PROPAGATEPARTIALDEC(), getAllSubsets(), and reduceClasses().

◆ getClassNameOfCons()

const char * gcg::ConsPartition::getClassNameOfCons ( int  givenConsindex)

returns the name of the class a constraint is assigned to

Parameters
givenConsindexindex of constraint

Definition at line 126 of file class_conspartition.cpp.

References gcg::IndexPartition::getClassNameOfIndex().

◆ getClassOfCons()

int gcg::ConsPartition::getClassOfCons ( int  givenConsindex)

returns the index of the class a constraint is assigned to

Parameters
givenConsindexindex of constraint

Definition at line 132 of file class_conspartition.cpp.

References gcg::IndexPartition::getClassOfIndex().

Referenced by DEC_DECL_PROPAGATEPARTIALDEC(), and reduceClasses().

◆ getConssToClasses()

const int * gcg::ConsPartition::getConssToClasses ( )

returns vector containing the assigned class of each constraint

Definition at line 138 of file class_conspartition.cpp.

References gcg::IndexPartition::getIndicesToClasses().

◆ getNConss()

int gcg::ConsPartition::getNConss ( )

returns the number of constraints

Definition at line 148 of file class_conspartition.cpp.

References gcg::IndexPartition::getNIndices().

Referenced by DEC_DECL_CONSCLASSIFY(), and reduceClasses().

◆ getNConssOfClasses()

std::vector< int > gcg::ConsPartition::getNConssOfClasses ( )

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

Definition at line 154 of file class_conspartition.cpp.

References gcg::IndexPartition::getNIndicesOfClasses().

◆ isConsClassified()

bool gcg::ConsPartition::isConsClassified ( int  givenConsindex)

returns whether a constraint is already assigned to a class

Parameters
givenConsindexindex of constraint

Definition at line 161 of file class_conspartition.cpp.

References gcg::IndexPartition::isIndexClassified().

◆ reduceClasses()

ConsPartition * gcg::ConsPartition::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 167 of file class_conspartition.cpp.

References assignConsToClass(), gcg::BOTH, ConsPartition(), getClassDecompInfo(), gcg::IndexPartition::getClassDescription(), gcg::IndexPartition::getClassName(), getClassOfCons(), gcg::IndexPartition::getName(), gcg::IndexPartition::getNClasses(), getNConss(), gcg::IndexPartition::reduceClasses(), gcg::IndexPartition::scip, setClassDecompInfo(), gcg::IndexPartition::setClassDescription(), and gcg::IndexPartition::setClassName().

Referenced by reduceConsclasses().

◆ setClassDecompInfo()

void gcg::ConsPartition::setClassDecompInfo ( int  givenClassindex,
CONS_DECOMPINFO  givenDecompInfo 
)

sets the decomposition code of a class

Parameters
givenClassindexindex of class
givenDecompInfodecomposition code of class

Definition at line 214 of file class_conspartition.cpp.

References gcg::BOTH, gcg::ONLY_MASTER, gcg::ONLY_PRICING, and gcg::IndexPartition::setClassDecompInfo().

Referenced by addClass(), and reduceClasses().