 |
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
39 class OsiSolverInterface;
41 #pragma GCC visibility push(default)
55 template<
class BaseType,
class CoType>
class StandardPool;
100 static const char* STATUS_[];
118 static const char *ENUMSTRAT_[];
131 static const char *BRANCHINGSTRAT_[];
151 static const char* PRIMALBOUNDMODE_[];
164 static const char* SKIPPINGMODE_[];
178 static const char* CONELIMMODE_[];
190 static const char* VARELIMMODE_[];
203 static const char* VBCMODE_[];
210 enum OSISOLVER { Cbc, Clp, CPLEX, DyLP, FortMP, GLPK, MOSEK, OSL, SoPlex, SYMPHONY,
XPRESS_MP, Gurobi, Csdp };
213 static const char* OSISOLVER_[];
240 Master(
const char *problemName,
bool cutting,
bool pricing,
242 double eps = 1.0e-4,
double machineEps = 1.0e-7,
244 bool readParamFromFile =
false);
269 double lowerBound()
const;
272 double upperBound()
const;
287 void primalBound(
double x);
302 void dualBound(
double x);
308 bool betterDual(
double x)
const;
319 bool primalViolated(
double x)
const;
327 bool betterPrimal(
double x)
const;
339 bool feasibleFound()
const;
364 virtual int enumerationStrategy(
const Sub *s1,
const Sub *s2);
380 bool guaranteed()
const;
389 double guarantee()
const;
396 void printGuarantee()
const;
421 bool knownOptimum(
double &optVal)
const;
507 int nSub()
const {
return nSub_; }
510 int nLp()
const {
return nLp_; }
522 void printParameters()
const;
552 void nBranchingVariableCandidates(
int n);
561 void nStrongBranchingIterations(
int n);
574 void requiredGuarantee(
double g);
588 void maxLevel(
int ml);
602 void maxNSub(
int ml);
608 string maxCpuTimeAsString()
const;
614 void maxCpuTime(
const string &t);
620 void maxCpuTime(
int hour,
int min,
int sec);
626 string maxCowTimeAsString()
const;
635 void maxCowTime(
const string &t);
668 void tailOffPercent(
double p);
674 bool delayedBranching(
int nOpt)
const;
732 void pricingFreq(
int f);
741 void skipFactor(
int f);
956 virtual bool setSolverParameters(OsiSolverInterface* interface,
bool solverIsApprox);
979 virtual void initializePools(
984 bool dynamicCutPool =
false);
1009 virtual void initializePools(
1015 bool dynamicCutPool =
false);
1040 int bestFirstSearch(
const Sub* s1,
const Sub* s2)
const;
1067 virtual int equalSubCompare(
const Sub *s1,
const Sub *s2)
const;
1081 int depthFirstSearch(
const Sub* s1,
const Sub* s2)
const;
1096 int breadthFirstSearch(
const Sub* s1,
const Sub* s2)
const;
1108 int diveAndBestFirstSearch(
const Sub *s1,
const Sub* s2)
const;
1123 virtual Sub *firstSub() = 0;
1142 virtual void assignParameters();
1164 void _initializeParameters();
1166 void _createLpMasters();
1167 void _deleteLpMasters();
1168 void _initializeLpParameters();
1174 void _setDefaultLpParameters();
1180 void _printLpParameters()
const;
1186 void _outputLpStatistics()
const;
1206 void writeTreeInterface(
const string &info,
bool time =
true)
const;
1213 void treeInterfaceNewNode(
Sub *sub)
const;
1216 void treeInterfacePaintNode(
int id,
int color)
const;
1219 void treeInterfaceLowerBound(
double lb)
const;
1222 void treeInterfaceUpperBound(
double ub)
const;
1225 void treeInterfaceNodeBounds(
int id,
double lb,
double ub);
1231 void newSub(
int level);
1262 void rRoot(
Sub *newRoot,
bool reoptimize);
1271 void rootDualBound(
double x);
1538 #pragma GCC visibility pop
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
StandardPool< Constraint, Variable > * conPool() const
Returns a pointer to the default pool storing the constraints of the problem formulation.
@ MaxCpuTime
The status, if the optimization terminates since the maximum cpu time is exceeded.
int nAddCons_
The total number of added constraints.
int nLp() const
Returns the number of optimized linear programs (only LP-relaxations).
FixCand * fixCand_
The variables which are candidates for being fixed.
void maxConBuffered(int max)
Changes the maximal number of constraints that are buffered in an iteration of the cutting plane algo...
PRIMALBOUNDMODE pbMode_
The mode of the primal bound initialization.
double rootDualBound_
The best known dual bound at the end of the optimization of the root node.
double varElimEps_
The tolerance for the elimination of variables by the mode ReducedCost.
const ogdf::StopwatchCPU * improveTime() const
Returns a pointer to the timer measuring the cpu time spent in the heuristics for the computation of ...
int maxNSub() const
Returns the maximal number of subproblems to be processed.
void maxConAdd(int max)
Sets the maximal number of constraints that are added in an iteration of the cutting plane algorithm.
double dualBound_
The best known dual bound.
int conElimAge() const
Returns the age for the elimination of constraints.
@ DepthFirst
Depth-first search, i.e., select the subproblem with maximal level in the enumeration tree.
int skipFactor() const
Returns the frequency of subproblems in which constraints or variables should be generated.
string problemName_
The name of the optimized problem.
OpenSub * openSub() const
Returns a pointer to the set of open subproblems.
Implements a stopwatch measuring wall-clock time.
double conElimEps_
The tolerance for the elimination of constraints by the mode NonBinding/.
SENSE
The enumeration defining the sense of optimization.
void dbThreshold(int threshold)
Sets the number of optimizations of a subproblem until sons are created in Sub::branching().
TWeight infinity()
Helper function to get the maximum value for a given weight type.
double varElimEps() const
Returns the zero tolerance for the elimination of variables by the reduced cost criterion.
double rootDualBound() const
Returns the dual bound at the root node.
double tailOffPercent() const
Returns the minimal change of the dual bound for the tailing off analysis in percent.
@ Unprocessed
The initial status, before the optimization starts.
STATUS
The various statuses of the optimization process.
int maxLevel() const
Returns the maximal depth up to which the enumeration should be performed.
CONELIMMODE
This enumeration defines the ways for automatic constraint elimination during the cutting plane phase...
bool cutting_
If true, then constraints are generated in the optimization.
ENUMSTRAT enumerationStrategy() const
Returns the enumeration strategy.
virtual void initializeOptimization()
The default implementation of initializeOptimization() does nothing.
OpenSub * openSub_
The set of open subproblems.
int pricingFreq_
The number of solved LPs between two additional pricing steps.
void removeCons(int n)
Increments the counter for the total number of removed constraints by n.
LpMasterOsi * lpMasterOsi() const
bool pricing_
If true, then variables are generated in the optimization.
void showAverageCutDistance(bool on)
Turns the output of the average distance of the added cuts from the fractional solution on or off.
void varElimAge(int age)
Changes the age for the elimination of variables by the reduced cost criterion to age.
@ Error
An error occurred during the optimization process.
int nNewRoot() const
Returns the number of root changes of the remaining branch-and-cut tree.
const ogdf::StopwatchCPU * separationTime() const
Returns a pointer to the timer measuring the cpu time spent in the separation of cutting planes.
void varElimMode(VARELIMMODE mode)
Changes the variable elimination mode to mode.
History * history_
The solution history.
Sub * rRoot_
The root node of the remaining enumeration tree.
void skippingMode(SKIPPINGMODE mode)
Sets the skipping strategy to mode.
std::ostream * treeStream_
A pointer to the log stream for the VBC-Tool.
int64_t maxCowTime() const
Returns the maximal wall-clock time (in seconds) which can be used by the optimization.
int maxConAdd() const
Returns the maximal number of constraints which should be added in every iteration of the cutting pla...
bool newRootReOptimize_
If true, then an already earlier processed node is reoptimized if it becomes the new root of the rema...
VARELIMMODE varElimMode_
The way variables are automatically eliminated in the column generation algorithm.
bool showAverageCutDistance() const
void maxCpuTime(int64_t seconds)
Sets the maximally allowed cpu time to seconds.
int maxVarBuffered_
The size of the buffer for generated variables.
const ogdf::StopwatchWallClock * totalCowTime() const
Returns a pointer to the timer measuring the total wall clock time.
double primalBound() const
Returns the value of the primal bound.
int varElimAge() const
Returns the age for the elimination of variables by the reduced cost criterion.
virtual void terminateOptimization()
The default implementation of terminateOptimization() does nothing.
VBCMODE
This enumeration defines what kind of output can be generated for the VBCTOOL.
ogdf::StopwatchCPU lpTime_
The timer for the cpu time spent in the LP-interface.
Implements a stopwatch measuring CPU time.
int nSub() const
returns the number of generated subproblems.
ogdf::StopwatchCPU lpSolverTime_
int nAddVars_
The total number of added variables.
CONELIMMODE conElimMode() const
Returns the mode for the elimination of constraints.
BRANCHINGSTRAT branchingStrategy() const
Returns the branching strategy.
int maxConAdd_
The maximal number of added constraints per iteration of the cutting plane algorithm.
int pricingFreq() const
Returns the number of linear programs being solved between two additional pricing steps.
int nBranchingVariableCandidates() const
Returns the number of variables that should be tested for the selection of the branching variable.
StandardPool< Variable, Constraint > * varPool_
The default pool with the variables of the problem formulation.
const string & problemName() const
Returns the name of the instance being optimized (as specified in the constructor of this class).
int64_t maxCpuTime() const
Returns the maximal cpu time (in seconds) which can be used by the optimization.
bool eliminateFixedSet_
If true, then nonbasic fixed and set variables are eliminated.
ogdf::StopwatchCPU branchingTime_
The timer for the cpu time spent in determining the branching rules.
BRANCHINGSTRAT branchingStrategy_
The branching strategy.
StandardPool< Constraint, Variable > * cutPool() const
Returns a pointer to the default pool for the generated cutting planes.
OSISOLVER defaultLpSolver() const
returns the Lp Solver.
VARELIMMODE varElimMode() const
Returns the mode for the elimination of variables.
int maxIterations() const
Returns the maximal number of iterations per subproblem optimization (-1 means no iteration limit).
bool fixSetByRedCost_
If true, then variables are fixed and set by reduced cost criteria.
int maxVarBuffered() const
Returns the size of the buffer for the variables generated in the column generation algorithm.
@ Processing
The status while the optimization is performed.
int nSubSelected() const
Returns the number of subproblems which have already been selected from the set of open subproblems.
void enumerationStrategy(ENUMSTRAT strat)
Changes the enumeration strategy to strat.
void newRootReOptimize(bool on)
Turns the reoptimization of new root nodes of the remaining branch and bound tree on or off.
void conElimMode(CONELIMMODE mode)
Changes the constraint elimination mode to mode.
CONELIMMODE conElimMode_
The way constraints are automatically eliminated in the cutting plane algorithm.
void maxVarAdd(int max)
Changes the maximal number of variables that are added in an iteration of the subproblem optimization...
int maxLevel_
The maximal level in enumeration tree.
void pbMode(PRIMALBOUNDMODE mode)
Sets the mode of the primal bound initialization to mode.
@ MaxLevel
The status, if subproblems are ignored since the maximum enumeration level is exceeded.
virtual void initializeParameters()
Is only a dummy.
int nStrongBranchingIterations_
The number of simplex iterations that are performed when testing a branching variable candidate withi...
int conElimAge_
The number of iterations an elimination criterion must be satisfied until a constraint can be removed...
void tailOffNLp(int n)
Sets the number of linear programs considered in the tailing off analysis to n.
@ NoConElim
No constraints are eliminated.
@ NoVarElim
No variables are eliminated.
ogdf::StopwatchCPU pricingTime_
The timer for the cpu time spent in pricing.
StandardPool< Variable, Constraint > * varPool() const
Returns a pointer to the default pool storing the variables.
const ogdf::StopwatchCPU * lpTime() const
Returns a pointer to the timer measuring the cpu time spent in members of the LP-interface.
ogdf::StopwatchCPU improveTime_
The timer for the cpu time spent in the heuristics for the computation of feasible solutions.
int nSub_
The number of generated subproblems.
void vbcLog(VBCMODE mode)
Changes the mode of output for the Vbc-Tool to mode.
int nRemVars_
The total number of removed variables.
int nLp_
The number of solved LPs.
int tailOffNLp() const
Returns the number of linear programs considered in the tailing off analysis.
OSISOLVER defaultLpSolver_
The default LP-Solver.
void maxVarBuffered(int max)
Changes the maximal number of variables that are buffered in an iteration of the subproblem optimizat...
VARELIMMODE
This enumeration defines the ways for automatic variable elimination during the column generation alg...
@ MaxNSub
The status, if the optimization terminates since the maximum number of subproblems is reached.
bool fixSetByRedCost() const
@ Unknown
Unknown optimization sense, required to recognize uninitialized object.
STATUS status() const
Returns the status of the Master.
int nNewRoot_
The number of changes of the root of the remaining branch-and-bound tree.
STATUS status_
The current status of the optimization.
void defaultLpSolver(OSISOLVER osiSolver)
Changes the default Lp solver to osiSolver.
Declaration of stopwatch classes.
void removeVars(int n)
Increments the counter for the total number of removed variables by n.
void addCons(int n)
Increments the counter for the total number of added constraints by n.
int maxNSub_
The maximal number of subproblems to be processed.
SKIPPINGMODE skippingMode_
Either constraints are generated only every skipFactor_ subproblem (SkipByNode) only every skipFactor...
int64_t maxCowTime_
The maximal available wall-clock time.
bool objInteger() const
If true then we assume that all feasible solutions have integral objective function values.
double dualBound() const
Returns the value of the dual bound.
bool solveApprox() const
True, if an approximative solver should be used.
virtual void output() const
Does nothing but can be redefined in derived classes for output before the timing statistics.
const ogdf::StopwatchCPU * pricingTime() const
Returns a pointer to the timer measuring the cpu time spent in pricing.
bool max() const
Returns true if it is maximization problem,, false otherwise.
void status(STATUS stat)
Sets the status of the Master.
void branchingStrategy(BRANCHINGSTRAT strat)
Changes the branching strategy to strat.
const OptSense * optSense() const
Returns a pointer to the object holding the optimization sense of the problem.
void objInteger(bool b)
Sets the assumption that the objective function values of all feasible solutions are integer.
ENUMSTRAT
The enumeration defining the different enumeration strategies for the branch and bound algorithm.
ogdf::StopwatchCPU totalTime_
The timer for the total cpu time for the optimization.
double conElimEps() const
Returns the zero tolerance for the elimination of constraints by the slack criterion.
int varElimAge_
The number of iterations an elimination criterion must be satisfied until a variable can be removed.
int nStrongBranchingIterations() const
The number of simplex iterations that are performed when testing candidates for branching variables w...
ogdf::StopwatchCPU separationTime_
The timer for the cpu time spent in the separation.
@ File
Output for the tree interface is written to a file.
VBCMODE VbcLog_
Ouput for the Tree Interface is generated depending on the value of this variable.
void newFixed(int n)
Increments the counter of the number of fixed variables by n.
@ NonBinding
Nonbinding constraints are eliminated.
int maxConBuffered() const
Returns the size of the buffer for generated constraints in the cutting plane algorithm.
double lowerBound() const
Returns the value of the global lower bound.
VBCMODE vbcLog() const
Returns the mode of output for the Vbc-Tool.
Sub * root() const
Can be used to access the root node of the branch-and-bound tree.
int nFixed_
The total number of fixed variables.
StandardPool< Constraint, Variable > * conPool_
The default pool with the constraints of the problem formulation.
int skipFactor_
The frequency constraints or variables are generated depending on the skipping mode.
const ogdf::StopwatchCPU * branchingTime() const
Returns a pointer to the timer measuring the cpu time spent in finding and selecting the branching ru...
void addVars(int n)
Increments the counter for the total number of added variables by n.
int maxConBuffered_
The size of the buffer for generated cutting planes.
bool objInteger_
true, if all objective function values of feasible solutions are assumed to be integer.
double tailOffPercent_
The minimal change of the LP-value on the tailing off analysis.
Maintains open subproblems.
int dbThreshold() const
Returns the number of optimizations of a subproblem until sons are created.
bool eliminateFixedSet() const
@ MaxCowTime
The status, if the optimization terminates since the maximum wall-clock time is exceeded.
void maxIterations(int max)
Changes the default value for the maximal number of iterations of the optimization of a subproblem.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
void fixSetByRedCost(bool on)
Turns fixing and setting variables by reduced cost on or off.
void conElimAge(int age)
Changes the age for the elimination of constraints to age.
int tailOffNLp_
The number of LP-iterations for the tailing off analysis.
ogdf::StopwatchWallClock totalCowTime_
The timer for the total elapsed time.
bool printLP_
If true, then the linear program is output every iteration.
int nSubSelected_
The number of subproblems already selected from the list of open subproblems.
void optimumFileName(const char *name)
Changes the name of the file in which the value of the optimum solution is searched.
int64_t maxCpuTime_
The maximal available cpu time.
History * history() const
Returns a pointer to the object storing the solution history of this branch and cut problem.
int maxIterations_
The maximal number of iterations of the cutting plane/column generation algorithm in the subproblem.
int maxVarAdd() const
Returns the maximal number of variables which should be added in the column generation algorithm.
LpMasterOsi * lpMasterOsi_
double upperBound() const
Returns the value of the global upper bound.
StandardPool< Constraint, Variable > * cutPool_
The default pool of dynamically generated constraints.
double requiredGuarantee_
The guarantee in percent which should be reached when the optimization stops.
@ BreadthFirst
Breadth-first search, i.e., select the subproblem with minimal level in the enumeration tree.
void conElimEps(double eps)
Changes the tolerance for the elimination of constraints by the slack criterion to eps.
const ogdf::StopwatchCPU * lpSolverTime() const
Return a pointer to the timer measuring the cpu time required by the LP solver.
int nBranchingVariableCandidates_
The number of candidates that are evaluated for branching on variables.
FixCand * fixCand() const
Returns a pointer to the object storing the variables which are candidates for being fixed.
int dbThreshold_
The number of optimizations of an Sub until branching is performed.
void countLp()
Increments the counter for linear programs and should be called in each optimization call of the LP-r...
bool showAverageCutDistance_
If true then the average distance of the added cutting planes is output every iteration of the cuttin...
const ogdf::StopwatchCPU * totalTime() const
returns a pointer to the timer measuring the total cpu time for the optimization.
int minDormantRounds() const
Returns the maximal number of rounds, i.e., number of subproblem optimizations, a subproblem is dorma...
void maxCowTime(int64_t seconds)
Sets the maximally allowed wall-clock time to seconds.
double primalBound_
The best known primal bound.
int highestLevel() const
Returns the highest level in the tree which has been reached during the implicit enumeration.
double requiredGuarantee() const
The guarantee specification for the optimization.
PRIMALBOUNDMODE pbMode() const
Returns the mode of the primal bound initialization.
bool newRootReOptimize() const
OptSense optSense_
The sense of the objective function.
@ Optimum
The primal bound is initialized with the value of the optimum solution.
void minDormantRounds(int nRounds)
Sets the number of rounds a subproblem should stay dormant to nRounds.
SKIPPINGMODE skippingMode() const
Returns the skipping strategy.
void varElimEps(double eps)
Changes the tolerance for the elimination of variables by the reduced cost criterion to eps.
@ NoVbc
No output for the tree interface.
Global data and functions.
void printLP(bool on)
Turns the output of the linear program in every iteration on or off.
int nRemCons_
The total number of removed constraints.
BRANCHINGSTRAT
This enumeration defines the two currently implemented branching variable selection strategies.
PRIMALBOUNDMODE
This enumeration provides various methods for the initialization of the primal bound.
int minDormantRounds_
The minimal number of rounds, i.e., number of subproblem optimizations, a subproblem is dormant,...
OSISOLVER
This enumeration defines which solvers can be used to solve the LP-relaxations.
void initializeOptSense(OptSense::SENSE sense)
Can be used to initialize the sense of the optimization in derived classes, if this has not been alre...
bool solveApprox_
If true, then an approximative solver is used to solve linear programs.
@ CloseHalf
Selects the variable with fractional part closest to 0.5.
int highestLevel_
The highest level which has been reached in the enumeration tree.
ENUMSTRAT enumerationStrategy_
The enumeration strategy.
int maxVarAdd_
The maximal number of added variables per iteration of the column generation algorithm.
The master of the optimization.
Sub * root_
The root node of the enumeration tree.
string optimumFileName_
The name of a file storing a list of optimum solutions of problem instances.
const string & optimumFileName() const
Returns the name of the file that stores the optimum solutions.
SKIPPINGMODE
The way nodes are skipped for the generation of cuts.
void eliminateFixedSet(bool turnOn)
Turns the elimination of fixed and set variables on or off.