Decomposition¶
- class pygcgopt.gcg.PartialDecomposition¶
class to manage partial decompositions
each partialdec corresponds to one
DetProbData
which contains the problem information, there is one detprobdata for the original and the transformed problem.- addAncestorID(self, int ancestor)¶
adds ancestor id to back of list
- Parameters
ancestor – id of ancestor that is to be added.
- addBlock(self)¶
Adds a block
- Returns
the number (id) of the new block
- addClockTime(self, double clocktime)¶
Adds detection time of one detector
incorporates the needed time of some detector in the detector chain.
- addDecChangesFromAncestor(self, PartialDecomposition ancestor)¶
Adds the statistical differences to an ancestor
incorporates the changes from ancestor partialdec into the statistical data structures.
- addDetectorChainInfo(self, decinfo)¶
Add information about the detector chain
adds a detectorchain information string to the corresponding vector (that carries information for each detector call)
- addNNewBlocks(self, int nnewblocks)¶
Adds how many new blocks were introduced
bookkeeping information: adds number of new blocks created by a detector added to detector chain.
- addPctConssFromFree(self, double pct)¶
Adds percentage of closed constraints
bookkeeping information: fraction of constraints that are not longer open for a detector added to detector chain.
- addPctConssToBlock(self, double pct)¶
Adds percentage of constraints assigned to blocks
bookkeeping information: adds fraction of constraints assigned to a block for a detector added to detector chain
- addPctConssToBorder(self, double pct)¶
Adds percentage of constraints assigned to border
bookkeeping information: adds fraction of constraints assigned to the border for a detector added to detector chain.
- addPctVarsFromFree(self, double pct)¶
Adds percentage of closed variables
bookkeeping information: adds fraction of variables that are not longer open for a detector added to detector chain.
- addPctVarsToBlock(self, double pct)¶
Adds percentage of variables assigned to blocks
bookkeeping information: adds fraction of variables assigned to a block for a detector added to detector chain
- addPctVarsToBorder(self, double pct)¶
Adds percentage of variables assigned to border
bookkeeping information: adds fraction of variables assigned to the border for a detector added to detector chain.
- aggInfoCalculated(self)¶
Checks if the aggregation information was already calculated
- Returns
True iff the aggregation information was already calculated.
- alreadyAssignedConssToBlocks(self)¶
Method to check if at least one constraint is assigned to some block
- Returns
True iff at least one constraint is assigned to a block
- assignCurrentStairlinking(self)¶
Assigns open vars to stairlinking if appropriate
assigns open vars to stairlinking if they can be found in exactly two consecutive blocks
- Returns
True iff at least one stairlinkingvar was assigned.
- assignOpenConssToMaster(self)¶
Assigns open conss to master.
- assignPartialdecFromConstoblockVector(self, constoblock, int additionalNBlocks)¶
assigns conss structure according to given vector
adds blocks and assigns open conss to a new block or to master according to the cons assignment information given in constoblock vector
- Returns
scip return code
See also
assignPartialdecFromConstoblock()
Note
master is indicated by assigning cons to index additionalNBlocks.
- assignSmallestComponentsButOneConssAdjacency(self)¶
computes components by connectedness of conss and vars
computes components corresponding to connectedness of conss and vars and assigns them accordingly (all but one of largest components)
strategy: assigns all conss same block if they are connected two constraints are adjacent if there is a common variable
Note
this relies on the consadjacency structure of the detprobdata
hence it cannot be applied in presence of linking variables.
- bendersScore¶
gets the benders score
Note
-1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcBendersScore
- Returns
benders score.
- borderAreaScore¶
gets the border area score
Note
-1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcBorderAreaScore
- Returns
border area score.
- buildDecChainString(self, buffer)¶
creates a detector chain short string for this partialdec, is built from detector chain.
- calcAggregationInformation(self, bool ignoreDetectionLimits)¶
computes if aggregation of sub problems is possible
checks if aggregation of sub problems is possible and stores the corresponding aggregation information
- Parameters
ignoreDetectionLimits – Set to True if computation should ignore detection limits.
This parameter is ignored if the patched bliss version is not present.
- calcStairlinkingVars(self)¶
Reassigns linking vars to stairlinkingvars if possible
potentially reorders blocks for making a maximum number of linking vars stairlinking if all vars that connect exactly two blocks have a staircase structure, all of them become stairlinkingvars otherwise, the stairlinking assignment is done greedily .. note:: precondition: partialdec does not have any stairlinking vars.
- checkAllConssAssigned(self)¶
Checks if all conss are assigned
returns True iff all constraints are assigned and deletes the vector open conss if so
- Returns
True iff all constraints are assigned
- checkConsistency(self)¶
Checks whether the assignments in the partialdec are consistent
The following checks are performed: - check if nblocks is set appropriately - check for empty (row- and col-wise) blocks - every variable is assigned at most once - check if all not assigned variables are open vars - check if all open vars are not assigned - every constraint is assigned at most once - check if all not assigned constraints are open cons - check if all open conss are not assigned - check if the data structures are sorted - check if variables hitting a cons are either in the cons’s block or border or still open
- Returns
True iff the partialdec seems to be consistent
- classicScore¶
gets the classic score
Note
-1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcClassicScore
- Returns
border area score.
- complete(self)¶
Assigns all open constraints and open variables trivially
strategy: assigns all open conss and vars to blocks if they can be refined there, otherwise to the master
- Note
partialdecomps should usually be completed by a detector, only use this function if you know what you are doing.
- completeByConnected(self)¶
Assigns all open constraints and open variables
strategy: assigns all conss and vars to the same block if they are connected, a cons and a var are adjacent if the var appears in the cons.
- completeByConnectedConssAdjacency(self)¶
Assigns all open constraints and open variables
strategy: assigns all conss and vars to the same block if they are connected a cons and a var are adjacent if the var appears in the cons .. note:: this relies on the consadjacency structure of the detprobdata hence it cannot be applied in presence of linking variables.
- completeGreedily(self)¶
Assigns all open constraints and open variables
strategy: assigns a cons (and related vars) to a new block if possible, if not to an existing block if possible (by means of prior var assignments) and finally to master, if there does not exist such a block.
- considerImplicits(self)¶
Assigns every open cons/var.
Assignments happen as follows: - to the respective block if it hits exactly one blockvar/blockcons and no open vars/conss - to master/linking if it hits blockvars/blockconss assigned to different blocks - and every cons to master that hits a master var - and every var to master if it does not hit any blockcons and has no open cons - leave the cons/variableopen if nothing from the above holds
- copy(self)¶
- copyPartitionStatistics(self, PartialDecomposition otherpartialdec)¶
Copies the given partialdec’s partition statistics
- Parameters
otherpartialdec – partialdec whose partition statistics are to be copied.
- deleteEmptyBlocks(self, bool variables)¶
Deletes empty blocks and sets nblocks accordingly
A block is considered to be empty if no constraint is assigned to it, variables in blocks with no constraints become open
- Parameters
variables – if True, then blocks with no constraints but at least one variable are considered to be nonempty.
- deleteOpencons(self, int opencons)¶
Deletes a cons from list of open conss
- Parameters
opencons – id of the cons that is not considered open anymore.
- deleteOpenvar(self, int openvar)¶
Deletes a var from the list of open vars
- Parameters
openvar – id of the var that is not considered open anymore.
- displayInfo(self, int detailLevel)¶
displays the relevant information of the partialdec
- Parameters
detailLevel – pass a value that indicates how detailed the output should be:
0: brief overview 1: block and detector info 2: cons and var assignments.
- findVarsLinkingToMaster(self)¶
reassigns linking variables to master if appropriate
Variables are reassigned as master if the variable only hits master conss.
- findVarsLinkingToStairlinking(self)¶
reassigns variables classified as linking to stairlinking if appropriate
Variables are reassigned as master if the variable hits conss in exactly two consecutive blocks.
- fixConsToBlock(self, Constraint cons, block)¶
Adds a constraint to a block.
- Parameters
cons – scip#Constraint to add
block – identifier of block to add. Can be any hashable Python object.
- Returns
the internal block_id assigned to the block.
This method will automatically manage the blocks of the decomposition and create blocks if neccessary. The passed
block
identifiers will be mapped to internal block ids.To address the internal blocks directly, use
fixConsToBlockId()
.See also
- fixConsToBlockByName(self, consname, int blockid)¶
assigns a constraint by name to a block
See also
- Returns
True iff successful.
- fixConsToBlockId(self, Constraint cons, int block_id)¶
Adds a constraint to a block.
- Parameters
cons (Constraint) – scip#Constraint to add
block_id (int) – id of block to add.
- Note
The passed
block_id
has to by of type integer and use the internal numbering of blocks. Before
calling this method, one has to ensure that the specified block exists. A more convenient alternative is fixConsToBlock().
See also
- fixConsToMaster(self, Constraint cons)¶
Fixes a Constraint to the master constraints.
- Parameters
cons (Constraint) – scip#Constraint to add
- fixConsToMasterByName(self, consname)¶
assgins a constraint by name as master
See also
- Returns
True iff successful.
- fixConssToBlock(self, conss, block)¶
Adds all constraints to a block.
- Parameters
conss – An iterable of scip#Constraint objects
block – identifier of block to add. Can be any hashable Python object.
- Returns
the internal block_id assigned to the block.
See also
- fixConssToBlockId(self, conss, int block_id)¶
Adds all constraints to a block.
- Parameters
conss – An iterable of scip#Constraint objects
block_id – id of block to add.
See also
- fixConssToMaster(self, conss)¶
Fixes all constraints to the master constraints.
- Parameters
conss (An iterable of scip#Constraint objects) – An iterable of scip#Constraint objects
- Raises
TypeError – occurs if conss is not an Iterable
See also
- fixVarToBlock(self, int var, int block)¶
adds a variable to the linking variables
- Parameters
var – id of var to be added
block – id of block to be added.
- fixVarToBlockByName(self, varname, int blockid)¶
assigns a variable by name to a block
See also
- Returns
True iff successful.
- fixVarToLinking(self, int var)¶
adds a variable to the linking variables
- Parameters
var – var to be set to linking.
- fixVarToLinkingByName(self, varname)¶
assigns a variable by name to the linking variables
See also
- Returns
True iff successful.
- fixVarToMaster(self, int var)¶
adds a variable to the master variables
master variables hit only constraints in the master.
- fixVarToMasterByName(self, varname)¶
assigns a variable with given name as master
See also
- Returns
True iff successful.
- fixVarToStairlinking(self, int var, int firstblock)¶
adds a variable to the stairlinking variables
- Parameters
var – id of variable to be added
firstblock – stairlinking variables hit exactly two consecutive blocks, this is the index of the first of these blocks
Note
stairlinking variables are only registered in block with smaller index.
- getAncestorID(self, int ancestorindex)¶
gets partialdec id of given ancestor id
- Returns
partialdec id of given ancestor id.
- getAncestorList(self)¶
get ancestor ids as vector
- Returns
vector of ids of all ancestors id.
- getBlockConss(self, int block)¶
returns array containing constraints assigned to a block
- Parameters
block – id of the block the constraint indices are returned
- Returns
array containing constraints assigned to a block.
Note
This calls the corresponding getConssForBlock() method. For consistancy, the method was renamed in the Python API.
- getBlocksForRep(self, int repid)¶
get a vector of block ids that are identical to block with id repid
- Parameters
repid – id of the representative block
- Returns
vector of block ids that are identical to block with id repid.
- getConssForBlocks(self)¶
- getDetectorClockTime(self, int detectorchainindex)¶
returns the time that the detector related to the given detectorchainindex needed for detecting
- Returns
the clock time for the corresponding detector in the chain.
- getDetectorClockTimes(self)¶
returns a vector of the clock times that each detector needed that was involved in this partialdec
- Returns
vector of the clock times.
- getDetectorchainInfo(self)¶
Gets the detectorchain info vector
- Returns
detectorchain info vector.
- getDetprobdata(self)¶
Gets the corresponding detprobdata
- Returns
corresponding detprobdata.
- getFinishedByFinisher(self)¶
returns True iff this partialdec was finished by finishPartialdec() method of a detector
- Returns
True iff this partialdec was finished by finishPartialdec() method of a detector.
- getHashValue(self)¶
returns the calculated hash value of this partialdec
- Returns
the calculated hash value of this partialdec.
- getID(self)¶
returns the unique id of the partialdec
- Returns
the unique id of the partialdec.
- getLinkingvars(self)¶
returns array containing all linking vars indices
- Returns
vector containing all linking vars indices
Note
when accessed it is supposed to be sorted.
- getMasterconss(self)¶
Gets array containing all master conss indices
- Returns
array containing all master conss indices
Note
when accessed it is supposed to be sorted.
- getMastervars(self)¶
Gets array containing all master vars indices
master vars hit only constraints in the master, aka static variables :return: array containing all master vars indices.
- getNAncestors(self)¶
Gets number of ancestor partialdecs
- Returns
number of ancestor partialdecs.
- getNBlocks(self)¶
Gets the number of blocks
- Returns
number of blocks.
- getNCoeffsForBlock(self, int blockid)¶
Gets the number of nonzero coeffs in a certain block
- Parameters
blockid – of the block the number of nozerors are requested for
- Returns
number of nonzero coeffs in a certain block.
- getNCoeffsForMaster(self)¶
!Gets the number of nonzero coeffs in master :return: the number of nonzero coeffs in master.
- getNConss(self)¶
Gets the number of constraints
- Returns
number of constraints.
- getNConssForBlock(self, int block)¶
Gets size of the vector containing conss assigned to a block
- Parameters
block – id of the block the number of constraints is asked for
- Returns
size of the vector containing conss assigned to a block.
- getNDetectors(self)¶
Gets the number of detectors the partialdec is propagated by
- Returns
number of detectors the partialdec is propagated by.
- getNLinkingvars(self)¶
Gets size of the vector containing linking vars
- Returns
size of the vector containing linking vars.
- getNMasterconss(self)¶
Gets size of the vector containing master conss
- Returns
size of the vector containing master conss.
- getNMastervars(self)¶
Gets size of the vector containing master vars
master vars hit only constraints in the master :return: size of the vector containing master vars.
- getNNewBlocks(self, int detectorchainindex)¶
Gets number of blocks a detector added
- Returns
number of blocks a detector added.
- getNNewBlocksVector(self)¶
gets number of blocks the detectors in the detectorchain added
- Returns
number of blocks the detectors in the detectorchain added.
- getNOpenconss(self)¶
Gets size of vector containing constraints not assigned yet
- Returns
returns size of vector containing constraints not assigned yet.
- getNOpenvars(self)¶
Gets size of vector containing variables not assigned yet
- Returns
size of vector containing variables not assigned yet.
- getNReps(self)¶
Gets the number of blockrepresentatives
- Returns
the number of blockrepresentatives.
- getNStairlinkingvars(self, int block)¶
Gets size of the vector containing stairlinking vars
- Parameters
block – id of the block the size of the stairlinking vector is asked for
- Returns
size of the vector containing stairlinking vars.
- getNTotalStairlinkingvars(self)¶
Gets total number of stairlinking vars
- Returns
total number of stairlinking vars.
- getNVars(self)¶
Gets number of vars
- Returns
number of vars.
- getNVarsForBlock(self, int block)¶
Gets size of the vector containing vars assigned to a block
- Parameters
block – id of the block the number of variables is asked for
- Returns
size of the vector containing vars assigned to a block.
- getNVarsForBlocks(self)¶
Gets overall number of vars assigned to a block
- Returns
number of vars that are assigned to any block.
- getOpenconss(self)¶
Gets a vector containing constraint ids not assigned yet as vector
- Returns
returns a vector containing constraint ids not assigned yet as vector.
- getOpenconssVec(self)¶
Gets a vector containing constraint ids not assigned yet as vector
- Returns
returns a vector containing constraint ids not assigned yet as vector.
- getOpenvars(self)¶
Gets array containing variables not assigned yet
- Returns
returns array containing variables not assigned yet.
- getOpenvarsVec(self)¶
!Gets array containing variables not assigned yet as vector
- Returns
array containing variables not assigned yet as vector.
- getPctConssFromFree(self, int detectorchainindex)¶
Gets fraction of constraints that are not longer open for a detector
- Returns
fraction of constraints that are not longer open for a detector.
- getPctConssFromFreeVector(self)¶
Gets fraction of constraints that are not longer open for detectors in detectorchain
- Returns
vector of fractions of constraints that are not longer open for detectors in detectorchain.
- getPctConssToBlock(self, int detectorchainindex)¶
Gets fraction of constraints assigned to a block for a detector
- Returns
fraction of constraints assigned to a block for a detector.
- getPctConssToBlockVector(self)¶
Gets fraction of constraints assigned to a block for detectors in detectorchain
- Returns
vector of fractions of constraints assigned to a block for detectors in detectorchain.
- getPctConssToBorder(self, int detectorchainindex)¶
Gets fraction of constraints assigned to the border for a detector
- Returns
returns fraction of constraints assigned to the border for a detector
/ /**.
- getPctConssToBorderVector(self)¶
Gets fraction of constraints assigned to the border for detectors in detectorchain
- Returns
vector of fractions of constraints assigned to the border for detectors in detectorchain.
- getPctVarsFromFree(self, int detectorchainindex)¶
Gets fraction of variables that are not longer open for a detector
- Returns
index of the detector in the detectorchain.
- getPctVarsFromFreeVector(self)¶
Gets fraction of variables that are not longer open for detectors in detectorchain
- Returns
vector or fractions of variables that are not longer open for detectors in detectorchain.
- getPctVarsToBlock(self, int detectorchainindex)¶
Gets fraction of variables assigned to a block for a detector
- Returns
fraction of variables assigned to a block for a detector.
- getPctVarsToBlockVector(self)¶
returns fraction of variables assigned to a block for detectors in detectorchain
- Returns
vector of fractions of variables assigned to a block for detectors in detectorchain.
- getPctVarsToBorder(self, int detectorchainindex)¶
Gets fraction of variables assigned to the border for a detector
- Returns
fraction of variables assigned to the border for a detector.
- getPctVarsToBorderVector(self)¶
Gets fraction of variables assigned to the border for detectors in detectorchain
- Returns
vector of fractions of variables assigned to the border for detectors in detectorchain.
- getRepForBlock(self, int blockid)¶
Gets index of the representative block for a block, this might be blockid itself
- Parameters
blockid – id of the block the representative is asked for
- Returns
index of the representative block for a block, this might be blockid itself.
- getRepVarmap(self, int repid, int blockrepid)¶
Gets the represenation varmap
Var map is vector for represenative repid and the blockrepid-th block that is represented by repid
- Parameters
repid – id of representative
blockrepid – id of block
- Returns
the represenation varmap as vector for represenative repid and the blockrepid-th block that is represented by repid.
- getStairlinkingvars(self, int block)¶
Gets array containing stairlinking vars,
Note
if a stairlinking variable links block i and i+1 it is only stored in vector of block i
- Parameters
block – id of the block the stairlinking variable varctor is asked for
- Returns
array containing stairlinking vars,.
- getTranslatedpartialdecid(self)¶
- getUsergiven(self)¶
Gets the USERGIVEN status of this partialdecs
- Returns
the USERGIVEN status of this partialdecs
- getVarProbindexForBlock(self, int varid, int block)¶
Gets index in variables array of a block for a variable
- Parameters
varid – the id of the variable the index
block – the corresponding block id
- Returns
returns index in variables array of a block for a variable.
- getVarsForBlock(self, int block)¶
Gets array containing vars of a block
- Parameters
block – id of the block the vars are requested for
- Returns
returns array containing vars of a block.
- hasSetppMaster(self)¶
checks iff all master constraints set partitioning, or set packing constraints
- Returns
True iff all master constraints set partitioning, or set packing constraints.
- hasSetppcMaster(self)¶
checks iff all master constraints set partitioning, set packing, or set cover constraints
- Returns
True iff all master constraints set partitioning, set packing, or set cover.
- hasSetppccardMaster(self)¶
checks if all master constraints set partitioning, set packing, set cover, or cardinality constraints
- Returns
True iff all master constraints set partitioning, set packing, set cover, or cardinality constraints.
- isAssignedToOrigProb(self)¶
Gets whether the partialdec is from the presolved problem
- Returns
True iff the partialdec is from the presolved problem.
- isComplete(self)¶
Gets whether this partialdec is complete, i.e. it has no more open constraints and variables
- Returns
True iff this partialdec is complete
- isConsMastercons(self, int cons)¶
Gets whether the cons is a master cons
- Parameters
cons – id of ccons to check if it is master constraint
- Returns
True iff the cons is a master cons.
- isConsOpencons(self, int cons)¶
Gets whether the cons is an open cons
- Parameters
cons – id of cons to check
- Returns
True iff the cons is an open cons.
- isSelected¶
!Gets whether the partialdec is currently selected in explore menue
- Returns
True iff the partialdec is currently selected in explore menue.
- isTrivial(self)¶
Gets whether this partialdec is considered to be trivial
PARTIALDECOMP is considered trivial if all conss are in one block, all conss are in border, all variables linking or mastervars, or all constraints and variables are open :return: True iff this partialdec is considered to be trivial.
- isVarBlockvarOfBlock(self, int var, int block)¶
Checks whether the var is assigned to the block
- Parameters
var – id of var to check
block – id of block to check
- Returns
True iff the var is assigned to the block.
- isVarLinkingvar(self, int var)¶
Checks whether the var is a linking var
- Parameters
var – id of var to check
- Returns
True iff the var is a linking var.
- isVarMastervar(self, int var)¶
Checks whether the var is a master var
- Parameters
var – id of var to check
- Returns
True iff the var is a master var.
- isVarOpenvar(self, int var)¶
Checks whether the var is an open var
- Parameters
var – id of var to check
- Returns
True iff the var is an open var
/ /**.
- isVarStairlinkingvar(self, int var)¶
Checks whether the var is a stairlinking var
- Parameters
var – id of var to check
- Returns
True iff the var is a stairlinking var.
- isVarStairlinkingvarOfBlock(self, int var, int block)¶
Checks whether the var is a stairlinkingvar of a specified block
- Parameters
var – id of var to check if it is a stairlinking variable hitting specified block
block – id of block to check
- Returns
True iff the var is a stairlinkingvar of a specified block.
- maxForWhiteAggScore¶
gets the maximum foreseeing white area score with respect to aggregatable blocks
Note
-1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcMaxForeseeingWhiteAggScore
- Returns
maximum foreseeing white area score with respect to aggregatable blocks
- maxForWhiteScore¶
gets the maximum foreseeing white area score
Note
-1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcMaxForseeingWhiteScore
- Returns
maximum foreseeing white area score
- maxWhiteScore¶
gets the maximum white area score
“maximum white score” is fraction of the area of the decomposed matrix that is neither block or border .. note:: -1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcMaxWhiteScore :return: maximum white area score
- partForWhiteAggScore¶
gets the setpartitioning maximum foreseeing white area score with respect to aggregateable
Note
-1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcSetPartForWhiteAggScore
- Returns
setpartitioning maximum foreseeing white area score with respect to aggregateable.
- partForWhiteScore¶
gets the setpartitioning maximum foreseeing white area score
Note
-1 iff not calculated yet, .. seealso:: GGCGconshdlrDecompCalcSetPartForseeingWhiteScore
- Returns
setpartitioning maximum foreseeing white area score
- prepare(self)¶
sorts the partialdec and calculates a its implicit assignments, hashvalue and evaluation
- Returns
SCIP_OKAY if the result is consistent, SCIP_ERROR if there was an inconsistency.
- refineToBlocks(self)¶
refine partialdec with focus on blocks
strategy: assigns open conss and vars if they can be found in blocks (without respect to open vars and conss see assignHittingOpenconss(), see assignHittingOpenvars()) .. note:: partialdec might be not complete.
- refineToMaster(self)¶
refine partialdec with focus on master
strategy: do obvious ( see considerImplicits()) assignments and assign other conss and vars to master if possible (see assignOpenPartialHittingToMaster()).
- removeAncestorID(self, int ancestorid)¶
removes ancestor id from list.
- removeMastercons(self, int consid)¶
Removes the given cons from master.
- setAncestorList(self, newlist)¶
set ancestor list directly
- Parameters
newlist – new list of ancestor ids.
- setConsPartitionStatistics(self, int detectorchainindex, ConsPart partition, consclassesmaster)¶
registers statistics for a used conspartition.
- setConsToBlock(self, int consToBlock, int block)¶
adds a constraint to a block, does not delete this cons from list of open conss
- Parameters
consToBlock – id of cons to add
block – id of block to add.
- setConsToMaster(self, int consToMaster)¶
adds a constraint to the master constraints, does not delete this cons from list of open conss
- Parameters
consToMaster – id of cons to add.
- setDetectorClockTimes(self, newvector)¶
set statistical vector of the times that the detectors needed for detecting per involved detector
- Parameters
newvector – vector of the times that the detectors needed for detecting per involved detector.
- setFinishedByFinisher(self, bool finished)¶
sets whether this partialdec was finished by a finishing detector
- Parameters
finished – is this partialdecs finished by a finishing detector.
- setFinishedByFinisherOrig(self, bool finished)¶
sets whether this partialdec was finished by a finishing detector in the original problem (in case this partialdec was translated)
- Parameters
finished – was this partialdecs finished by a finishing detector in orig.
- setNBlocks(self, int nblocks)¶
sets number of blocks, only increasing number allowed
- Parameters
nblocks – new number of blocks.
- setPctConssFromFreeVector(self, newvector)¶
set statistical vector of fractions of constraints that are not longer open per involved detector
- Parameters
newvector – vector of fractions of constraints that are not longer open per involved detector.
- setPctConssToBlockVector(self, newvector)¶
set statistical vector of fractions of constraints set to blocks per involved detector
- Parameters
newvector – vector of fractions of constraints set to blocks per involved detector.
- setPctConssToBorderVector(self, newvector)¶
set statistical vector of fractions of constraints assigned to the border per involved detector
- Parameters
newvector – vector of fractions of constraints assigned to the border per involved detector.
- setPctVarsFromFreeVector(self, newvector)¶
set statistical vector of variables that are not longer open per involved detector
- Parameters
newvector – vector of fractions of variables that are not longer open per involved detector.
- setPctVarsToBlockVector(self, newvector)¶
set statistical vector of fractions of variables assigned to a block per involved detector
- Parameters
newvector – vector of fractions of variables assigned to a block per involved detector.
- setPctVarsToBorderVector(self, newvector)¶
set statistical vector of fraction of variables assigned to the border per involved detector
- Parameters
newvector – vector of fractions of variables assigned to the border per involved detector.
- setStemsFromOrig(self, bool fromorig)¶
sets whether this partialdec stems from an orig problem partialdec
- Parameters
fromorig – has this partialdec ancestors from the orig problem.
- setTranslatedpartialdecid(self, int decid)¶
- setUsergiven(self, USERGIVEN value=COMPLETED_CONSTOMASTER)¶
- setVarPartitionStatistics(self, int detectorchainindex, VarPart partition, varclasseslinking, varclassesmaster)¶
registers statistics for a used varpartition.
- setVarToBlock(self, int varToBlock, int block)¶
adds a variable to the linking variables, does not delete this var from list of open vars
- Parameters
varToBlock – id of var to be added
block – id of block to be added.
- setVarToLinking(self, int varToLinking)¶
adds a variable to the linking variables, does not delete this var from list of open vars
- Parameters
varToLinking – var to be set to linking.
- setVarToMaster(self, int varToMaster)¶
adds a variable to the master variables, does not delete this var from list of open vars
master variables hit only constraints in the master.
- setVarToStairlinking(self, int varToStairLinking, int block1, int block2)¶
adds a variable to the stairlinking variables, does not delete this var from list of open vars
- Parameters
varToStairLinking – id of variable to be added
block1 – id of block one
block2 – id of block two
Note
stairlinking variables are only registered in block with smaller index.
- shouldCompletedByConsToMaster(self)¶
Checks whether this partialdec is a userpartialdec that should be completed
the completion should be done by setting unspecified constraints to master :return: True iff this partialdec is a userpartialdec that should be completed.
- showVisualization(self)¶
generates and opens a gp visualization of the partialdec
Note
linux only.
- sort(self)¶
sorts the vars and conss data structures by their indices
- Returns
True if the internal order of variables or constraints changed.
- strongDecompScore¶
gets the strong decomposition score
Note
-1 iff not calculated yet, .. seealso:: GCGconshdlrDecompCalcStrongDecompositionScore
- Returns
strong decomposition score.