The subproblem. More...
#include <ogdf/lib/abacus/sub.h>
Public Types | |
enum | PHASE { Done , Cutting , Branching , Fathoming } |
The optimization of the subproblem can be in one of the following phases. More... | |
enum | STATUS { Unprocessed , ActiveSub , Dormant , Processed , Fathomed } |
A subproblem can have different statuses. More... | |
Public Member Functions | |
Sub (Master *master, double conRes, double varRes, double nnzRes, bool relativeRes=true, ArrayBuffer< PoolSlot< Constraint, Variable > * > *constraints=nullptr, ArrayBuffer< PoolSlot< Variable, Constraint > * > *variables=nullptr) | |
Creates the root node of the enumeration tree. | |
Sub (Master *master, Sub *father, BranchRule *branchRule) | |
Creates a non-root node of the enumeration tree. | |
virtual | ~Sub () |
The destructor only deletes the sons of the node. | |
Active< Constraint, Variable > * | actCon () const |
Returns a pointer to the currently active constraints. | |
Active< Variable, Constraint > * | actVar () const |
Returns a pointer to the currently active variables. | |
virtual int | addBranchingConstraint (PoolSlot< Constraint, Variable > *slot) |
Adds a branching constraint to the constraint buffer. | |
int | addConBufferSpace () const |
Can be used to determine the maximal number of the constraints which still can be added to the constraint buffer. | |
int | addVarBufferSpace () const |
Can be used to determine the maximal number of the variables which still can be added to the variable buffer. | |
bool | ancestor (const Sub *sub) const |
Returns true if this subproblem is an ancestor of the subproblem sub, false otherwise. | |
BranchRule * | branchRule () const |
Returns a pointer to the branching rule of the subproblem. | |
Constraint * | constraint (int i) const |
Returns a pointer to the i-th active constraint. | |
double | dualBound () const |
Returns a bound which is "better" than the optimal solution of the subproblem w.r.t. the sense of the optimization. | |
void | dualBound (double x) |
Sets the dual bound of the subproblem. | |
const Sub * | father () const |
Returns a pointer to the father of the subproblem in the branch-and-bound tree. | |
bool | forceExactSolver () const |
Returns whether using the exact solver is forced. | |
FSVarStat * | fsVarStat (int i) const |
Returns a pointer to the status of fixing/setting of the i-th variable. | |
int | id () const |
Returns the identity number of the subproblem. | |
void | ignoreInTailingOff () |
Can be used to control better the tailing-off effect. | |
double | lBound (int i) const |
Can be used to access the lower of an active variable of the subproblem. | |
void | lBound (int i, double l) |
Sets the local lower bound of variable i to l. | |
int | level () const |
Returns the level of the subproblem in the branch-and-bound tree. | |
double | lowerBound () const |
Returns a lower bound on the optimal solution of the subproblem. | |
LpSub * | lp () const |
Returns a pointer to the linear program of the subproblem. | |
LPVARSTAT * | lpVarStat (int i) const |
Returns a pointer to the status of the variable i in the last solved linear program. | |
Master * | master () |
Returns the master of the optimization. | |
const Master * | master () const |
Returns the const master of the optimization. | |
int | maxCon () const |
Returns the maximum number of constraints which can be handled without reallocation. | |
void | maxIterations (int max) |
Sets the maximal number of iterations in the cutting plane phase. | |
int | maxVar () const |
Returns the maximum number of variables which can be handled without reallocation. | |
int | nCon () const |
Returns the number of active constraints. | |
int | nDormantRounds () const |
double | nnzReserve () const |
Returns the additional space for nonzero elements of the constraint matrix when it is passed to the LP-solver. | |
int | nVar () const |
Returns the number of active variables. | |
bool | objAllInteger () const |
Tests if all active variables and objective function coefficients are integer. | |
bool | relativeReserve () const |
virtual void | removeCon (int i) |
Adds a single constraint to the set of constraints which are removed from the active set at the beginning of the next iteration. | |
virtual void | removeCons (ArrayBuffer< int > &remove) |
Adds constraints to the buffer of the removed constraints. | |
void | removeVar (int i) |
Remove variable i from the set of active variables. | |
void | removeVars (ArrayBuffer< int > &remove) |
Removes the variables in remove from the set of active variables. | |
SlackStat * | slackStat (int i) const |
Returns a pointer to the status of the slack variable i in the last solved linear program. | |
STATUS | status () const |
Returns the status of the subproblem optimization. | |
double | uBound (int i) const |
Can be used to access the upper of an active variable of the subproblem. | |
void | uBound (int i, double u) |
Sets the local upper bound of variable i to u. | |
double | upperBound () const |
Returns an upper bound on the optimal solution of the subproblem. | |
Variable * | variable (int i) const |
Returns a pointer to the i-th active variable. | |
double | xVal (int i) const |
Returns the value of the i-th variable in the last solved linear program. | |
double | yVal (int i) const |
Returns the value of the i-th dual variable in the last solved linear program. | |
Public Member Functions inherited from abacus::AbacusRoot | |
virtual | ~AbacusRoot () |
The destructor. | |
Protected Member Functions | |
virtual void | activate () |
Can be used as an entrance point for problem specific activations. | |
virtual int | addCons (ArrayBuffer< Constraint * > &constraints, Pool< Constraint, Variable > *pool=nullptr, ArrayBuffer< bool > *keepInPool=nullptr, ArrayBuffer< double > *rank=nullptr) |
Tries to add new constraints to the constraint buffer and a pool. | |
virtual int | addCons (ArrayBuffer< PoolSlot< Constraint, Variable > * > &newCons) |
Adds constraints to the active constraints and the linear program. | |
virtual int | addVars (ArrayBuffer< PoolSlot< Variable, Constraint > * > &newVars) |
Adds both the variables in newVars to the set of active variables and to the linear program of the subproblem. | |
virtual int | addVars (ArrayBuffer< Variable * > &variables, Pool< Variable, Constraint > *pool=nullptr, ArrayBuffer< bool > *keepInPool=nullptr, ArrayBuffer< double > *rank=nullptr) |
Tries to add new variables to the variable buffer and a pool. | |
virtual void | basicConEliminate (ArrayBuffer< int > &remove) |
Retrieves all dynamic constraints having basic slack variable. | |
bool | betterDual (double x) const |
Returns true if x is better than the best known dual bound of the subproblem, false otherwise. | |
bool | boundCrash () const |
Returns true if the dual bound is worse than the best known primal bound, false otherwise. | |
virtual PHASE | branching () |
Performs branching. | |
virtual int | branchingOnVariable (ArrayBuffer< BranchRule * > &rules) |
Generates branching rules for two new subproblems by selecting a branching variable with the function selectBranchingVariable(). | |
virtual LP::METHOD | chooseLpMethod (int nVarRemoved, int nConRemoved, int nVarAdded, int nConAdded) |
Controls the method used to solve a linear programming relaxation. | |
int | closeHalf (ArrayBuffer< int > &branchVar, VarType::TYPE branchVarType) |
Searches searches several possible branching variable of type branchVarType, with fraction as close to \(0.5\) as possible. | |
int | closeHalf (int &branchVar, VarType::TYPE branchVarType) |
Searches a branching variable of type branchVarType, with fraction as close to \(0.5\) as possible. | |
int | closeHalfExpensive (ArrayBuffer< int > &variables, VarType::TYPE branchVarType) |
Selects several candidates for branching variables of type branchVarType. | |
int | closeHalfExpensive (int &branchVar, VarType::TYPE branchVarType) |
Selects a single branching variable of type branchVarType, with fractional part close to \(0.5\) and high absolute objective function coefficient. | |
virtual int | compareBranchingSampleRanks (Array< double > &rank1, Array< double > &rank2) |
Compares the ranks of two branching samples. | |
virtual void | conEliminate (ArrayBuffer< int > &remove) |
Can be used as an entry point for application specific elimination of constraints. | |
virtual void | conRealloc (int newSize) |
Reallocates memory that at most newSize constraints can be handled in the subproblem. | |
virtual int | constraintPoolSeparation (int ranking=0, Pool< Constraint, Variable > *pool=nullptr, double minViolation=0.001) |
Tries to generate inactive constraints from a pool. | |
virtual PHASE | cutting () |
Iteratively solves the LP-relaxation, generates constraints and/or variables. | |
virtual void | deactivate () |
Can be used as entrance point for problem specific deactivations after the subproblem optimization. | |
virtual double | dualRound (double x) |
virtual bool | exceptionBranch () |
Can be used to specify a problem specific criteria for enforcing a branching step. | |
virtual bool | exceptionFathom () |
Can be used to specify a problem specific fathoming criterium that is checked before the separation or pricing. | |
virtual void | fathom (bool reoptimize) |
Fathoms a node and recursively tries to fathom its father. | |
virtual PHASE | fathoming () |
Fathoms the node, and if certain conditions are satisfied, also its ancestor. | |
virtual void | fathomTheSubTree () |
Fathoms all nodes in the subtree rooted at this subproblem. | |
virtual bool | feasible ()=0 |
Must check the feasibility of a solution of the LP-relaxation. | |
int | findNonFixedSet (ArrayBuffer< int > &branchVar, VarType::TYPE branchVarType) |
Selects the first variables that are neither fixed nor set. | |
int | findNonFixedSet (int &branchVar, VarType::TYPE branchVarType) |
Selects the first variable that is neither fixed nor set. | |
virtual int | fix (int i, FSVarStat *newStat, bool &newValue) |
Fixes a variable. | |
virtual int | fixAndSet (bool &newValues) |
Tries to fix and set variables both by logical implications and reduced cost criteria. | |
virtual bool | fixAndSetTime () |
Controls if variables should be fixed or set when all variables price out correctly. | |
virtual void | fixByLogImp (ArrayBuffer< int > &variables, ArrayBuffer< FSVarStat * > &status) |
Should collect the numbers of the variables to be fixed in variable and the respective statuses in status. | |
virtual int | fixByRedCost (bool &newValues, bool saveCand) |
Tries to fix variables according to the reduced cost criterion. | |
virtual int | fixing (bool &newValues, bool saveCand=false) |
Tries to fix variables by reduced cost criteria and logical implications. | |
virtual int | generateBranchRules (ArrayBuffer< BranchRule * > &rules) |
Tries to find rules for splitting the current subproblem in further subproblems. | |
virtual LpSub * | generateLp () |
Instantiates an LP for the solution of the LP-relaxation in this subproblem. | |
virtual Sub * | generateSon (BranchRule *rule)=0 |
Returns a pointer to an object of a problem specific subproblem, which is generated from the current subproblem by branching rule rule. | |
virtual bool | goodCol (Column &col, Array< double > &row, double x, double lb, double ub) |
virtual double | guarantee () const |
May not be called if the lower bound is 0 and upper bound not equal to 0. | |
virtual bool | guaranteed () const |
virtual int | improve (double &primalValue) |
Can be redefined in order to implement primal heuristics for finding feasible solutions. | |
bool | infeasible () |
Returns true if the subproblem does not contain a feasible solution, false otherwise. | |
virtual void | initializeCons (int maxCon) |
Initializes the active constraint set. | |
virtual int | initializeLp () |
Initializes the linear program. | |
virtual void | initializeVars (int maxVar) |
Initializes the active variable set. | |
virtual int | initMakeFeas (ArrayBuffer< InfeasCon * > &infeasCon, ArrayBuffer< Variable * > &newVars, Pool< Variable, Constraint > **pool) |
The default implementation of the virtual initMakeFeas() does nothing. | |
bool | integerFeasible () |
Can be used to check if the solution of the LP-relaxation is primally feasible if integrality is suficinet. | |
double | lpRankBranchingRule (BranchRule *branchRule, int iterLimit=-1) |
Computes the rank of a branching rule by modifying the linear programming relaxation of the subproblem according to the branching rule and solving it. | |
virtual int | makeFeasible () |
The default implementation of makeFeasible()does nothing. | |
virtual void | nonBindingConEliminate (ArrayBuffer< int > &remove) |
Retrieves the dynamic constraints with slack exceeding the value given by the parameter ConElimEps . | |
virtual int | optimize () |
Performs the optimization of the subproblem. | |
virtual bool | pausing () |
Sometimes it is appropriate to put a subproblem back into the list of open subproblems. | |
virtual int | prepareBranching (bool &lastIteration) |
Is called before a branching step to remove constraints. | |
virtual int | pricing () |
Should generate inactive variables which do not price out correctly. | |
virtual bool | primalSeparation () |
Controls if during the cutting plane phase a (primal) separation step or a pricing step (dual separation) should be performed. | |
virtual double | rankBranchingRule (BranchRule *branchRule) |
Computes the rank of a branching rule. | |
virtual void | rankBranchingSample (ArrayBuffer< BranchRule * > &sample, Array< double > &rank) |
Computes for each branching rule of a branching sample a rank with the function rankBranchingRule(). | |
void | redCostVarEliminate (ArrayBuffer< int > &remove) |
Retrieves all variables with "wrong" reduced costs. | |
virtual bool | removeNonLiftableCons () |
virtual void | reoptimize () |
Repeats the optimization of an already optimized subproblem. | |
virtual int | selectBestBranchingSample (int nSamples, ArrayBuffer< BranchRule * > **samples) |
Evaluates branching samples. | |
virtual int | selectBranchingVariable (int &variable) |
Chooses a branching variable. | |
virtual int | selectBranchingVariableCandidates (ArrayBuffer< int > &candidates) |
Selects candidates for branching variables. | |
virtual void | selectCons () |
Is called before constraint are selected from the constraint buffer. | |
virtual void | selectVars () |
Is called before variables are selected from the variable buffer. | |
virtual int | separate () |
Must be redefined in derived classes for the generation of cutting planes. | |
virtual int | set (int i, FSVarStat *newStat, bool &newValue) |
Sets a variable. | |
virtual int | set (int i, FSVarStat::STATUS newStat, bool &newValue) |
Sets a variable. | |
virtual int | set (int i, FSVarStat::STATUS newStat, double value, bool &newValue) |
Sets a variable. | |
virtual void | setByLogImp (ArrayBuffer< int > &variable, ArrayBuffer< FSVarStat * > &status) |
The default implementation of setByLogImp() does nothing. | |
virtual int | setByRedCost () |
Tries to set variables according to the reduced cost criterion. | |
virtual int | setting (bool &newValues) |
Tries to set variables by reduced cost criteria and logical implications like fixing(). | |
virtual bool | solveApproxNow () |
The default implementation always returns false. | |
virtual int | solveLp () |
Solves the LP-relaxation of the subproblem. | |
virtual bool | tailingOff () |
Called when a tailing off effect according to the parameters TailOffPercent and TailOffNLps is observed. | |
virtual void | varEliminate (ArrayBuffer< int > &remove) |
Entry point for application specific variable elimination. | |
virtual int | variablePoolSeparation (int ranking=0, Pool< Variable, Constraint > *pool=nullptr, double minViolation=0.001) |
Tries to generate inactive variables from a pool. | |
virtual void | varRealloc (int newSize) |
Reallocates memory that at most newSize variables can be handled in the subproblem. | |
Protected Attributes | |
Active< Constraint, Variable > * | actCon_ |
The active constraints of the subproblem. | |
Active< Variable, Constraint > * | actVar_ |
The active variables of the subproblem. | |
CutBuffer< Constraint, Variable > * | addConBuffer_ |
The buffer of the newly generated constraints. | |
CutBuffer< Variable, Constraint > * | addVarBuffer_ |
The buffer of the newly generated variables. | |
bool | allBranchOnSetVars_ |
If true, then the branching rule of the subproblem and of all ancestor on the path to the root node are branching on a binary variable. | |
double * | bInvRow_ |
A row of the basis inverse associated with the infeasible variable infeasVar_ or slack variable infeasCon_. | |
BranchRule * | branchRule_ |
The branching rule for the subproblem. | |
double | dualBound_ |
The dual bound of the subproblem. | |
Sub * | father_ |
A pointer to the father in the branch-and-cut tree. | |
Array< FSVarStat * > * | fsVarStat_ |
A pointer to an array storing the status of fixing and setting of the active variables. | |
bool | genNonLiftCons_ |
If true, then the management of non-liftable constraints is performed. | |
int | infeasCon_ |
The number of an infeasible constraint. | |
int | infeasVar_ |
The number of an infeasible variable. | |
int | lastIterConAdd_ |
The last iteration in which constraints have been added. | |
int | lastIterVarAdd_ |
The last iteration in which variables have been added. | |
Array< double > * | lBound_ |
A pointer to an array with the local lower bound of the active variables. | |
LpSub * | lp_ |
A pointer to the corresponding linear program. | |
LP::METHOD | lpMethod_ |
The solution method for the next linear program. | |
Array< LPVARSTAT * > * | lpVarStat_ |
A pointer to an array storing the status of each active variable in the linear program. | |
Master * | master_ |
A pointer to the corresponding master of the optimization. | |
int | nIter_ |
The number of iterations in the cutting plane phase. | |
ArrayBuffer< int > * | removeConBuffer_ |
The buffer of the constraints which are removed at the beginning of the next iteration. | |
ArrayBuffer< int > * | removeVarBuffer_ |
The buffer of the variables which are removed at the beginning of the next iteration. | |
Array< SlackStat * > * | slackStat_ |
A pointer to an array storing the statuses of the slack variables of the last solved linear program. | |
TailOff * | tailOff_ |
A pointer to the tailing off manager. | |
Array< double > * | uBound_ |
A pointer to an array with the local upper bounds of the active variables. | |
double * | xVal_ |
The last LP-solution. | |
double * | yVal_ |
The dual variables of the last linear program. | |
Private Member Functions | |
Sub (const Sub &rhs) | |
virtual PHASE | _activate () |
Allocates and initializes memory of the subproblem at the beginning of the optimization. | |
bool | _atLowerBound (int i) |
Returns true iff the current value of variable i in the primal lp is equal to its lower bound. | |
bool | _atUpperBound (int i) |
Returns true iff the current value of variable i in the primal lp is equal to its upper bound. | |
virtual int | _conEliminate () |
Returns the number of eliminated constraints. | |
virtual void | _deactivate () |
Deallocates the memory which is not required after the optimization of the subproblem. | |
virtual int | _fixByLogImp (bool &newValues) |
Returns 1, if a contradiction has been found, 0 otherwise. | |
virtual int | _improve (double &primalValue) |
Tries to find a better feasible solution. | |
virtual int | _initMakeFeas () |
Tries to add variables to restore infeasibilities detected at initialization time. | |
virtual int | _makeFeasible () |
Is called if the LP is infeasible and adds inactive variables, which can make the LP feasible again, to the set of active variables. | |
virtual int | _pricing (bool &newValues, bool doFixSet=true) |
If doFixSet is true, then we try to fix and set variables, if all inactive variables price out correctly. | |
virtual int | _removeCons (ArrayBuffer< int > &remove) |
Removes the constraints with numbers remove from the set of active constraints. | |
virtual int | _removeVars (ArrayBuffer< int > &remove) |
Removes the variables with numbers remove from the set of active variables. | |
virtual void | _selectCons (ArrayBuffer< PoolSlot< Constraint, Variable > * > &newCons) |
Selects the master_->maxConAdd() best constraints from the buffered constraints and stores them in newCons. | |
virtual void | _selectVars (ArrayBuffer< PoolSlot< Variable, Constraint > * > &newVars) |
Selects the master_->maxVarAdd() best variables from the buffered variables. | |
virtual int | _separate () |
Returns the number of generated cutting planes. | |
virtual int | _setByLogImp (bool &newValues) |
Tries to set variables according to logical implications of already set and fixed variables. | |
virtual int | _varEliminate () |
Returns the number of eliminated variables. | |
virtual void | activateVars (ArrayBuffer< PoolSlot< Variable, Constraint > * > &newVars) |
Adds the variables stored in the pool slots of newVars to the set of active variables, but not to the linear program. | |
virtual void | addVarsToLp (ArrayBuffer< PoolSlot< Variable, Constraint > * > &newVars, ArrayBuffer< FSVarStat * > *localStatus=nullptr) |
Adds the variables stored in the pool slots of newVars to the linear program. localStatus can specify a local status of fixing and setting. | |
virtual double | fixSetNewBound (int i) |
Returns the value which the upper and lower bounds of a variable should take after it is fixed or set. | |
virtual void | getBase () |
Updates the status of the variables and the slack variables. | |
virtual void | infeasibleSub () |
Should be called if a subproblem turns out to be infeasible. | |
virtual void | newDormantRound () |
Increments the counter for the number of rounds the subproblem is dormant. | |
const Sub & | operator= (const Sub &rhs) |
virtual void | updateBoundInLp (int i) |
Adapts the bound of a fixed or set variable i also in the linear program. | |
Private Attributes | |
bool | activated_ |
The variable is true if the function activate() has been called from the function _activate(). | |
double | conReserve_ |
The additional space for constraints. | |
bool | forceExactSolver_ |
Indicates whether to force the use of an exact solver to prepare branching etc. | |
int | id_ |
The number of the subproblem. | |
bool | ignoreInTailingOff_ |
If this flag is set to true then the next LP-solution is ignored in the tailing-off control. | |
LP::METHOD | lastLP_ |
The method that was used to solve the last LP. | |
int | level_ |
The level of the subproblem in the enumeration tree. | |
ogdf::StopwatchCPU | localTimer_ |
int | maxIterations_ |
The maximum number of iterations in the cutting plane phase. | |
int | nDormantRounds_ |
The number of subproblem optimizations the subproblem has already the status Dormant. | |
double | nnzReserve_ |
The additional space for nonzeros. | |
int | nOpt_ |
The number of optimizations of the subproblem. | |
bool | relativeReserve_ |
If this member is true then the space reserve of the following three members varReserve_, conReserve_, and nnzReserve_ is relative to the initial numbers of constraints, variables, and nonzeros, respectively. | |
ArrayBuffer< Sub * > * | sons_ |
The sons of the node in the branch-and-cut tree. | |
STATUS | status_ |
The status of the subproblem. | |
double | varReserve_ |
The additional space for variables. | |
Friends | |
class | BoundBranchRule |
class | LpSolution< Constraint, Variable > |
class | LpSolution< Variable, Constraint > |
class | Master |
class | OpenSub |
Additional Inherited Members | |
Static Public Member Functions inherited from abacus::AbacusRoot | |
static bool | ascii2bool (const string &str) |
Converts the string str to a boolean value. | |
static bool | endsWith (const string &str, const string &end) |
Returns true if str ends with end, false otherwise. | |
static double | fracPart (double x) |
Returns the absolute value of the fractional part of x. | |
static const char * | onOff (bool value) |
Converts a boolean variable to the strings "on" and "off". | |
The subproblem.
This class implements an abstract base class for a subproblem of the enumeration, i.e., a node of the branch-and-bound tree. The core of this class is the solution of the linear programming relaxation. If a derived class provides methods for the generation of cutting planes and/or variables, then the subproblem is processed by a cutting plane and/or column generation algorithm. Essential is that every subproblem has its own sets of active constraints and variables, which provides a very high flexibility.
The optimization of the subproblem can be in one of the following phases.
A subproblem can have different statuses.
abacus::Sub::Sub | ( | Master * | master, |
double | conRes, | ||
double | varRes, | ||
double | nnzRes, | ||
bool | relativeRes = true , |
||
ArrayBuffer< PoolSlot< Constraint, Variable > * > * | constraints = nullptr , |
||
ArrayBuffer< PoolSlot< Variable, Constraint > * > * | variables = nullptr |
||
) |
Creates the root node of the enumeration tree.
master | A pointer to the corresponding master of the optimization. |
conRes | The additional memory allocated for constraints. |
varRes | The additional memory allocated for variables. |
nnzRes | The additional memory allocated for nonzero elements of the constraint matrix. |
relativeRes | If this argument is true, then reserve space for variables, constraints, and nonzeros given by the previous three arguments, is given in percent of the original numbers. Otherwise, the numbers are interpreted as absolute values (casted to integer). The default value is true. |
constraints | The pool slots of the initial constraints. If the value is 0, then the constraints of the default constraint pool are taken. The default value is 0. |
variables | The pool slots of the initial variables. If the value is 0, then the variables of the default variable pool are taken. The default value is 0. |
abacus::Sub::Sub | ( | Master * | master, |
Sub * | father, | ||
BranchRule * | branchRule | ||
) |
Creates a non-root node of the enumeration tree.
master | A pointer to the corresponding master of the optimization. |
father | A pointer to the father in the enumeration tree. |
branchRule | The rule defining the subspace of the solution space associated with this subproblem. |
|
virtual |
The destructor only deletes the sons of the node.
The deletion of allocated memory is already performed when the node is fathomed. We recursively call the destructors of all subproblems contained in the enumeration tree below this subproblem itself.
If a subproblem has no sons and its status is either Unprocessed or Dormant, then it is still contained in the set of open subproblems, where it is removed from.
Reimplemented in ogdf::MinSteinerTreeDirectedCut< T >::Sub.
Allocates and initializes memory of the subproblem at the beginning of the optimization.
The function returns the next phase of the optimization. This is either Cutting or Fathoming if the subproblem immediately turns out to be infeasible.
Since many objects of the class Sub can exist at the same time, yet in a sequential algorithm only one problem is active, a lot of memory can be saved if some memory is dynamically allocated when the subproblem becomes active and other information is stored in a compressed format for dormant problems.
These allocations and decompressions are performed by the function _activate(), the respective deallocations and compression of data is executed by the function _deactivate().
Currently for all subproblems which have not been processed already (except for the root) we initialize the active constraints and variables with the respective data from the father node adapted by the branching information since so we can make sure that all fixed and set variables are active. A more flexible strategy might be desirable but also dangerous.
The virtual function activate() can perform problem specific activations. It is called before variables are fixed by logical implications, because, e.g., for problems on graphs, the graph associated with the subproblem might have to be activated.
Moreover, the function _activate() is redundant in the sense that it is called only once and could be substituted by a function. However, having a future generalization to non linear-programming based branch-and-bound in mind, we keep this function.
Returns true iff the current value of variable i in the primal lp is equal to its lower bound.
Returns true iff the current value of variable i in the primal lp is equal to its upper bound.
Returns the number of eliminated constraints.
Only dynamic constraints are eliminated from the LP.
It might be worth to implement problem specific versions of this function.
Deallocates the memory which is not required after the optimization of the subproblem.
The virtual dummy function deactivate() can perform problem specific deactivations.
As the function _activate(), the function _deactivate() is redundant in the sense that it is called only once and could be substituted by a function. However, having a future generalization to non linear-programming based branch-and-bound in mind, we keep this function.
Returns 1, if a contradiction has been found, 0 otherwise.
The parameter newValues is set to true if a variable is fixed to value different from its value in the last solved linear program.
Tries to find a better feasible solution.
If a better solution is found its value is stored in primalValue and we return 1, otherwise we return 0.
If the upper bound has been initialized with the optimum solution or with the optimum solution plus/minus one these primal heuristics are skipped.
The primal bound, if improved, is either updated in the function cutting(), from which _improved() is called, are can be updated in the function improve() of an application in a derived class.
Tries to add variables to restore infeasibilities detected at initialization time.
It returns 0 if variables could be activated which might restore feasibility, otherwise it returns 1.
The function should analyse the constraints stored in LpSub::infeasCons_ and try to add inactive variables which could restore the infeasibility.
The new variables are only added to the set of active variables but not to the linear program since no linear program exists when this function is called.
If doFixSet is true, then we try to fix and set variables, if all inactive variables price out correctly.
In this case newValues becomes true of a variable is set or fixed to a value different from its value in the last linear program.
In a pricing step the reduced costs of inactive variables are computed and variables with positive (negative) reduced costs in a maximization (minimization) problem are activated.
The function _pricing() returns the 1 if no global optimality can be guaranteed, since variables have negative reduced costs, it returns 2 if before a pricing step can be performed, non-liftable constraints have to be removed, and 0 if the LP-solution is global dual feasible.
Also if there are no inactive variables, this function is called since it will also try to fix and set variables.
true is the default value of doFixSet. No variables should be fixed or set if _pricing() is called from _makeFeasible().
|
privatevirtual |
Removes the constraints with numbers remove from the set of active constraints.
|
privatevirtual |
Removes the variables with numbers remove from the set of active variables.
|
privatevirtual |
Selects the master_->maxConAdd() best constraints from the buffered constraints and stores them in newCons.
|
privatevirtual |
Selects the master_->maxVarAdd() best variables from the buffered variables.
newVars | Holds the selected variables after the call. |
Returns the number of generated cutting planes.
Tries to set variables according to logical implications of already set and fixed variables.
Since logical implications are problem specific the virtual function setByLogImp() is called to find variables which can be set. If a variable is set to a new value, i.e., a value different from the one in the last solved LP, newValues is set to true. If such a setting implies a contradiction, _setByLogImp() returns 1, otherwise it returns 0.
Returns the number of eliminated variables.
Only dynamic variables can be eliminated.
|
inline |
|
privatevirtual |
Adds the variables stored in the pool slots of newVars to the set of active variables, but not to the linear program.
If the new number of variables exceeds the maximal number of variables an automatic reallocation is performed.
|
inline |
|
inlinevirtual |
Adds a branching constraint to the constraint buffer.
This constraint is automatically added at the beginning of the cutting plane algorithm. It should be used in definitions of the pure virtual function BRANCHRULE::extract().
slot | A pointer to the pool slot containing the branching constraint. |
|
inline |
Can be used to determine the maximal number of the constraints which still can be added to the constraint buffer.
A separation algorithm should stop as soon as the number of generated constraints reaches this number because further work is useless.
|
protectedvirtual |
Tries to add new constraints to the constraint buffer and a pool.
The memory management of added constraints is passed to ABACUS by calling this function.
constraints | The new constraints. |
pool | The pool in which the new constraints are inserted. If the value of this argument is 0, then the cut pool of the master is selected. Its default value is 0. |
keepInPool | If (*keepInPool)[i] is true, then the constraint stays in the pool even if it is not activated. The default value is a 0-pointer. |
rank | If this pointer to a buffer is nonzero, this buffer should store a rank for each constraint. The greater the rank, the better the variable. The default value of rank is 0. |
|
protectedvirtual |
Adds constraints to the active constraints and the linear program.
newCons | A buffer storing the pool slots of the new constraints. |
|
inline |
Can be used to determine the maximal number of the variables which still can be added to the variable buffer.
A pricing algorithm should stop as soon as the number of generated variables reaches this number because further work is useless.
|
protectedvirtual |
Adds both the variables in newVars to the set of active variables and to the linear program of the subproblem.
If the new number of variables exceeds the maximal number of variables an automatic reallocation is performed.
We require this feature in derived classes if variables of newVars can be discarded if they are already active.
newVars | A buffer storing the pool slots of the new variables. |
|
protectedvirtual |
Tries to add new variables to the variable buffer and a pool.
The memory management of added variables is passed to ABACUS by calling this function.
variables | The new variables. |
pool | The pool in which the new variables are inserted. If the value of this argument is 0, then the default variable pool is taken. The default value is 0. |
keepInPool | If (*keepInPool)[i] is true, then the variable stays in the pool even if it is not activated. The default value is a 0-pointer. |
rank | If this pointer to a buffer is nonzero, this buffer should store a rank for each variable. The greater the rank, the better the variable. The default value of rank is 0. |
|
privatevirtual |
Adds the variables stored in the pool slots of newVars to the linear program. localStatus can specify a local status of fixing and setting.
If the local FSVarStat of the added variables differs from their global status, then this local status can be stated in localStatus. Per default the value of localStatus is 0.
Returns true if this subproblem is an ancestor of the subproblem sub, false otherwise.
We define that a subproblem is also an ancestor of its own.
sub | A pointer to a subproblem. |
|
protectedvirtual |
Retrieves all dynamic constraints having basic slack variable.
remove | Stores the nonbinding constraints. |
|
inlineprotected |
Performs branching.
Is called if the global lower bound of a branch-and-cut node is still strictly less than the local upper bound, but either no violated cutting planes or variables are found, or we abort the cutting phase for some other strategic reason (e.g., observation of a tailing off effect, or branch pausing).
Usually, two new subproblems are generated. However, our implementation of branching() is more sophisticated that allows different branching. Moreover, we also check if this node is only paused. If this is the case the node is put back into the list of open branch-and-cut nodes without generating sons of this node.
Finally if none of the previous conditions is satisfied we generate new subproblems.
|
protectedvirtual |
Generates branching rules for two new subproblems by selecting a branching variable with the function selectBranchingVariable().
If a new branching variable selection strategy should be used the function selectBranchingVariable() should be redefined.
rules | If branching rules are found, then they are stored in this buffer. The length of this buffer is the number of active variables of the subproblem. If more branching rules are generated a reallocation has to be performed. |
|
inline |
|
protectedvirtual |
Controls the method used to solve a linear programming relaxation.
The default implementation chooses the barrier method for the first linear program of the root node and for all other linear programs it tries to choose a method such that phase 1 of the simplex method is not required.
nVarRemoved | The number of removed variables. |
nConRemoved | The number of removed constraints. |
nVarAdded | The number of added variables. |
nConAdded | The number of added constraint. |
|
protected |
Searches searches several possible branching variable of type branchVarType, with fraction as close to \(0.5\) as possible.
branchVar | Stores the possible branching variables. |
branchVarType | The type of the branching variable can berestricted either to VarType::Binary or VarType::Integer. |
|
protected |
Searches a branching variable of type branchVarType, with fraction as close to \(0.5\) as possible.
branchVar | Holds the branching variable if one is found. |
branchVarType | The type of the branching variable can be restricted either to VarType::Binary or VarType::Integer. |
|
protected |
Selects several candidates for branching variables of type branchVarType.
|
protected |
Selects a single branching variable of type branchVarType, with fractional part close to \(0.5\) and high absolute objective function coefficient.
This is the default strategy from the TSP project.
branchVar | Holds the number of the branching variable if one is found. |
branchVarType | The type of the branching variable can be restricted either to VarType::Binary or VarType::Integer. |
|
protectedvirtual |
Compares the ranks of two branching samples.
For maximimization problem that rank is better for which the maximal rank of a rule is minimal, while for minimization problem the rank is better for which the minimal rank of a rule is maximal. If this value equals for both ranks we continue with the secand greatest value, etc.
|
protectedvirtual |
Can be used as an entry point for application specific elimination of constraints.
The default implementation of this function calls either the function nonBindingConEliminate() or the function basicConEliminate() depending on the constraint elimination mode of the master that is initialized via the parameter file.
remove | The constraints that should be eliminated must be inserted in this buffer. |
Reallocates memory that at most newSize constraints can be handled in the subproblem.
newSize | The new maximal number of constraints of the subproblem. |
|
inline |
|
protectedvirtual |
Tries to generate inactive constraints from a pool.
ranking | This parameter indicates how the ranks of violated constraints should be computed (0: no ranking; 1: violation is rank, 2: absolute value of violation is rank, 3: rank determined by ConVar::rank()). The default value is 0. |
pool | The pool the constraints are generated from. If pool is 0, then the default constraint pool is used. The default value of pool is 0. |
minViolation | A violated constraint/variable is only added if the absolute value of its violation is at least minAbsViolation. The default value is 0.001. |
Iteratively solves the LP-relaxation, generates constraints and/or variables.
Also generating variables can be regarded as "cutting", namely as generating cuts for the dual problem. A reader even studying these lines has been very brave! Therefore, the first reader of these lines is invited to a beer from the author.
Can be used as entrance point for problem specific deactivations after the subproblem optimization.
The default version of this function does nothing. This function is only called if the function activate() for the subproblem has been executed. This function is called from _deactivate().
|
inline |
Sets the dual bound of the subproblem.
If the subproblem is the root node of the enumeration tree and the new value is better than its dual bound, also the global dual bound is updated. It is an error if the dual bound gets worse.
In normal applications it is not required to call this function explicitly. This is already done by ABACUS during the subproblem optimization.
x | The new value of the dual bound. |
x | The value that should be rounded if possible. |
Fathoms a node and recursively tries to fathom its father.
If the root of the remaining branch-and-cut tree is fathomed we are done since the optimization problem has been solved.
Otherwise, we count the number of unfathomed sons of the father of the subproblem being fathomed. If all sons of the father are fathomed it is recursively fathomed, too. If the father is the root of the remaining branch-and-cut tree and only one of its sons is unfathomed, then this unfathomed son becomes the new root of the remaining branch-and-cut tree.
We could stop the recursive fathoming already at the root of the remaining branch-and-cut tree. But, we proceed until the root of the complete tree was visited to be really correct.
reoptimize | If reoptimize is true, then we perform a reoptimization in the new root. This is controlled via a parameter since it might not be desirable when we find a new root during the fathoming of a complete subtree with the function fathomTheSubTree(). |
Fathoms the node, and if certain conditions are satisfied, also its ancestor.
The third central phase of the optimization of a subproblem is the Fathoming of a subproblem. A subproblem is fathomed if it can be guaranteed that this subproblem cannot contain a better solution than the best known one. This is the case if the global upper bound does not exceed the local lower bound (maximization problem assumed) or the subproblem cannot contain a feasible solution either if there is a fixing/setting contradiction or the LP-relaxation turns out to be infeasible.
The called function fathom() fathoms the subproblem itself and recursively also tries to fathom its father in the enumeration tree. The argument of fathom() is true as a possibly detected new root should be reoptimized in order to receive better criteria for fixing variables by reduced costs.
In the parallel version, only the subproblem itself is fathomed. No processed unfathomed nodes are kept in memory (father_=0).
Fathoms all nodes in the subtree rooted at this subproblem.
Dormant and Unprocessed nodes are also removed from the set of open subproblems.
If the subproblem is already Fathomed we do not have to proceed in this branch. Otherwise, we fathom the node and continue with all its sons. The actual fathoming starts at the unfathomed leaves of the subtree and recursively goes up through the tree.
Must check the feasibility of a solution of the LP-relaxation.
If the function returns true and the value of the primal bound is worse than the value of this feasible solution, the value of the primal bound is updated automatically.
Implemented in ogdf::cluster_planarity::CPlanaritySub, ogdf::cluster_planarity::MaxCPlanarSub, and ogdf::MinSteinerTreeDirectedCut< T >::Sub.
|
protected |
Selects the first variables that are neither fixed nor set.
branchVar | Holds the number of the possible branching variables if one is found. |
branchVarType | The type of the branching variable can be restricted either to VarType::Binary or VarType::Integer. |
|
protected |
Selects the first variable that is neither fixed nor set.
branchVar | Holds the number of the branching variable if one is found. |
branchVarType | The type of the branching have (VarType::Binary or VarType::Integer). |
Fixes a variable.
If the variable which is currently fixed is already set then we must not change its bounds in the LP since it might be eliminated.
i | The number of the variable being fixed. |
newStat | A pointer to an object storing the new status of the variable. |
newValue | If the variable is fixed to a value different from the one of the last LP-solution, the argument newValue is set to true. Otherwise, it is set to false. |
Tries to fix and set variables both by logical implications and reduced cost criteria.
Actually, variables fixed or set to 0 could be eliminated. However, this could lead to a loss of important structural information for fixing and setting further variables later, for the computation of feasible solutions, for the separation and for detecting contradictions. Therefore, we do not eliminate these variables per default.
newValues | If a variables is set or fixed to a value different from the last LP-solution, newValues is set to true, otherwise it is set to false. |
|
inlineprotectedvirtual |
Tries to fix variables according to the reduced cost criterion.
newValues | If variables are fixed to different values as in the last solved linear program, then newValues becomes true. |
saveCand | If saveCand is true, then a new list of candidates for later calls is compiled. This is only possible when the root of the remaining branch-and-bound is processed. |
Tries to fix variables by reduced cost criteria and logical implications.
newValues | The parameter newValues becomes true if variables are fixed to other values as in the current LP-solution. |
saveCand | If the parameter saveCand is true a new candidate list of variables for fixing is generated. The default value of saveCand is false. Candidates should not be saved if fixing is performed after the addition of variables. |
Returns the value which the upper and lower bounds of a variable should take after it is fixed or set.
|
inline |
Returns a pointer to the status of fixing/setting of the i-th variable.
In a branch-and-cut-and-price algorithm we also would have to refer to the global variable status. While this subproblem is processed another subproblem could change the global status.
i | The number of the variable. |
|
inlineprotectedvirtual |
Tries to find rules for splitting the current subproblem in further subproblems.
Per default we generate rules for branching on variables (branchingOnVariable()). But by redefining this function in a derived class any other branching strategy can be implemented.
rules | If branching rules are found, then they are stored in this buffer. |
|
protectedpure virtual |
Returns a pointer to an object of a problem specific subproblem, which is generated from the current subproblem by branching rule rule.
rule | The branching rule with which the subproblem is generated. |
Implemented in ogdf::cluster_planarity::CPlanaritySub, ogdf::cluster_planarity::MaxCPlanarSub, and ogdf::MinSteinerTreeDirectedCut< T >::Sub.
Updates the status of the variables and the slack variables.
|
protectedvirtual |
col | The column of the variable. |
row | The row of the basis inverse associated with the infeasible variable. |
x | The LP-value of the infeasible variable. |
lb | The lower bound of the infeasible variable. |
ub | The upper bound of the infeasible variable. |
May not be called if the lower bound is 0 and upper bound not equal to 0.
The guarantee that can be given for the subproblem.
|
inline |
void abacus::Sub::ignoreInTailingOff | ( | ) |
Can be used to control better the tailing-off effect.
If this function is called, the next LP-solution is ignored in the tailing-off control. Calling ignoreInTailingOff() can e.g. be considered in the following situation: If only constraints that are required for the integer programming formulation of the optimization problem are added then the next LP-value could be ignored in the tailing-off control. Only "real" cutting planes should be considered in the tailing-off control (this is only an example strategy that might not be practical in many situations, but sometimes turned out to be efficient).
Can be redefined in order to implement primal heuristics for finding feasible solutions.
The default implementation does nothing.
primalValue | Should hold the value of the feasible solution, if a better one is found. |
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, and ogdf::cluster_planarity::MaxCPlanarSub.
|
protected |
Returns true if the subproblem does not contain a feasible solution, false otherwise.
Should be called if a subproblem turns out to be infeasible.
It sets the dual bound of the subproblem correctly.
Initializes the active constraint set.
maxCon | The maximal number of constraints of the subproblem. |
Initializes the linear program.
Since not all variables might be active we first have to try making the LP feasible again by the addition of variables. If this fails, i.e., _initMakeFeas() has a nonzero return value, we return 1 in order to indicate that the corresponding subproblem can be fathomed. Otherwise, we continue with the initialization of the LP.
Initializes the active variable set.
maxVar | The maximal number of variables of the subproblem. |
|
inlineprotectedvirtual |
The default implementation of the virtual initMakeFeas() does nothing.
A reimplementation of this function should generate inactive variables until at least one variable v which satisfies the function InfeasCon::goodVar(v) for each infeasible constraint is found.
infeasCon | The infeasible constraints. |
newVars | The variables that might restore feasibility should be added here. |
pool | A pointer to the pool to which the new variables should be added. If this is a 0-pointer the variables are added to the default variable pool. The default value is 0. |
|
protected |
Can be used to check if the solution of the LP-relaxation is primally feasible if integrality is suficinet.
Checks if all binary and integer variables have an integral value. This function can be called from the function feasible() in derived classes.
Can be used to access the lower of an active variable of the subproblem.
i | The number of the variable. |
|
inline |
|
inline |
|
inline |
|
protected |
Computes the rank of a branching rule by modifying the linear programming relaxation of the subproblem according to the branching rule and solving it.
This modifiction is undone after the solution of the linear program.
It is useless, but no error, to call this function for branching rules for which the virtual dummy functions extract(LpSub*) and unExtract(LpSub*) of the base class BranchRule are not redefined.
branchRule | A pointer to a branching rule. |
iterLimit | The maximal number of iterations that should be performed by the simplex method. If this number is negative there is no iteration limit (besides internal limits of the LP-solver). The default value is -1. |
The default implementation of makeFeasible()does nothing.
If there is an infeasible structural variable then it is stored in infeasVar_, otherwise infeasVar_ is -1. If there is an infeasible slack variable, it is stored in infeasCon_, otherwise it is -1. At most one of the two members infeasVar_ and infeasCon_ can be nonnegative. A reimplementation in a derived class should generate variables to restore feasibility or confirm that the subproblem is infeasible.
The strategy for the generation of inactive variables is completely problem and user specific. For testing if a variable might restore again the feasibility the functions Variable::useful() and Sub::goodCol() might be helpful.
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, and ogdf::cluster_planarity::MaxCPlanarSub.
|
inline |
|
inline |
Sets the maximal number of iterations in the cutting plane phase.
Setting this value to 1 implies that no cuts are generated in the optimization process of the subproblem.
max | The maximal number of iterations. |
|
inline |
|
inline |
|
inline |
|
inline |
|
protectedvirtual |
Retrieves the dynamic constraints with slack exceeding the value given by the parameter ConElimEps
.
remove | Stores the nonbinding constraints. |
|
inline |
bool abacus::Sub::objAllInteger | ( | ) | const |
Tests if all active variables and objective function coefficients are integer.
If all variables are Binary or Integer and all objective function coefficients are integral, then all objective function values of feasible solutions are integral. The function objAllInteger() tests this condition for the current set of active variables.
Performs the optimization of the subproblem.
After activating the subproblem, i.e., allocating and initializing memory, and initializing the LP, the optimization process constitutes of the three phases Cutting, Branching, and Fathoming, which are alternately processed. The function fathoming() always returns Done. However, we think that the code is better readable instead of taking it out of the while loop. The optimization stops if the PHASE Done is reached. Note, Done does not necessarily mean that the subproblem is solved to optimality!
After the node is processed we deallocate memory, which is not required for further computations or of which the corresponding data can be easily reconstructed. This is performed in _deactivate().
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, and ogdf::cluster_planarity::MaxCPlanarSub.
Sometimes it is appropriate to put a subproblem back into the list of open subproblems.
This is called pausing. In the default implementation the virtual function pausing() always returns false.
It could be useful to enforce pausing a node if a tailing off effect is observed during its first optimization.
Is called before a branching step to remove constraints.
lastIteration | This argument is always set to true in the function call. |
Should generate inactive variables which do not price out correctly.
The default implementation does nothing and returns 0.
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, and ogdf::cluster_planarity::MaxCPlanarSub.
Controls if during the cutting plane phase a (primal) separation step or a pricing step (dual separation) should be performed.
Per default a pure cutting plane algorithm performs always a primal separation step, a pure column generation algorithm never performs a primal separation, and a hybrid algorithm generates usually cutting planes but from time to time also inactive variables are priced out depending on the pricingFrequency().
|
inlineprotectedvirtual |
Computes the rank of a branching rule.
This default implementation computes the rank with the function lpRankBranchingRule(). By redefining this virtual function the rank for a branching rule can be computed differently.
branchRule | A pointer to a branching rule. |
|
protectedvirtual |
Computes for each branching rule of a branching sample a rank with the function rankBranchingRule().
sample | A branching sample. |
rank | An array storing the rank for each branching rule in the sample after the function call. |
|
protected |
Retrieves all variables with "wrong" reduced costs.
remove | The variables with "wrong" reduced cost are stored in this buffer. |
|
inline |
|
virtual |
Adds constraints to the buffer of the removed constraints.
These will be removed at the beginning of the next iteration of the cutting plane algorithm.
remove | The constraints which should be removed. |
Remove variable i from the set of active variables.
Like in the function removeVars() the variable is buffered and removed at the beginning of the next iteration.
i | The variable which should be removed. |
void abacus::Sub::removeVars | ( | ArrayBuffer< int > & | remove | ) |
Removes the variables in remove from the set of active variables.
The variables are not removed when this function is called, but are buffered and removed at the beginning of the next iteration.
remove | The variables which should be removed. |
Repeats the optimization of an already optimized subproblem.
This function is used to determine the reduced costs for fixing variables of a new root of the remaining branch-and-bound tree.
As the subproblem has been processed already earlier it is sufficient to perform the cutting plane algorithm. If the subproblem is fathomed the complete subtree rooted at this subproblem can be fathomed, too. Since this function is usually only called for the root of the remaining branch-and-bound tree, we are done in this case.
It is not guaranteed that all constraints and variables of this subproblem can be regenerated in _activate(). Therefore, the result of a call to reoptimize() can differ from the result obtained by the cutting plane algorithm in optimize().
|
protectedvirtual |
Evaluates branching samples.
We denote a branching sample the set of rules defining all sons of a subproblem in the enumeration tree). For each sample the ranks are determined with the function rankBranchingSample(). The ranks of the various samples are compared with the function compareBranchingSample().
nSamples | The number of branching samples. |
samples | An array of pointer to buffers storing the branching rules of each sample. |
Chooses a branching variable.
The function selectBranchingVariableCandidates() is asked to generate depending in the parameter NBranchingVariableCandidates
of the file .abacus
candidates for branching variables. If only one candidate is generated, this one becomes the branching variable. Otherwise, the pairs of branching rules are generated for all candidates and the "best" branching variables is determined with the function selectBestBranchingSample().
variable | Holds the branching variable if one is found. |
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, and ogdf::cluster_planarity::MaxCPlanarSub.
|
protectedvirtual |
Selects candidates for branching variables.
Candidates are selected depending on the branching variable strategy given by the parameter BranchingStrategy
in the file .abacus
candidates that for branching variables.
Currently two branching variable selection strategies are implemented. The first one (CloseHalf) first searches the binary variables with fractional part closest to \(0.5\). If there is no fractional binary variable it repeats this process with the integer variables.
The second strategy (CloseHalfExpensive) first tries to find binary variables with fraction close to \(0.5\) and high absolute objective function coefficient. If this fails, it tries to find an integer variable with fractional part close to \(0.5\) and high absolute objective function coefficient.
If neither a binary nor an integer variable with fractional value is found then for both strategies we try to find non-fixed and non-set binary variables. If this fails we repeat this process with the integer variables.
Other branching variable selection strategies can be implemented by redefining this virtual function in a derived class.
candidates | The candidates for branching variables are stored in this buffer. We try to find as many variables as fit into the buffer. |
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, and ogdf::cluster_planarity::MaxCPlanarSub.
Must be redefined in derived classes for the generation of cutting planes.
The default implementation does nothing.
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, ogdf::cluster_planarity::MaxCPlanarSub, and ogdf::MinSteinerTreeDirectedCut< T >::Sub.
Sets a variable.
i | The number of the variable being set. |
newStat | A pointer to the object storing the new status of the the variable. |
newValue | If the variable is set to a value different from the one of the last LP-solution, newValue is set to true. Otherwise, it is set to false. |
|
protectedvirtual |
Sets a variable.
i | The number of the variable being set. |
newStat | The new status of the variable. |
newValue | If the variable is set to a value different from the one of the last LP-solution, newValue is set to true. Otherwise, it is set to false. |
|
protectedvirtual |
Sets a variable.
i | The number of the variable being set. |
newStat | The new status of the variable. |
value | The value the variable is set to. |
newValue | If the variable is set to a value different from the one of the last LP-solution, newValue is set to true. Otherwise, it is set to false. |
|
inlineprotectedvirtual |
The default implementation of setByLogImp() does nothing.
In derived classes this function can be reimplemented.
variable | The variables which should be set have to be inserted in this buffer. |
status | The status of the set variables. |
Tries to set variables according to the reduced cost criterion.
Tries to set variables by reduced cost criteria and logical implications like fixing().
But instead of global conditions only locally valid conditions have to be satisfied.
newValues | The parameter newValues becomes true if variables are fixed to other values as in the current LP-solution (setByRedCost() cannot set variables to new values). |
Solves the LP-relaxation of the subproblem.
As soon as the LP-relaxation becomes infeasible in a static branch and cut algorithm the respective subproblem can be fathomed. Otherwise, we memorize the value of the LP-solution to control the tailing off effect.
We assume that the LP is never primal unbounded.
Reimplemented in ogdf::cluster_planarity::CPlanaritySub, and ogdf::cluster_planarity::MaxCPlanarSub.
|
inline |
Called when a tailing off effect according to the parameters TailOffPercent
and TailOffNLps
is observed.
This function can be redefined in derived classes in order to perform actions to resolve the tailing off (e.g., switching on an enhanced separation strategy).
Can be used to access the upper of an active variable of the subproblem.
i | The number of the variable. |
Adapts the bound of a fixed or set variable i also in the linear program.
This can be only done if a linear program is available and the variable is not eliminated.
|
inline |
|
protectedvirtual |
Entry point for application specific variable elimination.
The default implementation selects the variables with the function redCostVarEliminate().
remove | The variables that should be removed have to be stored in this buffer. |
|
protectedvirtual |
Tries to generate inactive variables from a pool.
ranking | This parameter indicates how the ranks of geneated variables should be computed (0: no ranking; 1: violation is rank, 2: absolute value of violation is rank 3: rank determined by ConVar::rank()). The default value is 0. |
pool | The pool the variables are generated from. If pool is 0, then the default variable pool is used. The default value of pool is 0. |
minViolation | A violated constraint/variable is only added if the absolute value of its violation is at least minAbsViolation. The default value is 0.001. |
Reallocates memory that at most newSize variables can be handled in the subproblem.
newSize | The new maximal number of variables in the subproblem. |
|
friend |
|
friend |
|
friend |
|
protected |
|
private |
The variable is true if the function activate() has been called from the function _activate().
This memorization is required such that a deactivate() is only called when activate() has been called.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
private |
A pointer to an array storing the status of fixing and setting of the active variables.
Although fixed and set variables are already kept at their value by the adaption of the lower and upper bounds, we store this information, since, e.g., a fixed or set variable should not be removed, but a variable with an upper bound equal to the lower bound can be removed.
|
protected |
|
private |
If this flag is set to true then the next LP-solution is ignored in the tailing-off control.
The default value of the variable is false. It can be set to true by the function ignoreInTailingOff().
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
protected |
|
private |
|
private |
|
protected |
|
private |
|
private |
|
private |
If this member is true then the space reserve of the following three members varReserve_, conReserve_, and nnzReserve_ is relative to the initial numbers of constraints, variables, and nonzeros, respectively.
Otherwise, the values are casted to integers and regarded as absolute values.
|
protected |
|
protected |
|
private |
|
private |
|
protected |
|
private |
|
protected |