 |
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
39 #pragma GCC visibility push(default)
51 template<
class BaseType,
class CoType>
class CutBuffer;
52 template<
class BaseType,
class CoType>
class Active;
53 template<
class BaseType,
class CoType>
class Pool;
54 template<
class BaseType,
class CoType>
class PoolSlot;
55 template<
class BaseType,
class CoType>
class LpSolution;
121 bool relativeRes =
true,
151 int level()
const {
return level_; }
154 int id()
const {
return id_; }
172 double lowerBound()
const;
175 double upperBound()
const;
196 void dualBound(
double x);
211 void maxIterations(
int max);
246 double lBound(
int i)
const {
return (*lBound_)[i]; }
256 void lBound(
int i,
double l);
267 double uBound(
int i)
const {
return (*uBound_)[i]; }
277 void uBound(
int i,
double u);
304 double xVal(
int i)
const {
return xVal_[i]; }
310 double yVal(
int i)
const {
return yVal_[i]; }
318 bool ancestor(
const Sub *sub)
const;
372 bool objAllInteger()
const;
386 virtual void removeCon(
int i);
396 int addConBufferSpace()
const;
406 int addVarBufferSpace()
const;
424 void ignoreInTailingOff();
525 virtual int variablePoolSeparation(
528 double minViolation = 0.001);
547 virtual int constraintPoolSeparation(
550 double minViolation = 0.001);
577 return branchingOnVariable(rules);
607 virtual int selectBranchingVariable(
int &variable);
640 virtual int selectBranchingVariableCandidates(
ArrayBuffer<int> &candidates);
655 virtual int selectBestBranchingSample(
int nSamples,
677 virtual double rankBranchingRule(
BranchRule *branchRule);
694 double lpRankBranchingRule(
BranchRule *branchRule,
int iterLimit = -1);
708 virtual int compareBranchingSampleRanks(
Array<double> &rank1,
721 int closeHalfExpensive(
int &branchVar,
VarType::TYPE branchVarType);
780 int findNonFixedSet(
int &branchVar,
VarType::TYPE branchVarType);
837 double x,
double lb,
double ub);
857 virtual bool feasible() = 0;
867 bool integerFeasible();
880 virtual bool primalSeparation();
888 virtual int separate();
946 virtual int improve(
double &primalValue);
955 bool boundCrash()
const;
978 virtual void varRealloc(
int newSize);
984 virtual void conRealloc(
int newSize);
1000 virtual LP::METHOD chooseLpMethod(
int nVarRemoved,
int nConRemoved,
1001 int nVarAdded,
int nConAdded);
1018 bool betterDual(
double x)
const;
1046 virtual int fixByRedCost(
bool &newValues,
bool saveCand);
1074 virtual int fixAndSet(
bool &newValues);
1087 virtual int fixing(
bool &newValues,
bool saveCand =
false);
1099 virtual int setting(
bool &newValues);
1105 virtual int setByRedCost();
1131 virtual void fathom(
bool reoptimize);
1157 virtual int fix(
int i,
FSVarStat *newStat,
bool &newValue);
1170 virtual int set(
int i,
FSVarStat *newStat,
bool &newValue);
1207 virtual double dualRound(
double x);
1213 virtual double guarantee()
const;
1219 virtual bool guaranteed()
const;
1228 virtual bool removeNonLiftableCons();
1237 virtual int prepareBranching(
bool &lastIteration);
1251 virtual void fathomTheSubTree();
1272 virtual int optimize();
1291 virtual void reoptimize();
1297 virtual void initializeVars(
int maxVar);
1303 virtual void initializeCons(
int maxCon);
1326 virtual PHASE branching();
1353 virtual PHASE fathoming();
1366 virtual PHASE cutting();
1377 virtual LpSub *generateLp();
1391 virtual int initializeLp();
1408 virtual int solveLp();
1533 virtual int _separate();
1541 virtual int _conEliminate();
1547 virtual int _varEliminate();
1573 virtual int _pricing(
bool &newValues,
bool doFixSet =
true);
1588 virtual int _improve(
double &primalValue);
1595 virtual int _fixByLogImp(
bool &newValues);
1602 virtual void updateBoundInLp(
int i);
1605 virtual double fixSetNewBound(
int i);
1648 virtual PHASE _activate();
1660 virtual void _deactivate();
1675 virtual int _initMakeFeas();
1685 virtual int _makeFeasible();
1697 virtual int _setByLogImp(
bool &newValues);
1703 virtual void infeasibleSub();
1706 virtual void getBase();
1740 bool _atUpperBound(
int i);
1743 bool _atLowerBound(
int i);
1809 const Sub &operator=(
const Sub &rhs);
1813 #pragma GCC visibility pop
1823 #pragma GCC visibility push(default)
1925 #pragma GCC visibility pop
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Active< Variable, Constraint > * actVar() const
Returns a pointer to the currently active variables.
Implements the sets of active constraints and variables which are associated with each subproblem.
Array< LPVARSTAT * > * lpVarStat_
A pointer to an array storing the status of each active variable in the linear program.
LpSub * lp_
A pointer to the corresponding linear program.
@ ActiveSub
The subproblem is currently processed.
virtual void activate()
Can be used as an entrance point for problem specific activations.
bool primalViolated(double x) const
Can be used to compare a value with the one of the best known primal bound.
virtual bool tailingOff()
Called when a tailing off effect according to the parameters TailOffPercent and TailOffNLps is observ...
Abstract base class for all branching rules.
bool activated_
The variable is true if the function activate() has been called from the function _activate().
status of fixed and set variables.
virtual void selectCons()
Is called before constraint are selected from the constraint buffer.
ArrayBuffer< int > * removeVarBuffer_
The buffer of the variables which are removed at the beginning of the next iteration.
virtual void setByLogImp(ArrayBuffer< int > &variable, ArrayBuffer< FSVarStat * > &status)
The default implementation of setByLogImp() does nothing.
@ Branching
We try to generate further subproblems as sons of this subproblem.
int id_
The number of the subproblem.
@ Unprocessed
The status after generation, but before optimization of the subproblem.
Sub * father_
A pointer to the father in the branch-and-cut tree.
virtual void changeLBound(int i, double newLb) override
Sets the lower bound of variable i to newLb.
bool boundCrash() const
Returns true if the dual bound is worse than the best known primal bound, false otherwise.
virtual int makeFeasible()
The default implementation of makeFeasible()does nothing.
virtual double rankBranchingRule(BranchRule *branchRule)
Computes the rank of a branching rule.
Status of fixed and set variables.
BranchRule * branchRule() const
Returns a pointer to the branching rule of the subproblem.
int maxCon() const
Returns the maximum number of constraints which can be handled without reallocation.
int lastIterVarAdd_
The last iteration in which variables have been added.
LP::METHOD lpMethod_
The solution method for the next linear program.
LpSub * lp() const
Returns a pointer to the linear program of the subproblem.
virtual bool fixAndSetTime()
Controls if variables should be fixed or set when all variables price out correctly.
FSVarStat * fsVarStat(int i) const
Returns a pointer to the status of fixing/setting of the i-th variable.
Master * master()
Returns the master of the optimization.
double nnzReserve_
The additional space for nonzeros.
double lpRankBranchingRule(BranchRule *branchRule, int iterLimit=-1)
Computes the rank of a branching rule by modifying the linear programming relaxation of the subproble...
virtual bool solveApproxNow()
The default implementation always returns false.
Array< double > * uBound_
A pointer to an array with the local upper bounds of the active variables.
Active< Variable, Constraint > * actVar_
The active variables of the subproblem.
TailOff * tailOff_
A pointer to the tailing off manager.
Implements a branching rule for modifying the lower and the upper bound of a variable.
double primalBound() const
Returns the value of the primal bound.
virtual int pricing()
Should generate inactive variables which do not price out correctly.
double * xVal_
The last LP-solution.
int level_
The level of the subproblem in the enumeration tree.
double lBound(int i) const
Can be used to access the lower of an active variable of the subproblem.
CutBuffer< Constraint, Variable > * addConBuffer_
The buffer of the newly generated constraints.
Implements a stopwatch measuring CPU time.
int nIter_
The number of iterations in the cutting plane phase.
bool allBranchOnSetVars_
If true, then the branching rule of the subproblem and of all ancestor on the path to the root node a...
const Master * master() const
Returns the const master of the optimization.
bool forceExactSolver_
Indicates whether to force the use of an exact solver to prepare branching etc.
virtual int initMakeFeas(ArrayBuffer< InfeasCon * > &infeasCon, ArrayBuffer< Variable * > &newVars, Pool< Variable, Constraint > **pool)
The default implementation of the virtual initMakeFeas() does nothing.
int nVar() const
Returns the number of active variables.
double dualBound_
The dual bound of the subproblem.
Base class for constraint/variabe pools.
int lastIterConAdd_
The last iteration in which constraints have been added.
bool relativeReserve() const
const Sub * father() const
Returns a pointer to the father of the subproblem in the branch-and-bound tree.
bool min() const
Returns true If it is minimization problem,, false otherwise.
Status of slack variables.
Variable * variable(int i) const
Returns a pointer to the i-th active variable.
STATUS status() const
Returns the status of the subproblem optimization.
int maxVar() const
Returns the maximum number of variables which can be handled without reallocation.
@ Done
The optimization is done.
bool forceExactSolver() const
Returns whether using the exact solver is forced.
int infeasCon_
The number of an infeasible constraint.
STATUS
The enumeration defining the different statuses of variables from the point of view of fixing and set...
int maxIterations_
The maximum number of iterations in the cutting plane phase.
ArrayBuffer< Sub * > * sons_
The sons of the node in the branch-and-cut tree.
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 betterDual(double x) const
Returns true if x is better than the best known dual bound of the subproblem, false otherwise.
double lowerBound() const
Returns a lower bound on the optimal solution 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...
CutBuffer< Variable, Constraint > * addVarBuffer_
The buffer of the newly generated variables.
virtual void changeUBound(int i, double newUb) override
Sets the upper bound of variable i to newUb.
Constraint * constraint(int i) const
Returns a pointer to the i-th active constraint.
Base class of all other classes of ABACUS.
Master * master_
A pointer to the corresponding master of the optimization.
ogdf::StopwatchCPU localTimer_
double * bInvRow_
A row of the basis inverse associated with the infeasible variable infeasVar_ or slack variable infea...
The parameterized class Array implements dynamic arrays of type E.
double upperBound() const
Returns an upper bound on the optimal solution of the subproblem.
STATUS
A subproblem can have different statuses.
int addConBufferSpace() const
Can be used to determine the maximal number of the constraints which still can be added to the constr...
@ Processed
The subproblem is completely processed but could not be fathomed.
void push(E e)
Puts a new element in the buffer.
Declaration of stopwatch classes.
Forms the virtual base class for all possible variables given in pool format.
Active< Constraint, Variable > * actCon() const
Returns a pointer to the currently active constraints.
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 void newDormantRound()
Increments the counter for the number of rounds the subproblem is dormant.
bool max() const
Returns true if it is maximization problem,, false otherwise.
PHASE
The optimization of the subproblem can be in one of the following phases.
int id() const
Returns the identity number of the subproblem.
int infeasVar_
The number of an infeasible variable.
virtual void deactivate()
Can be used as entrance point for problem specific deactivations after the subproblem optimization.
Array< SlackStat * > * slackStat_
A pointer to an array storing the statuses of the slack variables of the last solved linear program.
const OptSense * optSense() const
Returns a pointer to the object holding the optimization sense of the problem.
int level() const
Returns the level of the subproblem in the branch-and-bound tree.
The linear program of a subproblem.
Active< Constraint, Variable > * actCon_
The active constraints of the subproblem.
Array< FSVarStat * > * fsVarStat_
A pointer to an array storing the status of fixing and setting of the active variables.
METHOD
The solution method for the linear program.
int nStrongBranchingIterations() const
The number of simplex iterations that are performed when testing candidates for branching variables w...
virtual bool pausing()
Sometimes it is appropriate to put a subproblem back into the list of open subproblems.
Representation of variables in column format.
LP::METHOD lastLP_
The method that was used to solve the last LP.
double * yVal_
The dual variables of the last linear program.
double yVal(int i) const
Returns the value of the i-th dual variable in the last solved linear program.
Maintains open subproblems.
double xVal(int i) const
Returns the value of the i-th variable in the last solved linear program.
LPVARSTAT * lpVarStat(int i) const
Returns a pointer to the status of the variable i in the last solved linear program.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
bool relativeReserve_
If this member is true then the space reserve of the following three members varReserve_,...
Forms the virtual base class for all possible constraints given in pool format.
Array< double > * lBound_
A pointer to an array with the local lower bound of the active variables.
bool genNonLiftCons_
If true, then the management of non-liftable constraints is performed.
Stores constraints and variables.
int nOpt_
The number of optimizations of the subproblem.
virtual bool exceptionBranch()
Can be used to specify a problem specific criteria for enforcing a branching step.
bool ignoreInTailingOff_
If this flag is set to true then the next LP-solution is ignored in the tailing-off control.
TYPE
The enumeration with the different variable types.
SlackStat * slackStat(int i) const
Returns a pointer to the status of the slack variable i in the last solved linear program.
BranchRule * branchRule_
The branching rule for the subproblem.
virtual bool exceptionFathom()
Can be used to specify a problem specific fathoming criterium that is checked before the separation o...
virtual int generateBranchRules(ArrayBuffer< BranchRule * > &rules)
Tries to find rules for splitting the current subproblem in further subproblems.
linear program of a subproblem.
double uBound(int i) const
Can be used to access the upper of an active variable of the subproblem.
static void remove(V &ts, const T &t)
double conReserve_
The additional space for constraints.
virtual int addBranchingConstraint(PoolSlot< Constraint, Variable > *slot)
Adds a branching constraint to the constraint buffer.
double dualBound() const
Returns a bound which is "better" than the optimal solution of the subproblem w.r....
int nDormantRounds_
The number of subproblem optimizations the subproblem has already the status Dormant.
double varReserve_
The additional space for variables.
int nDormantRounds() const
ArrayBuffer< int > * removeConBuffer_
The buffer of the constraints which are removed at the beginning of the next iteration.
virtual void selectVars()
Is called before variables are selected from the variable buffer.
int nCon() const
Returns the number of active constraints.
STATUS status_
The status of the subproblem.
The master of the optimization.
double nnzReserve() const
Returns the additional space for nonzero elements of the constraint matrix when it is passed to the L...
void removeVar(int i)
Remove variable i from the set of active variables.