13#ifndef MINOTAURPARQGBRANCHANDBOUND_H
14#define MINOTAURPARQGBRANCHANDBOUND_H
21 struct ParQGBabOptions;
26 class ParNodeIncRelaxer;
27 class ParPCBProcessor;
34 typedef Engine* EnginePtr;
35 typedef ParQGBabOptions* ParQGBabOptionsPtr;
36 typedef NodeProcessor* NodeProcessorPtr;
37 typedef NodeRelaxer* NodeRelaxerPtr;
38 typedef ParNodeIncRelaxer* ParNodeIncRelaxerPtr;
39 typedef ParPCBProcessor* ParPCBProcessorPtr;
40 typedef Solution* SolutionPtr;
41 typedef SolutionPool* SolutionPoolPtr;
42 typedef ParTreeManager* ParTreeManagerPtr;
43 typedef WarmStart* WarmStartPtr;
60 void printsomething();
162 UInt nThreads,
bool prune);
174 UInt nThreads,
bool prune);
185 UInt nThreads,
bool prune);
211 if (gettimeofday(&time,NULL)) {
215 return (
double)time.tv_sec + (double)time.tv_usec * .000001;
226 static const std::string me_;
241 HeurVector preHeurs_;
276 NodePtr processRoot_(
bool *should_prune,
bool *should_dive);
287 NodePtr processRoot_(
bool *should_prune,
bool *should_dive,
293 bool shouldPrune_(
NodePtr node);
308 bool shouldStopPar_(
double wallStartTime,
double treeLb);
317 void showStatus_(
bool current_uncounted);
330 void showParStatus_(
UInt current_uncounted,
double treeLb,
331 double wallStartTime,
UInt threadId);
Declare important 'types' used in Minotaur.
Definition: Environment.h:28
Definition: Heuristic.h:30
Definition: NodeProcessor.h:49
Definition: NodeRelaxer.h:42
Definition: ParNodeIncRelaxer.h:32
Default node processor used in solver for now.
Definition: ParPCBProcessor.h:47
Implement a generic parallel branch-and-bound algorithm on a multicore cpu.
Definition: ParQGBranchAndBound.h:48
void setNodeProcessor(NodeProcessorPtr p)
Set the NodeProcessor that processes each node.
Definition: ParQGBranchAndBound.cpp:247
NodeProcessorPtr getNodeProcessor()
Return a pointer to NodeProcessor used in branch-and-bound.
Definition: ParQGBranchAndBound.cpp:130
double getUb()
Return the upper bound for the solution value from the search tree.
Definition: ParQGBranchAndBound.cpp:160
ParTreeManagerPtr getTreeManager()
Return a pointer to the tree manager. The client can then directly query the ParTreeManager for its s...
Definition: ParQGBranchAndBound.cpp:154
void shouldCreateRoot(bool b)
Switch to turn on/off root-node creation.
Definition: ParQGBranchAndBound.cpp:259
void solve()
Start solving the Problem using branch-and-bound.
double getLb()
Return the lower bound from the search tree.
Definition: ParQGBranchAndBound.cpp:124
UInt numProcNodes()
Return number of nodes processed while solving.
Definition: ParQGBranchAndBound.cpp:166
double totalTime()
Return total time taken.
Definition: ParQGBranchAndBound.cpp:1796
void parsolve(ParNodeIncRelaxerPtr parNodeRelaxer[], ParPCBProcessorPtr parPCBProcessor[], UInt nThreads, bool prune)
Start solving the Problem using branch-and-bound.
Definition: ParQGBranchAndBound.cpp:885
void addPreRootHeur(HeurPtr h)
Add a heuristic that will be called before root node.
Definition: ParQGBranchAndBound.cpp:112
void parsolveOppor(ParNodeIncRelaxerPtr parNodeRelaxer[], ParPCBProcessorPtr parPCBProcessor[], UInt nThreads, bool prune)
Start solving the Problem using parallel branch-and-bound in an opportunistic mode.
Definition: ParQGBranchAndBound.cpp:418
void removeAddedCons(RelaxationPtr rel, UInt nc)
Function to remove the constraints added to this relaxation.
Definition: ParQGBranchAndBound.cpp:410
double getWallTime()
Get wall clock time.
Definition: ParQGBranchAndBound.h:209
virtual ~ParQGBranchAndBound()
Destroy.
Definition: ParQGBranchAndBound.cpp:88
SolveStatus getStatus()
Return the final status.
Definition: ParQGBranchAndBound.cpp:148
NodeRelaxerPtr getNodeRelaxer()
Return a pointer to NodeRelaxer used in branch-and-bound.
Definition: ParQGBranchAndBound.cpp:136
ParQGBranchAndBound()
Default constructor.
Definition: ParQGBranchAndBound.cpp:57
void setLogLevel(LogLevel level)
Set log level.
Definition: ParQGBranchAndBound.cpp:241
void writeStats()
Write statistics to the logger.
double getPerGap()
Return the percentage gap between the lower and upper bounds.
Definition: ParQGBranchAndBound.cpp:118
void writeParStats(std::ostream &out, ParPCBProcessorPtr parPCBProcessor[])
Write statistics of parallel algorithm to the ostream out.
Definition: ParQGBranchAndBound.cpp:1781
void parsolveSync(ParNodeIncRelaxerPtr parNodeRelaxer[], ParPCBProcessorPtr parPCBProcessor[], UInt nThreads, bool prune)
Branch-and-bound solver with reproducibility of results.
Definition: ParQGBranchAndBound.cpp:1377
void setNodeRelaxer(NodeRelaxerPtr nr)
Set the NodeRelaxer for setting-up relaxations at each node.
Definition: ParQGBranchAndBound.cpp:253
Base class for managing the branch-and-bound tree.
Definition: ParTreeManager.h:29
Definition: Relaxation.h:53
Definition: SolutionPool.h:28
Definition: Solution.h:30
Definition: WarmStart.h:45
Definition: ActiveNodeStore.h:20
LogLevel
Levels of verbosity.
Definition: Types.h:226
unsigned int UInt
Unsigned integer.
Definition: Types.h:30
SolveStatus
Different states an algorithm like branch-and-bound can be in.
Definition: Types.h:158
Different options and parameters that control branch-and-bound.
Definition: ParQGBranchAndBound.h:353
double perGapLimit
Stop if the percent gap between lower and upper bounds of the objective function falls below this lev...
Definition: ParQGBranchAndBound.h:379
ParQGBabOptions()
Default constructor.
Definition: ParQGBranchAndBound.cpp:1815
bool createRoot
Should the root be created in branch-and-bound (yes), or the user calls branch-and-bound after creati...
Definition: ParQGBranchAndBound.h:364
double logInterval
Time in seconds between status updates of the progress.
Definition: ParQGBranchAndBound.h:367
UInt solLimit
Limit on number of nodes processed.
Definition: ParQGBranchAndBound.h:382
UInt nodeLimit
Limit on number of nodes processed.
Definition: ParQGBranchAndBound.h:373
LogLevel logLevel
Verbosity of log.
Definition: ParQGBranchAndBound.h:370
double timeLimit
Time limit in seconds for the branch-and-bound.
Definition: ParQGBranchAndBound.h:385
Statistics about the branch-and-bound.
Definition: ParQGBranchAndBound.h:336
double timeUsed
Total time used in branch-and-bound.
Definition: ParQGBranchAndBound.h:344
ParQGBabStats()
Constructor. All data is initialized to zero.
Definition: ParQGBranchAndBound.cpp:1805
UInt nodesProc
Number of nodes processed.
Definition: ParQGBranchAndBound.h:341
double updateTime
Time of the last log display.
Definition: ParQGBranchAndBound.h:347