50template<
class BaseType,
class CoType>
class CutBuffer;
51template<
class BaseType,
class CoType>
class Active;
52template<
class BaseType,
class CoType>
class Pool;
53template<
class BaseType,
class CoType>
class PoolSlot;
54template<
class BaseType,
class CoType>
class LpSolution;
150 int level()
const {
return level_; }
153 int id()
const {
return id_; }
171 double lowerBound()
const;
174 double upperBound()
const;
245 double lBound(
int i)
const {
return (*lBound_)[i]; }
255 void lBound(
int i,
double l);
266 double uBound(
int i)
const {
return (*uBound_)[i]; }
276 void uBound(
int i,
double u);
303 double xVal(
int i)
const {
return xVal_[i]; }
309 double yVal(
int i)
const {
return yVal_[i]; }
385 virtual void removeCon(
int i);
395 int addConBufferSpace()
const;
405 int addVarBufferSpace()
const;
576 return branchingOnVariable(
rules);
676 virtual double rankBranchingRule(
BranchRule *branchRule);
836 double x,
double lb,
double ub);
954 bool boundCrash()
const;
1017 bool betterDual(
double x)
const;
Declaration of stopwatch classes.
Base class of all other classes of ABACUS.
Implements the sets of active constraints and variables which are associated with each subproblem.
Implements a branching rule for modifying the lower and the upper bound of a variable.
Abstract base class for all branching rules.
Representation of variables in column format.
Forms the virtual base class for all possible constraints given in pool format.
Status of fixed and set variables.
STATUS
The enumeration defining the different statuses of variables from the point of view of fixing and set...
METHOD
The solution method for the linear program.
The linear program of a subproblem.
virtual void changeUBound(int i, double newUb) override
Sets the upper bound of variable i to newUb.
virtual void changeLBound(int i, double newLb) override
Sets the lower bound of variable i to newLb.
The master of the optimization.
int nStrongBranchingIterations() const
The number of simplex iterations that are performed when testing candidates for branching variables w...
bool primalViolated(double x) const
Can be used to compare a value with the one of the best known primal bound.
double primalBound() const
Returns the value of the primal bound.
const OptSense * optSense() const
Returns a pointer to the object holding the optimization sense of the problem.
Maintains open subproblems.
bool min() const
Returns true If it is minimization problem,, false otherwise.
bool max() const
Returns true if it is maximization problem,, false otherwise.
Base class for constraint/variabe pools.
Stores constraints and variables.
Status of slack variables.
const Sub & operator=(const Sub &rhs)
virtual void setByLogImp(ArrayBuffer< int > &variable, ArrayBuffer< FSVarStat * > &status)
The default implementation of setByLogImp() does nothing.
virtual int makeFeasible()
The default implementation of makeFeasible()does nothing.
virtual int selectBranchingVariable(int &variable)
Chooses a branching variable.
double uBound(int i) const
Can be used to access the upper of an active variable of the subproblem.
ArrayBuffer< int > * removeVarBuffer_
The buffer of the variables which are removed at the beginning of the next iteration.
int maxVar() const
Returns the maximum number of variables which can be handled without reallocation.
void dualBound(double x)
Sets the dual bound of the subproblem.
virtual void removeCon(int i)
Adds a single constraint to the set of constraints which are removed from the active set at the begin...
bool infeasible()
Returns true if the subproblem does not contain a feasible solution, false otherwise.
LP::METHOD lpMethod_
The solution method for the next linear program.
virtual bool tailingOff()
Called when a tailing off effect according to the parameters TailOffPercent and TailOffNLps is observ...
int lastIterConAdd_
The last iteration in which constraints have been added.
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 correc...
int infeasVar_
The number of an infeasible variable.
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...
virtual void fathom(bool reoptimize)
Fathoms a node and recursively tries to fathom its father.
virtual int separate()
Must be redefined in derived classes for the generation of cutting planes.
Array< double > * uBound_
A pointer to an array with the local upper bounds of the active variables.
virtual void initializeCons(int maxCon)
Initializes the active constraint set.
virtual int selectBestBranchingSample(int nSamples, ArrayBuffer< BranchRule * > **samples)
Evaluates branching samples.
virtual void conRealloc(int newSize)
Reallocates memory that at most newSize constraints can be handled in the subproblem.
virtual int fixing(bool &newValues, bool saveCand=false)
Tries to fix variables by reduced cost criteria and logical implications.
double yVal(int i) const
Returns the value of the i-th dual variable in the last solved linear program.
BranchRule * branchRule_
The branching rule for the subproblem.
virtual void nonBindingConEliminate(ArrayBuffer< int > &remove)
Retrieves the dynamic constraints with slack exceeding the value given by the parameter ConElimEps.
virtual ~Sub()
The destructor only deletes the sons of the node.
virtual int selectBranchingVariableCandidates(ArrayBuffer< int > &candidates)
Selects candidates for branching variables.
int closeHalf(ArrayBuffer< int > &branchVar, VarType::TYPE branchVarType)
Searches searches several possible branching variable of type branchVarType, with fraction as close t...
virtual int _fixByLogImp(bool &newValues)
Returns 1, if a contradiction has been found, 0 otherwise.
virtual bool primalSeparation()
Controls if during the cutting plane phase a (primal) separation step or a pricing step (dual separat...
virtual int fixByRedCost(bool &newValues, bool saveCand)
Tries to fix variables according to the reduced cost criterion.
virtual int fixAndSet(bool &newValues)
Tries to fix and set variables both by logical implications and reduced cost criteria.
virtual void deactivate()
Can be used as entrance point for problem specific deactivations after the subproblem optimization.
bool boundCrash() const
Returns true if the dual bound is worse than the best known primal bound, false otherwise.
virtual PHASE cutting()
Iteratively solves the LP-relaxation, generates constraints and/or variables.
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 st...
virtual double rankBranchingRule(BranchRule *branchRule)
Computes the rank of a branching rule.
virtual void conEliminate(ArrayBuffer< int > &remove)
Can be used as an entry point for application specific elimination of constraints.
virtual void activateVars(ArrayBuffer< PoolSlot< Variable, Constraint > * > &newVars)
Adds the variables stored in the pool slots of newVars to the set of active variables,...
int level_
The level of the subproblem in the enumeration tree.
BranchRule * branchRule() const
Returns a pointer to the branching rule of the subproblem.
bool activated_
The variable is true if the function activate() has been called from the function _activate().
virtual PHASE _activate()
Allocates and initializes memory of the subproblem at the beginning of the optimization.
virtual int _improve(double &primalValue)
Tries to find a better feasible solution.
virtual int set(int i, FSVarStat::STATUS newStat, double value, bool &newValue)
Sets a variable.
virtual void rankBranchingSample(ArrayBuffer< BranchRule * > &sample, Array< double > &rank)
Computes for each branching rule of a branching sample a rank with the function rankBranchingRule().
STATUS
A subproblem can have different statuses.
@ Unprocessed
The status after generation, but before optimization of the subproblem.
@ Processed
The subproblem is completely processed but could not be fathomed.
@ ActiveSub
The subproblem is currently processed.
bool relativeReserve() const
Constraint * constraint(int i) const
Returns a pointer to the i-th active constraint.
virtual int improve(double &primalValue)
Can be redefined in order to implement primal heuristics for finding feasible solutions.
virtual Sub * generateSon(BranchRule *rule)=0
Returns a pointer to an object of a problem specific subproblem, which is generated from the current ...
STATUS status_
The status of the subproblem.
virtual int compareBranchingSampleRanks(Array< double > &rank1, Array< double > &rank2)
Compares the ranks of two branching samples.
virtual void updateBoundInLp(int i)
Adapts the bound of a fixed or set variable i also in the linear program.
virtual void varEliminate(ArrayBuffer< int > &remove)
Entry point for application specific variable elimination.
virtual int branchingOnVariable(ArrayBuffer< BranchRule * > &rules)
Generates branching rules for two new subproblems by selecting a branching variable with the function...
bool _atUpperBound(int i)
Returns true iff the current value of variable i in the primal lp is equal to its upper bound.
bool betterDual(double x) const
Returns true if x is better than the best known dual bound of the subproblem, false otherwise.
bool forceExactSolver() const
Returns whether using the exact solver is forced.
virtual bool exceptionBranch()
Can be used to specify a problem specific criteria for enforcing a branching step.
virtual PHASE branching()
Performs branching.
double dualBound_
The dual bound of the subproblem.
virtual int set(int i, FSVarStat::STATUS newStat, bool &newValue)
Sets a variable.
virtual void _deactivate()
Deallocates the memory which is not required after the optimization of the subproblem.
int addVarBufferSpace() const
Can be used to determine the maximal number of the variables which still can be added to the variable...
bool objAllInteger() const
Tests if all active variables and objective function coefficients are integer.
virtual int _removeCons(ArrayBuffer< int > &remove)
Removes the constraints with numbers remove from the set of active constraints.
const Master * master() const
Returns the const master of the optimization.
bool allBranchOnSetVars_
If true, then the branching rule of the subproblem and of all ancestor on the path to the root node a...
ArrayBuffer< int > * removeConBuffer_
The buffer of the constraints which are removed at the beginning of the next iteration.
void redCostVarEliminate(ArrayBuffer< int > &remove)
Retrieves all variables with "wrong" reduced costs.
int id() const
Returns the identity number of the subproblem.
double lBound(int i) const
Can be used to access the lower of an active variable of the subproblem.
LpSub * lp_
A pointer to the corresponding linear program.
double * bInvRow_
A row of the basis inverse associated with the infeasible variable infeasVar_ or slack variable infea...
int nIter_
The number of iterations in the cutting plane phase.
int findNonFixedSet(ArrayBuffer< int > &branchVar, VarType::TYPE branchVarType)
Selects the first variables that are neither fixed nor set.
virtual int initializeLp()
Initializes the linear program.
virtual void selectCons()
Is called before constraint are selected from the constraint buffer.
Variable * variable(int i) const
Returns a pointer to the i-th active variable.
int lastIterVarAdd_
The last iteration in which variables have been added.
CutBuffer< Variable, Constraint > * addVarBuffer_
The buffer of the newly generated variables.
virtual int pricing()
Should generate inactive variables which do not price out correctly.
virtual int optimize()
Performs the optimization of the subproblem.
Array< LPVARSTAT * > * lpVarStat_
A pointer to an array storing the status of each active variable in the linear program.
virtual void reoptimize()
Repeats the optimization of an already optimized subproblem.
int nOpt_
The number of optimizations of the subproblem.
int findNonFixedSet(int &branchVar, VarType::TYPE branchVarType)
Selects the first variable that is neither fixed nor set.
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.
bool relativeReserve_
If this member is true then the space reserve of the following three members varReserve_,...
virtual LP::METHOD chooseLpMethod(int nVarRemoved, int nConRemoved, int nVarAdded, int nConAdded)
Controls the method used to solve a linear programming relaxation.
TailOff * tailOff_
A pointer to the tailing off manager.
FSVarStat * fsVarStat(int i) const
Returns a pointer to the status of fixing/setting of the i-th variable.
virtual void _selectCons(ArrayBuffer< PoolSlot< Constraint, Variable > * > &newCons)
Selects the master_->maxConAdd() best constraints from the buffered constraints and stores them in ne...
int id_
The number of the subproblem.
double dualBound() const
Returns a bound which is "better" than the optimal solution of the subproblem w.r....
virtual PHASE fathoming()
Fathoms the node, and if certain conditions are satisfied, also its ancestor.
virtual void initializeVars(int maxVar)
Initializes the active variable set.
virtual int _setByLogImp(bool &newValues)
Tries to set variables according to logical implications of already set and fixed variables.
virtual void getBase()
Updates the status of the variables and the slack variables.
virtual bool exceptionFathom()
Can be used to specify a problem specific fathoming criterium that is checked before the separation o...
virtual int _conEliminate()
Returns the number of eliminated constraints.
bool forceExactSolver_
Indicates whether to force the use of an exact solver to prepare branching etc.
virtual int addCons(ArrayBuffer< PoolSlot< Constraint, Variable > * > &newCons)
Adds constraints to the active constraints and the linear program.
virtual bool pausing()
Sometimes it is appropriate to put a subproblem back into the list of open subproblems.
virtual int _makeFeasible()
Is called if the LP is infeasible and adds inactive variables, which can make the LP feasible again,...
int addConBufferSpace() const
Can be used to determine the maximal number of the constraints which still can be added to the constr...
bool ancestor(const Sub *sub) const
Returns true if this subproblem is an ancestor of the subproblem sub, false otherwise.
ArrayBuffer< Sub * > * sons_
The sons of the node in the branch-and-cut tree.
bool integerFeasible()
Can be used to check if the solution of the LP-relaxation is primally feasible if integrality is sufi...
bool genNonLiftCons_
If true, then the management of non-liftable constraints is performed.
double upperBound() const
Returns an upper bound on the optimal solution of the subproblem.
virtual void selectVars()
Is called before variables are selected from the variable buffer.
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.
LPVARSTAT * lpVarStat(int i) const
Returns a pointer to the status of the variable i in the last solved linear program.
double nnzReserve() const
Returns the additional space for nonzero elements of the constraint matrix when it is passed to the L...
virtual int initMakeFeas(ArrayBuffer< InfeasCon * > &infeasCon, ArrayBuffer< Variable * > &newVars, Pool< Variable, Constraint > **pool)
The default implementation of the virtual initMakeFeas() does nothing.
virtual void newDormantRound()
Increments the counter for the number of rounds the subproblem is dormant.
PHASE
The optimization of the subproblem can be in one of the following phases.
@ Done
The optimization is done.
@ Branching
We try to generate further subproblems as sons of this subproblem.
virtual int fix(int i, FSVarStat *newStat, bool &newValue)
Fixes a variable.
virtual int generateBranchRules(ArrayBuffer< BranchRule * > &rules)
Tries to find rules for splitting the current subproblem in further subproblems.
ogdf::StopwatchCPU localTimer_
Active< Variable, Constraint > * actVar_
The active variables of the subproblem.
virtual int addBranchingConstraint(PoolSlot< Constraint, Variable > *slot)
Adds a branching constraint to the constraint buffer.
Array< FSVarStat * > * fsVarStat_
A pointer to an array storing the status of fixing and setting of the active variables.
STATUS status() const
Returns the status of the subproblem optimization.
Sub * father_
A pointer to the father in the branch-and-cut tree.
double * xVal_
The last LP-solution.
virtual int _varEliminate()
Returns the number of eliminated variables.
int nVar() const
Returns the number of active variables.
virtual int _separate()
Returns the number of generated cutting planes.
CutBuffer< Constraint, Variable > * addConBuffer_
The buffer of the newly generated constraints.
virtual int solveLp()
Solves the LP-relaxation of the subproblem.
int closeHalfExpensive(int &branchVar, VarType::TYPE branchVarType)
Selects a single branching variable of type branchVarType, with fractional part close to and high ab...
int nCon() const
Returns the number of active constraints.
void ignoreInTailingOff()
Can be used to control better the tailing-off effect.
virtual void removeCons(ArrayBuffer< int > &remove)
Adds constraints to the buffer of the removed constraints.
virtual int variablePoolSeparation(int ranking=0, Pool< Variable, Constraint > *pool=nullptr, double minViolation=0.001)
Tries to generate inactive variables from a pool.
int closeHalf(int &branchVar, VarType::TYPE branchVarType)
Searches a branching variable of type branchVarType, with fraction as close to as possible.
int nDormantRounds() const
double lowerBound() const
Returns a lower bound on the optimal solution of the subproblem.
Active< Variable, Constraint > * actVar() const
Returns a pointer to the currently active variables.
virtual int constraintPoolSeparation(int ranking=0, Pool< Constraint, Variable > *pool=nullptr, double minViolation=0.001)
Tries to generate inactive constraints from a pool.
int infeasCon_
The number of an infeasible constraint.
virtual int _removeVars(ArrayBuffer< int > &remove)
Removes the variables with numbers remove from the set of active variables.
Array< double > * lBound_
A pointer to an array with the local lower bound of the active variables.
Sub(Master *master, Sub *father, BranchRule *branchRule)
Creates a non-root node of the enumeration tree.
double lpRankBranchingRule(BranchRule *branchRule, int iterLimit=-1)
Computes the rank of a branching rule by modifying the linear programming relaxation of the subproble...
LP::METHOD lastLP_
The method that was used to solve the last LP.
virtual int set(int i, FSVarStat *newStat, bool &newValue)
Sets a variable.
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...
Array< SlackStat * > * slackStat_
A pointer to an array storing the statuses of the slack variables of the last solved linear program.
virtual int _initMakeFeas()
Tries to add variables to restore infeasibilities detected at initialization time.
virtual int prepareBranching(bool &lastIteration)
Is called before a branching step to remove constraints.
virtual void varRealloc(int newSize)
Reallocates memory that at most newSize variables can be handled in the subproblem.
virtual void _selectVars(ArrayBuffer< PoolSlot< Variable, Constraint > * > &newVars)
Selects the master_->maxVarAdd() best variables from the buffered variables.
int maxIterations_
The maximum number of iterations in the cutting plane phase.
virtual bool goodCol(Column &col, Array< double > &row, double x, double lb, double ub)
virtual bool solveApproxNow()
The default implementation always returns false.
virtual int setByRedCost()
Tries to set variables according to the reduced cost criterion.
virtual LpSub * generateLp()
Instantiates an LP for the solution of the LP-relaxation in this subproblem.
Master * master_
A pointer to the corresponding master of the optimization.
virtual void basicConEliminate(ArrayBuffer< int > &remove)
Retrieves all dynamic constraints having basic slack variable.
Active< Constraint, Variable > * actCon_
The active constraints of the subproblem.
bool _atLowerBound(int i)
Returns true iff the current value of variable i in the primal lp is equal to its lower bound.
int level() const
Returns the level of the subproblem in the branch-and-bound tree.
double varReserve_
The additional space for variables.
double nnzReserve_
The additional space for nonzeros.
virtual void fathomTheSubTree()
Fathoms all nodes in the subtree rooted at this subproblem.
double * yVal_
The dual variables of the last linear program.
Active< Constraint, Variable > * actCon() const
Returns a pointer to the currently active constraints.
virtual void activate()
Can be used as an entrance point for problem specific activations.
double conReserve_
The additional space for constraints.
virtual bool fixAndSetTime()
Controls if variables should be fixed or set when all variables price out correctly.
void removeVar(int i)
Remove variable i from the set of active variables.
virtual double guarantee() const
May not be called if the lower bound is 0 and upper bound not equal to 0.
void removeVars(ArrayBuffer< int > &remove)
Removes the variables in remove from the set of active variables.
int closeHalfExpensive(ArrayBuffer< int > &variables, VarType::TYPE branchVarType)
Selects several candidates for branching variables of type branchVarType.
virtual bool removeNonLiftableCons()
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 su...
void maxIterations(int max)
Sets the maximal number of iterations in the cutting plane phase.
double xVal(int i) const
Returns the value of the i-th variable in the last solved linear program.
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.
int nDormantRounds_
The number of subproblem optimizations the subproblem has already the status Dormant.
virtual int setting(bool &newValues)
Tries to set variables by reduced cost criteria and logical implications like fixing().
bool ignoreInTailingOff_
If this flag is set to true then the next LP-solution is ignored in the tailing-off control.
virtual void infeasibleSub()
Should be called if a subproblem turns out to be infeasible.
virtual bool feasible()=0
Must check the feasibility of a solution of the LP-relaxation.
SlackStat * slackStat(int i) const
Returns a pointer to the status of the slack variable i in the last solved linear program.
Master * master()
Returns the master of the optimization.
int maxCon() const
Returns the maximum number of constraints which can be handled without reallocation.
virtual bool guaranteed() const
virtual double dualRound(double x)
LpSub * lp() const
Returns a pointer to the linear program of the subproblem.
const Sub * father() const
Returns a pointer to the father of the subproblem in the branch-and-bound tree.
TYPE
The enumeration with the different variable types.
Forms the virtual base class for all possible variables given in pool format.
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
void push(E e)
Puts a new element in the buffer.
The parameterized class Array implements dynamic arrays of type E.
Implements a stopwatch measuring CPU time.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
status of fixed and set variables.
linear program of a subproblem.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()