GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
gcg::ConsPartition Class Reference

Detailed Description

Definition at line 59 of file class_conspartition.h.

#include <class_conspartition.h>

Public Member Functions

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

◆ ConsPartition() [1/2]

gcg::ConsPartition::ConsPartition ( GCG * gcgstruct,
const char * givenName,
int givenNClasses,
int givenNCons )

constructor

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

Definition at line 48 of file class_conspartition.cpp.

References gcg::IndexPartition::IndexPartition().

Referenced by ConsPartition(), and reduceClasses().

◆ ConsPartition() [2/2]

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

copy constructor

Parameters
toCopyConsPartition to be copied

Definition at line 60 of file class_conspartition.cpp.

References ConsPartition(), and gcg::IndexPartition::IndexPartition().

◆ ~ConsPartition()

gcg::ConsPartition::~ConsPartition ( )

destructor

Definition at line 67 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 72 of file class_conspartition.cpp.

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

Referenced by GCG_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 81 of file class_conspartition.cpp.

References gcg::IndexPartition::assignIndexToClass().

Referenced by GCG_DECL_CONSCLASSIFY(), GCG_DECL_CONSCLASSIFY(), GCG_DECL_CONSCLASSIFY(), GCG_DECL_CONSCLASSIFY(), GCG_DECL_CONSCLASSIFY(), GCG_DECL_CONSCLASSIFY(), GCG_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 87 of file class_conspartition.cpp.

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

Referenced by GCG_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 100 of file class_conspartition.cpp.

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

Referenced by GCG_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 127 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 133 of file class_conspartition.cpp.

References gcg::IndexPartition::getClassOfIndex().

Referenced by GCG_DECL_PROPAGATEPARTIALDEC(), reduceClasses(), and writeCls().

◆ getConssToClasses()

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

returns vector containing the assigned class of each constraint

Definition at line 139 of file class_conspartition.cpp.

References gcg::IndexPartition::getIndicesToClasses().

◆ getNConss()

int gcg::ConsPartition::getNConss ( )

◆ getNConssOfClasses()

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

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

Definition at line 155 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 162 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 168 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(), i, gcg::IndexPartition::reduceClasses(), 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 215 of file class_conspartition.cpp.

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

Referenced by addClass(), and reduceClasses().