Partition¶
- class pygcgopt.gcg.ConsPart¶
Base class holding a pointer to corresponding ConsPartition
- addClass(self, name, desc, decompInfo)¶
adds a new class to the constraint partition
- Parameters:
name (str) – name of the class
desc (str) – description of the class
decompInfo (
CONS_DECOMPINFO
) – decomposition information of the constraint class
- Returns:
index of the added class
- Return type:
int
- assignConsToClass(self, Constraint cons, classindex)¶
assigns a constraint to the class corresponding to the classindex
- Parameters:
cons (
Constraint
) – constraint that should be assigned to a classclassindex (int) – index of the class
- getAllSubsets(self, both, only_master, only_pricing)¶
returns a list containing all possible subsets of the chosen classindices
- Parameters:
both (bool) – True iff PY_BOTH classes should be considered
only_master (bool) – True iff PY_ONLY_MASTER classes should be considered
only_pricing (bool) – True iff PY_ONLY_PRICING classes should be considered
- Returns:
list of lists containing all possible subsets of the chosen classindices
- Return type:
list
- getClassDecompInfo(self, classindex)¶
returns the decomposition information of a class
- Parameters:
classindex (int) – index of the class
- Returns:
decomposition information of the constraint class
- Return type:
CONS_DECOMPINFO
- getClassDescription(self, classindex)¶
returns the description of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
- Returns:
description of the class
- Return type:
str
- getClassName(self, classindex)¶
returns the name of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
- Returns:
name of the class
- Return type:
str
- getClassNameOfCons(self, Constraint cons)¶
returns the name of the class a constraint is assigned to
- Parameters:
cons (
Constraint
) – constraint- Returns:
name of the class of the constraint
- Return type:
str
- getClassOfCons(self, Constraint cons)¶
returns the index of the class a constraint is assigned to
- Parameters:
cons (
Constraint
) – constraint- Returns:
classindex of the constraint
- Return type:
int
- getNClasses(self)¶
returns the number of classes of the constraint partition
- Returns:
number of classes
- Return type:
int
- getNConss(self)¶
returns the number of constraints of the constraint partition
- Returns:
number of constraints
- Return type:
int
- getNConssOfClasses(self)¶
returns list with the numbers of constraints that are assigned to the classes
- Returns:
list with the numbers of constraints that are assigned to the classes
- Return type:
list
- getName(self)¶
returns the name of the constraint partition
- Returns:
name of the constraint partition
- Return type:
str
- isConsClassified(self, Constraint cons)¶
returns whether a constraint is already assigned to a class
- Parameters:
cons (
Constraint
) – constraint that should be checked if it is already assigned to a class- Returns:
True iff variable is already assigned to a class
- Return type:
bool
- reduceClasses(self, maxNumberOfClasses)¶
returns constraint partition with reduced number of classes
- Parameters:
maxNumberOfClasses (int) – maximal number of classes that are allowed
- Returns:
- Return type:
- removeEmptyClasses(self)¶
removes all classes which do not have any assigned indices (classindices may change)
- Returns:
number of removed classes
- Return type:
int
- setClassDecompInfo(self, classindex, decompInfo)¶
sets the decomposition information of a class
- Parameters:
classindex (int) – index of the class
decompInfo (
CONS_DECOMPINFO
) – decomposition information of the constraint class
- setClassDescription(self, classindex, desc)¶
sets the description of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
desc (str) – description of the class
- setClassName(self, classindex, name)¶
sets the name of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
name (str) – name of the class
- class pygcgopt.gcg.VarPart¶
Base class holding a pointer to corresponding VarPartition
- addClass(self, name, desc, decompInfo)¶
adds a new class to the variable partition
- Parameters:
name (str) – name of the class
desc (str) – description of the class
decompInfo (
VAR_DECOMPINFO
) – decomposition information of the variable class
- Returns:
index of the added class
- Return type:
int
- assignVarToClass(self, Variable var, classindex)¶
assigns a variable to the class corresponding to the classindex
- Parameters:
var (
Variable
) – variable that should be assigned to a classclassindex (int) – index of the class
- getAllSubsets(self, all, linking, master, block)¶
returns a list containing all possible subsets of the chosen classindices
- Parameters:
all (bool) – True iff PY_ALL classes should be considered
linking (bool) – True iff PY_LINKING classes should be considered
master (bool) – True iff PY_MASTER classes should be considered
block (bool) – True iff PY_BLOCK classes should be considered
- Returns:
list of lists containing all possible subsets of the chosen classindices
- Return type:
list
- getClassDecompInfo(self, classindex)¶
returns the decomposition information of a class
- Parameters:
classindex (int) – index of the class
- Returns:
decomposition information of the variable class
- Return type:
VAR_DECOMPINFO
- getClassDescription(self, classindex)¶
returns the description of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
- Returns:
description of the class
- Return type:
str
- getClassName(self, classindex)¶
returns the name of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
- Returns:
name of the class
- Return type:
str
- getClassNameOfVar(self, Variable var)¶
returns the name of the class a variable is assigned to
- Parameters:
var (
Variable
) – variable- Returns:
name of the class of the variable
- Return type:
str
- getClassOfVar(self, Variable var)¶
returns the index of the class a variable is assigned to
- Parameters:
var (
Variable
) – variable- Returns:
classindex of the variable
- Return type:
int
- getNClasses(self)¶
returns the number of classes of the variable partition
- Returns:
number of classes
- Return type:
int
- getNVars(self)¶
returns the number of variables of the variable partition
- Returns:
number of variables
- Return type:
int
- getNVarsOfClasses(self)¶
returns list with the numbers of variables that are assigned to the classes
- Returns:
list with the numbers of variables that are assigned to the classes
- Return type:
list
- getName(self)¶
returns the name of the variable partition
- Returns:
name of the constraint partition
- Return type:
str
- isVarClassified(self, Variable var)¶
returns whether a variable is already assigned to a class
- Parameters:
var (
Variable
) – variable that should be checked if it is already assigned to a class- Returns:
True iff variable is already assigned to a class
- Return type:
bool
- reduceClasses(self, maxNumberOfClasses)¶
returns variable partition with reduced number of classes
- Parameters:
maxNumberOfClasses (int) – maximal number of classes that are allowed
- Returns:
- Return type:
- removeEmptyClasses(self)¶
removes all classes which do not have any assigned indices (classindices may change)
- Returns:
number of removed classes
- Return type:
int
- setClassDecompInfo(self, classindex, decompInfo)¶
sets the decomposition information of a class
- Parameters:
classindex (int) – index of the class
decompInfo (
VAR_DECOMPINFO
) – decomposition information of the variable class
- setClassDescription(self, classindex, desc)¶
sets the description of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
desc (str) – description of the class
- setClassName(self, classindex, name)¶
sets the name of the class corresponding to the classindex
- Parameters:
classindex (int) – index of the class
name (str) – name of the class