50 template<
class BaseType,
class CoType>
class CutBuffer;
51 template<
class BaseType,
class CoType>
class Active;
52 template<
class BaseType,
class CoType>
class Pool;
53 template<
class BaseType,
class CoType>
class PoolSlot;
54 template<
class BaseType,
class CoType>
class LpSolution;
120 bool relativeRes =
true,
150 int level()
const {
return level_; }
153 int id()
const {
return id_; }
171 double lowerBound()
const;
174 double upperBound()
const;
195 void dualBound(
double x);
210 void maxIterations(
int max);
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]; }
317 bool ancestor(
const Sub *sub)
const;
371 bool objAllInteger()
const;
385 virtual void removeCon(
int i);
395 int addConBufferSpace()
const;
405 int addVarBufferSpace()
const;
423 void ignoreInTailingOff();
524 virtual int variablePoolSeparation(
527 double minViolation = 0.001);
546 virtual int constraintPoolSeparation(
549 double minViolation = 0.001);
576 return branchingOnVariable(rules);
606 virtual int selectBranchingVariable(
int &variable);
639 virtual int selectBranchingVariableCandidates(
ArrayBuffer<int> &candidates);
654 virtual int selectBestBranchingSample(
int nSamples,
676 virtual double rankBranchingRule(
BranchRule *branchRule);
693 double lpRankBranchingRule(
BranchRule *branchRule,
int iterLimit = -1);
707 virtual int compareBranchingSampleRanks(
Array<double> &rank1,
720 int closeHalfExpensive(
int &branchVar,
VarType::TYPE branchVarType);
779 int findNonFixedSet(
int &branchVar,
VarType::TYPE branchVarType);
836 double x,
double lb,
double ub);
856 virtual bool feasible() = 0;
866 bool integerFeasible();
879 virtual bool primalSeparation();
887 virtual int separate();
945 virtual int improve(
double &primalValue);
954 bool boundCrash()
const;
977 virtual void varRealloc(
int newSize);
983 virtual void conRealloc(
int newSize);
999 virtual LP::METHOD chooseLpMethod(
int nVarRemoved,
int nConRemoved,
1000 int nVarAdded,
int nConAdded);
1017 bool betterDual(
double x)
const;
1045 virtual int fixByRedCost(
bool &newValues,
bool saveCand);
1073 virtual int fixAndSet(
bool &newValues);
1086 virtual int fixing(
bool &newValues,
bool saveCand =
false);
1098 virtual int setting(
bool &newValues);
1104 virtual int setByRedCost();
1130 virtual void fathom(
bool reoptimize);
1156 virtual int fix(
int i,
FSVarStat *newStat,
bool &newValue);
1169 virtual int set(
int i,
FSVarStat *newStat,
bool &newValue);
1206 virtual double dualRound(
double x);
1212 virtual double guarantee()
const;
1218 virtual bool guaranteed()
const;
1227 virtual bool removeNonLiftableCons();
1236 virtual int prepareBranching(
bool &lastIteration);
1250 virtual void fathomTheSubTree();
1271 virtual int optimize();
1290 virtual void reoptimize();
1296 virtual void initializeVars(
int maxVar);
1302 virtual void initializeCons(
int maxCon);
1325 virtual PHASE branching();
1352 virtual PHASE fathoming();
1365 virtual PHASE cutting();
1376 virtual LpSub *generateLp();
1390 virtual int initializeLp();
1407 virtual int solveLp();
1532 virtual int _separate();
1540 virtual int _conEliminate();
1546 virtual int _varEliminate();
1572 virtual int _pricing(
bool &newValues,
bool doFixSet =
true);
1587 virtual int _improve(
double &primalValue);
1594 virtual int _fixByLogImp(
bool &newValues);
1601 virtual void updateBoundInLp(
int i);
1604 virtual double fixSetNewBound(
int i);
1647 virtual PHASE _activate();
1659 virtual void _deactivate();
1674 virtual int _initMakeFeas();
1684 virtual int _makeFeasible();
1696 virtual int _setByLogImp(
bool &newValues);
1702 virtual void infeasibleSub();
1705 virtual void getBase();
1739 bool _atUpperBound(
int i);
1742 bool _atLowerBound(
int i);
1808 const Sub &operator=(
const Sub &rhs);
1825 return addConBuffer_->insert(slot,
true);
1830 return addConBuffer_->space();
1835 return addVarBuffer_->space();
1840 return actVar_->number();
1845 return actCon_->number();
1850 return actVar_->max();
1855 return actCon_->max();
1860 return (*actCon_)[i];
1865 return (*actVar_)[i];
1870 return lpRankBranchingRule(branchRule, master_->nStrongBranchingIterations());
1875 if (master_->optSense()->max())
1876 return master_->primalBound();
1883 if (master_->optSense()->min())
1884 return master_->primalBound();
1891 if (master_->optSense()->max())
1892 return x < dualBound_ ?
true :
false;
1894 return x > dualBound_ ? true :
false;
1899 return(master_->primalViolated(dualBound_));
1904 removeConBuffer_->push(i);
1911 lp_->changeLBound(i, l);
1918 lp_->changeUBound(i, u);
STATUS status_
The status of the subproblem.
virtual int pricing()
Should generate inactive variables which do not price out correctly.
int addVarBufferSpace() const
Can be used to determine the maximal number of the variables which still can be added to the variable...
CutBuffer< Variable, Constraint > * addVarBuffer_
The buffer of the newly generated variables.
bool forceExactSolver() const
Returns whether using the exact solver is forced.
virtual int generateBranchRules(ArrayBuffer< BranchRule *> &rules)
Tries to find rules for splitting the current subproblem in further subproblems.
double * bInvRow_
A row of the basis inverse associated with the infeasible variable infeasVar_ or slack variable infea...
double lBound(int i) const
Can be used to access the lower of an active variable of the subproblem.
Base class of all other classes of ABACUS.
LpSub * lp() const
Returns a pointer to the linear program of the subproblem.
double yVal(int i) const
Returns the value of the i-th dual variable in the last solved linear program.
double xVal(int i) const
Returns the value of the i-th variable in the last solved linear program.
The master of the optimization.
bool genNonLiftCons_
If true, then the management of non-liftable constraints is performed.
int lastIterConAdd_
The last iteration in which constraints have been added.
SlackStat * slackStat(int i) const
Returns a pointer to the status of the slack variable i in the last solved linear program...
virtual void removeCon(int i)
Adds a single constraint to the set of constraints which are removed from the active set at the begin...
Implements the sets of active constraints and variables which are associated with each subproblem...
virtual void setByLogImp(ArrayBuffer< int > &variable, ArrayBuffer< FSVarStat *> &status)
The default implementation of setByLogImp() does nothing.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Declaration of stopwatch classes.
double dualBound_
The dual bound of the subproblem.
bool allBranchOnSetVars_
If true, then the branching rule of the subproblem and of all ancestor on the path to the root node a...
virtual int initMakeFeas(ArrayBuffer< InfeasCon *> &infeasCon, ArrayBuffer< Variable *> &newVars, Pool< Variable, Constraint > **pool)
The default implementation of the virtual initMakeFeas() does nothing.
double lowerBound() const
Returns a lower bound on the optimal solution of the subproblem.
status of fixed and set variables.
int nOpt_
The number of optimizations of the subproblem.
Representation of variables in column format.
The status after generation, but before optimization of the subproblem.
int nCon() const
Returns the number of active constraints.
LP::METHOD lastLP_
The method that was used to solve the last LP.
virtual bool solveApproxNow()
The default implementation always returns false.
Active< Variable, Constraint > * actVar_
The active variables of the subproblem.
ogdf::StopwatchCPU localTimer_
bool forceExactSolver_
Indicates whether to force the use of an exact solver to prepare branching etc.
Status of fixed and set variables.
An array that keeps track of the number of inserted elements; also usable as an efficient stack...
double uBound(int i) const
Can be used to access the upper of an active variable of the subproblem.
bool relativeReserve() const
The subproblem is currently processed.
LPVARSTAT * lpVarStat(int i) const
Returns a pointer to the status of the variable i in the last solved linear program.
STATUS
The enumeration defining the different statuses of variables from the point of view of fixing and set...
We try to generate further subproblems as sons of this subproblem.
Sub * father_
A pointer to the father in the branch-and-cut tree.
const Master * master() const
Returns the const master of the optimization.
double nnzReserve_
The additional space for nonzeros.
int nDormantRounds() const
double dualBound() const
Returns a bound which is "better" than the optimal solution of the subproblem w.r.t. the sense of the optimization.
ArrayBuffer< Sub * > * sons_
The sons of the node in the branch-and-cut tree.
Implements a branching rule for modifying the lower and the upper bound of a variable.
virtual void selectVars()
Is called before variables are selected from the variable buffer.
The optimization is done.
double varReserve_
The additional space for variables.
FSVarStat * fsVarStat(int i) const
Returns a pointer to the status of fixing/setting of the i-th variable.
bool ignoreInTailingOff_
If this flag is set to true then the next LP-solution is ignored in the tailing-off control...
Array< double > * lBound_
A pointer to an array with the local lower bound of the active variables.
Forms the virtual base class for all possible constraints given in pool format.
int addConBufferSpace() const
Can be used to determine the maximal number of the constraints which still can be added to the constr...
virtual int makeFeasible()
The default implementation of makeFeasible()does nothing.
int id() const
Returns the identity number of the subproblem.
Maintains open subproblems.
int level() const
Returns the level of the subproblem in the branch-and-bound tree.
ArrayBuffer< int > * removeConBuffer_
The buffer of the constraints which are removed at the beginning of the next iteration.
void removeVar(int i)
Remove variable i from the set of active variables.
int infeasVar_
The number of an infeasible variable.
BranchRule * branchRule_
The branching rule for the subproblem.
bool boundCrash() const
Returns true if the dual bound is worse than the best known primal bound, false otherwise.
virtual void activate()
Can be used as an entrance point for problem specific activations.
int nDormantRounds_
The number of subproblem optimizations the subproblem has already the status Dormant.
The linear program of a subproblem.
Active< Constraint, Variable > * actCon_
The active constraints of the subproblem.
LP::METHOD lpMethod_
The solution method for the next linear program.
double nnzReserve() const
Returns the additional space for nonzero elements of the constraint matrix when it is passed to the L...
Abstract base class for all branching rules.
Base class for constraint/variabe pools.
The subproblem is completely processed but could not be fathomed.
double * xVal_
The last LP-solution.
virtual bool pausing()
Sometimes it is appropriate to put a subproblem back into the list of open subproblems.
virtual void deactivate()
Can be used as entrance point for problem specific deactivations after the subproblem optimization...
int id_
The number of the subproblem.
Status of slack variables.
Active< Constraint, Variable > * actCon() const
Returns a pointer to the currently active constraints.
Forms the virtual base class for all possible variables given in pool format.
int maxIterations_
The maximum number of iterations in the cutting plane phase.
Stores constraints and 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...
int nVar() const
Returns the number of active variables.
BranchRule * branchRule() const
Returns a pointer to the branching rule of the subproblem.
ArrayBuffer< int > * removeVarBuffer_
The buffer of the variables which are removed at the beginning of the next iteration.
TailOff * tailOff_
A pointer to the tailing off manager.
linear program of a subproblem.
Active< Variable, Constraint > * actVar() const
Returns a pointer to the currently active variables.
Array< SlackStat * > * slackStat_
A pointer to an array storing the statuses of the slack variables of the last solved linear program...
double upperBound() const
Returns an upper bound on the optimal solution of the subproblem.
double * yVal_
The dual variables of the last linear program.
bool activated_
The variable is true if the function activate() has been called from the function _activate()...
METHOD
The solution method for the linear program.
virtual bool fixAndSetTime()
Controls if variables should be fixed or set when all variables price out correctly.
TYPE
The enumeration with the different variable types.
virtual void selectCons()
Is called before constraint are selected from the constraint buffer.
STATUS status() const
Returns the status of the subproblem optimization.
CutBuffer< Constraint, Variable > * addConBuffer_
The buffer of the newly generated constraints.
int lastIterVarAdd_
The last iteration in which variables have been added.
virtual double rankBranchingRule(BranchRule *branchRule)
Computes the rank of a branching rule.
int maxCon() const
Returns the maximum number of constraints which can be handled without reallocation.
Array< FSVarStat * > * fsVarStat_
A pointer to an array storing the status of fixing and setting of the active variables.
virtual void newDormantRound()
Increments the counter for the number of rounds the subproblem is dormant.
Constraint * constraint(int i) const
Returns a pointer to the i-th active constraint.
Master * master_
A pointer to the corresponding master of the optimization.
virtual int addBranchingConstraint(PoolSlot< Constraint, Variable > *slot)
Adds a branching constraint to the constraint buffer.
virtual bool exceptionBranch()
Can be used to specify a problem specific criteria for enforcing a branching step.
virtual bool tailingOff()
Called when a tailing off effect according to the parameters TailOffPercent and TailOffNLps is observ...
int infeasCon_
The number of an infeasible constraint.
Array< double > * uBound_
A pointer to an array with the local upper bounds of the active variables.
virtual bool exceptionFathom()
Can be used to specify a problem specific fathoming criterium that is checked before the separation o...
Variable * variable(int i) const
Returns a pointer to the i-th active variable.
LpSub * lp_
A pointer to the corresponding linear program.
double conReserve_
The additional space for constraints.
int level_
The level of the subproblem in the enumeration tree.
const Sub * father() const
Returns a pointer to the father of the subproblem in the branch-and-bound tree.
int nIter_
The number of iterations in the cutting plane phase.
int maxVar() const
Returns the maximum number of variables which can be handled without reallocation.
STATUS
A subproblem can have different statuses.
Master * master()
Returns the master of the optimization.
bool betterDual(double x) const
Returns true if x is better than the best known dual bound of the subproblem, false otherwise...
PHASE
The optimization of the subproblem can be in one of the following phases.
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.
Array< LPVARSTAT * > * lpVarStat_
A pointer to an array storing the status of each active variable in the linear program.
Implements a stopwatch measuring CPU time.