DetProbData

class pygcgopt.gcg.DetProbData

Base class holding a pointer to corresponding DETPROBDATA

addCandidatesNBlocksNVotes(self, int candidate, int nvotes)

adds a candidate for block number and counts how often a candidate is added

Parameters:
  • candidate (int) – candidate for block size

  • nvotes (int) – number of votes this candidates will get

addConsPartition(self, ConsPart partition)

adds a constraint partition if it is no duplicate of an existing constraint partition

Parameters:

partition (ConsPart) – constraint partition object

addPartialdecToAncestor(self, PartialDecomposition partialdec)

adds a partialdec to ancestor partialdecs

Parameters:

partialdec (PartialDecomposition) – partialdec that is added to the ancestor partialdecs

addPartialdecToFinished(self, PartialDecomposition partialdec)

adds a partialdec to finished partialdecs

Parameters:

partialdec (PartialDecomposition) – pointer of partialdec that is going to be added to the finished partialdecs (data structure to carry finished decompositions)

Returns:

True if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)

Return type:

bool

addPartialdecToFinishedUnchecked(self, PartialDecomposition partialdec)

adds a partialdec to finished partialdecs without checking for duplicates, dev has to check this on his own

Parameters:

partialdec (PartialDecomposition) – pointer of partialdec that is going to be added unchecked to the finished partialdecs (data structure to carry finished decompositions)

addPartialdecToOpen(self, PartialDecomposition partialdec)

adds a partialdec to current partialdecs (data structure for partialdecs that are going to processed in the propagation rounds)

Parameters:

partialdec (PartialDecomposition) – pointer of partialdec to be added

Returns:

True if the partialdecs was successfully added (i.e. it is no duplicate of a known partialdec)

Return type:

bool

addVarPartition(self, VarPart partition)

adds a variable partition if it is no duplicate of an existing variable partition

Parameters:

partition (VarPart) – variable partition object

candidatesNBlocks(self, candidatesNBlocks)
classificationtime(self, double classificationtime)
clearAncestorPartialdecs(self)

clears ancestor partialdec data structure

Note

does not free the partialdecs themselves

clearCurrentPartialdecs(self)

clears current partialdec data structure

Note

does not free the partialdecs themselves.

clearFinishedPartialdecs(self)

clears finished partialdec data structure

Note

does not free the partialdecs themselves.

conspartitioncollection(self, conspartitioncollection)
createConsPart(self, name, nclasses, ncons)

returns a ConsPart object

Parameters:
  • name (str) – name of the constraint partition

  • nclasses (int) – number of classes

  • ncons (int) – number of constraints

Returns:

constraint partition object

Return type:

ConsPart

createConssAdjacency(self)

creates the constraint adjacency datastructure that is used (if created) for some methods to faster access the constarints that have variables in common

createVarPart(self, name, nclasses, nvars)

returns a VarPart object

Parameters:
  • name (str) – name of the variable partition

  • nclasses (int) – number of classes

  • nvars (int) – number of variables

Returns:

variable partition object

Return type:

VarPart

freeTemporaryData(self)

frees temporary data that is only needed during the detection process

getAncestorPartialdec(self, partialdecindex)

returns a partialdec from ancestor partialdec data structure with given index

Parameters:

partialdecindex (int) – index of the partialdec

Returns:

partialdec from ancestor partialdec

Return type:

PartialDecomposition

getCons(self, consIndex)

returns constraint related to a constraint index

Parameters:

consIndex (int) – index of a constraint

Returns:

constraint related to a constraint index

Return type:

Constraint

getConsPartition(self, partitionIndex)

returns a constraint partition

Parameters:

partitionIndex (int) – index of a constraint partition

Returns:

constraint partition object

Return type:

ConsPart

getConsPartitions(self)

returns list to stored constraint partitions

Returns:

list to stored constraint partitions

Return type:

list

getConssForCons(self, consIndex)

returns list of constraint indices that have a common variable with the given constraint

Note

constraint adjacency data structure has to initilized

Parameters:

consIndex (int) – index of constraint

Returns:

list of constraint indices that have a common variable with the given constraint

Return type:

list

getConssForVar(self, varIndex)

returns the constraint indices of the coefficient matrix for a variable

Parameters:

varIndex (int) – index of variable

Returns:

list of constraint indices that have a nonzero entry with this variable

Return type:

list

getFinishedPartialdec(self, int partialdecindex)

returns a partialdec from finished partialdec data structure

Parameters:

partialdecindex (int) – index of partialdec

Returns:

partialdec from finished partialdec data structure

Return type:

PartialDecomposition

getFinishedPartialdecs(self)

gets all finished partialdecs

Returns:

all finished partialdecs

Return type:

list

getIndexForCons(self, Constraint cons)

returns the constraint index related to a constraint

Parameters:

cons (Constraint) – constraint the index is asked for

Returns:

the constraint index related to constraint

Return type:

int

getIndexForVar(self, Variable var)

returns the variable index related to a variable

Parameters:

var (Variable) – variable the index is asked for

Returns:

the variable index related to variable

Return type:

int

getModel(self)

returns the corresponding Model instance wrapping the scip data structure

Returns:

the corresponding Model instance wrapping scip data structure

Return type:

pyscipopt.Model

getNAncestorPartialdecs(self)

returns size of ancestor partialdec data structure

Returns:

size of ancestor partialdec data structure

Return type:

int

getNConsPartitions(self)

returns number of different constraint partitions

Returns:

number of different constraint partitions

Return type:

int

getNConss(self)

returns the number of variables considered in the detprobdata

Returns:

number of variables considered in the detprobdata

Return type:

int

getNConssForCons(self, consIndex)

returns the number of constraints for a given constraint index

Parameters:

consIndex (int) – index of constraint

