39 class OsiSolverInterface;
54 template<
class BaseType,
class CoType>
class StandardPool;
99 static const char* STATUS_[];
117 static const char *ENUMSTRAT_[];
130 static const char *BRANCHINGSTRAT_[];
150 static const char* PRIMALBOUNDMODE_[];
163 static const char* SKIPPINGMODE_[];
177 static const char* CONELIMMODE_[];
189 static const char* VARELIMMODE_[];
202 static const char* VBCMODE_[];
209 enum OSISOLVER { Cbc, Clp, CPLEX, DyLP, FortMP, GLPK, MOSEK, OSL, SoPlex, SYMPHONY,
XPRESS_MP, Gurobi, Csdp };
212 static const char* OSISOLVER_[];
239 Master(
const char *problemName,
bool cutting,
bool pricing,
241 double eps = 1.0e-4,
double machineEps = 1.0e-7,
242 double infinity = 1.0e30,
243 bool readParamFromFile =
false);
268 double lowerBound()
const;
271 double upperBound()
const;
286 void primalBound(
double x);
301 void dualBound(
double x);
307 bool betterDual(
double x)
const;
318 bool primalViolated(
double x)
const;
326 bool betterPrimal(
double x)
const;
338 bool feasibleFound()
const;
363 virtual int enumerationStrategy(
const Sub *s1,
const Sub *s2);
379 bool guaranteed()
const;
388 double guarantee()
const;
395 void printGuarantee()
const;
420 bool knownOptimum(
double &optVal)
const;
506 int nSub()
const {
return nSub_; }
509 int nLp()
const {
return nLp_; }
521 void printParameters()
const;
551 void nBranchingVariableCandidates(
int n);
560 void nStrongBranchingIterations(
int n);
573 void requiredGuarantee(
double g);
587 void maxLevel(
int ml);
601 void maxNSub(
int ml);
607 string maxCpuTimeAsString()
const;
613 void maxCpuTime(
const string &t);
619 void maxCpuTime(
int hour,
int min,
int sec);
625 string maxCowTimeAsString()
const;
634 void maxCowTime(
const string &t);
667 void tailOffPercent(
double p);
673 bool delayedBranching(
int nOpt)
const;
731 void pricingFreq(
int f);
740 void skipFactor(
int f);
955 virtual bool setSolverParameters(OsiSolverInterface* interface,
bool solverIsApprox);
978 virtual void initializePools(
983 bool dynamicCutPool =
false);
1008 virtual void initializePools(
1014 bool dynamicCutPool =
false);
1039 int bestFirstSearch(
const Sub* s1,
const Sub* s2)
const;
1066 virtual int equalSubCompare(
const Sub *s1,
const Sub *s2)
const;
1080 int depthFirstSearch(
const Sub* s1,
const Sub* s2)
const;
1095 int breadthFirstSearch(
const Sub* s1,
const Sub* s2)
const;
1107 int diveAndBestFirstSearch(
const Sub *s1,
const Sub* s2)
const;
1122 virtual Sub *firstSub() = 0;
1141 virtual void assignParameters();
1163 void _initializeParameters();
1165 void _createLpMasters();
1166 void _deleteLpMasters();
1167 void _initializeLpParameters();
1173 void _setDefaultLpParameters();
1179 void _printLpParameters()
const;
1185 void _outputLpStatistics()
const;
1205 void writeTreeInterface(
const string &info,
bool time =
true)
const;
1212 void treeInterfaceNewNode(
Sub *sub)
const;
1215 void treeInterfacePaintNode(
int id,
int color)
const;
1218 void treeInterfaceLowerBound(
double lb)
const;
1221 void treeInterfaceUpperBound(
double ub)
const;
1224 void treeInterfaceNodeBounds(
int id,
double lb,
double ub);
1230 void newSub(
int level);
1261 void rRoot(
Sub *newRoot,
bool reoptimize);
1270 void rootDualBound(
double x);
1526 if (optSense_.max())
return primalBound_;
1527 else return dualBound_;
1532 if (optSense_.max())
return dualBound_;
1533 else return primalBound_;
void removeCons(int n)
Increments the counter for the total number of removed constraints by n.
const ogdf::StopwatchCPU * lpSolverTime() const
Return a pointer to the timer measuring the cpu time required by the LP solver.
LpMasterOsi * lpMasterOsi() const
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.
void maxIterations(int max)
Changes the default value for the maximal number of iterations of the optimization of a subproblem...
void varElimAge(int age)
Changes the age for the elimination of variables by the reduced cost criterion to age...
int dbThreshold_
The number of optimizations of an Sub until branching is performed.
virtual void terminateOptimization()
The default implementation of terminateOptimization() does nothing.
int nNewRoot() const
Returns the number of root changes of the remaining branch-and-cut tree.
void varElimMode(VARELIMMODE mode)
Changes the variable elimination mode to mode.
int minDormantRounds() const
Returns the maximal number of rounds, i.e., number of subproblem optimizations, a subproblem is dorma...
int nAddVars_
The total number of added variables.
double primalBound_
The best known primal bound.
std::ostream * treeStream_
A pointer to the log stream for the VBC-Tool.
Global data and functions.
int pricingFreq() const
Returns the number of linear programs being solved between two additional pricing steps...
PRIMALBOUNDMODE pbMode() const
Returns the mode of the primal bound initialization.
OptSense optSense_
The sense of the objective function.
const string & problemName() const
Returns the name of the instance being optimized (as specified in the constructor of this class)...
void minDormantRounds(int nRounds)
Sets the number of rounds a subproblem should stay dormant to nRounds.
bool newRootReOptimize_
If true, then an already earlier processed node is reoptimized if it becomes the new root of the rema...
The master of the optimization.
int64_t maxCpuTime_
The maximal available cpu time.
void varElimEps(double eps)
Changes the tolerance for the elimination of variables by the reduced cost criterion to eps...
int maxVarAdd() const
Returns the maximal number of variables which should be added in the column generation algorithm...
void printLP(bool on)
Turns the output of the linear program in every iteration on or off.
ogdf::StopwatchCPU branchingTime_
The timer for the cpu time spent in determining the branching rules.
void conElimEps(double eps)
Changes the tolerance for the elimination of constraints by the slack criterion to eps...
void initializeOptSense(OptSense::SENSE sense)
Can be used to initialize the sense of the optimization in derived classes, if this has not been alre...
int maxVarBuffered_
The size of the buffer for generated variables.
int nBranchingVariableCandidates_
The number of candidates that are evaluated for branching on variables.
Selects the variable with fractional part closest to 0.5.
FixCand * fixCand() const
Returns a pointer to the object storing the variables which are candidates for being fixed...
StandardPool< Constraint, Variable > * cutPool() const
Returns a pointer to the default pool for the generated cutting planes.
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
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...
VBCMODE
This enumeration defines what kind of output can be generated for the VBCTOOL.
Declaration of stopwatch classes.
int nSub() const
returns the number of generated subproblems.
ogdf::StopwatchCPU lpSolverTime_
void eliminateFixedSet(bool turnOn)
Turns the elimination of fixed and set variables on or off.
void maxCowTime(int64_t seconds)
Sets the maximally allowed wall-clock time to seconds.
Breadth-first search, i.e., select the subproblem with minimal level in the enumeration tree...
int highestLevel() const
Returns the highest level in the tree which has been reached during the implicit enumeration.
int maxVarBuffered() const
Returns the size of the buffer for the variables generated in the column generation algorithm...
double requiredGuarantee() const
The guarantee specification for the optimization.
BRANCHINGSTRAT branchingStrategy() const
Returns the branching strategy.
StandardPool< Constraint, Variable > * conPool() const
Returns a pointer to the default pool storing the constraints of the problem formulation.
bool newRootReOptimize() const
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.
SKIPPINGMODE skippingMode() const
Returns the skipping strategy.
virtual void initializeParameters()
Is only a dummy.
int nRemCons_
The total number of removed constraints.
BRANCHINGSTRAT branchingStrategy_
The branching strategy.
PRIMALBOUNDMODE pbMode_
The mode of the primal bound initialization.
The primal bound is initialized with the value of the optimum solution.
double rootDualBound_
The best known dual bound at the end of the optimization of the root node.
StandardPool< Variable, Constraint > * varPool() const
Returns a pointer to the default pool storing the variables.
const ogdf::StopwatchCPU * improveTime() const
Returns a pointer to the timer measuring the cpu time spent in the heuristics for the computation of ...
double varElimEps_
The tolerance for the elimination of variables by the mode ReducedCost.
OSISOLVER defaultLpSolver() const
returns the Lp Solver.
void maxConAdd(int max)
Sets the maximal number of constraints that are added in an iteration of the cutting plane algorithm...
const string & optimumFileName() const
Returns the name of the file that stores the optimum solutions.
int conElimAge() const
Returns the age for the elimination of constraints.
SKIPPINGMODE
The way nodes are skipped for the generation of cuts.
An array that keeps track of the number of inserted elements; also usable as an efficient stack...
void conElimMode(CONELIMMODE mode)
Changes the constraint elimination mode to mode.
Output for the tree interface is written to a file.
CONELIMMODE conElimMode_
The way constraints are automatically eliminated in the cutting plane algorithm.
int tailOffNLp() const
Returns the number of linear programs considered in the tailing off analysis.
double rootDualBound() const
Returns the dual bound at the root node.
Nonbinding constraints are eliminated.
void pbMode(PRIMALBOUNDMODE mode)
Sets the mode of the primal bound initialization to mode.
int maxLevel_
The maximal level in enumeration tree.
void maxConBuffered(int max)
Changes the maximal number of constraints that are buffered in an iteration of the cutting plane algo...
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.
No constraints are eliminated.
ogdf::StopwatchCPU pricingTime_
The timer for the cpu time spent in pricing.
int nSub_
The number of generated subproblems.
An error occurred during the optimization process.
bool objInteger() const
If true then we assume that all feasible solutions have integral objective function values...
double dualBound_
The best known dual bound.
History * history_
The solution history.
void vbcLog(VBCMODE mode)
Changes the mode of output for the Vbc-Tool to mode.
int nLp_
The number of solved LPs.
OpenSub * openSub() const
Returns a pointer to the set of open subproblems.
const OptSense * optSense() const
Returns a pointer to the object holding the optimization sense of the problem.
Depth-first search, i.e., select the subproblem with maximal level in the enumeration tree...
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 showAverageCutDistance() const
bool cutting_
If true, then constraints are generated in the optimization.
OpenSub * openSub_
The set of open subproblems.
double lowerBound() const
Returns the value of the global lower bound.
void removeVars(int n)
Increments the counter for the total number of removed variables by n.
Maintains open subproblems.
double dualBound() const
Returns the value of the dual bound.
StandardPool< Constraint, Variable > * conPool_
The default pool with the constraints of the problem formulation.
bool solveApprox() const
True, if an approximative solver should be used.
void skippingMode(SKIPPINGMODE mode)
Sets the skipping strategy to mode.
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.
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...
void maxCpuTime(int64_t seconds)
Sets the maximally allowed cpu time to seconds.
int tailOffNLp_
The number of LP-iterations for the tailing off analysis.
int varElimAge() const
Returns the age for the elimination of variables by the reduced cost criterion.
int maxIterations() const
Returns the maximal number of iterations per subproblem optimization (-1 means no iteration limit)...
int nFixed_
The total number of fixed variables.
ogdf::StopwatchCPU lpTime_
The timer for the cpu time spent in the LP-interface.
bool printLP_
If true, then the linear program is output every iteration.
CONELIMMODE conElimMode() const
Returns the mode for the elimination of constraints.
const ogdf::StopwatchCPU * branchingTime() const
Returns a pointer to the timer measuring the cpu time spent in finding and selecting the branching ru...
void optimumFileName(const char *name)
Changes the name of the file in which the value of the optimum solution is searched.
int maxConAdd_
The maximal number of added constraints per iteration of the cutting plane algorithm.
void newRootReOptimize(bool on)
Turns the reoptimization of new root nodes of the remaining branch and bound tree on or off...
History * history() const
Returns a pointer to the object storing the solution history of this branch and cut problem...
bool objInteger_
true, if all objective function values of feasible solutions are assumed to be integer.
int maxIterations_
The maximal number of iterations of the cutting plane/column generation algorithm in the subproblem...
double requiredGuarantee_
The guarantee in percent which should be reached when the optimization stops.
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.
void maxVarAdd(int max)
Changes the maximal number of variables that are added in an iteration of the subproblem optimization...
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.
Implements a stopwatch measuring wall-clock time.
The status, if the optimization terminates since the maximum cpu time is exceeded.
const ogdf::StopwatchCPU * totalTime() const
returns a pointer to the timer measuring the total cpu time for the optimization. ...
No variables are eliminated.
const ogdf::StopwatchCPU * lpTime() const
Returns a pointer to the timer measuring the cpu time spent in members of the LP-interface.
VARELIMMODE varElimMode() const
Returns the mode for the elimination of variables.
bool fixSetByRedCost_
If true, then variables are fixed and set by reduced cost criteria.
int nRemVars_
The total number of removed variables.
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.
No output for the tree interface.
double upperBound() const
Returns the value of the global upper bound.
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.
bool fixSetByRedCost() const
The status while the optimization is performed.
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.
bool solveApprox_
If true, then an approximative solver is used to solve linear programs.
STATUS status() const
Returns the status of the Master.
int nStrongBranchingIterations_
The number of simplex iterations that are performed when testing a branching variable candidate withi...
int maxVarAdd_
The maximal number of added variables per iteration of the column generation algorithm.
int nNewRoot_
The number of changes of the root of the remaining branch-and-bound tree.
Sub * root_
The root node of the enumeration tree.
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.
ogdf::StopwatchCPU improveTime_
The timer for the cpu time spent in the heuristics for the computation of feasible solutions...
SKIPPINGMODE skippingMode_
Either constraints are generated only every skipFactor_ subproblem (SkipByNode) only every skipFactor...
The status, if subproblems are ignored since the maximum enumeration level is exceeded.
SENSE
The enumeration defining the sense of optimization.
int nAddCons_
The total number of added constraints.
int nLp() const
Returns the number of optimized linear programs (only LP-relaxations).
void status(STATUS stat)
Sets the status of the Master.
OSISOLVER defaultLpSolver_
The default LP-Solver.
void branchingStrategy(BRANCHINGSTRAT strat)
Changes the branching strategy to strat.
ENUMSTRAT
The enumeration defining the different enumeration strategies for the branch and bound algorithm...
void objInteger(bool b)
Sets the assumption that the objective function values of all feasible solutions are integer...
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...
Unknown optimization sense, required to recognize uninitialized object.
int highestLevel_
The highest level which has been reached in the enumeration tree.
VBCMODE VbcLog_
Ouput for the Tree Interface is generated depending on the value of this variable.
ENUMSTRAT enumerationStrategy_
The enumeration strategy.
void defaultLpSolver(OSISOLVER osiSolver)
Changes the default Lp solver to osiSolver.
STATUS status_
The current status of the optimization.
string optimumFileName_
The name of a file storing a list of optimum solutions of problem instances.
void newFixed(int n)
Increments the counter of the number of fixed variables by n.
The status, if the optimization terminates since the maximum number of subproblems is reached...
int maxConBuffered() const
Returns the size of the buffer for generated constraints in the cutting plane algorithm.
VBCMODE vbcLog() const
Returns the mode of output for the Vbc-Tool.
int64_t maxCowTime_
The maximal available wall-clock time.
double conElimEps_
The tolerance for the elimination of constraints by the mode NonBinding/.
string problemName_
The name of the optimized problem.
int skipFactor_
The frequency constraints or variables are generated depending on the skipping mode.
virtual void output() const
Does nothing but can be redefined in derived classes for output before the timing statistics...
double varElimEps() const
Returns the zero tolerance for the elimination of variables by the reduced cost criterion.
const ogdf::StopwatchCPU * pricingTime() const
Returns a pointer to the timer measuring the cpu time spent in pricing.
STATUS
The various statuses of the optimization process.
FixCand * fixCand_
The variables which are candidates for being fixed.
ENUMSTRAT enumerationStrategy() const
Returns the enumeration strategy.
ogdf::StopwatchCPU totalTime_
The timer for the total cpu time for the optimization.
bool eliminateFixedSet() const
int pricingFreq_
The number of solved LPs between two additional pricing steps.
The status, if the optimization terminates since the maximum wall-clock time is exceeded.
bool pricing_
If true, then variables are generated in the optimization.
ogdf::StopwatchCPU separationTime_
The timer for the cpu time spent in the separation.
double conElimEps() const
Returns the zero tolerance for the elimination of constraints by the slack criterion.
void showAverageCutDistance(bool on)
Turns the output of the average distance of the added cuts from the fractional solution on or off...
int maxNSub() const
Returns the maximal number of subproblems to be processed.
const ogdf::StopwatchCPU * separationTime() const
Returns a pointer to the timer measuring the cpu time spent in the separation of cutting planes...
Sub * root() const
Can be used to access the root node of the branch-and-bound tree.
int skipFactor() const
Returns the frequency of subproblems in which constraints or variables should be generated.
Sub * rRoot_
The root node of the remaining enumeration tree.
void dbThreshold(int threshold)
Sets the number of optimizations of a subproblem until sons are created in Sub::branching().
ogdf::StopwatchWallClock totalCowTime_
The timer for the total elapsed time.
int64_t maxCowTime() const
Returns the maximal wall-clock time (in seconds) which can be used by the optimization.
int nSubSelected_
The number of subproblems already selected from the list of open subproblems.
VARELIMMODE varElimMode_
The way variables are automatically eliminated in the column generation algorithm.
int maxConAdd() const
Returns the maximal number of constraints which should be added in every iteration of the cutting pla...
The initial status, before the optimization starts.
double tailOffPercent() const
Returns the minimal change of the dual bound for the tailing off analysis in percent.
StandardPool< Constraint, Variable > * cutPool_
The default pool of dynamically generated constraints.
int dbThreshold() const
Returns the number of optimizations of a subproblem until sons are created.
double tailOffPercent_
The minimal change of the LP-value on the tailing off analysis.
LpMasterOsi * lpMasterOsi_
virtual void initializeOptimization()
The default implementation of initializeOptimization() does nothing.
Implements a stopwatch measuring CPU time.