Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
master.h
Go to the documentation of this file.
1
30#pragma once
31
34
37
38
40
41namespace abacus {
42
43
44class Sub;
45class BranchRule;
46class Variable;
47class Constraint;
48
49class History;
50class OpenSub;
51class FixCand;
52class LpMasterOsi;
53
54template<class BaseType, class CoType> class StandardPool;
55
56
58
70
71 friend class Sub;
72 friend class FixCand;
73
74public:
75
77 enum STATUS {
78 Optimal,
85 Guaranteed,
91 ExceptionFathom
93 };
94
96
99 static const char* STATUS_[];
100
101
104 BestFirst,
109 DiveAndBest
111 };
112
114
117 static const char *ENUMSTRAT_[];
118
122 CloseHalfExpensive
124 };
125
127
130 static const char *BRANCHINGSTRAT_[];
131
133
139 NoPrimalBound,
142 OptimumOne
144 };
145
147
150 static const char* PRIMALBOUNDMODE_[];
151
154 SkipByNode,
156 SkipByLevel
157 };
158
160
163 static const char* SKIPPINGMODE_[];
164
171
172
174
177 static const char* CONELIMMODE_[];
178
182 ReducedCost
183 };
184
186
189 static const char* VARELIMMODE_[];
190
192 enum VBCMODE {
195 Pipe
196 };
197
199
202 static const char* VBCMODE_[];
203
204
206
209 enum OSISOLVER { Cbc, Clp, CPLEX, DyLP, FortMP, GLPK, MOSEK, OSL, SoPlex, SYMPHONY, XPRESS_MP, Gurobi, Csdp };
210
212 static const char* OSISOLVER_[];
213
215
239 Master(const char *problemName, bool cutting, bool pricing,
240 OptSense::SENSE optSense = OptSense::Unknown,
241 double eps = 1.0e-4, double machineEps = 1.0e-7,
242 double infinity = 1.0e30,
243 bool readParamFromFile = false);
244
246 virtual ~Master();
247
249
253
266
268 double lowerBound() const;
269
271 double upperBound() const;
272
274
278 double primalBound() const { return primalBound_; }
279
281
286 void primalBound(double x);
287
289
293 double dualBound() const { return dualBound_; }
294
296
301 void dualBound(double x);
302
304
307 bool betterDual(double x) const;
308
310
318 bool primalViolated(double x) const;
319
321
326 bool betterPrimal(double x) const;
327
329 double rootDualBound() const { return rootDualBound_; }
330
332 /***
333 * This function is only correct if any primal bound better than plus/minus infinity corresponds
334 * to a feasible solution.
335 *
336 * \return true If a feasible solution of the optimization problem has been found, false otherwise.
337 */
338 bool feasibleFound() const;
340
342 ENUMSTRAT enumerationStrategy() const { return enumerationStrategy_; }
343
345
348 void enumerationStrategy(ENUMSTRAT strat) { enumerationStrategy_ = strat; }
349
363 virtual int enumerationStrategy(const Sub *s1, const Sub *s2);
364
366
379 bool guaranteed() const;
380
382
388 double guarantee() const;
389
391
395 void printGuarantee() const;
396
398
406 bool check() const;
407
420 bool knownOptimum(double &optVal) const;
421
423 virtual void output() const { }
424
431 bool cutting() const { return cutting_; }
432
439 bool pricing() const { return pricing_; }
440
442 const OptSense *optSense() const { return &optSense_; }
443
445 History *history() const { return history_; }
446
448 OpenSub *openSub() const { return openSub_; }
449
451 StandardPool<Constraint, Variable> *conPool() const { return conPool_; }
452
454 StandardPool<Constraint, Variable> *cutPool() const { return cutPool_; }
455
457 StandardPool<Variable, Constraint> *varPool() const { return varPool_; }
458
460
463 Sub *root() const { return root_; }
464
470 Sub *rRoot() const { return rRoot_; }
471
473 STATUS status() const { return status_; }
474
476 const string &problemName() const { return problemName_; }
477
479 const ogdf::StopwatchWallClock *totalCowTime() const { return &totalCowTime_; }
480
482 inline bool solveApprox() const { return solveApprox_; }
483
485 const ogdf::StopwatchCPU *totalTime() const { return &totalTime_; }
486
488 const ogdf::StopwatchCPU *lpTime() const { return &lpTime_; }
489
491 const ogdf::StopwatchCPU *lpSolverTime() const { return &lpSolverTime_; }
492
494 const ogdf::StopwatchCPU *separationTime() const { return &separationTime_; }
495
497 const ogdf::StopwatchCPU *improveTime() const { return &improveTime_; }
498
500 const ogdf::StopwatchCPU *pricingTime() const { return &pricingTime_; }
501
503 const ogdf::StopwatchCPU *branchingTime() const { return &branchingTime_; }
504
506 int nSub() const { return nSub_; }
507
509 int nLp() const { return nLp_; }
510
512 int highestLevel() const { return highestLevel_; }
513
515 int nNewRoot() const { return nNewRoot_; }
516
518 int nSubSelected() const { return nSubSelected_; }
519
521 void printParameters() const;
522
524 BRANCHINGSTRAT branchingStrategy() const { return branchingStrategy_; }
525
527
530 void branchingStrategy(BRANCHINGSTRAT strat) { branchingStrategy_ = strat; }
531
533 OSISOLVER defaultLpSolver() const { return defaultLpSolver_; }
534
536
539 void defaultLpSolver(OSISOLVER osiSolver) { defaultLpSolver_ = osiSolver; }
540
541 LpMasterOsi *lpMasterOsi() const { return lpMasterOsi_; }
542
544 int nBranchingVariableCandidates() const { return nBranchingVariableCandidates_; }
545
547
552
554 int nStrongBranchingIterations() const { return nStrongBranchingIterations_; }
555
557
561
563 double requiredGuarantee() const { return requiredGuarantee_; }
564
566
573 void requiredGuarantee(double g);
574
576
579 int maxLevel() const { return maxLevel_; }
580
582
587 void maxLevel(int ml);
588
590
593 int maxNSub() const { return maxNSub_; }
594
596
601 void maxNSub(int ml);
602
604 int64_t maxCpuTime() const { return maxCpuTime_; }
605
607 string maxCpuTimeAsString() const;
608
610
613 void maxCpuTime(const string &t);
614
616 void maxCpuTime(int64_t seconds) { maxCpuTime_ = seconds; }
617
619 void maxCpuTime(int hour, int min, int sec);
620
622 int64_t maxCowTime() const { return maxCowTime_; }
623
625 string maxCowTimeAsString() const;
626
628 void maxCowTime(int64_t seconds) { maxCowTime_ = seconds; }
629
631
634 void maxCowTime(const string &t);
635
637 bool objInteger() const { return objInteger_; }
638
640
643 void objInteger(bool b) { objInteger_ = b; }
644
646 int tailOffNLp() const { return tailOffNLp_; }
647
649
655 void tailOffNLp(int n) { tailOffNLp_ = n; }
656
658 double tailOffPercent() const { return tailOffPercent_; }
659
661
667 void tailOffPercent(double p);
668
670
673 bool delayedBranching(int nOpt) const;
674
676
687 void dbThreshold(int threshold) { dbThreshold_ = threshold; }
688
690
693 int dbThreshold() const { return dbThreshold_; }
694
696
700 int minDormantRounds() const { return minDormantRounds_; }
701
703
706 void minDormantRounds(int nRounds) { minDormantRounds_ = nRounds; }
707
709 PRIMALBOUNDMODE pbMode() const { return pbMode_; }
710
712
715 void pbMode(PRIMALBOUNDMODE mode) { pbMode_ = mode; }
716
718
725 int pricingFreq() const { return pricingFreq_; }
726
728
731 void pricingFreq(int f);
732
734 int skipFactor() const { return skipFactor_; }
735
737
740 void skipFactor(int f);
741
743
746 void skippingMode(SKIPPINGMODE mode) { skippingMode_ = mode; }
747
749 SKIPPINGMODE skippingMode() const { return skippingMode_; }
750
752 CONELIMMODE conElimMode() const { return conElimMode_; }
753
755
758 void conElimMode(CONELIMMODE mode) { conElimMode_ = mode; }
759
761 VARELIMMODE varElimMode() const { return varElimMode_; }
762
764
767 void varElimMode(VARELIMMODE mode) { varElimMode_ = mode; }
768
770 double conElimEps() const { return conElimEps_; }
771
773
776 void conElimEps(double eps) { conElimEps_ = eps; }
777
779 double varElimEps() const { return varElimEps_; }
780
782
785 void varElimEps(double eps) { varElimEps_ = eps; }
786
788 int varElimAge() const { return varElimAge_; }
789
791
794 void varElimAge(int age) { varElimAge_ = age; }
795
797 int conElimAge() const { return conElimAge_; }
798
800
803 void conElimAge(int age) { conElimAge_ = age; }
804
809 bool fixSetByRedCost() const { return fixSetByRedCost_; }
810
812
816 void fixSetByRedCost(bool on) { fixSetByRedCost_ = on; }
817
822 bool printLP() const { return printLP_; }
823
825
829 void printLP(bool on) { printLP_ = on; }
830
832 int maxConAdd() const { return maxConAdd_; }
833
835 /***
836 * \param max The maximal number of constraints.
837 */
838 void maxConAdd(int max) { maxConAdd_ = max; }
839
841 int maxConBuffered() const { return maxConBuffered_; }
842
844
850 void maxConBuffered(int max) { maxConBuffered_ = max; }
851
853 int maxVarAdd() const { return maxVarAdd_; }
854
856
859 void maxVarAdd(int max) { maxVarAdd_ = max; }
860
862 int maxVarBuffered() const { return maxVarBuffered_; }
863
865
871 void maxVarBuffered(int max) { maxVarBuffered_ = max; }
872
874 int maxIterations() const { return maxIterations_; }
875
877
886 void maxIterations(int max) { maxIterations_ = max; }
887
892 bool eliminateFixedSet() const { return eliminateFixedSet_; }
893
895
899 void eliminateFixedSet(bool turnOn) { eliminateFixedSet_ = turnOn; }
900
906 bool newRootReOptimize() const { return newRootReOptimize_; }
907
909
912 void newRootReOptimize(bool on) { newRootReOptimize_ = on; }
913
915 const string &optimumFileName() const { return optimumFileName_; }
916
918
921 void optimumFileName(const char *name) { optimumFileName_ = name; }
922
929 bool showAverageCutDistance() const { return showAverageCutDistance_; }
930
932
935 void showAverageCutDistance(bool on) { showAverageCutDistance_ = on; }
936
938 VBCMODE vbcLog() const { return VbcLog_; }
939
941
947 void vbcLog(VBCMODE mode) { VbcLog_ = mode; }
948
950
956
957protected:
958
960
978 virtual void initializePools(
981 int varPoolSize,
982 int cutPoolSize,
983 bool dynamicCutPool = false);
984
986
1008 virtual void initializePools(
1012 int varPoolSize,
1013 int cutPoolSize,
1014 bool dynamicCutPool = false);
1015
1023 void initializeOptSense(OptSense::SENSE sense) { optSense_.sense(sense); }
1024
1026
1039 int bestFirstSearch(const Sub* s1, const Sub* s2) const;
1040
1066 virtual int equalSubCompare(const Sub *s1, const Sub *s2) const;
1067
1069
1080 int depthFirstSearch(const Sub* s1, const Sub* s2) const;
1081
1083
1095 int breadthFirstSearch(const Sub* s1, const Sub* s2) const;
1096
1097
1099
1107 int diveAndBestFirstSearch(const Sub *s1, const Sub* s2) const;
1108
1114 virtual void initializeParameters() { }
1115
1117
1122 virtual Sub *firstSub() = 0;
1123
1130 virtual void initializeOptimization() { }
1131
1138 virtual void terminateOptimization() { }
1139
1141 virtual void assignParameters();
1142
1143private:
1144
1146
1164
1168
1170
1174
1176
1180
1182
1186
1188
1195
1196 int initLP();
1197
1199
1205 void writeTreeInterface(const string &info, bool time = true) const;
1206
1212 void treeInterfaceNewNode(Sub *sub) const;
1213
1215 void treeInterfacePaintNode(int id, int color) const;
1216
1218 void treeInterfaceLowerBound(double lb) const;
1219
1221 void treeInterfaceUpperBound(double ub) const;
1222
1224 void treeInterfaceNodeBounds(int id, double lb, double ub);
1225
1227
1230 void newSub(int level);
1231
1233 void countLp() { ++nLp_; }
1234
1236 void newFixed(int n) { nFixed_ += n; }
1237
1239 void addCons(int n) { nAddCons_ += n; }
1240
1242 void removeCons(int n) { nRemCons_ += n; }
1243
1245 void addVars(int n) { nAddVars_ += n; }
1246
1248 void removeVars(int n) { nRemVars_ += n; }
1249
1251 FixCand *fixCand() const { return fixCand_; }
1252
1254
1261 void rRoot(Sub *newRoot, bool reoptimize);
1262
1264 void status(STATUS stat) { status_ = stat; }
1265
1267
1270 void rootDualBound(double x);
1271
1273
1276
1278
1281
1284
1287
1290
1293
1296
1299
1302
1305
1308
1310
1313
1314
1317
1320
1323
1326
1329
1332
1335
1338
1341
1344
1347
1349 std::ostream *treeStream_;
1350
1352
1356
1358
1362
1364
1368
1371
1374
1377
1380
1383
1386
1393
1396
1399
1402
1408
1411
1414
1417
1420
1423
1426
1429
1432
1438
1441
1447
1450
1453
1456
1459
1462
1465
1468
1471
1474
1477
1479
1482
1485
1488
1491
1494
1496 int nLp_;
1497
1500
1503
1506
1509
1512
1515
1518
1519 Master(const Master &rhs);
1520 const Master &operator=(const Master& rhs);
1521};
1522
1523
1524inline double Master::lowerBound() const
1525{
1526 if (optSense_.max()) return primalBound_;
1527 else return dualBound_;
1528}
1529
1530inline double Master::upperBound() const
1531{
1532 if (optSense_.max()) return dualBound_;
1533 else return primalBound_;
1534}
1535
1536}
Declaration of stopwatch classes.
Global data and functions.
Definition global.h:57
Candidates for fixing.
Definition fixcand.h:63
Solution histories.
Definition history.h:43
The OSI LP master.
Definition lpmasterosi.h:43
The master of the optimization.
Definition master.h:69
Sub * root_
The root node of the enumeration tree.
Definition master.h:1283
int maxVarAdd() const
Returns the maximal number of variables which should be added in the column generation algorithm.
Definition master.h:853
int varElimAge() const
Returns the age for the elimination of variables by the reduced cost criterion.
Definition master.h:788
bool betterPrimal(double x) const
Can be used to check if a value is better than the best know primal bound.
ogdf::StopwatchCPU lpSolverTime_
Definition master.h:1478
History * history() const
Returns a pointer to the object storing the solution history of this branch and cut problem.
Definition master.h:445
int maxNSub() const
Returns the maximal number of subproblems to be processed.
Definition master.h:593
int maxLevel() const
Returns the maximal depth up to which the enumeration should be performed.
Definition master.h:579
void defaultLpSolver(OSISOLVER osiSolver)
Changes the default Lp solver to osiSolver.
Definition master.h:539
void maxVarAdd(int max)
Changes the maximal number of variables that are added in an iteration of the subproblem optimization...
Definition master.h:859
int nBranchingVariableCandidates_
The number of candidates that are evaluated for branching on variables.
Definition master.h:1301
ENUMSTRAT enumerationStrategy_
The enumeration strategy.
Definition master.h:1295
void nStrongBranchingIterations(int n)
Sets the number of simplex iterations that are performed when testing candidates for branching variab...
void maxConAdd(int max)
Sets the maximal number of constraints that are added in an iteration of the cutting plane algorithm.
Definition master.h:838
int bestFirstSearch(const Sub *s1, const Sub *s2) const
Implements the best first search enumeration.
bool newRootReOptimize_
If true, then an already earlier processed node is reoptimized if it becomes the new root of the rema...
Definition master.h:1437
int maxConBuffered_
The size of the buffer for generated cutting planes.
Definition master.h:1419
int maxNSub_
The maximal number of subproblems to be processed.
Definition master.h:1367
int highestLevel_
The highest level which has been reached in the enumeration tree.
Definition master.h:1499
void maxConBuffered(int max)
Changes the maximal number of constraints that are buffered in an iteration of the cutting plane algo...
Definition master.h:850
CONELIMMODE conElimMode_
The way constraints are automatically eliminated in the cutting plane algorithm.
Definition master.h:1449
void pricingFreq(int f)
Sets the number of linear programs being solved between two additional pricing steps to f.
void enumerationStrategy(ENUMSTRAT strat)
Changes the enumeration strategy to strat.
Definition master.h:348
double lowerBound() const
Returns the value of the global lower bound.
Definition master.h:1524
void treeInterfaceNewNode(Sub *sub) const
Adds the subproblem sub to the stream storing information for graphical output of the enumeration tre...
int nStrongBranchingIterations() const
The number of simplex iterations that are performed when testing candidates for branching variables w...
Definition master.h:554
bool printLP() const
Definition master.h:822
void branchingStrategy(BRANCHINGSTRAT strat)
Changes the branching strategy to strat.
Definition master.h:530
ogdf::StopwatchCPU branchingTime_
The timer for the cpu time spent in determining the branching rules.
Definition master.h:1490
double requiredGuarantee() const
The guarantee specification for the optimization.
Definition master.h:563
void primalBound(double x)
Sets the primal bound to x and makes a new entry in the solution history.
void varElimAge(int age)
Changes the age for the elimination of variables by the reduced cost criterion to age.
Definition master.h:794
StandardPool< Constraint, Variable > * conPool() const
Returns a pointer to the default pool storing the constraints of the problem formulation.
Definition master.h:451
void maxCowTime(int64_t seconds)
Sets the maximally allowed wall-clock time to seconds.
Definition master.h:628
BRANCHINGSTRAT
This enumeration defines the two currently implemented branching variable selection strategies.
Definition master.h:120
@ CloseHalf
Selects the variable with fractional part closest to 0.5.
Definition master.h:121
BRANCHINGSTRAT branchingStrategy_
The branching strategy.
Definition master.h:1298
const ogdf::StopwatchCPU * totalTime() const
returns a pointer to the timer measuring the total cpu time for the optimization.
Definition master.h:485
VARELIMMODE varElimMode() const
Returns the mode for the elimination of variables.
Definition master.h:761
double rootDualBound() const
Returns the dual bound at the root node.
Definition master.h:329
const ogdf::StopwatchCPU * lpSolverTime() const
Return a pointer to the timer measuring the cpu time required by the LP solver.
Definition master.h:491
virtual void initializePools(ArrayBuffer< Constraint * > &constraints, ArrayBuffer< Variable * > &variables, int varPoolSize, int cutPoolSize, bool dynamicCutPool=false)
Sets up the default pools for variables, constraints, and cutting planes.
const string & optimumFileName() const
Returns the name of the file that stores the optimum solutions.
Definition master.h:915
void maxNSub(int ml)
Changes the maximal number of subproblems to ml.
double tailOffPercent_
The minimal change of the LP-value on the tailing off analysis.
Definition master.h:1382
ENUMSTRAT enumerationStrategy() const
Returns the enumeration strategy.
Definition master.h:342
StandardPool< Constraint, Variable > * cutPool_
The default pool of dynamically generated constraints.
Definition master.h:1316
int maxIterations() const
Returns the maximal number of iterations per subproblem optimization (-1 means no iteration limit).
Definition master.h:874
void _setDefaultLpParameters()
Initializes the LP solver specific default parameters if they are not read from .abacus.
void nBranchingVariableCandidates(int n)
Sets the number of tested branching variable candidates to n.
void newFixed(int n)
Increments the counter of the number of fixed variables by n.
Definition master.h:1236
bool pricing() const
Definition master.h:439
const ogdf::StopwatchCPU * lpTime() const
Returns a pointer to the timer measuring the cpu time spent in members of the LP-interface.
Definition master.h:488
double varElimEps_
The tolerance for the elimination of variables by the mode ReducedCost.
Definition master.h:1458
Master(const char *problemName, bool cutting, bool pricing, OptSense::SENSE optSense=OptSense::Unknown, double eps=1.0e-4, double machineEps=1.0e-7, double infinity=1.0e30, bool readParamFromFile=false)
The constructor.
bool fixSetByRedCost() const
Definition master.h:809
int maxIterations_
The maximal number of iterations of the cutting plane/column generation algorithm in the subproblem.
Definition master.h:1428
int nStrongBranchingIterations_
The number of simplex iterations that are performed when testing a branching variable candidate withi...
Definition master.h:1304
void dualBound(double x)
Sets the dual bound to x and makes a new entry in the solution history.
void addVars(int n)
Increments the counter for the total number of added variables by n.
Definition master.h:1245
int minDormantRounds() const
Returns the maximal number of rounds, i.e., number of subproblem optimizations, a subproblem is dorma...
Definition master.h:700
Master(const Master &rhs)
bool primalViolated(double x) const
Can be used to compare a value with the one of the best known primal bound.
PRIMALBOUNDMODE pbMode_
The mode of the primal bound initialization.
Definition master.h:1395
void maxLevel(int ml)
This version of the function maxLevel() changes the maximal enumeration depth.
void varElimMode(VARELIMMODE mode)
Changes the variable elimination mode to mode.
Definition master.h:767
int maxVarBuffered_
The size of the buffer for generated variables.
Definition master.h:1425
bool newRootReOptimize() const
Definition master.h:906
double dualBound_
The best known dual bound.
Definition master.h:1325
int nNewRoot() const
Returns the number of root changes of the remaining branch-and-cut tree.
Definition master.h:515
void removeCons(int n)
Increments the counter for the total number of removed constraints by n.
Definition master.h:1242
void minDormantRounds(int nRounds)
Sets the number of rounds a subproblem should stay dormant to nRounds.
Definition master.h:706
int nRemCons_
The total number of removed constraints.
Definition master.h:1508
double primalBound() const
Returns the value of the primal bound.
Definition master.h:278
Sub * select()
Returns a pointer to an open subproblem for further processing.
double guarantee() const
Can be used to access the guarantee which can be given for the best known feasible solution.
CONELIMMODE conElimMode() const
Returns the mode for the elimination of constraints.
Definition master.h:752
STATUS
The various statuses of the optimization process.
Definition master.h:77
@ Unprocessed
The initial status, before the optimization starts.
Definition master.h:83
@ Error
An error occurred during the optimization process.
Definition master.h:81
@ MaxLevel
The status, if subproblems are ignored since the maximum enumeration level is exceeded.
Definition master.h:87
@ Processing
The status while the optimization is performed.
Definition master.h:84
@ MaxCpuTime
The status, if the optimization terminates since the maximum cpu time is exceeded.
Definition master.h:88
@ MaxNSub
The status, if the optimization terminates since the maximum number of subproblems is reached.
Definition master.h:89
@ MaxCowTime
The status, if the optimization terminates since the maximum wall-clock time is exceeded.
Definition master.h:90
const ogdf::StopwatchCPU * pricingTime() const
Returns a pointer to the timer measuring the cpu time spent in pricing.
Definition master.h:500
STATUS status_
The current status of the optimization.
Definition master.h:1467
virtual void assignParameters()
Assigns the parameters that were read from a file to the member variables of the master.
virtual bool setSolverParameters(OsiSolverInterface *interface, bool solverIsApprox)
Sets solver specific parameters.
void optimumFileName(const char *name)
Changes the name of the file in which the value of the optimum solution is searched.
Definition master.h:921
int64_t maxCpuTime() const
Returns the maximal cpu time (in seconds) which can be used by the optimization.
Definition master.h:604
VARELIMMODE
This enumeration defines the ways for automatic variable elimination during the column generation alg...
Definition master.h:180
@ NoVarElim
No variables are eliminated.
Definition master.h:181
bool knownOptimum(double &optVal) const
Opens the file specified with the parameter OptimumFileName in the configuration file ....
bool betterDual(double x) const
Returns true if x is better than the best known dual bound; false otherwise.
virtual ~Master()
The destructor.
void rRoot(Sub *newRoot, bool reoptimize)
Sets the root of the remaining branch-and-cut tree to newRoot.
bool feasibleFound() const
We use this function, e.g., to adapt the enumeration strategy in the DiveAndBest-Strategy.
void maxCpuTime(int hour, int min, int sec)
Sets the maximally allowed cpu time for the optimization to hour, min, sec.
ogdf::StopwatchCPU improveTime_
The timer for the cpu time spent in the heuristics for the computation of feasible solutions.
Definition master.h:1484
bool delayedBranching(int nOpt) const
Returns true if the number of optimizations nOpt of a subproblem exceeds the delayed branching thresh...
void dbThreshold(int threshold)
Sets the number of optimizations of a subproblem until sons are created in Sub::branching().
Definition master.h:687
void _deleteLpMasters()
void removeVars(int n)
Increments the counter for the total number of removed variables by n.
Definition master.h:1248
void conElimAge(int age)
Changes the age for the elimination of constraints to age.
Definition master.h:803
StandardPool< Constraint, Variable > * cutPool() const
Returns a pointer to the default pool for the generated cutting planes.
Definition master.h:454
OSISOLVER
This enumeration defines which solvers can be used to solve the LP-relaxations.
Definition master.h:209
void status(STATUS stat)
Sets the status of the Master.
Definition master.h:1264
void varElimEps(double eps)
Changes the tolerance for the elimination of variables by the reduced cost criterion to eps.
Definition master.h:785
History * history_
The solution history.
Definition master.h:1292
void tailOffPercent(double p)
Sets the minimal change of the dual bound for the tailing off analysis to p.
const ogdf::StopwatchCPU * separationTime() const
Returns a pointer to the timer measuring the cpu time spent in the separation of cutting planes.
Definition master.h:494
StandardPool< Constraint, Variable > * conPool_
The default pool with the constraints of the problem formulation.
Definition master.h:1312
double primalBound_
The best known primal bound.
Definition master.h:1322
int nSubSelected() const
Returns the number of subproblems which have already been selected from the set of open subproblems.
Definition master.h:518
FixCand * fixCand() const
Returns a pointer to the object storing the variables which are candidates for being fixed.
Definition master.h:1251
Sub * rRoot_
The root node of the remaining enumeration tree.
Definition master.h:1286
OptSense optSense_
The sense of the objective function.
Definition master.h:1280
int nLp_
The number of solved LPs.
Definition master.h:1496
CONELIMMODE
This enumeration defines the ways for automatic constraint elimination during the cutting plane phase...
Definition master.h:166
@ NonBinding
Nonbinding constraints are eliminated.
Definition master.h:168
@ NoConElim
No constraints are eliminated.
Definition master.h:167
void writeTreeInterface(const string &info, bool time=true) const
Writes the string info to the stream associated with the Tree Interface.
FixCand * fixCand_
The variables which are candidates for being fixed.
Definition master.h:1331
int minDormantRounds_
The minimal number of rounds, i.e., number of subproblem optimizations, a subproblem is dormant,...
Definition master.h:1392
void conElimMode(CONELIMMODE mode)
Changes the constraint elimination mode to mode.
Definition master.h:758
void _initializeParameters()
Reads the parameter-file .abacus.
int maxConBuffered() const
Returns the size of the buffer for generated constraints in the cutting plane algorithm.
Definition master.h:841
void skipFactor(int f)
Sets the frequency for constraint and variable generation to f.
void conElimEps(double eps)
Changes the tolerance for the elimination of constraints by the slack criterion to eps.
Definition master.h:776
void _initializeLpParameters()
bool showAverageCutDistance_
If true then the average distance of the added cutting planes is output every iteration of the cuttin...
Definition master.h:1446
ogdf::StopwatchCPU lpTime_
The timer for the cpu time spent in the LP-interface.
Definition master.h:1476
bool eliminateFixedSet_
If true, then nonbasic fixed and set variables are eliminated.
Definition master.h:1431
void fixSetByRedCost(bool on)
Turns fixing and setting variables by reduced cost on or off.
Definition master.h:816
double tailOffPercent() const
Returns the minimal change of the dual bound for the tailing off analysis in percent.
Definition master.h:658
int conElimAge_
The number of iterations an elimination criterion must be satisfied until a constraint can be removed...
Definition master.h:1461
double conElimEps() const
Returns the zero tolerance for the elimination of constraints by the slack criterion.
Definition master.h:770
StandardPool< Variable, Constraint > * varPool_
The default pool with the variables of the problem formulation.
Definition master.h:1319
LpMasterOsi * lpMasterOsi_
Definition master.h:1309
bool objInteger_
true, if all objective function values of feasible solutions are assumed to be integer.
Definition master.h:1376
bool cutting() const
Definition master.h:431
void rootDualBound(double x)
Updates the final dual bound of the root node.
ogdf::StopwatchWallClock totalCowTime_
The timer for the total elapsed time.
Definition master.h:1470
double requiredGuarantee_
The guarantee in percent which should be reached when the optimization stops.
Definition master.h:1355
int64_t maxCowTime() const
Returns the maximal wall-clock time (in seconds) which can be used by the optimization.
Definition master.h:622
int pricingFreq_
The number of solved LPs between two additional pricing steps.
Definition master.h:1398
int tailOffNLp_
The number of LP-iterations for the tailing off analysis.
Definition master.h:1379
LpMasterOsi * lpMasterOsi() const
Definition master.h:541
virtual int equalSubCompare(const Sub *s1, const Sub *s2) const
Is called from the function bestFirstSearch() and from the function depthFirstSearch() if the subprob...
string problemName_
The name of the optimized problem.
Definition master.h:1275
int diveAndBestFirstSearch(const Sub *s1, const Sub *s2) const
Performs depth-first search until a feasible solution is found, then the search process is continued ...
OpenSub * openSub() const
Returns a pointer to the set of open subproblems.
Definition master.h:448
int maxVarBuffered() const
Returns the size of the buffer for the variables generated in the column generation algorithm.
Definition master.h:862
VBCMODE VbcLog_
Ouput for the Tree Interface is generated depending on the value of this variable.
Definition master.h:1346
void treeInterfaceNodeBounds(int id, double lb, double ub)
Updates the node information in the node with number id by writing the lower bound lb and the upper b...
const Master & operator=(const Master &rhs)
int breadthFirstSearch(const Sub *s1, const Sub *s2) const
Implements the breadth first search enumeration strategy, i.e., the subproblem with minimum level is ...
void printLP(bool on)
Turns the output of the linear program in every iteration on or off.
Definition master.h:829
PRIMALBOUNDMODE pbMode() const
Returns the mode of the primal bound initialization.
Definition master.h:709
double upperBound() const
Returns the value of the global upper bound.
Definition master.h:1530
bool check() const
Can be used to control the correctness of the optimization if the value of the optimum solution has b...
bool guaranteed() const
Can be used to check if the guarantee requirements are fulfilled.
const OptSense * optSense() const
Returns a pointer to the object holding the optimization sense of the problem.
Definition master.h:442
void showAverageCutDistance(bool on)
Turns the output of the average distance of the added cuts from the fractional solution on or off.
Definition master.h:935
void treeInterfacePaintNode(int id, int color) const
Assigns the color to the subproblem sub in the Tree Interface.
std::ostream * treeStream_
A pointer to the log stream for the VBC-Tool.
Definition master.h:1349
const ogdf::StopwatchCPU * improveTime() const
Returns a pointer to the timer measuring the cpu time spent in the heuristics for the computation of ...
Definition master.h:497
void vbcLog(VBCMODE mode)
Changes the mode of output for the Vbc-Tool to mode.
Definition master.h:947
int nSub_
The number of generated subproblems.
Definition master.h:1493
void maxIterations(int max)
Changes the default value for the maximal number of iterations of the optimization of a subproblem.
Definition master.h:886
int maxVarAdd_
The maximal number of added variables per iteration of the column generation algorithm.
Definition master.h:1422
double dualBound() const
Returns the value of the dual bound.
Definition master.h:293
int conElimAge() const
Returns the age for the elimination of constraints.
Definition master.h:797
void pbMode(PRIMALBOUNDMODE mode)
Sets the mode of the primal bound initialization to mode.
Definition master.h:715
virtual void initializeOptimization()
The default implementation of initializeOptimization() does nothing.
Definition master.h:1130
bool solveApprox() const
True, if an approximative solver should be used.
Definition master.h:482
VBCMODE vbcLog() const
Returns the mode of output for the Vbc-Tool.
Definition master.h:938
int nLp() const
Returns the number of optimized linear programs (only LP-relaxations).
Definition master.h:509
bool solveApprox_
If true, then an approximative solver is used to solve linear programs.
Definition master.h:1340
void countLp()
Increments the counter for linear programs and should be called in each optimization call of the LP-r...
Definition master.h:1233
int64_t maxCowTime_
The maximal available wall-clock time.
Definition master.h:1373
int maxLevel_
The maximal level in enumeration tree.
Definition master.h:1361
void newSub(int level)
Registers a new subproblem which is on level level in enumeration tree.
int pricingFreq() const
Returns the number of linear programs being solved between two additional pricing steps.
Definition master.h:725
int highestLevel() const
Returns the highest level in the tree which has been reached during the implicit enumeration.
Definition master.h:512
void eliminateFixedSet(bool turnOn)
Turns the elimination of fixed and set variables on or off.
Definition master.h:899
int nSubSelected_
The number of subproblems already selected from the list of open subproblems.
Definition master.h:1343
ogdf::StopwatchCPU separationTime_
The timer for the cpu time spent in the separation.
Definition master.h:1481
STATUS status() const
Returns the status of the Master.
Definition master.h:473
STATUS optimize()
Performs the optimization by branch-and-bound.
int nNewRoot_
The number of changes of the root of the remaining branch-and-bound tree.
Definition master.h:1517
int maxConAdd_
The maximal number of added constraints per iteration of the cutting plane algorithm.
Definition master.h:1416
PRIMALBOUNDMODE
This enumeration provides various methods for the initialization of the primal bound.
Definition master.h:138
@ Optimum
The primal bound is initialized with the value of the optimum solution.
Definition master.h:141
int tailOffNLp() const
Returns the number of linear programs considered in the tailing off analysis.
Definition master.h:646
ENUMSTRAT
The enumeration defining the different enumeration strategies for the branch and bound algorithm.
Definition master.h:103
@ DepthFirst
Depth-first search, i.e., select the subproblem with maximal level in the enumeration tree.
Definition master.h:108
@ BreadthFirst
Breadth-first search, i.e., select the subproblem with minimal level in the enumeration tree.
Definition master.h:107
const ogdf::StopwatchCPU * branchingTime() const
Returns a pointer to the timer measuring the cpu time spent in finding and selecting the branching ru...
Definition master.h:503
int depthFirstSearch(const Sub *s1, const Sub *s2) const
Implements the depth first search enumeration strategy, i.e., the subproblem with maximum level is se...
void initializeOptSense(OptSense::SENSE sense)
Can be used to initialize the sense of the optimization in derived classes, if this has not been alre...
Definition master.h:1023
VBCMODE
This enumeration defines what kind of output can be generated for the VBCTOOL.
Definition master.h:192
@ NoVbc
No output for the tree interface.
Definition master.h:193
@ File
Output for the tree interface is written to a file.
Definition master.h:194
bool pricing_
If true, then variables are generated in the optimization.
Definition master.h:1337
void tailOffNLp(int n)
Sets the number of linear programs considered in the tailing off analysis to n.
Definition master.h:655
ogdf::StopwatchCPU totalTime_
The timer for the total cpu time for the optimization.
Definition master.h:1473
int nBranchingVariableCandidates() const
Returns the number of variables that should be tested for the selection of the branching variable.
Definition master.h:544
int64_t maxCpuTime_
The maximal available cpu time.
Definition master.h:1370
int skipFactor_
The frequency constraints or variables are generated depending on the skipping mode.
Definition master.h:1401
bool printLP_
If true, then the linear program is output every iteration.
Definition master.h:1413
string maxCowTimeAsString() const
Returns the maximal wall-clock time (as string hh:mm:ss) which can be used by the optimization.
double varElimEps() const
Returns the zero tolerance for the elimination of variables by the reduced cost criterion.
Definition master.h:779
string optimumFileName_
The name of a file storing a list of optimum solutions of problem instances.
Definition master.h:1440
void maxCowTime(const string &t)
Sets the maximally allowed wall-clock time for the optimization to t.
Sub * rRoot() const
Definition master.h:470
StandardPool< Variable, Constraint > * varPool() const
Returns a pointer to the default pool storing the variables.
Definition master.h:457
BRANCHINGSTRAT branchingStrategy() const
Returns the branching strategy.
Definition master.h:524
double conElimEps_
The tolerance for the elimination of constraints by the mode NonBinding/.
Definition master.h:1455
ogdf::StopwatchCPU pricingTime_
The timer for the cpu time spent in pricing.
Definition master.h:1487
virtual int enumerationStrategy(const Sub *s1, const Sub *s2)
Analyzes the enumeration strategy set in the parameter file .abacus and calls the corresponding compa...
bool objInteger() const
If true then we assume that all feasible solutions have integral objective function values.
Definition master.h:637
void objInteger(bool b)
Sets the assumption that the objective function values of all feasible solutions are integer.
Definition master.h:643
int nRemVars_
The total number of removed variables.
Definition master.h:1514
void treeInterfaceLowerBound(double lb) const
Passes the new lower bound lb to the Tree Interface.
void printGuarantee() const
Writes the guarantee nicely formated on the output stream associated with this object.
int skipFactor() const
Returns the frequency of subproblems in which constraints or variables should be generated.
Definition master.h:734
OSISOLVER defaultLpSolver_
The default LP-Solver.
Definition master.h:1307
void maxCpuTime(int64_t seconds)
Sets the maximally allowed cpu time to seconds.
Definition master.h:616
virtual void initializePools(ArrayBuffer< Constraint * > &constraints, ArrayBuffer< Constraint * > &cuts, ArrayBuffer< Variable * > &variables, int varPoolSize, int cutPoolSize, bool dynamicCutPool=false)
Is overloaded such that also a first set of cutting planes can be inserted into the cutting plane poo...
int maxConAdd() const
Returns the maximal number of constraints which should be added in every iteration of the cutting pla...
Definition master.h:832
bool showAverageCutDistance() const
Definition master.h:929
void addCons(int n)
Increments the counter for the total number of added constraints by n.
Definition master.h:1239
void printParameters() const
Writes all parameters of the class Master together with their values to the global output stream.
void _outputLpStatistics() const
Prints the LP solver specific statistics.
const ogdf::StopwatchWallClock * totalCowTime() const
Returns a pointer to the timer measuring the total wall clock time.
Definition master.h:479
int varElimAge_
The number of iterations an elimination criterion must be satisfied until a variable can be removed.
Definition master.h:1464
int nAddVars_
The total number of added variables.
Definition master.h:1511
void treeInterfaceUpperBound(double ub) const
Passes the new upper bound ub to the Tree Interface.
void maxVarBuffered(int max)
Changes the maximal number of variables that are buffered in an iteration of the subproblem optimizat...
Definition master.h:871
int nSub() const
returns the number of generated subproblems.
Definition master.h:506
bool eliminateFixedSet() const
Definition master.h:892
virtual void initializeParameters()
Is only a dummy.
Definition master.h:1114
bool cutting_
If true, then constraints are generated in the optimization.
Definition master.h:1334
void maxCpuTime(const string &t)
Sets the maximally allowed cpu time for the optimization to t.
int dbThreshold() const
Returns the number of optimizations of a subproblem until sons are created.
Definition master.h:693
VARELIMMODE varElimMode_
The way variables are automatically eliminated in the column generation algorithm.
Definition master.h:1452
void newRootReOptimize(bool on)
Turns the reoptimization of new root nodes of the remaining branch and bound tree on or off.
Definition master.h:912
double rootDualBound_
The best known dual bound at the end of the optimization of the root node.
Definition master.h:1328
OSISOLVER defaultLpSolver() const
returns the Lp Solver.
Definition master.h:533
string maxCpuTimeAsString() const
Returns the maximal cpu time (as string hh:mm:ss) which can be used by the optimization.
OpenSub * openSub_
The set of open subproblems.
Definition master.h:1289
int nAddCons_
The total number of added constraints.
Definition master.h:1505
bool readParamFromFile_
Definition master.h:1277
int dbThreshold_
The number of optimizations of an Sub until branching is performed.
Definition master.h:1385
virtual void output() const
Does nothing but can be redefined in derived classes for output before the timing statistics.
Definition master.h:423
SKIPPINGMODE skippingMode() const
Returns the skipping strategy.
Definition master.h:749
SKIPPINGMODE skippingMode_
Either constraints are generated only every skipFactor_ subproblem (SkipByNode) only every skipFactor...
Definition master.h:1407
void requiredGuarantee(double g)
Changes the guarantee specification tp g.
const string & problemName() const
Returns the name of the instance being optimized (as specified in the constructor of this class).
Definition master.h:476
virtual Sub * firstSub()=0
Should return a pointer to the first subproblem of the optimization, i.e., the root node of the enume...
int nFixed_
The total number of fixed variables.
Definition master.h:1502
bool fixSetByRedCost_
If true, then variables are fixed and set by reduced cost criteria.
Definition master.h:1410
void skippingMode(SKIPPINGMODE mode)
Sets the skipping strategy to mode.
Definition master.h:746
virtual void terminateOptimization()
The default implementation of terminateOptimization() does nothing.
Definition master.h:1138
SKIPPINGMODE
The way nodes are skipped for the generation of cuts.
Definition master.h:153
void _createLpMasters()
void _printLpParameters() const
Prints the LP solver specific parameters.
Sub * root() const
Can be used to access the root node of the branch-and-bound tree.
Definition master.h:463
Maintains open subproblems.
Definition opensub.h:49
Sense of optimization.
Definition optsense.h:44
SENSE
The enumeration defining the sense of optimization.
Definition optsense.h:48
bool max() const
Returns true if it is maximization problem,, false otherwise.
Definition optsense.h:90
Standard pools.
The subproblem.
Definition sub.h:68
An array that keeps track of the number of inserted elements; also usable as an efficient stack.
Definition ArrayBuffer.h:56
Implements a stopwatch measuring CPU time.
Definition Stopwatch.h:154
Implements a stopwatch measuring wall-clock time.
Definition Stopwatch.h:180
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
global.
hash table.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
sense of optimization.