Returns:

the number of constraints for a given constraint index

Return type:

int

getNConssForVar(self, varIndex)

returns the number of constraints for a given variable index where the variable has a nonzero entry in

Parameters:

varIndex (int) – index of variable

Returns:

the number of constraints for a given variable

Return type:

int

getNFinishedPartialdecs(self)

size of finished partialdec data structure

Returns:

size of finished partialdec data structure

Return type:

int

getNNonzeros(self)

returns the number of nonzero entries in the coefficient matrix

Returns:

the number of nonzero entries in the coefficient matrix

Return type:

int

getNOpenPartialdecs(self)

returns size of current (open) partialdec data structure

Returns:

size of current (open) partialdec data structure

Return type:

int

getNPartialdecs(self)

returns the number of stored partialdecs

Returns:

number of stored partialdecs

Return type:

int

getNVarPartitions(self)

returns number of different variable partitions

Returns:

number of different variable partitions

Return type:

int

getNVars(self)

return the number of variables considered in the detprobdata

Returns:

the number of variables considered in the detprobdata

Return type:

int

getNVarsForCons(self, consIndex)

returns the number of variables for a given constraint

Parameters:

consIndex (int) – index of constraint

Returns:

the number of variables for a given constraint

Return type:

int

getOpenPartialdecs(self)

determines all partialdecs from current (open) partialdec data structure

Returns:

all partialdecs in current (open) partialdec data structure

Return type:

list

getOrigVarsFixedZero(self)

returns list of all original variables that are fixed to zero

Returns:

list of variables

Return type:

list

getRelevantConss(self)

returns list of all constraints that are not marked as deleted or obsolete

Returns:

list of constraints

Return type:

list

getRelevantVars(self)

returns list of all problem variables that are not fixed to 0

Returns:

list of variables

Return type:

list

getSortedCandidatesNBlocks(self, candidates)

gets the candidates for number of blocks added by the user followed by the found ones sorted in descending order by how often a candidate was proposed

Parameters:

candidates (object) – will contain the candidates for number of blocks sorted in descending order by how often a candidate was added

getVal(self, row, col)

returns a coefficient from the coefficient matrix

Parameters:
  • row (int) – index of the constraint to be considered

  • col (int) – index of the variable to be considered

Returns:

a coefficient from the coefficient matrix

Return type:

double

getValsForCons(self, consIndex)

returns the nonzero coefficients of the coefficient matrix for a constraint

Note

same order as in getVarsForCons()

Parameters:

consIndex (int) – index of constraint

Returns:

list of coefficients of in matrix for constraints

Return type:

list

getVar(self, varIndex)

returns variable related to a variable index

Returns:

variable related to a variable index

Return type:

Variable

getVarPartition(self, partitionIndex)

returns variable partition with given index

Parameters:

partitionIndex (int) – index of variable partition

Returns:

variable partition with given index

Return type:

VarPart

getVarPartitions(self)

returns list to stored variable partitions

Returns:

list to stored variable partitions

Return type:

list

getVarsForCons(self, consIndex)

returns the variable indices of the coefficient matrix for a constraint

Parameters:

consIndex (int) – index of constraint

Returns:

list of the variable indices of the coefficient matrix for a constraint

Return type:

list

isAssignedToOrigProb(self)

returns True if the matrix structure corresponds to the presolved problem

Returns:

True if the matrix structure corresponds to the presolved problem

Return type:

bool

isConsCardinalityCons(self, consIndex)

returns whether a constraint is a cardinality constraint, i.e. of the .. math::sum_{i} x_i = b

Parameters:

consIndex (int) – index of constraint

Returns:

returns whether a constraint is a cardinality constraint

Return type:

bool

isConsSetpp(self, consIndex)

is cons with specified indec partitioning, or packing covering constraint?

Parameters:

consIndex (int) – index of constraint

Returns:

is constraint with specified index partitioning or packing covering constraint

Return type:

bool

isConsSetppc(self, consIndex)

is cons with specified index partitioning packing, or covering constraint?

Parameters:

consIndex (int) – index of constraint

Returns:

whether a constraint is partitioning packing, or covering constraint?

Return type:

bool

isConssAdjInitialized(self)

determines whether or not the constraint-constraint adjacency data structure is initilized

Returns:

True iff the constraint-constraint adjacency data structure is initilized

Return type:

bool

isPartialdecDuplicateofFinished(self, PartialDecomposition partialdec)

checks if partialdec is a duplicate of an existing finished partialdec

Parameters:

partialdec (PartialDecomposition) – partialdec to be checked

Returns:

True iff partialdec is a duplicate of an existing finished partialdec

Return type:

bool

nblockscandidatescalctime(self, double nblockscandidatescalctime)
partialdecIsNoDuplicateOfPartialdecs(self, PartialDecomposition comppartialdec, partialdecs, sort)

check if partialdec is a duplicate of any given partialdecs

Parameters:
  • comppartialdec (PartialDecomposition) – partialdec to be checked

  • partialdecs (object) – partialdecs to compare with

  • sort (bool) – sort the vars and conss data structures in the partialdecs by their indices

Returns:

True iff partialdec is no duplicate of any given partialdecs

Return type:

bool

postprocessingtime(self, double postprocessingtime)
sortFinishedForScore(self)

sorts partialdecs in finished partialdecs data structure according to the current scoretype

translatePartialdecs(self, DetProbData otherdata, otherpartialdecs)

translates partialdecs if the index structure of the problem has changed, e.g. due to presolving

Parameters:
  • otherdata (DetProbData) – old detprobdata

  • otherpartialdecs (object) – partialdecs to be translated

Returns:

translated partialdecs

Return type:

list

translatingtime(self, double translatingtime)
varpartitioncollection(self, varpartitioncollection)